Updated FEATURE_MATRIX/API_CLIENTS/WHATS_NEW/API/PRODUCT_OVERVIEW/PRIZE_MAP/api README to the real counts; OpenAPI now 68 paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.4 KiB
Guardrail Alpha API — OpenAPI Spec
openapi.yaml is an OpenAPI 3.1 document describing the
read-only Guardrail Alpha HTTP API. Every documented endpoint is a GET and is
side-effect free.
The spec covers all 68 routes currently registered in
apps/guardrail-api/src/server.rs —
including the newest /journal, /ensemble, /skills, and /version. A
human-readable index with sample responses lives in ../API.md.
Viewing the spec
Pick whichever is convenient:
-
Swagger Editor (no install): open https://editor.swagger.io, then
File → Import fileand selectopenapi.yaml(or paste its contents into the left pane). The rendered docs and a request explorer appear on the right. -
Redocly CLI (preview + lint):
npx @redocly/cli preview-docs docs/api/openapi.yaml # live preview server npx @redocly/cli lint docs/api/openapi.yaml # validate the spec -
Swagger UI via Docker:
docker run --rm -p 8081:8080 \ -e SWAGGER_JSON=/spec/openapi.yaml \ -v "$(pwd)/docs/api:/spec" swaggerapi/swagger-ui # then open http://localhost:8081 -
VS Code: install an OpenAPI extension (e.g. "OpenAPI (Swagger) Editor") and open
openapi.yamlfor inline preview and validation.
The default server is http://localhost:8080. Start the API with:
DATABASE_URL=sqlite://data/guardrail_alpha.db cargo run -p guardrail-api
How this spec is maintained
This document is generated by hand to match
apps/guardrail-api/src/server.rs.
Paths, query parameters, and rough response shapes were read directly from
server.rs and the handler modules (routes/mod.rs, backtest.rs,
walkforward.rs, sweep.rs, history.rs, compile.rs). It is not generated
from code annotations, so when routes change in server.rs, update
openapi.yaml to match.
Response bodies are assembled dynamically from event payloads and run reports,
so most responses use a loose object schema (additionalProperties: true). Two
endpoints have approximate typed schemas under components.schemas:
BacktestResponse (for /backtest) and AlertsResponse (for /alerts). The
/metrics endpoint returns Prometheus text/plain, and /report/markdown and
/export/submission.md return text/markdown.