Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.upstackdata.com/llms.txt

Use this file to discover all available pages before exploring further.

Run a cohort analysis — cohort an audience by acquisition period and analyze retention or LTV over time. Wraps POST /api/query-cohort-analysis — see the API reference.

Usage

upstack query-cohort \
  --measures orders.ltv_cohort_gross_revenue \
  --granularity week \
  --date-start 2026-01-01 \
  --date-end 2026-04-30

Required flags

FlagDescription
--measures <m1,m2,...>One or more cohort-specific measure ids.
--granularity <g>week, month, or year.
--date-start <YYYY-MM-DD> --date-end <YYYY-MM-DD>Date range.

Cohort-only measures

This endpoint only accepts these measure ids:
Measure idWhat it computes
orders.ltv_cohort_gross_revenueCohorted gross revenue over time.
orders.ltv_cohort_net_revenueCohorted net revenue (after refunds).
orders.customers_cohortCustomer count per cohort.
orders.avg_order_value_cohortCohort AOV.
orders.cohort_retention_percentRetention rate per cohort.
orders.cohort_cm1 / cm2Cohort contribution margins.

Optional flags

FlagDescriptionDefault
--timezone <tz>IANA timezone.UTC
See upstack query for the shared output / interactive / from-file flags.

Examples

# Weekly LTV cohort
upstack query-cohort \
  --measures orders.ltv_cohort_gross_revenue,orders.cohort_retention_percent \
  --granularity week \
  --date-start 2026-01-01 --date-end 2026-04-30

# Interactive
upstack query-cohort -i