Authorization
Every API request requires authorization. You have to pass the OAuth token generated for your Yandex account in the Authorization HTTP header for each method.
GET api/v1 HTTP/1.1
Host: adfox.yandex.ru
Authorization: OAuth 05dd3dd84ff948fdae2bc4fb91f13e22bb1f289ceef0037
If an API method is called without a token or an invalid token is passed in the request, the server returns HTTP status 401 Unauthorized.
Getting a token
To get a token:
-
Go to the Create app page.
-
Fill in the fields:
-
Your service's name.
-
Service icon — optional.
-
Platforms — add one or more app platforms.
-
Redirect URL — specify
https://oauth.yandex.ru/verification_code. -
Data access — specify
adfox:api. -
Email address — optional.
-
-
Click Create app and copy its ClientID
. -
Append the copied ClientID to a URL structured like this: https://oauth.yandex.com/authorize?response_type=token&client_id=
. -
Click the link and copy the OAuth token from the page that opens.