Skip to main content
PATCH
Update a segment

Authorizations

Authorization
string
header
required

Your project's secret key (pk_…, without the pub segment). Server-side only — never ship it to a browser. Get it from Settings → Projects in the dashboard.

Path Parameters

id
string
required

Segment id (seg_…) or machine key.

Body

application/json
name
string
Maximum string length: 80
description
string | null
Maximum string length: 1000
expression
object

Versioned, strictly validated audience rule. Example: { "version": 1, "root": { "kind": "all", "children": [ { "kind": "field", "field": { "kind": "trait", "key": "plan" }, "op": "eq", "value": "free" }, { "kind": "not", "child": { "kind": "event", "event": "used_csv_export" } } ] } }

Example:
expectedVersion
integer

Required with expression.

Required range: x >= 1
reason
string

Why this revision; stored on the new version.

Maximum string length: 500
agentRunId
string | null
Minimum string length: 1

Response

Updated segment detail.

segment
object
required