Request flow

There are two stages in the request flow for the AppMetrica Logs API:

Request flow

Request to prepare data

The AppMetrica Logs API accepts the request and puts it in the queue. If the request is processed successfully, AppMetrica prepares a file for download. In this case, the API returns the HTTP 202 Accepted status. If the request resulted in an error, the API returns the appropriate response status, and the HTTP message body contains the error description.

Note

Requests in the queue are processed sequentially (each subsequent request is executed strictly after the previous one is completed).

While the request is being processed and the file is being prepared, all identical requests (with the same parameters) will return the HTTP 202 Accepted status.

Sample request:

GET /logs/v1/export/installations.json HTTP/1.1
Host: api.appmetrica.yandex.com
Authorization: OAuth <your_token>

where <your_token> is an OAuth token that you can obtain by following this guide.

Response example:

HTTP/1.1 202 Accepted
Content-Type: text/plain

Wait for result

To get compressed data, send the HTTP Accept-Encoding: gzip header.

Request to download data

The request to download data is identical to the request to prepare data. If the request to prepare the file is complete, for the next identical request, the Logs API returns the 200 OK status. The results file is ready to be downloaded.

The file is available for download for 24 hours at the URL of the initial request. For a repeat request after 24 hours has passed, the request is put in the queue for processing and preparing a new file.

You can force regenerating the file using the HTTP Cache-Control header:

  • To generate a new file, send the Cache-Control: no-cache header in the request.
  • To download a file that was generated within the last N seconds, send the Cache-Control: max-age=N header in the request. If the file was created more than N seconds ago, AppMetrica generates a new one.
  • To download the last generated file (if one exists), don't send the Cache-Control header in the request.

How to improve data availability

Some data shards may be temporarily unavailable during maintenance. If you need to receive samples at specific times and can tolerate a small margin of error in the data, use the skip_unavailable_shards parameter. By default, it's set to false.

When this parameter is set to true, the Logs API returns data only from available shards. Although these samples will be incomplete, the data loss rate won't exceed 1%.

  1. Check if the Logs API is available.

  2. If your request returns logs_api_availability_status = disabled, include skip_unavailable_shards = true in your request to prepare data.

    If your request returns logs_api_availability_status = enabled, keep the default value: skip_unavailable_shards = false.

Export data using the AppMetrica interface

In the AppMetrica interface, you can export data to a file. To learn more, see Exporting data to a file.

List of active export requests

To get a list of all active data export requests, make the following request:

GET /logs/v1/export/get_active_queries?application_id={application_id} HTTP/1.1
Host: api.appmetrica.yandex.com
Authorization: OAuth <your_token>

where <your_token> is an OAuth token that you can obtain by following this guide, and {application_id} is the app ID.

Sample request:

GET /logs/v1/export/get_active_queries?application_id=123456
Host: api.appmetrica.yandex.com
Authorization: OAuth <your_token>

Response example:

[
  {
    "application_id": 123456,
    "create_time": "2026-06-26 16:00:41",
    "entity": 1,
    "output_format": 0,
    "request_id": "112233445566778899",
    "query": "application_id=123456&date_since=...&date_until=...&date_dimension=default&fields=...",
    "status": 0,
    "total_progress": 0.125275,
    "total_rows_loaded": 0,
    "shards_unavailable": 0
  }
]

Parameter name

Description

Sample value

application_id

App ID.

123456

create_time

Date and time when the request was created.

"2026-03-17 10:11:17"

entity

Event type. Possible values:

  • 0 — Tracking URL clicks
  • 1 — App installs
  • 2 — App events
  • 3 — Postbacks
  • 4 — Errors
  • 5 — Crashes
  • 6 — Push tokens
  • 7 — Session starts
  • 8 — Deprecated, not used
  • 9 — App openings via a deeplink
  • 10 — Revenue events
  • 11 — Notifications
  • 12 — Profiles
  • 13 — Ad Revenue events
  • 14 — Ecommerce events

5

output_format

Output format:

  • 0 — CSV
  • 1 — JSON

1

request_id

Request ID.

112233445566778899

query

Request text.

"application_id=123456&date_since=2026-02-19&date_until=2026-02-19%2023%3A59%3A57&date_dimension=default&use_utf8_bom=true&fields=error_id%2Cerror_json&skip_unavailable_shards=true"

status

Current request status. Possible values:

  • 0 — Created
  • 1 — Processed

0

total_progress

Completion rate. Value from 0 to 1.

0.99

total_rows_loaded

Number of exported data rows.

0

shards_unavailable

Indicator/share of unavailable shards.

0

If there are no active requests, an empty array [] is returned.

Cancel an export request

You can cancel a request to prepare or export data:

POST /logs/v1/export/{request_id}/cancel?application_id={application_id} HTTP/1.1
Host: api.appmetrica.yandex.com
Authorization: OAuth <your_token>

where <your_token> is an OAuth token that you can obtain by following this guide, {request_id} is the ID of the request you want to cancel, and {application_id} is the app ID.

You can find the request ID in the list of active export requests.

Sample request:

POST /logs/v1/export/112233445566778899/cancel?application_id=123456
Host: api.appmetrica.yandex.com
Authorization: OAuth <your_token>

If the cancellation request is successful, it returns the HTTP status 200 OK with the message:

  • Request cancellation has been scheduled:

    {"message": "Request cancellation has been scheduled."}

  • The request has already been completed and cannot be canceled:

    {"message": "The request has already been completed and cannot be canceled."}

If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.

Contact support Suggest an improvement for documentation
Previous
Next