Request Metrica raw logs
logs_requestQueue a Yandex Metrica Logs API export for raw visits or hits data within a date range. Returns a request ID to poll for download of un-sampled rows.
Instructions
Create a Yandex Metrica Logs API request for RAW, un-sampled rows (source="visits" sessions or "hits" events) over a date range. Checks feasibility, then queues preparation (takes minutes). Returns a request_id to poll with logs_status; then logs_download, then logs_clean. Discover field ids with get_metadata. Not read-only: preparing data consumes the counter storage quota.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date1 | Yes | Start date as a concrete YYYY-MM-DD (relative dates are not supported for logs). date2 must be earlier than today — the current day's data is not ready. | |
| date2 | Yes | End date as a concrete YYYY-MM-DD (relative dates are not supported for logs). date2 must be earlier than today — the current day's data is not ready. | |
| fields | Yes | Log field ids to export, e.g. ["ym:s:visitID","ym:s:dateTime","ym:s:startURL"]. All must share the source's prefix (ym:s: for visits, ym:pv: for hits). Discover valid ids with get_metadata (logs_fields). | |
| source | Yes | Raw data source. "visits" = sessions (ym:s: fields); "hits" = page views/events (ym:pv: fields). Fields must match the source. | |
| counterId | No | Yandex Metrica counter id. Optional if YANDEX_METRIKA_COUNTER_ID is configured. | |
| attribution | No | Attribution model for attribution-dependent fields: FIRST | LAST | LASTSIGN | CROSS_DEVICE_LAST_SIGNIFICANT | AUTOMATIC | ... Default LASTSIGN. | |
| waitSeconds | No | Optionally poll up to this many seconds for preparation to finish before returning (handy for small exports). Default 0 = return immediately; poll with logs_status afterwards. |