Query Count
POST /cdp/query/{itemType}/count — count the items matching a condition without exporting
raw data. itemType is profile or event; anything else returns 404.
Your brand’s scope is AND-ed into the condition server-side — the count only ever covers
your brand’s data, and a condition that references scope or shopDomain is rejected with
400 (the owning scope is enforced by the server, never caller-supplied).
The optional condition uses the public Unomi condition subset — see
Define Segment for the allowed condition types and operators.
Omit it to count everything in scope.
Request
Section titled “Request”POST /cdp/query/{itemType}/countAuthorization: Bearer vyg_…Content-Type: application/json| Field | Type | Required | Description |
|---|---|---|---|
condition | object | no | Unomi condition (public subset). Omit to count in-scope. |
{ "condition": { "type": "eventTypeCondition", "parameterValues": { "eventTypeId": "order" } }}Response 200
Section titled “Response 200”{ "itemType": "event", "count": 4211, "scope": "your-shop.myshopify.com"}| Field | Type | Description |
|---|---|---|
itemType | string | The counted item type. |
count | number | Items matching the condition in scope. |
scope | string | Your brand’s connected shop domain. |
Example
Section titled “Example”curl -s -X POST "https://cdp.vyg.app/cdp/query/profile/count" \ -H "Authorization: Bearer vyg_your_key_here" \ -H "Content-Type: application/json" \ -d '{"condition":{"type":"profilePropertyCondition","parameterValues":{"propertyName":"properties.email","comparisonOperator":"exists"}}}'Errors
Section titled “Errors”| Status | When |
|---|---|
400 | Malformed body, or the condition fails the vocabulary allowlist. |
401 | Missing or invalid credential. |
403 | No connected shop resolves a scope. |
404 | Unknown itemType (only profile and event are supported). |
429 | Query throttle exceeded — retry with backoff. |
502 | The CDP could not evaluate the query. |
503 | The CDP is temporarily unavailable (retry). |