> For the complete documentation index, see [llms.txt](https://support.gamoshi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.gamoshi.com/gamoshi-wiki/how-to-guides/how-to-generate-an-api-token.md).

# How to generate an API token

*Availability: All accounts*

## Overview

Gamoshi enables users and analytics users to generate reports via the API quickly and easily.

**User permissions:** Each user gets data based on their permissions.

* **Regular user:** Can see all entities and all data in the account.
* **Analytics user:** Can see analytics data only for the advertisers/inventories associated with their business partner.

Users can get reports via an HTTP GET request, using the following endpoint:

`https://{dashboard host}/api/v1/report`

***

## Generating a Token

{% stepper %}
{% step %}

### Go to the API tab

Go to the **Analytics module → API tab**.
{% endstep %}

{% step %}

### Generate a token

On first login, click **"Generate a Token."**
{% endstep %}

{% step %}

### Override an existing token

To replace an existing token, use the **"Override Token"** button.

{% hint style="info" %}
Unless overridden, the token is valid for 30 days.
{% endhint %}
{% endstep %}

{% step %}

### Copy the token

Click **"Copy"** and place the token in your HTTP GET request URL.
{% endstep %}
{% endstepper %}

Users can add parameters to the REST API request for more precise filtering and analysis. The full list of allowed parameters and values is below.

***

## Permitted Request Parameters & Values

| **Parameter**   | **Description**                                                                                                                                                                                                     | **Supported Values**                                                                                                                                                                                                                                                                                                                      | **Mandatory**                          | **Example**                                             |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------- |
| date\_range     | The date range of the report.                                                                                                                                                                                       | today (default), yesterday, last\_7\_days, this\_week, this\_month, last\_month, last\_3\_months                                                                                                                                                                                                                                          | No                                     | —                                                       |
| from\_date      | The customized beginning of a date range.                                                                                                                                                                           | yyyy-mm-dd                                                                                                                                                                                                                                                                                                                                | No (if present, overrides date\_range) | 2021-02-01                                              |
| to\_date        | The customized end of a date range.                                                                                                                                                                                 | yyyy-mm-dd                                                                                                                                                                                                                                                                                                                                | No                                     | 2021-02-28                                              |
| timezone        | The customized time zone. Default is ETC/UTC.                                                                                                                                                                       | America/Los\_Angeles, America/Yellowknife, America/Phoenix, America/Denver, America/Mexico\_City, America/Chicago, America/New\_York, America/Argentina/Buenos\_Aires, Etc/UTC, Asia/Jerusalem, Europe/Paris, Asia/Seoul, Asia/Tokyo, Asia/Hong\_Kong, Pacific/Guam, Asia/Kathmandu — or the format GMT+\<num> / GMT-\<num> (URL-encoded) | No                                     | America/Chicago; for GMT+2: GMT%2B2; for GMT-2: GMT%2D2 |
| dimensions      | Results are grouped by the chosen value(s). Up to 2 dimensions per report.                                                                                                                                          | country, inventory\_id, advertiser\_id, inventory\_business\_partner\_id, advertiser\_business\_partner\_id, device\_os, day, ad\_size, browser, app\_id, campaign\_id, ad\_type, device\_type, app\_bundle, site\_domain, app\_or\_site, adomains                                                                                        | No                                     | dimensions=ad\_size                                     |
| perspective     | Inventory or Advertiser. For an analytics user of a business partner with both Advertiser and Inventory; otherwise, this parameter is disabled.                                                                     | Inventory, Advertiser                                                                                                                                                                                                                                                                                                                     | No                                     | perspective=advertiser                                  |
| granularity     | The time granularity of the report.                                                                                                                                                                                 | none (default), hour, day, month                                                                                                                                                                                                                                                                                                          | Yes                                    | granularity=hour                                        |
| output\_format  | The response format.                                                                                                                                                                                                | json (default), csv, Excel                                                                                                                                                                                                                                                                                                                | Yes                                    | output\_format=csv                                      |
| include\_sum    | Whether summaries appear at the start.                                                                                                                                                                              | true / false (default)                                                                                                                                                                                                                                                                                                                    | No                                     | true                                                    |
| limit           | The number of records in the result set.                                                                                                                                                                            | 1–10000                                                                                                                                                                                                                                                                                                                                   | No                                     | default = 500                                           |
| filters         | Filter results; multiple filters can be applied. Supports contains / notContains, = / !=, > / <, across all dimensions.                                                                                             | —                                                                                                                                                                                                                                                                                                                                         | No                                     | `filters=country`                                       |
| metric\_filters | Filter results; multiple filters can be applied. Supports =, !=, >, <. Supported metric dimensions: impressions, video\_impressions, video\_start, video\_25\_pct, video\_50\_pct, video\_75\_pct, video\_complete. | —                                                                                                                                                                                                                                                                                                                                         | No                                     | `metric_filters=impressions`                            |

{% hint style="info" %}
Each parameter added should be preceded by &, followed by parameter\_name=value.
{% endhint %}

***

## Example Request

A request for data between April 1, 2024 and April 30, 2024, daily, grouped by "Country":

```
https://dashboard.gamoshi.io/api/v1/report?from_date=2024-04-01&to_date=2024-04-30&granularity=day&report_token=report_2024-05-07_3faa738d-79c6-4064-a91c-f74f4e7eg36b&dimensions=country
```

***

## Example Response

Each response includes zero or more row objects packed into one response. Example of a row's event object:

```json
{
  "event": {
    "fired_impressions": 1033679,
    "fired_video_impressions": 0,
    "clicks": 0,
    "cost": 773.578,
    "revenue": 531.045,
    "profit": 242.532,
    "partner_legal_name": "",
    "inventory_id": 7700,
    "inventory_name": "example inventory"
  }
}
```

***

## Response Fields

| **Field**    | **Type**         | **Description**                 |
| ------------ | ---------------- | ------------------------------- |
| success      | boolean          | Success/failure.                |
| created      | date             | The timestamp of the request.   |
| cached       | boolean          | true/false.                     |
| fromTo       | —                | The date range of the response. |
| numberOfRows | —                | —                               |
| timeInMili   | Number           | —                               |
| rows         | array of objects | —                               |

***

## Caching Behavior

{% hint style="info" %}
When the same request is issued again within a 5-minute window, the response data will not be refreshed (the cached value will be true).
{% endhint %}

***

## Related articles

* [Analytics](/gamoshi-wiki/analytics.md) — Review Analytics screens and reporting options.
* [Gamoshi metrics](/gamoshi-wiki/general-information/gamoshi-metrics.md) — Find definitions for BI and Performance metrics.
