Skip to main content
POST
Exchange Code for Tokens

Overview

Exchange an authorization code or refresh token for access tokens. Supports two grant types:
  1. Authorization Code (grant_type=authorization_code) - Step 4 of OAuth flow
  2. Refresh Token (grant_type=refresh_token) - Renew expired access tokens

Request

Body Parameters

string
required
Type of token exchangeValues: authorization_code | refresh_token
string
Authorization code from Step 3Required for: authorization_code grant
string
Must exactly match URI from Step 1Required for: authorization_code grant
string
Original PKCE verifier from Step 1 (43-128 chars)Required for: authorization_code grantPattern: [A-Za-z0-9-._~]{43,128}
string
Refresh token from previous exchangeRequired for: refresh_token grant

Response

string
Bearer token for API authentication (6 hours expiry)Example: access_token_100a99cf-f4d3-4fa1-9be9-2e9828b20ebc
number
Access token lifetime in seconds (21600 = 6 hours)
string
Token for obtaining new access tokens (184 days expiry)Example: refresh_token_100a99cf-f4d3-4fa1-9be9-2e9828b20ebd
number
Refresh token lifetime in seconds (15897600 = 184 days)

Code Examples

Implement automatic token refresh 5 minutes before expiry to ensure uninterrupted API access.