Skip to main content
generateOpenAPISpec returns an OpenAPI 3.1 document describing the REST endpoints createTheAuthHandler serves. It is generated from the handler’s route table and the typed result shapes in core, so it cannot lag behind the routes. The same document is checked in as sdks/openapi.json, and a test fails when the two differ. Feed it to a code generator to produce a client for Python, Java, Rust or any other language.
openapi.ts
Then generate a client, for example:

Serving it

The function is pure, so you can expose it from any route:

Options

What it covers

Every route in the handler’s route table: agents, /authorize and /authorize/token, /explain, delegations, audit, dashboard aggregates and the MCP OAuth endpoints (including /mcp/introspect). The admin API approval routes (/approvals) are added unless you set adminApi: false. AuthorizeResult carries code, one of the decision codes, and a denied call (403, or 401 for an identity failure) returns the same { data } result as an allowed one. ExplainResult includes the delegation chain (delegation.path, links, inbound), the constraint checks and near misses.

Regenerating sdks/openapi.json

Requests authenticate with a bearer token (BearerAuth for signed-in callers, AgentToken for /authorize/token, ClientBasic for OAuth client endpoints). Endpoints that other plugins register (email, OAuth, passkeys and so on) are not included; see Writing plugins for how those are mounted.
Last modified on October 19, 2026