Your account
Refresh an access token
Exchange a refresh token for a new access token and a new refresh token with POST /v1/auth/refresh-token.
| Method | Path |
|---|---|
POST | /v1/auth/refresh-token |
Authentication · Account routes
Exchanges a refresh token for a new access token and a new refresh token. Call it before the access token expires to keep a session alive.
This is an account-level route. It has no /v1/auth/tenant/ variant. Use the refreshToken that a tenant sign-in or registration returned.
Auth: None. The refresh token in the body is the credential. Scope: The session the refresh token belongs to.
Request
Body
| Name | Type | Required | Description |
|---|---|---|---|
refresh_token | string | Yes | The refresh token of the session. At least 1 character. The request field stays in snake case. |
Behaviour
- The answer uses
accessToken,refreshTokenandexpiresIn. It also includes the deprecatedaccess_token,refresh_tokenandexpires_infields for one release; read only the camelCase fields.refreshTokenmay benull. - Store the new
refreshTokenand use it for the next refresh. - The access token is valid for one hour.
expiresInis in seconds. - A refused refresh token (spent, expired, revoked or not a refresh token) gives
401; sign in again. A token-store failure with no OAuth error stays400. - A session of a patient whose project turned
PATIENT_LOGIN_ENABLEDoff, or of a practitioner whose project turnedPRACTITIONER_LOGIN_ENABLEDoff, gives403withLogin is not enabled for this project.That ends the session: the refresh token is used up, and signing in again is refused while login is off. - A practitioner who is a project admin is not refused, so a signed-in admin can still turn login back on. They cannot sign in again while it is off.
- The route is rate limited to 600 requests per minute for each caller. Over the limit the answer is
429, which can sign a user out, so refresh once per token lifetime and not in a loop.
Example
curl -X POST 'https://api.sandbox.ovok.com/v1/auth/refresh-token' \
-H 'Content-Type: application/json' \
-d '{
"refresh_token": "<refresh token from sign-in>"
}'Successful response
201 — A new token pair.
{
"accessToken": "<new access token>",
"refreshToken": "<new refresh token>",
"expiresIn": 3600,
"access_token": "<deprecated duplicate>",
"refresh_token": "<deprecated duplicate>",
"expires_in": 3600
}| Field | Type | Description |
|---|---|---|
accessToken | string | Bearer access token. Valid for one hour. |
refreshToken | string | null | The refresh token to use next, or null. |
expiresIn | integer | Lifetime of the access token, in seconds. |
access_token | string | Deprecated duplicate; read accessToken. Removed one release after this compatibility period. |
refresh_token | string | null | Deprecated duplicate; read refreshToken. Removed one release after this compatibility period. |
expires_in | integer | Deprecated duplicate; read expiresIn. Removed one release after this compatibility period. |
Errors
| Status | Meaning |
|---|---|
400 | The token store could not process the request and returned no OAuth error, or refresh_token is missing or empty. |
401 | The refresh token is spent, expired, revoked or not a refresh token. The response includes WWW-Authenticate: Bearer; sign in again. |
403 | Login is switched off for the project of a patient or of a non-admin practitioner. The session ends. |
429 | More than 600 requests in a minute from the same caller. |
Last updated on