API Reference
New Access Token
Overview
Use this endpoint to obtain a new Access Token when the current one has expired, without requiring the client to sign in again.
Send a valid Refresh Token from Register Client or Login Client. RealtimeX validates it and returns a fresh Access Token so your application can continue calling protected APIs seamlessly.
When to use this endpoint?
Call New Access Token when:
- A protected API returns 401 Unauthorized because the Access Token expired.
- Is Logged In fails and you still have a stored Refresh Token.
- Your application wants to renew the session silently in the background.
- You want to avoid forcing the client through a full login flow.
If the Refresh Token is also invalid or expired, redirect the client to Auth → Login Client.
{baseUrl}/api/{apiVersion}/auth/jwt/client/refresh-tokenAuthentication
Not required
Tenant-scoped
No (root DB)
Request Headers
| Header | Value | Description |
|---|---|---|
| Content-Type | application/json | Specifies the content type of the request body. |
| is-tenant | false | Targets the root DB for client authentication endpoints. |
Request Payload
{
"refreshToken": "<refresh_token>"
}| Field | Type | Required | Description |
|---|---|---|---|
| refreshToken | string | The Refresh Token returned from Register Client or Login Client. |
Success Response (HTTP 200 OK)
When the Refresh Token is valid, the API returns a new Access Token that you should use for subsequent authenticated requests.
{
"success": true,
"message": "New access token",
"data": {
"accessToken": "<new_access_token>"
},
"error": null
}After a Successful Refresh
Update your session immediately
Discard the expired Access Token and continue with the new one.
New Access Token
RequiredReplace the previous token and send it in the Authorization header.
Refresh Token
Keep secureContinue storing the existing Refresh Token unless your app issues a new one.
Example authenticated request
GET /api/v1/user/list HTTP/1.1
Authorization: Bearer <new_access_token>
is-tenant: true
x-client-id: <client_id>Workflow
Use this flow to recover from an expired Access Token without sending the client back to the login screen.
- 1
Detect an Expired Access Token
When a protected API returns 401 Unauthorized, or Is Logged In fails, treat the Access Token as expired or invalid.
- 2
Send the Refresh Token
Call New Access Token with the stored Refresh Token in the request body. Do not send the expired Access Token.
json{ "refreshToken": "<refresh_token>" } - 3
Receive a New Access Token
On success, the API returns a fresh Access Token. Replace the previous Access Token in your secure storage.
- 4
Retry the Original Request
Continue with protected endpoints using the new Access Token in the Authorization header.
httpAuthorization: Bearer <new_access_token> - 5
Fall Back to Login if Needed
If the Refresh Token is invalid or expired, redirect the client to Login Client to start a new session.
Common Errors
If the Refresh Token is missing, invalid, or expired, token renewal fails.
HTTP 401 Unauthorized
{
"success": false,
"message": "Invalid or expired refresh token",
"data": null,
"error": "Unauthorized"
}| Code | Reason |
|---|---|
| 400 Bad Request | The request body is missing refreshToken or contains invalid data. |
| 401 Unauthorized | Refresh Token is missing, invalid, or expired. |
| 500 Internal Server Error | An unexpected error occurred while issuing a new Access Token. |
You’re ready to continue
After refreshing successfully, retry the original request or continue calling protected APIs with the new Access Token. If refresh fails, send the client to Auth → Login Client.
Best Practices
- Refresh automatically when you receive 401 Unauthorized from a protected endpoint.
- Store the Refresh Token securely and never expose it in client-side source code or logs.
- Replace the Access Token immediately after a successful refresh — do not keep using the expired token.
- Avoid refreshing on every request. Refresh only when the Access Token is expired or rejected.
- Always send refresh requests over HTTPS to protect credentials in transit.
- If refresh fails, clear the local session and redirect to login.