> For the complete documentation index, see [llms.txt](https://docs.tnid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tnid.com/authentication/refresh-token.md).

# Refresh Token

Exchange a refresh token at /auth/refresh-token for a new access token (7 days) and refresh token (30 days).

Access tokens have a limited lifetime. To keep calling the API without asking the user (or re-sending client credentials), exchange the refresh token for a new pair.

* Make a `POST` request to `/auth/refresh-token` with the `refresh_token` you received from `/auth/token`.
* The response contains a new `access_token` (7 days validity) and a new `refresh_token` (30 days validity).
* An access token can be used to access restricted resources. A refresh token can only be used to refresh tokens.
* The same endpoint works for user tokens and company tokens.

Request:

```json
{
   "refresh_token": "eyJ..."
}
```

Response:

```json
{
   "access_token": "eyJ...",
   "refresh_token": "eyJ..."
}
```

```bash
curl -X POST https://api.staging.v2.tnid.com/auth/refresh-token \
  -H "Content-Type: application/json" \
  -d '{"refresh_token":"<refresh_token>"}'
```
