---
title: "Run a report"
method: GET
path: "/v1/reports"
tags: ["Reports"]
---

# Run a report

`GET /v1/reports`

## Request

- Base URL: `https://api.affiliaterail.com`
- URL: `https://api.affiliaterail.com/v1/reports`
- Auth: HTTP bearer

Clicks, leads, customers, sales, refunds, revenue and commissions, cut by `dimension` over an inclusive range. Rows keyed `direct` are money that arrived without a partner; filtering by partner, group or tag reports that slice of the partner programme and excludes direct money. The window of the same length immediately before `from` rides along as `previous_period` with a basis-point `delta`, so a chart never needs two round trips; pass `compare=none` to skip it. `drill_down_config` says how a row's key becomes a filter.

**Scope:** `read`

## Query parameters

- `program_id` string, required
- `dimension` 'partner' | 'link' | 'product' | 'group' | 'tag' | 'period'
- `from` string: ISO date, inclusive. Defaults to twelve months back.
- `to` string: ISO date, inclusive. Defaults to now.
- `partner_id` string
- `group_id` string
- `tag_id` string
- `granularity` 'day' | 'week' | 'month': Bucket size for the period dimension
- `compare` 'previous_period' | 'none': `previous_period` (the default) returns the preceding window and the delta in the same response

## Response `200`

The report

- Report
  - `object` 'report', required
  - `dimension` 'partner' | 'link' | 'product' | 'group' | 'tag' | 'period', required
  - `currency` string, required: ISO-4217
  - `from` string, date-time, required: ISO-8601, UTC
  - `to` string, date-time, required: ISO-8601, UTC
  - `rows` ReportRow[], required
    - `key` string, nullable, required: The grouping value: an id, a product name, an ISO day, or `direct`. Null is "none".
    - `label` string, required
    - `clicks` integer, nullable, required
    - `leads` integer, nullable, required
    - `customers` integer, required
    - `sales` integer, required
    - `refunded` integer, required
    - `revenue_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
    - `commissions_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
    - `conversion_bps` integer, nullable, required: customers / clicks in basis points; null with no clicks
    - `refund_bps` integer, nullable, required
  - `totals` object, required: The true totals for the filter, computed without the grouping. Includes direct sales, so revenue matches the dashboard headline.
    - `key` string, nullable, required: The grouping value: an id, a product name, an ISO day, or `direct`. Null is "none".
    - `label` string, required
    - `clicks` integer, nullable, required
    - `leads` integer, nullable, required
    - `customers` integer, required
    - `sales` integer, required
    - `refunded` integer, required
    - `revenue_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
    - `commissions_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
    - `conversion_bps` integer, nullable, required: customers / clicks in basis points; null with no clicks
    - `refund_bps` integer, nullable, required
  - `previous_period` ReportPeriod, nullable, required: The window of the same length immediately before `from`, in the same response, so no chart needs a second round trip. Null when `compare=none`.
    - `from` string, date-time, required: ISO-8601, UTC
    - `to` string, date-time, required: ISO-8601, UTC
    - `rows` ReportRow[], required
      - `key` string, nullable, required: The grouping value: an id, a product name, an ISO day, or `direct`. Null is "none".
      - `label` string, required
      - `clicks` integer, nullable, required
      - `leads` integer, nullable, required
      - `customers` integer, required
      - `sales` integer, required
      - `refunded` integer, required
      - `revenue_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
      - `commissions_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
      - `conversion_bps` integer, nullable, required: customers / clicks in basis points; null with no clicks
      - `refund_bps` integer, nullable, required
    - `totals` ReportRow, required
      - `key` string, nullable, required: The grouping value: an id, a product name, an ISO day, or `direct`. Null is "none".
      - `label` string, required
      - `clicks` integer, nullable, required
      - `leads` integer, nullable, required
      - `customers` integer, required
      - `sales` integer, required
      - `refunded` integer, required
      - `revenue_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
      - `commissions_minor` integer, required: Integer minor units (cents, pence). Never a float, never a string.
      - `conversion_bps` integer, nullable, required: customers / clicks in basis points; null with no clicks
      - `refund_bps` integer, nullable, required
  - `delta` ReportDelta, nullable, required: Totals against the previous period, basis points and all integers. Null when `compare=none`.
    - `clicks` CountDelta, nullable, required
      - `absolute` integer, required: current minus previous
      - `change_bps` integer, nullable, required: The change as basis points of the previous value: +2083 = +20.83%. Null when the previous period was zero.
    - `leads` CountDelta, nullable, required
      - `absolute` integer, required: current minus previous
      - `change_bps` integer, nullable, required: The change as basis points of the previous value: +2083 = +20.83%. Null when the previous period was zero.
    - `customers` CountDelta, nullable, required
      - `absolute` integer, required: current minus previous
      - `change_bps` integer, nullable, required: The change as basis points of the previous value: +2083 = +20.83%. Null when the previous period was zero.
    - `sales` CountDelta, nullable, required
      - `absolute` integer, required: current minus previous
      - `change_bps` integer, nullable, required: The change as basis points of the previous value: +2083 = +20.83%. Null when the previous period was zero.
    - `refunded` CountDelta, nullable, required
      - `absolute` integer, required: current minus previous
      - `change_bps` integer, nullable, required: The change as basis points of the previous value: +2083 = +20.83%. Null when the previous period was zero.
    - `revenue` MoneyDelta, required
      - `absolute_minor` integer, required: current minus previous, integer minor units in the report's currency
      - `change_bps` integer, nullable, required: The change as basis points of the previous value: +2083 = +20.83%. Null when the previous period was zero.
    - `commissions` MoneyDelta, required
      - `absolute_minor` integer, required: current minus previous, integer minor units in the report's currency
      - `change_bps` integer, nullable, required: The change as basis points of the previous value: +2083 = +20.83%. Null when the previous period was zero.
  - `drill_down_config` DrillDownConfig, required: How a row's `key` becomes a filter on the report and list endpoints
    - `field` string, required
    - `filter_type` string, required
    - `value_prop` string, required

## Other responses

- `400`: Invalid request
- `401`: Missing or unknown API key
- `403`: Key lacks the required scope
- `404`: No such object in your organization
- `422`: The request was understood and refused
- `429`: Rate limited: see Retry-After

---

[API](https://skmtc.dev/affiliaterail/apis/affiliaterail-api.md) · [All operations](https://skmtc.dev/affiliaterail/apis/affiliaterail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/affiliaterail/apis/affiliaterail-api/revisions/ea41f345c092?raw)
