Skip to main content
POST
/
authentication
/
refresh-token
curl -X POST https://api.sapfiai.com/authentication/refresh-token \
  -H "Content-Type: application/json" \
  -d '{
    "refreshToken": "8f7d6e5c4b3a2918e7f6d5c4b3a29180"
  }'
{
  "success": false,
  "token": null,
  "refreshToken": null,
  "user": null,
  "message": "Token refresh failed",
  "errors": [
    "Invalid or expired refresh token"
  ],
  "requires2FA": false
}
Obtain a new access token using a refresh token.

Authentication

This endpoint does not require authentication. Use the refresh token to obtain a new access token.

Request Body

refreshToken
string
required
The refresh token received during login or previous token refresh.

Response

success
boolean
Indicates whether the token refresh was successful.
token
string
New JWT access token for authenticating subsequent requests.
refreshToken
string
New refresh token for future token refreshes.
refreshTokenExpiry
string
Expiration date and time of the new refresh token (ISO 8601 format).
user
object
User information object.
message
string
A message describing the result of the operation.
errors
string[]
Array of error messages if token refresh failed.
requires2FA
boolean
Always false for token refresh operations.

Error Responses

{
  "success": false,
  "token": null,
  "refreshToken": null,
  "user": null,
  "message": "Token refresh failed",
  "errors": [
    "Invalid or expired refresh token"
  ],
  "requires2FA": false
}
curl -X POST https://api.sapfiai.com/authentication/refresh-token \
  -H "Content-Type: application/json" \
  -d '{
    "refreshToken": "8f7d6e5c4b3a2918e7f6d5c4b3a29180"
  }'
{
  "success": true,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "9a8e7f6d5c4b3a2918e7f6d5c4b3a29181",
  "refreshTokenExpiry": "2026-04-05T10:30:00Z",
  "user": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "email": "[email protected]",
    "userName": "johndoe",
    "phoneNumber": "+1234567890",
    "twoFactorEnabled": false,
    "lastLoginDate": "2026-03-05T10:30:00Z",
    "lastLoginIp": "192.168.1.1"
  },
  "message": "Token refreshed successfully",
  "errors": null,
  "requires2FA": false
}

Build docs developers (and LLMs) love