POST /api/auth/refresh-token
Exchanges a valid refresh token for a new pair of access and refresh tokens. The old refresh token is invalidated after successful renewal.Request body
Valid refresh token obtained from login or previous refresh
Response
Indicates if the token refresh was successful
Human-readable response message
New authentication tokens
Status codes
200- Tokens refreshed successfully400- Refresh token not provided401- Invalid, expired, or revoked refresh token500- Internal server error
The old refresh token is automatically deleted and can no longer be used. Always store and use the new refresh token from the response.
Examples
Success response (200)
Error response (400)
Error response (401) - Invalid token
Error response (401) - Expired or not found
Token rotation process
This endpoint implements refresh token rotation for enhanced security:- Validates the provided refresh token (signature and expiration)
- Verifies the token exists in the database and hasn’t expired
- Deletes the old refresh token from the database
- Generates a new access token and refresh token pair
- Stores the new refresh token in the database with a 7-day expiration
- Returns both new tokens to the client