Skip to main content
POST
/
api
/
v1
/
oauth
/
token
Exchange tokens
curl --request POST \
  --url https://api.example.com/api/v1/oauth/token \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'grant_type=<string>' \
  --data 'client_id=<string>' \
  --data 'client_secret=<string>' \
  --data 'code=<string>' \
  --data 'code_verifier=<string>' \
  --data connected_account_id=cacc_7n42DGM5Tflk9n8mt7Fhc7 \
  --data 'redirect_uri=<string>' \
  --data 'refresh_token=<string>'
{
  "access_token": "<string>",
  "expires_in": 123,
  "token_type": "<string>",
  "refresh_token": "<string>",
  "scope": "<string>"
}

Body

application/x-www-form-urlencoded

Token request (from POST body, application/x-www-form-urlencoded)

grant_type
string
required

Grant type: "authorization_code", "refresh_token", or "connect_account"

client_id
string | null

Client ID (if not using HTTP Basic auth)

client_secret
string | null

Client secret (if not using HTTP Basic auth)

code
string | null

Authorization code (for authorization_code grant)

code_verifier
string | null

PKCE code verifier (for authorization_code grant with PKCE)

connected_account_id
null | string<MeteroidId>

Connected account ID (for connect_account grant)

Example:

"cacc_7n42DGM5Tflk9n8mt7Fhc7"

redirect_uri
string | null

Redirect URI (for authorization_code grant, must match the one used in /authorize)

refresh_token
string | null

Refresh token (for refresh_token grant)

Response

Token response

Token response as per OAuth 2.0 spec

access_token
string
required
expires_in
integer<int64>
required
token_type
string
required
refresh_token
string | null
scope
string | null