Skip to content
/oauth/token

Token — exchange code + PKCE for a token, or refresh

OAuth 2.1 token endpoint (public client, `token_endpoint_auth_method: none`). `grant_type=authorization_code` exchanges a one-time code + `code_verifier` for `{ access_token (RS256 JWT), token_type: Bearer, expires_in, refresh_token, scope }`. `grant_type=refresh_token` rotates the refresh token (reuse of a rotated token revokes the whole family).

free

Parameters

NameInRequiredDefaultAllowedDescriptionExample
grant_typebodyrequired——`authorization_code` or `refresh_token`.authorization_code
codebodyoptional——Authorization code (authorization_code grant).<one-time code>
code_verifierbodyoptional——PKCE verifier (authorization_code grant).<pkce verifier>
redirect_uribodyoptional——Must match the authorize request.http://127.0.0.1:51000/callback
refresh_tokenbodyoptional——Refresh token (refresh_token grant).<refresh token>
client_idbodyrequired——Client id.cursor

Response schema

FieldTypeNullableDescription
access_tokenstringnoThe RS256 JWT access token. Present it as `Authorization: Bearer <token>` to call MCP tools. Carries `iss`, `aud` (the canonical resource), `sub` (user uuid), `scope`, `token_use: mcp_access`, and a short `exp`.
token_typestringnoAlways `Bearer`.
expires_inintegernoAccess-token lifetime in seconds (short-lived, ≤15 min). Refresh before it expires.
refresh_tokenstringnoAn opaque refresh token. A rotated token is returned on every use (rotation family; reusing a rotated token revokes the whole family). Exchange it via `grant_type=refresh_token` for a new access token.
scopestringnoThe scope granted to the token, as a space-delimited string.

Errors

StatusLabelDescription
200OKRequest succeeded.
400Bad RequestInvalid query, body, or path parameter.
401UnauthorizedMissing or invalid Authorization header / api_Token.
402Payment RequiredInsufficient token balance for this call. Top up
429Too Many RequestsRate limit exceeded for your tier (see /pricing for tier limits). Tier limits
500Server ErrorUnexpected server-side failure. Retry with backoff; report if persistent.

Code samples

curl -X POST "https://api.finradar.ai/oauth/token" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d 'grant_type=authorization_code&code=%3Cone-time+code%3E&code_verifier=%3Cpkce+verifier%3E&redirect_uri=http%3A%2F%2F127.0.0.1%3A51000%2Fcallback&refresh_token=%3Crefresh+token%3E&client_id=cursor'

Generate an API key in /account/credentials to run live queries (literal YOUR_API_KEY placeholder shown until then).