Docs menuFeatures

DOCS / FEATURES

API & OpenAPI

The JSON API is described by an OpenAPI 3.1 spec, generated from handler annotations with utoipa and assembled in api/src/docs.rs. The API serves it at runtime with interactive docs, a copy is committed to the repo, and the SPA's TypeScript types are generated from it. The openapi binary (api/src/bin/openapi.rs) prints it without starting a server.

Where it comes from

  • Every JSON handler carries a #[utoipa::path(...)] annotation: method, path, tag, security, parameters, request body, responses.
  • Request and response types derive utoipa::ToSchema.
  • api/src/docs.rs assembles the document: the list of paths, the components(schemas(...)), the tags, and a SecurityAddon that registers the credential kinds:
Scheme name Kind
bearer_jwt Authorization: Bearer <JWT>
session_cookie the session cookie
api_key X-Api-Key header
scim_token Authorization: Bearer scim_…, the org's SCIM token
oauth Authorization: Bearer rso_…, an MCP client's access token

Operations are grouped by tag, listed in api/src/docs.rs: among them auth, users, orgs, billing, webhooks, uploads, admin, scim (the owner's SCIM settings), scim-v2 (SCIM itself, for the identity provider), oauth (including the /.well-known discovery documents), mcp, and meta (/api/health and this spec). DELETE /api/users/me/impersonation sits under admin, with the other impersonation routes.

SCIM's handlers read and write SCIM JSON directly, since identity providers send it with quirks. api/src/scim/docs.rs holds the RFC 7643 shapes (ScimUser, ScimGroup, ScimListResponse, ScimPatchOp, ScimErrorBody) the spec shows for them.

[ full guide ]

The rest of this guide comes with the repo.

  • Serving it
  • The committed spec
  • Generated TypeScript types
  • Conventions
  • Documenting a new endpoint
Get LaunchCrate