Skip to main content

Worked request and response samples

The {id}/run → {id}/download/{run_id} pair the scheduler walks is an artifact cycle: a /run call kicks off a report run (out-of-band generation), then a /download call retrieves its output once status: ready flips. The ad-hoc POST /api/v1/reports/generate below gives the same data in one request — use run when persistence matters, generate for dashboard drilldowns.
POST /api/v1/reports/generate — aggregate metrics + daily + per-channel breakdowns in one envelope
The 422 envelope below marks error.details.field — the generate body fields are channel, range (24h/7d/30d/90d), from, to; branch there and never blind-retry. Response headers name Idempotency-Key for timeouts under load — retry same key replays the original 200 instead of re-charging the compute.

Errors worth branching on

These five failures cover the artifact cycle outlined above (/reports/{id}/run → /reports/{id}/download/{run_id}), plus the ad-hoc /reports/generate the worked sample uses. Each block below is a full { error, meta } envelope as the API returns it, and the matrix at the bottom answers retry vs surface for the same five classes. For the platform-wide decision table these branches plug into, see the error handling guide.

401 — Unauthorized

A 401 on this page is the bearer key failing before the route ran — it never means the resource is wrong. Rotate the key or re-mint the scoped token; retrying the same request changes nothing.

403 — Forbidden

A 403 means the key authenticated but the operation is gated by scope — check the key’s scopes on the developer page; a 403 is never a data-not-found shape.

422 — Schema

A 422 means the generate body did not match the request schema — branch on error.details.field; the accepted values live above (channel enum, range shortcut, or an explicit from/to pair) and a blind retry repeats the same 422.

429 — Rate

The Retry-After header and error.details.retry_after are both set on every 429 — resend the SAME request after the lower of the two.

402 — Feature gate

Surface the upsell page — the report route is data-safe; only provisioning gates it.

60-second retry matrix