---
title: "Update Segment"
method: PUT
path: "/v3/lists/{listId}/segments/{segmentId}"
tags: ["Segments"]
---

# Update Segment

`PUT /v3/lists/{listId}/segments/{segmentId}`

This endpoint allows you to update an existing segment from a list using a CSV file or using a JSON. It replaces the previous segment's conditions with a new one and adds a condition to match source column (from file) with target column (from main list).

## Path parameters

- `listId` integer, required
- `segmentId` string, required

## Query parameters

- `name` string
- `sourceColumn` string, required
- `targetColumn` string, required

## Request body

- SegmentJson
  - `name` string, required — name of the segmnet
  - `queryRule` string — segment condition

## Response `200`

Successfully updated the segment

- SegmentResponse
  - `meta` MetadataDTO
    - `timestamp` integer, required — Transaction's date in timestamp
    - `transactionId` string, required — Id for the current transaction (Endpoint's call)
    - `explain` string — Explain string in case of failure
  - `data` Segment — list of segments
    - `id` string, required — segment id
    - `name` string, required — name of the segmnet
    - `userName` string — owner of the segment
    - `listId` integer, required — list id
    - `queryRule` string — segment condition
    - `total` integer, required — total of contacts in segment

## Other responses

- `400` — Bad request
- `500` — Internal server error

---

[API](https://skmtc.net/messangi/apis/raven.md) · [All operations](https://skmtc.net/messangi/apis/raven/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/messangi/raven/versions/c87f398fa338/schema)
