POST /api/v1/auth/refresh

Generate a new access token using a valid refresh token. This endpoint should be used when the access token expires to maintain user session without requiring re-login.

application/json

Body Required

Refresh token for generating new access token

  • refresh_key string Required

Responses

  • 200 application/json

    New access token generated successfully

    Hide response attributes Show response attributes object
    • message string Required
    • access_token string Required
  • 400 application/json

    Invalid or missing refresh token

  • 401 application/json

    Invalid or expired refresh token

POST /api/v1/auth/refresh
curl \
 --request POST 'http://localhost:3500/api/v1/auth/refresh' \
 --header "Content-Type: application/json" \
 --data '{"refresh_key":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}'
Request example
Valid refresh token to generate new access token
{
  "refresh_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Response examples (200)
{
  "message": "Token refreshed successfully",
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Response examples (400)
{
  "error": "Bad Request",
  "message": [
    "refresh_key should not be empty"
  ],
  "statusCode": 400
}
Response examples (401)
{
  "error": "Unauthorized",
  "message": "Invalid refresh token",
  "statusCode": 401
}