API overview
| Interface | Source of truth | Notes |
|---|---|---|
| REST | apis/openapi.yaml (OpenAPI 3.0.3, version 1.0.0) | The pages under REST are generated from the spec with npm run gen-api-docs; do not edit them by hand. Servers declared in the spec: http://localhost:8080 (local) and http://localhost:8000/api/exception-management (Kong in the kind cluster). |
| Events | apis/asyncapi.yaml | Summarised on the event catalogue; every field on Domain events. |
| MCP | internal/adapters/inbound/mcp | cmd/mcp, Streamable HTTP on :8090 at /mcp: read-only tools list_open_exceptions, get_exception, get_exception_policies, get_sla_report. Writes stay on REST. See MCP tools. |
Endpoints
| Tag | Endpoint | Use case | Success |
|---|---|---|---|
| Exceptions | GET /exceptions | ListOpenExceptions | 200, one keyset page {items, nextCursor}, never 404 on a list |
| Exceptions | POST /exceptions | — | 405 by design: every case is a consumed fact (ADR 0001), and the 405 body says so; keyed like every POST |
| Exceptions | GET /exceptions/{caseId} | GetException | 200, the case |
| Exceptions | POST /exceptions/{caseId}/triage-decisions | TriageException | 200, body {severity, queue} |
| Exceptions | POST /exceptions/{caseId}/assignments | AssignException | 200, body {assignee} |
| Exceptions | POST /exceptions/{caseId}/resolutions | ResolveException | 200, body {resolutionCode, rootCause, note?}; 409 case-already-resolved when terminal |
| Exception policies | GET /exception-policies | ListExceptionPolicies | 200, one keyset page {items, nextCursor} of the latest version per source type |
| Exception policies | PUT /exception-policies/{sourceType} | DeclareExceptionPolicy | 201, the new policy version |
| Health | GET /healthz, GET /readyz, GET /metrics | — | 200 / 503 (Runbook) |
GET /exceptions filters: status (OPEN, TRIAGED, ASSIGNED, RESOLVED; omitted = every status,
open and resolved alike — resolve activity is part of the record), queue, site, sourceType.
Both lists take limit (1–500, default 100) and cursor (the previous page's nextCursor, absent on
the first page); repeat the filters on every page request.
Conventions
- Bodies. Strict JSON: unknown fields, trailing data and a malformed body are
400 malformed-request-body. JSON names are camelCase on REST and snake_case in eventdata. Idempotency-Keyis required on everyPOST(the three case commands and the keyed405ofPOST /exceptions) and onPUT /exception-policies/{sourceType}. A missing key is400 idempotency-key-required(400 idempotency-key-invalidwhen it is over 128 characters or not printable ASCII); the same key and the same request (method, path, body) replays the stored answer (4xx included) withIdempotency-Replayed: true; the same key with a different request is409 idempotency-key-reused. A 5xx is never stored.- Pagination.
limitoutside 1–500 is400 invalid-limit, an undecodablecursoris400 invalid-cursorand an undeclared query parameter (after,offset, …) is400 unknown-query-parameter. - Errors are RFC 7807
application/problem+jsonwithtype = https://errors.exception-management.warehouse-systems.dev/<slug>. The slugs aremalformed-request-body,invalid-case-id,invalid-source-type,invalid-status,invalid-severity,invalid-queue,invalid-assignee,invalid-resolution,invalid-policy,case-not-found,case-already-resolved,concurrent-modification,not-found,method-not-allowed,idempotency-key-required,idempotency-key-invalid,idempotency-key-reused,invalid-limit,invalid-cursor,unknown-query-parameter,dependency-unavailableandinternal-error. Causes and fixes are on Troubleshooting. - NUL guard. A NUL byte in a path is 404, in a body
400 malformed-request-body(Postgres rejects U+0000). - Auth: none. The fleet removed REST and MCP bearer auth on 2026-09-11 and
TestNoAuthMiddlewareReintroducedfails CI if auth middleware returns. The router installs no CORS middleware. - No case creation. There is deliberately no
POST /exceptionsthat opens a case: every case starts from a consumed fact (ADR 0001), and the spec pins the 405 so the decision is visible on the wire.