---
title: "Update segment"
method: PATCH
path: "/apps/{app_id}/segments/{segment_id}"
---

# Update segment

`PATCH /apps/{app_id}/segments/{segment_id}`

Update an existing segment's name and/or filters. The name parameter is always required. When filters are provided, all existing filters are replaced with the new ones.

## Path parameters

- `app_id` string, required
- `segment_id` string, required

## Headers

- `Authorization` string, required
- `Content-Type` string, required

## Request body

- object
  - `name` string, required — Required. The segment name. Maximum 128 characters.
  - `description` string — Optional human-readable description for the segment. Maximum 255 characters. Pass an empty string to clear; omit to leave unchanged.
  - `filters` union[] — Optional. When provided, replaces all existing filters. Filters define the segment based on user properties like tags, activity, or location using flexible AND/OR logic. Limited to 200 total entries, including fields and `OR` operators. See [Create segment](/reference/create-segments) for filter syntax.
    - union
      - object — Required. The filter object.
        - `field` 'tag' | 'last_session' | 'first_session' | 'session_count' | 'session_time' | 'language' | 'app_version' | 'location' | 'country', required — The name of the filter to use.
        - `relation` '=' | '!=' | '>' | '<' | 'exists' | 'not_exists' | 'in_array' | 'not_in_array' | 'time_elapsed_gt' | 'time_elapsed_lt', required — Used with most filters. See details on the specific filter.
        - `key` string — Used with the `tag` filter. This is the tag `key`.
        - `value` string — The value of the `field` or tag `key` in which you want to filter with.
      - object
        - `operator` 'AND' | 'OR' — Chain filter conditions with implicit `AND` and `OR` logic. Never end your `filters` object with an `operator`. See [filters](/reference/create-message#filters) for more.

## Response `200`

200

- object
  - `success` boolean — true if the segment was updated successfully, false otherwise.
  - `id` string — The UUID of the updated segment.

## Other responses

- `400` — 400
- `403` — 403
- `404` — 404
- `429` — 429
- `503` — Service temporarily unavailable. Retry after a short backoff. The body may be empty or non-JSON in some failure modes.

---

[API](https://skmtc.net/onesignal/apis/api-onesignal-com.md) · [All operations](https://skmtc.net/onesignal/apis/api-onesignal-com/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/onesignal/api-onesignal-com/versions/0fc223f7e338/schema)
