Skip to content

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.

POST /cdp/query/{itemType}/count
Authorization: Bearer vyg_…
Content-Type: application/json
FieldTypeRequiredDescription
conditionobjectnoUnomi condition (public subset). Omit to count in-scope.
{
"condition": {
"type": "eventTypeCondition",
"parameterValues": { "eventTypeId": "order" }
}
}
{
"itemType": "event",
"count": 4211,
"scope": "your-shop.myshopify.com"
}
FieldTypeDescription
itemTypestringThe counted item type.
countnumberItems matching the condition in scope.
scopestringYour brand’s connected shop domain.
Terminal window
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"}}}'
StatusWhen
400Malformed body, or the condition fails the vocabulary allowlist.
401Missing or invalid credential.
403No connected shop resolves a scope.
404Unknown itemType (only profile and event are supported).
429Query throttle exceeded — retry with backoff.
502The CDP could not evaluate the query.
503The CDP is temporarily unavailable (retry).