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 are rotated on use. When you exchange a refresh token, the old tokens are revoked and new ones are issued. Always store the new refresh token from the response.