Skip to main content
POST
Run a cohort analysis

Authorizations

x-api-key
string
header
required

Your Upstack API key. Starts with upstack_.

x-pixel-id
string
header
required

The pixel id the request targets.

Body

application/json
pixelId
string
required

Must match the x-pixel-id header.

granularity
enum<string>
required
Available options:
week,
month,
year
measures
enum<string>[]
required

Cohort-specific measure ids. Pass measure ids as strings (this endpoint differs from /api/query, which takes objects with pacing).

Required array length: 1 - 30 elements
Available options:
orders.ltv_cohort_gross_revenue,
orders.ltv_cohort_net_revenue,
orders.customers_cohort,
orders.avg_order_value_cohort,
orders.cohort_retention_percent,
orders.cohort_cm1,
orders.cohort_cm2
dateRange
object
required
timezone
string
currency
string
default:USD

ISO 4217 code to convert cohort money values to (revenue, AOV, CM1/CM2). Each amount converts at the rate for the day the order occurred. Defaults to USD when omitted — if your store sells in another currency, pass this explicitly.

filters
object

Canonical filter applied to the cohort. orders.* fields are valid in this context — discover via GET /api/filters.

orderSettings
object

Order-level query settings — exclusion filters, pending/voided handling.

Response

Cohort results.

results
object[]
required