CDP REST APIAPI Reference
Update Segment
Update a segment's condition, name, or description. Scope predicates are stripped and your scope is re-injected.
PUT /cdp/segments/{id} — update one of your brand's segments. The submitted condition is
validated against the public condition vocabulary and then
re-saved under your scope:
- Scope strip — any scope predicate in the submitted condition is removed. This means
you can round-trip the
conditionreturned by Get Segment (which carries the server-injected scope wrapper) without editing it out — and a foreign-scope predicate smuggled into the tree is discarded, never persisted. - Allowlist validation — the remaining condition must use only the public subset of
condition types and operators;
script::resolvers and unknown vocabulary are rejected with JSON paths. - Scope re-injection — your brand's scope predicate is AND-combined back in server-side. A brand can never widen (or shift) its own segment.
A segment owned by another brand is indistinguishable from a missing one: both return 404.
Request
PUT /cdp/segments/{id}
Authorization: Bearer vyg_…
Content-Type: application/jsonBody
| Field | Type | Required | Description |
|---|---|---|---|
condition | object | yes | The new match condition (Unomi condition shape, public vocabulary). |
name | string | no | New segment name; when omitted the existing name is kept. |
description | string | no | New description; when omitted the existing description is kept. |
Response 200
{
"id": "seg__your-shop.myshopify.com__high-value",
"name": "High-value customers",
"scope": "your-shop.myshopify.com"
}Example
curl -s -X PUT "https://cdp.vyg.app/cdp/segments/seg__your-shop.myshopify.com__high-value" \
-H "Authorization: Bearer vyg_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"condition": {
"type": "profilePropertyCondition",
"parameterValues": {
"propertyName": "properties.totalSpend",
"comparisonOperator": "greaterThanOrEqualTo",
"propertyValueDouble": 500
}
}
}'Errors
| Status | When |
|---|---|
400 | Missing/non-object condition, empty name, condition empty after scope-predicate removal, or invalid_condition (allowlist rejection, with JSON paths). |
401 | Missing or invalid credential. |
403 | No connected shop resolves a scope. |
404 | The segment does not exist — or belongs to another brand. |
502 | upstream_error — the segment could not be persisted to the CDP. |
503 | The CDP is temporarily unavailable (retry). |