Skip to content

Search stays in your browser.

Open app

Exchange OAuth authorization code, device code, or refresh token.

POST /oauth/token

Exchange OAuth authorization code, device code, or refresh token.

This operation does not declare a credential requirement in the released API contract.

Provider access, workspace membership, and agent grants are enforced separately. A token does not expand access to a repository or resource. Set up developer access.

Required. Supported content types: application/json, application/x-www-form-urlencoded.

Field Type Required Description
grant_type "authorization_code" · "refresh_token" · "urn:ietf:params:oauth:grant-type:device_code" Yes
code string No
redirect_uri string No Format: uri.
client_id string No
code_verifier string No
refresh_token string No
device_code string No
resource string No

Replace path placeholders and your credential. For body operations, create request.json using the required fields above; this command does not invent resource identifiers or consent.

Terminal window
curl --request POST \
'https://commentary.dev/oauth/token' \
--header 'Content-Type: application/json' \
--data-binary @request.json
Status Meaning Payload
200 Successful response. OAuthToken
400 OAuth request error. OAuthError
401 OAuth token exchange was rejected. OAuthError
429 The request was rate limited. OAuthError
Field Type Required Description
access_token string Yes
refresh_token string Yes
token_type "Bearer" Yes
expires_in integer Yes
scope string Yes Space-delimited scopes actually granted to this token. Registered OAuth clients may receive a subset of requested scopes.

Use the returned status and error body. Correct invalid fields before retrying; reconnect or narrow the target for authentication and permission errors. For conditional writes, reload the latest version before preparing a new request. Respect rate-limit headers and retry only when the operation’s idempotency contract permits it.

Operation ID: exchangeOAuthToken. Download the OpenAPI contract for complete constraints and code generation. Browse endpoints.