Skip to content

Query Metrics

POST /cdp/query/{itemType}/{property}/metrics — compute a requested subset of sum / avg / min / max over a numeric property, for the items matching a condition. itemType is profile or event; anything else returns 404.

Your brand’s scope is AND-ed into the condition server-side, so the metrics only ever cover your brand’s data. The condition (optional) uses the same public condition subset as Query Count.

itemTypeAddressable properties
profileproperties.*
eventproperties.*, flattenedProperties.*, timeStamp, eventType

systemProperties and scope/shopDomain paths are rejected with 400.

POST /cdp/query/{itemType}/{property}/metrics
Authorization: Bearer vyg_…
Content-Type: application/json
FieldTypeRequiredDescription
metricsstring[]yesNon-empty subset of sum, avg, min, max.
conditionobjectnoUnomi condition (public subset). Omit for in-scope.
{
"metrics": ["sum", "avg"],
"condition": {
"type": "eventTypeCondition",
"parameterValues": { "eventTypeId": "order" }
}
}
{
"itemType": "event",
"property": "properties.total",
"metrics": { "_sum": 125430.5, "_avg": 87.2 },
"scope": "your-shop.myshopify.com"
}
FieldTypeDescription
itemTypestringThe queried item type.
propertystringThe property the metrics were computed over.
metricsobjectMetric map as computed by the CDP (keys like _sum, _avg, …).
scopestringYour brand’s connected shop domain.
Terminal window
curl -s -X POST "https://cdp.vyg.app/cdp/query/event/properties.total/metrics" \
-H "Authorization: Bearer vyg_your_key_here" \
-H "Content-Type: application/json" \
-d '{"metrics":["sum","avg","max"]}'
StatusWhen
400Missing/unknown metrics, property not in the allowlist, or bad condition.
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).