---
title: "Update a segment"
method: PATCH
path: "/segments/{id}"
tags: ["Segments"]
---

# Update a segment

`PATCH /segments/{id}`

## Request

- Base URL: `https://www.unitpost.com/api/v1`
- URL: `https://www.unitpost.com/api/v1/segments/{id}`
- Auth: HTTP bearer

Update a segment's editable metadata, such as its name. To change who's in the segment, add or remove members with [Add a member](#post-segments-id-contacts) and [Remove a member](#delete-segments-id-contacts-contact). Requires the `segments:write` capability.

## Request body

- SegmentUpdate
  - `name` string
  - `description` string, nullable
  - `filter` Schema0 (unresolved $ref)

## Response `200`

The updated segment.

- Segment
  - `object` 'segment', required
  - `id` string, required
  - `name` string, required
  - `description` string, nullable, required
  - `type` 'static' | 'dynamic', required
  - `filter` Schema0, required (unresolved $ref)
  - `created_at` string, required
  - `updated_at` string, required

## Other responses

- `401`: Missing or invalid API key.
- `404`: Segment not found.
- `422`: Validation error.

---

[API](https://skmtc.dev/unitpost/apis/unitpost-api.md) · [All operations](https://skmtc.dev/unitpost/apis/unitpost-api/llms.txt) · [OpenAPI document](https://skmtc.dev/unitpost/apis/unitpost-api/revisions/86ff7c890967?raw)
