In order to use the Yandex.Metrica API, you need to get an access token from the Yandex.OAuth service. You must pass the token for each method in the HTTP Authorization header.

GET /management/v1/counters HTTP/1.1
Authorization: OAuth 05dd3dd84ff948fdae2bc4fb91f13e22bb1f289ceef0037
Content-Type: application/x-yametrika+json
Content-Length: 123

If an API method is called without a token, or the request includes an invalid token, the server returns the HTTP status 401 Unauthorized.

Getting an OAuth token

To get an access token, register your application. During registration, choose the access rights.

For more information about authentication and authorization, read the document OAuth authorization. Developer's guide. This document also provides recommendations for client application developers.

How to get a token for application development and debugging is described in the section Debugging token.