> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aigenda.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Обновить токен

> Выдаёт новый access по refresh. Новый refresh не выдаётся.

## Тело запроса

<ParamField body="refresh" type="string" required>
  Токен `refresh` из ответа на вход. Действует 1 сутки.
</ParamField>

## Ответ

<ResponseField name="access" type="string">
  Новый токен доступа.
</ResponseField>

Через сутки после входа `refresh` истекает. Тогда получите новую пару через [Получить токен](/api-reference/auth/token).

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.aigenda.tech/api/token/refresh/" \
    -H "Content-Type: application/json" \
    -d '{
      "refresh": "eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCJ9.sig"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.aigenda.tech/api/token/refresh/",
      json={
          "refresh": "eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCJ9.sig",
      },
      timeout=30,
  )
  response.raise_for_status()
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.aigenda.tech/api/token/refresh/", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      "refresh": "eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCJ9.sig"
    }),
  });
  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "access": "eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIn0.sig"
  }
  ```

  ```json 401 theme={null}
  {
    "detail": "Token is invalid or expired",
    "code": "token_not_valid"
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.