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
codebodyoptionalAuthorization code (authorization_code grant).<one-time code>
code_verifierbodyoptionalPKCE verifier (authorization_code grant).<pkce verifier>
redirect_uribodyoptionalMust match the authorize request.http://127.0.0.1:51000/callback
refresh_tokenbodyoptionalRefresh token (refresh_token grant).<refresh token>
client_idbodyrequiredClient 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 "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "grant_type": "authorization_code",
  "code": "<one-time code>",
  "code_verifier": "<pkce verifier>",
  "redirect_uri": "http://127.0.0.1:51000/callback",
  "refresh_token": "<refresh token>",
  "client_id": "cursor"
}'

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