Skip to content

Define Segment

POST /cdp/segments — define a rule-based segment over a native Unomi condition. The brand scope predicate is AND-injected into the condition and the segment is tagged with the owning scope, so membership can never span shops and the segment is visible only to your brand.

POST /cdp/segments
Authorization: Bearer vyg_…
Content-Type: application/json
FieldTypeRequiredDescription
namestringyesNon-empty segment name.
conditionobjectyesA Unomi condition object (must be a JSON object, not an array).
keystringnoOptional segment key.
descriptionstringnoOptional description.
{
"id": "segment-scoped-id",
"name": "High-value customers",
"scope": "your-shop.myshopify.com"
}
FieldTypeDescription
idstringThe resolved (scope-namespaced) segment id.
namestringThe segment name you supplied.
scopestringYour brand’s connected shop domain.
Terminal window
curl -s -X POST "https://cdp.vyg.app/cdp/segments" \
-H "Authorization: Bearer vyg_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "High-value customers",
"condition": { "type": "profilePropertyCondition", "parameterValues": {} }
}'
StatusWhen
400Missing/empty name, or a missing/non-object condition.
401Missing or invalid credential.
403No connected shop resolves a scope.
405Unsupported method (use POST to define, GET to list/read).
502upstream_error — the segment could not be persisted to the CDP.

See Tenant Isolation & Scope for how segment scope is enforced.