---
title: "Update Segment"
description: "How to call Update Segment (PATCH /api/segments/{id}/) in the Klaviyo REST API: authentication, parameters, request and response bodies, and an example request."
url: "https://developers.klaviyo.com/en/v2023-07-15/reference/update_segment"
revision: "2023-07-15"
latestUrl: "https://developers.klaviyo.com/en/reference/update_segment"
operationId: "update_segment"
method: "PATCH"
endpoint: "https://a.klaviyo.com/api/segments/{id}/"
authentication: "privateKey"
scopes: ["segments:write"]
rateLimits: {"burst":"10/s","steady":"150/m"}
revisionHeader: {"name":"revision","required":true}
deprecated: false
related: ["https://developers.klaviyo.com/en/v2023-07-15/reference/segments/llms.txt","https://developers.klaviyo.com/en/v2023-07-15/reference/get_segments.md","https://developers.klaviyo.com/en/v2023-07-15/reference/get_segment.md","https://developers.klaviyo.com/en/v2023-07-15/reference/get_segment_tags.md","https://developers.klaviyo.com/en/v2023-07-15/reference/get_segment_profiles.md"]
---

# Update Segment

> This is the Markdown version of https://developers.klaviyo.com/en/v2023-07-15/reference/update_segment

```http
PATCH https://a.klaviyo.com/api/segments/{id}/
```

Update the name of a segment with the given segment ID.

- Revision header: `revision: 2023-07-15` (required)
- Scopes: `segments:write`
- Rate limits: Burst: `10/s`, Steady: `150/m`

## Example request

```bash
curl --request PATCH \
     --url 'https://a.klaviyo.com/api/segments/id/' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/json' \
     --header 'revision: 2023-07-15' \
     --header 'content-type: application/json' \
     --data '{
  "data": {
    "type": "segment",
    "id": "string",
    "attributes": {
      "name": "string"
    }
  }
}'
```

## Path parameters

- `id` (string, required)

## Headers

- `revision` (string, required): API endpoint revision (format: YYYY-MM-DD[.suffix]) Default: `2023-07-15`

## Request body

Content type: `application/json` (required)

- `data` (object, required)
  - `type` (string, required): Allowed values: `segment`
  - `id` (string, required)
  - `attributes` (object, required)
    - `name` (string, required)

### Example request body

```json
{
  "data": {
    "type": "segment",
    "id": "string",
    "attributes": {
      "name": "string"
    }
  }
}
```

## Responses

### 200: 

Content type: `application/json`

- `data` (object, required)
  - `type` (string, required): Allowed values: `segment`
  - `id` (string, required)
  - `attributes` (object, required)
    - `name` (string): A helpful name to label the segment Example: `Repeat Purchasers`
    - `created` (string<date-time>): Date and time when the segment was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm) Example: `2022-11-08T00:00:00`
    - `updated` (string<date-time>): Date and time when the segment was last updated, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm) Example: `2022-11-08T00:00:00`
  - `relationships` (object)
    - `profiles` (object)
      - `data` (object[], required): Fields nested this deep aren't listed here; they're in the endpoint's OpenAPI document.
      - `links` (object): Fields nested this deep aren't listed here; they're in the endpoint's OpenAPI document.
    - `tags` (object)
      - `data` (object[], required): Fields nested this deep aren't listed here; they're in the endpoint's OpenAPI document.
      - `links` (RelationshipLinks): Fields nested this deep aren't listed here; they're in the endpoint's OpenAPI document.
  - `links` (object, required)
    - `self` (string<uri>, required)

#### Example response body

```json
{
  "data": {
    "type": "segment",
    "id": "string",
    "attributes": {
      "name": "Repeat Purchasers",
      "created": "2022-11-08T00:00:00",
      "updated": "2022-11-08T00:00:00"
    },
    "relationships": {
      "profiles": {
        "data": [
          {
            "type": "profile",
            "id": "string"
          }
        ],
        "links": {
          "self": "https://www.example.com",
          "related": "https://www.example.com"
        }
      },
      "tags": {
        "data": [
          {
            "type": "tag",
            "id": "string"
          }
        ],
        "links": {
          "self": "https://www.example.com",
          "related": "https://www.example.com"
        }
      }
    },
    "links": {
      "self": "https://www.example.com"
    }
  }
}
```

### 4XX: Client Error

Content type: `application/json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```

### 5XX: Server Error

Content type: `application/json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```
