> 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/rko/rasschyotno-kassovoe-obsluzhivanie.-openapi-dlya-vashego-biznesa/avtorizaciya.md).

# Авторизация

Метод для получения токена авторизации (JWT Bearer).

Каждый запрос к API должен содержать заголовок `Authorization`, в который передается Bearer-токен. Для получения токена необходимо отправить этот запрос.

> Для того, чтобы получить авторизационные данные, необходимо написать  писмо на почту *`nikita.kulinenko@sravni.ru / artyem.kharaput@sravni.ru`* с темой "Авторизационные данные для API РКО". В теле письма указать IP-адреса, с которых будут отправляться запросы. В ответом письме Вам будут отправлены авторизационные данные (client\_id и client\_secret), которые необходимо будет указать в запросе на получение токена.

**Базовый URL dev:** <https://labs-id.sravni.tech/>\
**Базовый URL prod:** <https://my.sravni-labs.ru/>

## POST /connect/token

> Получение токена доступа

```json
{"openapi":"3.0.1","info":{"title":"Sravni.ApiGateway.Service 1.0","version":"1.0"},"paths":{"/connect/token":{"post":{"tags":["Identity"],"summary":"Получение токена доступа","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"required":["client_id","client_secret","grant_type","password","username"],"type":"object","properties":{"grant_type":{"type":"string","description":"Необходимо указать значение \"password\""},"username":{"type":"string","description":"Ваш имя пользователя"},"password":{"type":"string","description":"Ваш пароль"},"client_id":{"type":"string"},"client_secret":{"type":"string"}}},"encoding":{"grant_type":{"style":"form"},"username":{"style":"form"},"password":{"style":"form"},"client_id":{"style":"form"},"client_secret":{"style":"form"}}}}},"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/Sravni.ApiGateway.Service.Identity.TokenResponseDto"}},"application/json":{"schema":{"$ref":"#/components/schemas/Sravni.ApiGateway.Service.Identity.TokenResponseDto"}},"text/json":{"schema":{"$ref":"#/components/schemas/Sravni.ApiGateway.Service.Identity.TokenResponseDto"}}}},"400":{"description":"Bad Request","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/Sravni.Micro.Errors.ErrorModel"}},"application/json":{"schema":{"$ref":"#/components/schemas/Sravni.Micro.Errors.ErrorModel"}},"text/json":{"schema":{"$ref":"#/components/schemas/Sravni.Micro.Errors.ErrorModel"}}}},"500":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/Sravni.Micro.Errors.ErrorModel"}},"application/json":{"schema":{"$ref":"#/components/schemas/Sravni.Micro.Errors.ErrorModel"}},"text/json":{"schema":{"$ref":"#/components/schemas/Sravni.Micro.Errors.ErrorModel"}}}}}}}},"components":{"schemas":{"Sravni.ApiGateway.Service.Identity.TokenResponseDto":{"required":["access_token","expires_in","token_type"],"type":"object","properties":{"access_token":{"minLength":1,"type":"string","description":"Токен доступа"},"expires_in":{"type":"integer","description":"Время жизни токена в секундах","format":"int32"},"token_type":{"minLength":1,"type":"string","description":"Тип токена"}},"additionalProperties":false},"Sravni.Micro.Errors.ErrorModel":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/Sravni.Micro.Errors.Error"}},"additionalProperties":false},"Sravni.Micro.Errors.Error":{"type":"object","properties":{"code":{"type":"string","nullable":true},"target":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"attemptedValue":{"type":"string","nullable":true},"details":{"type":"array","items":{"$ref":"#/components/schemas/Sravni.Micro.Errors.Error"},"nullable":true}},"additionalProperties":false}}}}
```
