LiveRecoverVYG Developer Docs
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/json

Body

FieldTypeRequiredDescription
namestringyesNon-empty segment name.
conditionobjectyesA Unomi condition object (must be a JSON object, not an array).
keystringnoOptional segment key.
descriptionstringnoOptional description.

Response 201

{
	"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.

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

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.

On this page