Segments
Update a segment
PATCH/v1/segments/{id}
Requires an API key with the segments:write scope. About keys and scopes
Replaces the segment's rules or renames it. Changing rules changes who the segment matches from the next evaluation onward; campaigns already sent are unaffected.
Path parameters
idstringrequireduuid
Request body
namestringoptionalUnique within the workspace.
1–255 characters
rulesobjectoptionalReplaces the whole rule tree.
One of 2 shapes
- Match all
1 child attribute
allobject[]requiredEvery rule or nested group must match.
at least 1 item · at most 20 items
- Match any
1 child attribute
anyobject[]requiredAt least one rule or nested group must match.
at least 1 item · at most 20 items
Returns
Returns 200 OK with a Segment in data. Otherwise returns an error; Errors lists every code and which to retry.
idstringrequireduuid
namestringrequiredrulesobjectrequiredOne of 2 shapes
- Match all
1 child attribute
allobject[]requiredEvery rule or nested group must match.
at least 1 item · at most 20 items
- Match any
1 child attribute
anyobject[]requiredAt least one rule or nested group must match.
at least 1 item · at most 20 items
lastCountinteger | nullrequiredAudience size from the background count; null until first counted.
min 0 · max 9007199254740991
countedAtstring | nullrequiredWhen
lastCountwas taken.date-time
createdAtstringrequireddate-time
updatedAtstringrequireddate-time