# {"detail":"Given token not valid for any token type","code":"token_not_valid"}

**Code:** `Given token not valid` · **Category:** Authentication · **Seen on:** Python, Django

Simple JWT could not accept the token — it is expired, signed with a different key or of the wrong type.

## Meaning

The response's `messages` array says why. The commonest cause is an expired access token; others are a refresh token sent where an access token is expected or a different `SIGNING_KEY` between instances.

## Common causes

- Access token expired (default 5 minutes)
- Refresh token used as an access token
- `SECRET_KEY` changed or differs between servers
- Token blacklisted after logout

## Quick fix

1. Refresh the access token with the refresh endpoint
2. Send the access token in the header
3. Keep the same SIGNING_KEY on every instance

## Detailed fix by platform

### Simple JWT

1. `POST /api/token/refresh/` with `{"refresh": "<token>"}`; adjust `ACCESS_TOKEN_LIFETIME` if needed

## How to diagnose

1. **Reason** — What does `messages[0]` say?
2. **Type** — Access or refresh token?
3. **Key** — Same signing key everywhere?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/auth/drf-given-token-not-valid)
