Generate a report
Send a POST request specifying the required metrics, dimensions, filters, and date range. This will create an asynchronous report‑generation task or return an existing taskId if the same request was made before.
The response returns a taskId that you can use to track the report status.
POST /api/v2/reports
|
Characteristic |
Value |
|
Method |
|
|
Path |
|
|
Headers |
|
|
Success |
|
Request body
|
Field |
Type |
Required status |
Description |
|
|
Array of strings |
Logically required |
A non‑empty array, where each element is a non‑empty string. |
|
|
Array of strings |
Not required |
Dimensions. |
|
|
Array of objects |
Not required |
Filters. See the structure below. |
|
|
object |
Logically required |
Report period. Fields |
|
|
Integer |
Not required |
The maximum rows returned. If provided, the value must fall within the range of 1 to 1,000,000 inclusive. |
|
|
Integer > 0 |
Required for advertisers |
ID of the admin account. |
Structure filters[]
|
Field |
Type |
Description |
|
|
String |
Filter field. |
|
|
String |
Comparison operator (see the table “Allowed |
|
|
JSON |
Required, must not be |
Error‑message indexes are zero‑based: filters[0].field, …
Allowed operatorvalues in filters
|
Operator |
Description |
|
|
Equal to. |
|
|
Not equal to. |
|
|
Less than / less than or equal to. |
|
|
Greater than / greater than or equal to. |
|
|
Matches / does not match the pattern. |
|
|
Included in the list of values. |
|
|
Not included in the list of values. |
|
|
Intersects with the set. |
Object dateRange
|
Field |
Type |
Description |
|
|
string |
Required, not empty. Date in calendar format: |
|
|
string |
Must satisfy |
The number of calendar days in the date range (inclusive) must not exceed maxDateRangeDays from the metadata (365).
Sample request
curl -X POST \
-H 'Authorization: OAuth <token>' \
-H 'Content-Type: application/json' \
-d '{
"metrics": ["loads_commercial", "clicks_total", "ctr"],
"dimensions": ["date", "campaign_id"],
"dateRange": { "from": "2024-01-01", "to": "2024-01-31" },
"filters": [
{ "field": "campaign_id", "operator": "in", "value": ["12345", "12346"] }
],
"limit": 1000,
"ownerId": 67890
}' \
'https://adfox.yandex.ru/api/v2/reports'
Sample response (HTTP 202)
{
"result": {
"taskId": "umr-a-rsr-b5555555-5555-5555-5555-555555555501",
"status": "PENDING"
}
}
Save taskId. You'll need it to check the report status and retrieve the results.
Errors
For error codes, see the Error codes page.