Skip to main content

POST /auth/refresh

Use this endpoint to obtain a new access token when the old one expires. You must provide a valid refresh token.
This endpoint implements token rotation for enhanced security. Each time you refresh, you receive a new refresh token and the old one is automatically revoked.

Request Body

refreshToken
string
required
The refresh token that was provided during login or a previous refresh.

Response

success
boolean
Indicates if the refresh was successful.
message
string
Human-readable status message.
tokens
object
An object containing the new authentication tokens.
curl -X POST https://api.llmgenerator.com/api/v1/auth/refresh \
  -H "Content-Type: application/json" \
  -d '{
        "refreshToken": "YOUR_REFRESH_TOKEN"
      }'
{
  "success": true,
  "message": "Token refreshed successfully",
  "tokens": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expiresIn": 900,
    "tokenType": "Bearer"
  }
}