Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Exchange Token

Exchange an authorization code or refresh token for access tokens.
No authentication required. This is a public endpoint (client authenticates via client_id/client_secret).
Request example
curl -X POST https://api.v2.dealmachine.com/v1/oauth/token \ -H "Content-Type: application/json" \ -d '{ "grant_type": "authorization_code", "client_id": "dm_cid_abc123", "client_secret": "dm_cs_xxx", "code": "dm_ac_xxx", "redirect_uri": "http://localhost:3000/callback" }'
Response example
{ "access_token": "dm_at_live_xxx", "refresh_token": "dm_rt_xxx", "token_type": "Bearer", "expires_in": 3600, "scope": "account:read" }

Grant Types

authorization_code

Exchange an authorization code (from the /oauth/authorize flow) for tokens.
FieldTypeRequiredDescription
grant_typestringYesauthorization_code
client_idstringYesYour application's client ID
client_secretstringYes*Your application's client secret
codestringYesThe authorization code
redirect_uristringYesMust match the original authorize request
code_verifierstringNo**PKCE code verifier
* Not required for public clients using PKCE. ** Required if code_challenge was used in the authorize request.

refresh_token

Exchange a refresh token for a new token pair.
FieldTypeRequiredDescription
grant_typestringYesrefresh_token
client_idstringYesYour application's client ID
client_secretstringYes*Your application's client secret
refresh_tokenstringYesThe refresh token

Token Lifetimes

TokenLifetime
Access Token1 hour
Refresh Token30 days
Refresh tokens normally rotate on use: the old access and refresh tokens are revoked and replaced. Google Connected Apps clients registered exclusively with the supported Google HTTPS redirect addresses receive a new access token and the same refresh token, with its expiration extended by 30 days. Revocation still ends access. Always store the refresh token returned in the response.

Clients using authorization-server discovery

Use the token_endpoint from the server metadata for that authorization flow. The app-hosted /api/oauth/token endpoint has specific retry and error handling guidance, including 503 temporarily_unavailable and Retry-After: 2. Keep the saved refresh token when that endpoint reports a temporary failure.