[Tenjin API Reference](https://api-docs.tenjin.com/llms.txt) › [Reporting Metrics API](https://api-docs.tenjin.com/reporting-metrics-api.md) › Create a saved report

- Reporting Metrics API OpenAPI spec: https://api-docs.tenjin.com/openapi/reporting-metrics-api.json

# Create a saved report

- **Method:** `POST`
- **Path:** `/v2/saved_reports`
- **Operation ID:** `post_saved_reports`
- **Tags:** Saved Reports

## Effective servers

- `https://api.tenjin.com`

## Authentication

- **Bearer**: HTTP bearer (`JWT`)

  Generate an access token on the [Access Tokens](https://dashboard.tenjin.com/dashboard/access_tokens) page of the Tenjin dashboard and send it as `Authorization: Bearer <access token>`. [API access tokens](https://tenjin.com/docs/api-access-tokens/) explains them.

## Request body

**Required:** `true`

**Content type:** `application/json`

schema: `post_saved_reports_Request`

- **`granularity` (required)**: `string`, possible values: `"daily", "weekly", "monthly", "totals-daily"`

  Granularity of the report
- **`group_by` (required)**: `array`

  Dimensions to group the report by, comma-separated or as an array. The dimensions and combinations each report_type takes: user_acquisition: `channel`, `app`, `country`, `campaign`, `site`, `creative`, `channel,app,country`, `channel,app`, `campaign,country`; ad_revenue: `channel`, `app`, `country`, `ad_placement`, `channel,app,country`, `channel,app`, `app,country`

  **Items:**

  `string`, possible values: `"channel", "app", "country", "campaign", "site", "creative", "ad_placement"`
- **`name` (required)**: `string`, maxLength: `255`

  Name of the saved report
- **`report_type` (required)**: `string`, possible values: `"user_acquisition", "ad_revenue"`

  `user_acquisition` for a spend report, `ad_revenue` for an ad revenue report
- **`app_ids`**: `array of string`

  Ids of the apps the report covers, comma-separated or as an array; all when blank
- **`channel_ids`**: `array of integer`

  Ids of the channels the report covers, comma-separated or as an array; all when blank
- **`metrics`**: `array of string`

  Metrics of the report, comma-separated or as an array: any of the [spend metrics](https://api-docs.tenjin.com/metric_definitions#spend) for user_acquisition, or of the [ad revenue metrics](https://api-docs.tenjin.com/metric_definitions#ad_revenue) for ad_revenue. A POST without metrics uses spend, impressions, clicks, installs, cpi, ctr, cvr, tcpi for user_acquisition, and ad_revenue, impressions, clicks, ecpm, ecpc for ad_revenue
- **`past_number_days`**: `integer`, default: `30`

  Number of days before today that the report covers

**Example:**

```json
{
  "name": "",
  "granularity": "daily",
  "group_by": [
    "channel"
  ],
  "report_type": "user_acquisition",
  "past_number_days": 30,
  "channel_ids": [
    1
  ],
  "app_ids": [
    ""
  ],
  "metrics": [
    ""
  ]
}
```

## Responses

### 201 The created saved report

**Content type:** `application/json`

schema: `SavedReportDocument`

- **`data` (required)**: `object`, schema: `SavedReportResource`
  - **`attributes` (required)**: `object`
    - **`app_ids` (required)**: `array`

      Ids of the apps the report covers; all when empty

      **Items:**

      `string`, format: `uuid`
    - **`channel_ids` (required)**: `array of integer`

      Ids of the channels the report covers; all when empty
    - **`granularity` (required)**: `string`, possible values: `"daily", "weekly", "monthly", "totals-daily"`

      Granularity of the report
    - **`group_by` (required)**: `string | null`

      The dimension the report groups by, or the name of its combination: `channel_app_country`, `channel_app`, `campaign_country`, `app_country`. A report saved outside the API can hold several dimensions, comma-separated (`app,site`). Null when a stored dimension has no API name
    - **`metrics` (required)**: `array of string`

      Metrics of the report
    - **`name` (required)**: `string`

      Name of the saved report
    - **`past_number_days` (required)**: `integer`

      Number of days before today that the report covers
    - **`report_type` (required)**: `string`, possible values: `"user_acquisition", "ad_revenue"`

      `user_acquisition` for a spend report, `ad_revenue` for an ad revenue report
  - **`id` (required)**: `string`, format: `uuid`
  - **`type` (required)**: `string`, possible values: `"saved_report"`
- **`links` (required)**: `object`, schema: `Links`
  - **`self` (required)**: `string`, format: `uri`

    URL of this request
  - **`first`**: `string`, format: `uri`

    URL of the first page of a list
  - **`last`**: `string`, format: `uri`

    URL of the last page of a list
  - **`next`**: `string`, format: `uri`

    URL of the next page of a list
  - **`prev`**: `string`, format: `uri`

    URL of the previous page of a list
- **`meta` (required)**: `object`

  Always empty

**Example: The created saved report**

```json
{
  "data": {
    "id": "38ad4186-f449-4359-96ce-b821b74927b1",
    "type": "saved_report",
    "attributes": {
      "name": "Alpha UA",
      "past_number_days": 14,
      "metrics": [
        "spend",
        "installs"
      ],
      "granularity": "weekly",
      "report_type": "user_acquisition",
      "channel_ids": [
        900001
      ],
      "app_ids": [
        "e19fac7f-fedd-4b8e-8d7a-505e20c01dc7"
      ],
      "group_by": "channel_app"
    }
  },
  "links": {
    "self": "https://api.tenjin.com/v2/saved_reports/38ad4186-f449-4359-96ce-b821b74927b1"
  },
  "meta": {}
}
```

### 400, 401, 403, 498, 503

- `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
- `498` Expired token, or a token with an invalid signature
- `503` Read-only mode during maintenance; try again later

**Content type:** `application/json`

schema: `Error`

- **`error` (required)**: `string`

  What went wrong

**Example:**

```json
{
  "error": ""
}
```

## Schemas

- `Error` — shown above.
- `post_saved_reports_Request` — shown above.
- `SavedReportDocument` — shown above.
- `Links` — shown above.
- `SavedReportResource` — shown above.
