Skip to content

Update Segment

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:

  1. Scope strip — any scope predicate in the submitted condition is removed. This means you can round-trip the condition returned 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.
  2. 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.
  3. 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.

PUT /cdp/segments/{id}
Authorization: Bearer vyg_…
Content-Type: application/json
FieldTypeRequiredDescription
conditionobjectyesThe new match condition (Unomi condition shape, public vocabulary).
namestringnoNew segment name; when omitted the existing name is kept.
descriptionstringnoNew description; when omitted the existing description is kept.
{
"id": "seg__your-shop.myshopify.com__high-value",
"name": "High-value customers",
"scope": "your-shop.myshopify.com"
}
Terminal window
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
}
}
}'
StatusWhen
400Missing/non-object condition, empty name, condition empty after scope-predicate removal, or invalid_condition (allowlist rejection, with JSON paths).
401Missing or invalid credential.
403No connected shop resolves a scope.
404The segment does not exist — or belongs to another brand.
502upstream_error — the segment could not be persisted to the CDP.
503The CDP is temporarily unavailable (retry).