LiveRecoverVYG Developer Docs
CDP REST APIAPI Reference

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
FieldTypeRequiredDescription
conditionobjectnoUnomi 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"
}
FieldTypeDescription
itemTypestringThe counted item type.
countnumberItems matching the condition in scope.
scopestringYour 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

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).

On this page