Token lifetime
How long codes, access tokens, refresh tokens and keys live, and how refresh rotation works.
| Credential | Lifetime | Notes |
|---|---|---|
| Consent screen | 10 minutes | Start again from the authorize URL afterwards. |
Authorization code hcode_… | 60 seconds | Single use. A second use revokes the grant's tokens. |
| Access token | 60 minutes | Works like an API key (hv_live_…). |
Refresh token hr_… | 30 days | Rotates on every use. |
| API key | Until revoked, or 30 / 90 / 180 / 365 days | Rotation with a grace period. |
Refresh
Shell
curl -X POST https://hevia.app/api/oauth/token \
-d grant_type=refresh_token \
-d refresh_token=hr_... \
-d client_id=hc_...Every refresh returns a new refresh token and ends the previous access token. If a refresh token that was already used comes back, Hevia assumes it leaked and ends the whole grant.
Warning
Store the new refresh token before you use the new access token. If you lose it, the person has to connect again.
Revoke and introspect
POST /api/oauth/revoke:token,client_id(andclient_secretfor confidential clients). A refresh token ends the grant, an access token only itself.POST /api/oauth/introspect: returnsactive,scope,client_id,exp,hevia_business. You only see your own tokens.- The business can end any app at any time under API > Apps; its token stops at once.