Access tokens will not be accepted in URL parameters starting February 13, 2019. To continue working with the Yandex.Metrica API, set up authorization by passing the token in the HTTP header.
The outdated authorization method will be temporarily disabled on January 23, January 30, and February 6 for maintenance. Authorization using URL parameters will be unavailable on these dates.
The API for the Yandex.Metrica service allows you to:
- Manage counters, their settings, and access rights, without using the web interface.
- Get information about site traffic and other data.
- Generate reports, including segmented and parameterized reports.
To access the Yandex.Metrica API, you must get authorization using an OAuth access token.
Structure of the API
The API has the following parts:
- Management API — For managing counters, goals, filters, and other Yandex.Metrica objects (creating a counter, editing its parameters, creating a goal, granting access rights, and so on).
- Reports API:
- The Reports API supports all Yandex.Metrica reporting features: segmentation, the complete set of dimensions and metrics, segment comparison, and so on.
- The API compatible with the Google Analytics Core Reporting API supports all the features of the Google Analytics Core Reporting API (v3), but with a restricted set of dimensions and metrics.
All parts of the Yandex.Metrica API support versioning. Each version has a specific identifier (v1, v2, and so on). When a new version of the API is released, the previous version continues functioning to support backward compatibility.
If you are just getting started with the API, use the latest version. If you are already using previous versions of the API, we recommend gradually migrating to the latest version, since older versions are supported for a limited time.
When making API requests, always specify the version you want to work with.
The Yandex.Metrica API is built on REST principles.
Everything that can be managed via the API is represented by resources: statistics, the list of counters, the counter itself, counter goals and each specific goal, counter access, and so on.
- Read the contents and current status of the resource (GET).
- Modify the contents and status and write it to the resource (PUT).
- Delete the resource (DELETE).
- Perform special actions, such as adding new elements to a list (POST).
Each resource has its own unique URL. All actions are executed by the corresponding HTTP methods at the resource URLs.
For example, to get information about a counter, you send a GET request to the counter URL. And to create a new counter, you send a POST request with the counter body to the URL of the “counter list” resource.