Skip to main content
Issues a token pair. Two grant types are supported: authorization_code and refresh_token.
This endpoint requires an API key, so it should only ever be called from your backend and never from a browser or mobile client.
Credentials can also be passed as client_id and client_secret body fields if Basic auth is awkward in your HTTP client, where client_secret is your API key.

Exchange an Authorization Code

Refresh a Token Pair

cURL

Response

The response is identical for both grants.
Responses are sent with cache-control: no-store and pragma: no-cache.
The pair returned here is bound to the API key you authenticated with. Refreshing on a different key rebinds it, and revoking a key invalidates every token that key issued. See Rotating a Key.
Refresh tokens rotate on every use, so both new values need to be persisted atomically. If you store the access token but drop the refresh token, the connection cannot be recovered and the user will have to reconnect.

Errors

Errors may include an error_description field with more detail.
Two invalid_grant cases are destructive rather than simply failed. Replaying an authorization code revokes every token that code issued, and replaying a rotated-out refresh token revokes the user’s entire grant. Both are treated as evidence of theft.