Yandex Metrika: export report
metrika_export_reportExports all Yandex Metrika report rows to CSV or JSON in the background and returns a job for polling, resuming, or reading the file.
Instructions
Exports all rows of a Yandex Metrika report to a CSV or JSON file in the background and returns a job. Requires idempotency_key; the same key returns the same job. To continue an interrupted export pass only connection_id and resume_job_id. Poll metrika_get_job until completed, then read with metrika_read_artifact or give the user file_path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | Field IDs; prefix with '-' for descending. Default: first metric descending. | |
| format | No | csv (default), csv_excel_safe (BOM + formula guard for Excel) or json (exact values). | |
| period | No | Either {preset} or {start, end}. Dates are in the counter time zone. Default: last_7_complete_days. | |
| preset | No | Ready-made report. Mutually exclusive with metrics/dimensions. | |
| filters | No | Conditions combined with AND. | |
| metrics | No | Metric IDs (e.g. ym:s:visits, ym:s:goal<ID>visits) when no preset is used. | |
| accuracy | No | strict (default): fail instead of returning sampled data. balanced: accept sampling with a warning. | |
| goal_ids | No | Goal IDs (not names) from metrika_describe_counter; adds goal columns to a preset. | |
| counter_id | No | Counter ID as a string, from metrika_list_counters. | |
| dimensions | No | Dimension IDs. | |
| connection_id | Yes | Connection ID from metrika_status (e.g. conn_demo). | |
| resume_job_id | No | Continue an interrupted export. Pass only connection_id and resume_job_id. | |
| idempotency_key | No | Required for a new export. Repeating the same key returns the same job. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | ||
| error | Yes | ||
| query | Yes | ||
| stage | Yes | ||
| state | Yes | ||
| format | Yes | ||
| job_id | Yes | ||
| progress | Yes | ||
| warnings | Yes | ||
| artifacts | Yes | ||
| created_at | Yes | ||
| updated_at | Yes | ||
| finished_at | Yes | ||
| next_action | Yes | ||
| connection_id | Yes | ||
| schema_version | Yes |