> For the complete documentation index, see [llms.txt](https://sravni-labs-ru.gitbook.io/sravni-labs.ru-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sravni-labs-ru.gitbook.io/sravni-labs.ru-docs/kredity-dlya-biznesa-s-podpisaniem-dokumentov-na-storone-partnyora/tekhnicheskaya-dokumentaciya/authorization/poluchit-access-token.md).

# Получить access-токен

Выдаёт Bearer-токен по OAuth 2.0 `client_credentials`. Тело запроса кодируется как `application/x-www-form-urlencoded`.

```json
{"openapi":"3.1.0","info":{"title":"API интеграции с партнёрами","version":"2.0.0"},"tags":[{"name":"Authorization","description":"Получение access-токена"}],"servers":[{"url":"https://auth.example.ru","description":"Сервер авторизации"}],"paths":{"/oauth2/token":{"post":{"tags":["Authorization"],"operationId":"issueAccessToken","summary":"Получить access-токен","description":"Выдаёт Bearer-токен по OAuth 2.0 `client_credentials`. Тело запроса кодируется как `application/x-www-form-urlencoded`.","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/TokenRequest"}}}},"responses":{"200":{"description":"Токен успешно выдан","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"Некорректный `grant_type`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"401":{"description":"Неверные `client_id` или `client_secret`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}}}}},"components":{"schemas":{"TokenRequest":{"type":"object","additionalProperties":false,"required":["grant_type","client_id","client_secret"],"properties":{"grant_type":{"type":"string","const":"client_credentials","description":"Для этого API поддерживается только `client_credentials`"},"client_id":{"type":"string"},"client_secret":{"type":"string"}}},"TokenResponse":{"type":"object","required":["access_token","token_type","expires_in","scope"],"properties":{"access_token":{"type":"string","minLength":1},"token_type":{"type":"string","const":"Bearer"},"expires_in":{"type":"integer","minimum":1,"description":"Срок действия токена в секундах"},"scope":{"type":"string","description":"Фактически выданные scope"}}},"OAuthError":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["invalid_request","invalid_client","invalid_grant","unauthorized_client","unsupported_grant_type","invalid_scope"]},"error_description":{"type":"string"}}},"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","details"],"properties":{"code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Z][A-Z0-9_]*$"},"message":{"type":"string","minLength":1},"details":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}}}}}},"ErrorDetail":{"type":"object","required":["code","message"],"properties":{"path":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}},"responses":{"TooManyRequests":{"description":"Превышен лимит запросов","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"InternalError":{"description":"Внутренняя ошибка сервиса","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}
```
