Create permission

Attention.

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.

Creates permission for managing counter and viewing statistics.

  1. Request syntax
  2. Request message body
  3. Response format

Request syntax

counterId — counter ID. for which you want to create permission.

https://api-metrica.yandex.net/management/v1/counter/{counterId}/grants

Request message body


{
    "grant" : {
        "user_login" :  < string > ,
        "perm" :  < grant_type > ,
        "comment" :  < string > 
    }
}
ParametersDescription
grantPermission to manage counter and view statistics.
grant
user_login

Login of user, which has been granted permission to manage counter.

Parameter contains empty string, if public access is provided to the statistics of the counter (perm = public_stat)

permAccess level.

Possible values:

  • view — page views only;
  • edit — full access.
  • public_stat — public access to statistics;
comment

Any comment. 255 characters maximum.

Request example

POST https://api-metrica.yandex.net/management/v1/counter/{counterId}/grants?

Response format


{
    "grant" : {
        "user_login" :  < string > ,
        "perm" :  < grant_type > ,
        "created_at" :  < date > ,
        "comment" :  < string > 
    }
}
ParametersDescription
grantPermission to manage counter and view statistics.
grant
user_login

Login of user, which has been granted permission to manage counter.

Parameter contains empty string, if public access is provided to the statistics of the counter (perm = public_stat)

permAccess level.

Possible values:

  • view — page views only;
  • edit — full access.
  • public_stat — public access to statistics;
created_at

Date of granting access in the format YYYY-MM-DD'T'hh:mm:ssZ.

comment

Any comment. 255 characters maximum.