Получить краткосрочный JWT
POST
/auth/token
const url = 'https://passports.dev.techcon-ml.ru/auth/token';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"api_key":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://passports.dev.techcon-ml.ru/auth/token \ --header 'Content-Type: application/json' \ --data '{ "api_key": "example" }'Передайте статический API-ключ (api_key) — получите JWT со сроком жизни 24 часа (настраивается через JWT_EXPIRE_HOURS). Заголовок Authorization для этого эндпоинта не нужен.
Request Bodyrequired
Заголовок раздела «Request Bodyrequired»Media typeapplication/json
_TokenRequest
object
api_key
required
Api Key
API-ключ, предоставленный администратором сервиса
string
Examplegenerated
{ "api_key": "example"}Responses
Заголовок раздела «Responses»JWT и срок жизни токена в секундах (expires_in)
Media typeapplication/json
TokenResponse
object
token
required
Token
JWT для заголовка Authorization: Bearer
string
expires_in
required
Expires In
Срок жизни токена в секундах
integer
Example
{ "expires_in": 86400, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}Неверный API-ключ
Media typeapplication/json
ApiErrorResponse
object
ok
Ok
boolean
error
required
ApiErrorDetail
object
code
required
Code
Машиночитаемый код ошибки (UPPER_SNAKE_CASE)
string
message
required
Message
Человекочитаемое описание ошибки
string
Example
{ "ok": false}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}