Query Count
Count profiles or events matching a condition, scoped to your brand.
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.
The /cdp/query/* routes carry a dedicated, tighter rate limit than the rest of the API —
analytics queries are evaluated by the underlying search cluster. Batch your dashboards
accordingly and expect 429 under burst.
Request
POST /cdp/query/{itemType}/count
Authorization: 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
{
"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
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
| 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). |