POST /api/auth/refresh
Issues a new access token using a valid refresh token. Use this endpoint when the access token has expired to continue making authenticated requests without requiring the user to log in again.
Authentication
This endpoint requires a refresh token in theAuthorization header — not an access token.
POST /api/auth/login and stored in the database. A refresh token is valid until it expires or is explicitly revoked via POST /api/auth/logout.
Request body
No request body is required.Response
200 OK
Returns a new access token.true on success.Confirmation message.
Error responses
| Status | Description |
|---|---|
401 | Refresh token is missing, invalid, expired, or has been revoked |
Token rotation strategy
Access tokens are short-lived by design. When a request returns401 Unauthorized, follow this flow:
- Call
POST /api/auth/refreshwith the stored refresh token. - If the refresh succeeds, store the new access token and retry the original request.
- If the refresh returns
401, the refresh token is invalid or expired. Redirect the user to log in again.
- It is explicitly revoked via
POST /api/auth/logout. - The user changes their password (all refresh tokens are revoked).
- The token’s expiry time passes.