For the complete documentation index, see llms.txt. This page is also available as Markdown.

Reports

The Reports API gives you programmatic access to Spiffy's saved-report framework — the same six report types available in the dashboard, now accessible via API and AI connectors.

Endpoints:

  • GET /v2/reports/types — discover report types and their filters

  • GET /v2/reports / POST / PATCH / DELETE — manage saved reports

  • POST /v2/reports/:id/runs — trigger a run

  • GET /v2/reports/:id/runs / GET .../runs/:run_id — check run status

  • GET /v2/reports/:id/runs/:run_id/results — fetch results

  • POST /v2/reports/:id/runs/:run_id/exports — get a CSV download URL

All endpoints require the reports OAuth scope and count against your monthly API quota.


Concepts

Report types

Six report types are available:

Type
What it covers

product_sales

Revenue and quantity by product, option, and price point

affiliate_performance

Sales and commission by affiliate

attribution_performance

Revenue and orders by attribution channel

checkout_performance

Conversion and revenue by checkout

payment_plan_performance

Payment plan collection and status

customer_cohort_ltv

Lifetime value by customer cohort

Call GET /v2/reports/types first. That endpoint returns each type's available filters (names, data types, and option lists for enum filters), result datasets with their column definitions, grouping options, and the full list of relative_date presets. Build your POST /v2/reports request from what it returns — do not guess filter names.

Saved reports vs runs

A saved report is a reusable configuration: type, filter set, date range (or relative preset), and optional schedule. Create one with POST /v2/reports, then trigger runs against it at any time.

A run is a single execution of a saved report. Runs are asynchronous. POST /v2/reports/:id/runs returns 202 with the run in pending status. Execution takes roughly 10–60 seconds. Poll GET .../runs/:run_id until status is completed or failed.

Each page of results and each poll request costs one monthly API call.

Stats-first reading order

When a run completes, GET /v2/reports/:id/runs/:run_id returns the run with a stats block inline:

Read stats.flat_stats first. For most questions — "how much did we make last month?" — the stats block is the answer. Fetch rows only when you need to drill into the detail.

Compact positional rows

GET .../results returns results in a compact tabular form wrapped in the standard v2 envelope:

Each row is a positional array matched to columns by index. This format uses roughly 3x fewer tokens than object-per-row JSON for large datasets.

Group level and double-counting: most report types produce hierarchical results (product to option to price point). The API flattens that hierarchy and adds a group_level column: 0 for top-level rows, increasing with depth. Parent rows are aggregates of their descendants — summing a metric column across all rows at all levels will double-count. Sum only rows at a single group_level, or use stats.flat_stats for grand totals.

Pages and hierarchy: because results are paginated and the tree is flattened depth-first, a page boundary may fall between a parent row and some of its descendants. Each row is self-contained via its grouping-key columns (e.g. product_name, option_name) — there is no reference to a parent row index, so split pages are safe to process independently.

data_type values: currency columns carry integer cents; percent columns carry decimal fractions (0.1234 = 12.34%). The data_type field will be "percent" or "percentage" depending on the report type — treat both identically as decimal fractions.

Export URLs

POST /v2/reports/:id/runs/:run_id/exports returns a signed download URL for the full dataset as a CSV file:

The URL requires no authentication — the signed token in the path is the credential. It expires in 15 minutes. Fetch it with curl or hand it to the user directly. Creating the export URL costs one API call; downloading the CSV does not.

Timezone semantics

Report runs bucket dates using the report's timezone field (an IANA timezone string, e.g. America/New_York). This differs from the Analytics Query API (POST /v2/analytics/query), which is UTC-only. A date window of June 1–30 will produce different row boundaries depending on the report's timezone.

When you create a report, set timezone to match the merchant's business timezone. If omitted, the report uses UTC.


Workflow example

1. Discover available types and filters

Abbreviated response:

2. Create a saved report

Response (201):

3. Trigger a run

Response (202):

4. Poll until complete

Response when complete:

5. Read stats

stats.flat_stats contains the aggregate totals for the run. Currency values are in cents. For the example above: total_sales_amount = 4218500 means $42,185.00.

If the stats answer your question, you are done. Skip to export if you need the full row-level data.

6. Fetch results (when needed)

Response:

The group_level column indicates hierarchy: 0 = product, 1 = option. Do not sum sales_amount across all rows — "Widget A" at level 0 already includes "Standard" and "Deluxe" at level 1. Sum only rows at level 0, or use stats.flat_stats.total_sales_amount for the grand total.

Currency values are in cents (189500 = $1,895.00).

7. Export to CSV

Response (201):

Download with curl or share the URL directly. No authentication is needed on the download. The URL expires in 15 minutes.


Quota notes

  • Each run trigger (POST .../runs) costs one call.

  • Each poll request (GET .../runs/:run_id) costs one call.

  • Each page of results (GET .../results) costs one call.

  • Creating an export URL (POST .../exports) costs one call.

  • Downloading the CSV (GET /v2/reports/exports/:token) does not cost a call.

For MCP callers: read stats.flat_stats from the completed run before fetching pages of results. Stats are returned inline on get_report_run at no extra cost.


Scope

All Reports API endpoints require the reports scope. Request it when creating your OAuth application.

Scheduled reports created via API send the same emails as dashboard-created ones. Recipients must be account users with report access. Include their user IDs in the users array when creating or updating a report with a schedule.


Errors

Validation failures return 400 with a message that names the problem and lists valid alternatives. For example, an unknown filter name will list the filter names returned by GET /v2/reports/types for that report type.

A GET .../results or POST .../exports call against a run that is not yet completed returns 409 with a message telling you to poll get_report_run first.

Last updated