CDP REST APIAPI Reference
Define Segment
Define a rule-based segment over a Unomi condition. The brand scope is AND-ed into the condition.
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.
Request
POST /cdp/segments
Authorization: Bearer vyg_…
Content-Type: application/jsonBody
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Non-empty segment name. |
condition | object | yes | A Unomi condition object (must be a JSON object, not an array). |
key | string | no | Optional segment key. |
description | string | no | Optional description. |
Response 201
{
"id": "segment-scoped-id",
"name": "High-value customers",
"scope": "your-shop.myshopify.com"
}| Field | Type | Description |
|---|---|---|
id | string | The resolved (scope-namespaced) segment id. |
name | string | The segment name you supplied. |
scope | string | Your brand's connected shop domain. |
Example
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": {} }
}'Errors
| Status | When |
|---|---|
400 | Missing/empty name, or a missing/non-object condition. |
401 | Missing or invalid credential. |
403 | No connected shop resolves a scope. |
405 | Unsupported method (use POST to define, GET to list/read). |
502 | upstream_error — the segment could not be persisted to the CDP. |
See Tenant Isolation & Scope for how segment scope is enforced.