Endpoints
Protected resources (RFC 9728), one per audience:
A
401 from a resource carries WWW-Authenticate: Bearer resource_metadata="...", the start of discovery.
Identify your app
- Client ID metadata document (preferred)
- Dynamic registration
Use an The document’s
https URL as your client_id, pointing to a JSON document you host:client_id must be its own URL, token_endpoint_auth_method must be none (no secret), with 1 to 10 redirect_uris. CaptureFlow fetches it (no redirects, 5 KB at most) and caches it for a day.Authorization code flow
- Send the user to
/oauth/authorizewithresponse_type=code,client_id,redirect_uri,scope(space-separated scopes; unknown ones are ignored, and without any the app gets read-only access),state,code_challengeandcode_challenge_method=S256, andresource(the resource you will call; the MCP server when omitted). PKCE with S256 is required. - The user signs in to CaptureFlow, picks a default workspace and approves, possibly narrowing the scopes. CaptureFlow redirects back with
code,stateandiss(RFC 9207). - Exchange the code at the token endpoint (form-encoded):
grant_type=authorization_code,code,redirect_uri,code_verifier,client_idand the sameresource. Codes last 10 minutes and work once.
access_token (cfo_at_..., one hour), a refresh_token (cfo_rt_...) and the granted scope.
Refreshing
grant_type=refresh_token returns a new pair; refresh tokens rotate. A refresh token reused within 30 seconds of its rotation (a retried request) gets one more pair; any later reuse revokes the whole sign-in, as a stolen token would be. A refresh token unused for 30 days expires, and a sign-in lasts at most 180 days before the user approves again.
Revoking
POST /api/oauth/revoke with a token revokes the user’s whole sign-in with your app. Users can also disconnect your app in Settings > API & MCP > Connected apps.
Tokens are bound to a resource
A token works only for theresource it was issued for. A token for the MCP server also works on the read-only MCP server (with read scopes only); call the REST API with a token issued for https://api.captureflow.ai.
