Canopy API Reference
For an integrator consuming a canopy REST surface: this page is the entry point. Each JSON API service exposes a utoipa-generated OpenAPI 3.1 document that cargo xtask api-docs snapshots into docs/modules/ROOT/openapi/<service>.json (committed, so it ships with every Antora build). The per-service pages below state what the snapshot cannot: the guard behind each route, the coded refusals, the events published and consumed. The bearer shapes and guard families those guards compose are stated once, in Security › The identity receiver and admissions; each page carries only its own route specifics. What a service is lives in the Service Catalog; this table carries only what is specific to its snapshot.
Specifications
To consume a spec interactively, paste the JSON into Swagger Editor (https://editor.swagger.io/) or load the file in Postman / Insomnia. The service list is SERVICES in xtask/src/cmd/api_docs.rs.
| Service | Spec | Service-level reference | Snapshot notes |
|---|---|---|---|
canopy-rules |
Service-to-service only; every program service is a caller. |
||
canopy-persons |
The ADR-038 |
||
canopy-applications |
The largest surface (56 paths); the page indexes the RFC 9457 |
||
canopy-eligibility |
Three read routes are registered as literals with no |
||
canopy-verification |
The worker/portal |
||
canopy-enrollment |
|
||
canopy-renewals |
Program-parameterized routes ( |
||
canopy-notices |
Eight paths; the event-routing catalogue that drives most letters is ruleset data, not API, and is tabulated on the page. |
||
canopy-appeals |
The IPV router is merged into the appeals router; both are in one snapshot. |
||
canopy-reporting |
Composition surface over the program services (ADR-001); no program data of its own. |
||
canopy-security |
The audit subscriber’s write path is the event bus, not HTTP; the snapshot is the read / export / chain surface. |
||
canopy-snap |
Mounts its own floor-screened |
||
canopy-tanf |
Mounts the shared overpayment routes, |
||
canopy-medicaid |
Mounts the same shared overpayment routes, over its own database; CHIP is served by this service. |
||
canopy-caps |
— |
||
canopy-wic |
— |
||
canopy-web |
The composition API ( |
Of the two browser BFFs, canopy-web's pages have no OpenAPI document, only its composition API above, which it serves at /api-doc/openapi.json (canopy-web); canopy-portal has no OpenAPI document. canopy-exchange registers no routes (ADR-034).
Cross-program surfaces
Some types and endpoint shapes appear in several program services rather than in one cross-program service. Per ADR-001 the data stays in each program’s database; the types and wire shape are shared through a workspace crate.
-
Overpayment recovery —
crates/canopy-overpaymentscarries the typedOverpaymentClaim/RepaymentPlan/RecoupmentLedgerEntryshapes, the canonical migration SQL, the store (canopy_overpayments::store) and the HTTP handlers and routes (canopy_overpayments::api). canopy-snap, canopy-tanf and canopy-medicaid each run an identical copy of the tables in their own database and serve the same/v1/overpayments[/…]paths over it: canopy-tanf and canopy-medicaid mountcanopy_overpayments::api::routes(); canopy-snap mounts its ownPOST /v1/overpayments, which screens a claim against the pack’s pre-establishment claim floors before filing it (#2242), beside the shared list handler andcanopy_overpayments::api::claim_routes(…). canopy-reporting composes the cross-program roll-up over HTTP (no cross-program DB access). Lifecycle and rationale: the archived plan.
Pattern precedent: canopy-signing (types shared, signing keys per service) and canopy-policy (types + tooling shared, jurisdiction.toml lives in the pack).
Refresh workflow
Snapshots are refreshed when a contract change is accepted:
cargo xtask dev start # bring up the devstack
cargo xtask api-docs # diff the live specs against the snapshots
cargo xtask api-docs --update # accept the diff (after review)
The unflagged form is one of the cargo xtask validate gates (api-docs), so contract drift is a battery failure. The gate is intentional: pre-1.0 contracts can change, but every change is a deliberate snapshot bump in the same commit as the code.
Live Swagger UI
While the devstack is running, every JSON API service in the table above serves an interactive Swagger UI at /swagger-ui on its own host port (canopy_api::ApiServer). The browser BFFs do not: canopy-web’s strict CSP allows the JSON spec only, and canopy-portal serves none. Host ports are ephemeral — read them from cargo xtask dev status or .ports.env (CANOPY_PORT_<SERVICE>_<CONTAINER_PORT>), then open http://localhost:<port>/swagger-ui.