Authorization
Note
If a user account already has an active Adfox API token for managing objects, there's no need to obtain another one to access statistics. They can use a single OAuth token for all API sections.
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.
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.
Authorization: OAuth <token>
Example
curl -H 'Authorization: OAuth 05dd3dd84ff948fdae2bc4fb91f13e22bb1f289ceef0037' \
https://adfox.yandex.ru/api/v2/reports/metadata
Handling requests by user type
For admins and assistants, the ownerId parameter is optional.
If you're making requests from an advertiser or website owner account, be sure to include the ownerId parameter in every request. Use this parameter to specify the ID of the admin account for which the report is being generated.
|
Endpoint |
User type |
Required status of ownerId |
|
|
Admin / assistant |
Not required. If you're passing this parameter, it must match your |
|
|
Advertiser / website owner |
Required. |
|
|
Any |
You can't use |
In GET requests, pass ownerId as a query parameter:
?ownerId=12345
For POST requests, include ownerId in the request body as a positive integer.