REST API¶
Fathom exposes the engine over HTTP via FastAPI. The canonical schema is
exported at openapi.json and is regenerated on every
build.
Quick links¶
- Interactive try-it: Swagger UI
- Raw schema:
openapi.json - Postman: Import → OpenAPI pointed at
openapi.json. - Insomnia: use Import from URL pointed at
openapi.json.
Contract¶
- Auth. Every route except
GET /healthandGET /v1/statusneedsAuthorization: Bearer <FATHOM_API_TOKEN>;POST /v1/rules/reloadtakesFATHOM_ADMIN_TOKENwhen that is set. The schema declares this as theHTTPBearersecurity scheme. A missing or wrong token is 401. - Unknown keys. Request bodies refuse keys they do not declare with
422
validation_error, so a misspelledsesion_idfails instead of running stateless./v1/datais the exception: it follows OPA's Data API, which ignores unknown keys. - Sessions.
POST /v1/evaluatewith asession_idand arulesetopens a session bound to that ruleset;/v1/facts,/v1/query,/v1/templates,/v1/rulesand/v1/modulesaddress it (the GET routes by theX-Session-Idheader). A session id is at most 128 characters (422 in a body, 400 in the header). A server holds at most 1000 live sessions per app; a session idles out after 30 minutes without a call. Opening one more past the ceiling answers 503session_limit_exceededuntil one expires. Neither bound is configurable, so on a shared server one caller opening sessions can lock others out for up to 30 minutes: put per-caller rate limits in front of it, or use stateless evaluation (nosession_id). gRPC shares the same bounds (RESOURCE_EXHAUSTED). - Metrics. With
FATHOM_METRICS=1the app also servesGET /metrics(Prometheus text format, same bearer auth). It is not inopenapi.json, which is exported with metrics off. See Configuration.