Skip to navigation

Refresh an access token

View as Markdown

Refreshes an existing access token, extending its validity period. This endpoint should be called before the current token expires to maintain uninterrupted access.

The client should use the expires_in value from the login or previous refresh response to determine when to refresh the token. A common practice is to refresh when the token is at 50% of its lifetime.

Authentication: This endpoint requires a valid bearer token in the Authorization header.

Usage Example:

curl -X POST https://your-ocient-instance/v1/token_refresh \
-H "Authorization: Bearer YOUR_CURRENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"database": "retail_analytics"}'

Authentication

AuthorizationBearer
Access token obtained from the login endpoint

Request

This endpoint expects an object.
databasestringOptional

Target database name (defaults to system if not specified)

Response

Successfully refreshed token
access_tokenstring
New access token for subsequent API calls. This token should replace the old token in the Authorization header for future requests.
statusobjectRead-only
Status information about the refresh operation. A successful refresh will have a SQL state of "00000".
usernamestringOptional
The authenticated user's username.
databasestringOptional
The database that was authenticated against.
expires_inintegerOptional
Number of seconds until the new access token expires.

Errors

401
Unauthorized Error
404
Not Found Error
500
Internal Server Error