---
title: "Pull a spend report"
method: GET
path: "/v2/reports/spend"
tags: ["Reporting Metrics"]
---

# Pull a spend report

`GET /v2/reports/spend`

## Request

- Base URL: `https://api.tenjin.com`
- URL: `https://api.tenjin.com/v2/reports/spend`
- Auth: HTTP bearer

Columns of a row by group_by, besides `date` (absent with `granularity=totals-daily`) and the requested metrics:

| group_by | Columns |
| --- | --- |
| `app` | `app_id`, `name`, `icon_url`, `platform`, `bundle_id`, `store_id` |
| `channel` | `ad_network_id`, `name`, `icon_url`, `short_id`, `custom` |
| `campaign` | `campaign_id`, `name`, `icon_url`, the app columns (`app_id`, `app_name`, `app_icon_url`, `platform`, `bundle_id`, `store_id`) and the channel columns (`ad_network_id`, `ad_network_name`, `ad_network_icon_url`) |
| `creative` | `creative_id`, `name`, `remote_creative_id`, the app columns and the channel columns |
| `country` | `country`, `name` |
| `site` | `site_id`, `name` |
| `channel,app` | `ad_network_id`, `app_id`, the app columns and the channel columns |
| `channel,app,country` | the `channel,app` columns and `country` |
| `campaign,country` | the `campaign` columns and `country` |
| any other combination | `name`: the ids joined with `-`, and the id column of each value with its columns: for `app`, the app columns; for `channel`, `ad_network_name`, `ad_network_icon_url`, `ad_network_short_id`, `ad_network_custom`; for `campaign`, `campaign_name`, `campaign_icon_url`, the app columns and the channel columns; for `creative`, `creative_name`, `remote_creative_id`, the app columns and the channel columns |

A group_by with `campaign` or `creative` leaves out `channel` and `app`, which they determine: `channel,campaign` returns the `campaign` columns.

## Query parameters

- `start_date` string, date
- `end_date` string, date
- `app_ids` string[]
- `channel_ids` integer[]
- `granularity` 'daily' | 'weekly' | 'monthly' | 'totals-daily'
- `metrics` string[]
- `metric_filters` string[]
- `omit_blank_rows` boolean
- `ad_network_ids` integer
- `platforms` string
- `campaign_ids` string
- `cohort_strategy` string
- `countries` string[]
- `group_by` string[]
- `page` integer
- `per_page` integer

## Response `200`

The report

- SpendReportDocument
  - `data` SpendReportResource[], required
    - `id` string, required
    - `type` 'report', required
    - `attributes` object, required: The dimension columns of the group_by, and the requested metrics: any of the [Metric Definitions](https://api-docs.tenjin.com/metric_definitions#spend) and the organization's z_ custom metrics. Unknown metric names are left out.
      - `date` string, date: First day of the period; absent with granularity=totals-daily
      - `name` string, nullable: Name of the app, channel, campaign or creative; the country code or site id. Group by app, channel, campaign, creative, country or site, and the campaign name for campaign,country. Absent for channel,app and channel,app,country. A group_by with campaign or creative ignores channel and app. For any other combination, the ids joined with `-`, such as `3-US`
      - `icon_url` string, nullable: Icon URL of the app, channel or campaign. Group by app or channel alone, or a group_by that includes campaign, without site or creative
      - `short_id` string, nullable: URL-safe id of the channel. Group by channel
      - `custom` boolean, nullable: Whether the channel is a custom one. Group by channel
      - `app_id` string, uuid, nullable: Id of the app. A group_by that includes app, campaign or creative
      - `app_name` string, nullable: Name of the app. A group_by that includes app, campaign or creative, except app alone
      - `app_icon_url` string, nullable: Icon URL of the app. A group_by that includes app, campaign or creative, except app alone
      - `platform` 'amazon' | 'android' | 'android_other' | 'ios' | 'windows' | 'unspecified' | 'null', nullable: Platform of the app. A group_by that includes app, campaign or creative
      - `bundle_id` string, nullable: Bundle id of the app in its store. A group_by that includes app, campaign or creative
      - `store_id` string, nullable: Id of the app in its store. A group_by that includes app, campaign or creative
      - `ad_network_id` integer, nullable: Id of the channel. A group_by that includes channel, campaign or creative
      - `ad_network_name` string, nullable: Name of the channel. A group_by that includes channel, campaign or creative, except channel alone
      - `ad_network_icon_url` string, nullable: Icon URL of the channel. A group_by that includes channel, campaign or creative, except channel alone
      - `ad_network_short_id` string, nullable: URL-safe id of the channel. A group_by that includes channel and country or site, without campaign or creative, except channel,app,country
      - `ad_network_custom` boolean: Whether the channel is a custom one. A group_by that includes channel and country or site, without campaign or creative, except channel,app,country
      - `campaign_id` string, uuid: Id of the campaign. A group_by that includes campaign
      - `campaign_name` string, nullable: Name of the campaign. A group_by that includes campaign and site or creative
      - `campaign_icon_url` string, nullable: Icon URL of the campaign. A group_by that includes campaign and site or creative
      - `creative_id` string, uuid: Id of the creative. A group_by that includes creative
      - `creative_name` string, nullable: Name of the creative. A group_by that includes creative and campaign, country or site
      - `remote_creative_id` string, nullable: Id of the creative on the ad network. A group_by that includes creative
      - `country` string: ISO country code. A group_by that includes country
      - `site_id` string: Id of the site. A group_by that includes site
  - `links` Links, required
    - `self` string, uri, required: URL of this request
    - `first` string, uri: URL of the first page of a list
    - `prev` string, uri: URL of the previous page of a list
    - `next` string, uri: URL of the next page of a list
    - `last` string, uri: URL of the last page of a list
  - `meta` SpendReportMeta, required
    - `count` integer, required: Number of rows on all pages
    - `per_page` integer, required: Number of rows per page
    - `start_date` string, date, required: The start_date param, or its default
    - `end_date` string, date, required: The end_date param, or its default
    - `metrics` string[], required: The requested metrics
    - `organization_id` string, uuid, required: Id of your organization
    - `app_ids` string[], required: The app_ids param
    - `granularity` 'daily' | 'weekly' | 'monthly' | 'totals-daily', required: The granularity param, or its default
    - `group_by` 'ad_network_id' | 'app_id' | 'campaign_id' | 'country' | 'site_id' | 'creative_id' | 'ad_network_app' | 'ad_network_app_country' | 'channel_country' | 'app_country' | 'campaign_country' | 'campaign_creative' | 'campaign_site' | 'creative_country' | 'creative_site' | 'null', nullable, required: Internal dimension name for one dimension, a name for some combinations, or null for any other combination
    - `countries` string[], required: The countries param
    - `campaign_ids` union, required: The deprecated campaign_ids param as sent; empty when not sent
      - string
      - string[]
    - `platforms` union, required: The deprecated platforms param as sent; empty when not sent
      - string
      - string[]
    - `ad_network_ids` union, required: The channel_ids param, or the deprecated ad_network_ids param as sent: a string or an array of strings
      - integer[]
      - string
      - string[]

## Other responses

- `400`: A param is missing or invalid, a record is not found, or the request cannot be served
- `401`: Missing or invalid credentials, or no access to the requested data
- `403`: Invalid token, or the user's role does not allow the request
- `429`: More than 100 report requests in a minute with one access token
- `498`: Expired token, or a token with an invalid signature

---

[API](https://skmtc.dev/tenjin/apis/reporting-metrics-api.md) - [All operations](https://skmtc.dev/tenjin/apis/reporting-metrics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tenjin/apis/reporting-metrics-api/revisions/cffd908625be?raw)
