Monetization Stats API
Use the Monetization Stats API to programmatically access your ad performance data in CSV format for custom reporting and analysis.
Read time 2 minutesLast updated 4 hours ago
Use the Monetization Stats API to retrieve monetization data directly in CSV format. The API fetches the same statistics that are available on the developer dashboard, however you can use it to programmatically pull data for your own uses.
Authentication
The endpoint uses an API key from the Unity Ads Monetization dashboard. Select Setup > API Access from the secondary navigation menu, then copy the API key from the Monetization Stats API Access section, or select Create API Key if none exists.
You must include the API key as the
"apikey=<token>"
"Authorization: Token <token>"
400 {"errors":[{"msg":"access token required"}]}
Request Format
To retrieve statistics data from the Unity Ads service, use the following GET request, where<organizationId>
GET https://monetization.api.unity.com/stats/v1/operate/organizations/<organizationId>
Query parameters
The API supports various ways to split your data. Some are required for a successful request.Parameter | Description | Required? | Notes |
---|---|---|---|
| The API authentication key retrieved from the Monetization dashboard. | No. Use the Authentication header instead. | Not applicable. |
| A comma-separated list that defines the columns of available fields:
| Yes | Not applicable. |
| A comma-separated list that expands the rows, splitting data by the following fields:
| No | Not applicable. |
| A value that splits data by time resolution. Each day splits at 00:00 UTC. Supported options include:
| Yes | Not applicable. |
| The start time of data set, in ISO 8601 format. | Yes | Not applicable. |
| The end time of data set, in ISO 8601 format. | Yes | Not applicable. |
| A comma-separated list of source game IDs by which to filter results. | No | To obtain source IDs, you can make a request using
|
"Accept"
- For CSV, use .
"Accept: text/csv"
- For JSON, use .
"Accept: application/json"
curl https://monetization.api.unity.com/stats/v1/operate/organizations/:organizationId?groupBy=country,placement,platform,game&fields=adrequest_count,available_sum,revenue_sum,start_count,view_count&scale=hour&start=2020-05-01T00:00:00Z&end=2020-06-01T23:59:00Z&apikey=:apiKeyValue -H "Accept: text/csv" --output stats.csv
Request status codes
The endpoint returns the following status codes indicating the result of the request:Code | Description |
---|---|
| The request succeeded. |
| The
|
| The API key is missing from the request or invalid. |
| Organization not found. |
| The request timed out. |
| Request rate limit exceeded. |
| The request failed for an unknown reason. |
| The service is unavailable. |