Skip to main content
Cruq AI is an OAuth 2.0 authorization server, so an external agent or app can act on a user’s behalf without ever handling their API key. It supports the authorization-code grant with PKCE, refresh tokens, and dynamic client registration, and MCP clients can discover it automatically.

Endpoints

Discovery metadata (RFC 8414) lists everything:

Flow

  1. Register a client (once). Public clients use PKCE and no secret:
    The response contains a client_id (and a client_secret for confidential clients).
  2. Send the user to authorize. Generate a PKCE code_verifier / code_challenge, then redirect the user to:
    The user signs in (if needed), sees a consent screen for their workspace, and approves. Cruq AI redirects back to your redirect_uri with ?code=...&state=....
  3. Exchange the code for tokens:
    Returns access_token (cruq_at_...), refresh_token, expires_in, and scope.
  4. Call the API with the access token, exactly like an API key:
    Access tokens also work against the MCP server. Refresh with grant_type=refresh_token when the access token expires.

Scopes

Today a single api scope grants full access to the user’s workspace, the same reach as an API key. Finer-grained scopes may be added later; tokens already carry a scope list.