---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.1
alternate:
  - https://yandex.com/dev/adfox/doc/en/v.1/authorization.md
  - https://yandex.com/dev/adfox/doc/ru/v.1/authorization.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/adfox/doc/en/llms.txt

# Authorization

Every API request requires authorization. You have to pass the [OAuth token](#token) generated for your Yandex account in the `Authorization` HTTP header for each method.
 
```xml
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 {#token}

To get a token:

1. Go to the [Create app](https://oauth.yandex.com/client/new) page.

2. 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.
    
3. Click **Create app** and copy its ClientID ![](_images/copy-app.png).

4. Append the copied ClientID to a URL structured like this: [https://oauth.yandex.com/authorize?response_type=token&client_id=<app ID>](https://oauth.yandex.com/authorize?response_type=token&client_id=).

5. Click the link and copy the OAuth token from the page that opens.
