Access control
Create OAuth token
Exchange an authorization code for an access token, or refresh one.
/oauth/tokenCreate OAuth token exchanges an authorization code for an access token, or refreshes an access token. Start sign-in with Authorize OAuth.
Send this request to https://api.cloud.blnkfinance.com on Blnk Cloud. On a self-hosted Enterprise deployment, send it to ENTERPRISE_PUBLIC_URL.
Send the client id and client secret as HTTP Basic, or in the body as client_id and client_secret. The body is form fields or JSON.
The access token lasts 1 hour. Send it as X-blnk-key on Enterprise API requests.
A refresh returns a new access token and a new refresh token, and the previous refresh token stops working. The refresh token lasts 30 days.
Header
Authorizationstring
HTTP Basic credentials, Basic base64(client_id:client_secret). Omit this when client_id and client_secret are in the body.
Body
grant_typestring
authorization_code or refresh_token.
codestring
Authorization code from Authorize OAuth. Required when grant_type is authorization_code. The code lasts 10 minutes and works once.
redirect_uristring
The same redirect_uri used to authorize. Required when grant_type is authorization_code.
refresh_tokenstring
Refresh token from an earlier response (blnk_rt_...). Required when grant_type is refresh_token.
client_idstring
Client id. Required when you do not send the Authorization header.
client_secretstring
Client secret. Required when you do not send the Authorization header.
code_verifierstring
PKCE verifier. Required when the authorization request included code_challenge.
Response
A 200 response returns the tokens. Save access_token and refresh_token. Invalid client credentials return 401 with invalid_client.
access_tokenstring
Access token (blnk_at_...). Send it as X-blnk-key.
token_typestring
Bearer.
expires_ininteger
Seconds until the access token expires. 3600.
refresh_tokenstring
Refresh token (blnk_rt_...). Each refresh replaces this value.
scopestring
Space-separated scopes on the token.