API overview
| Interface | Source of truth | Notes |
|---|---|---|
| REST | apis/openapi.yaml (OpenAPI 3.0.3, version 1.0.0) | Pages under REST are generated from the spec; do not edit them by hand. Servers: http://localhost:8080 (local) and http://localhost:8000/api/inbound-receiving (kind cluster through Kong; warehouse-infra routes it on its develop). |
| Events | apis/asyncapi.yaml (AsyncAPI 2.6.0, version 1.0.0) | Summarised on the event catalogue. |
| MCP | internal/adapters/inbound/mcp/tools.go (pinned by testdata/tool_registry.golden.json) | Read-only server cmd/mcp on :8090 (Streamable HTTP at / and /mcp), ADR 0005. See MCP tools below. |
Conventions
- Every
POSTrequiresIdempotency-Key(1-128 printable ASCII): a missing key is400 idempotency-key-required, a malformed one400 idempotency-key-invalid, a replay with the same key and request returns the original response withIdempotency-Replayed: true, the same key with another request is409 idempotency-key-reused. - Collections are keyset-paged:
{items, nextCursor}withlimitandcursor; undeclared query parameters are400 unknown-query-parameter. - Versions and
ETag. Mutable resources carry aversion(starts at 1, +1 per accepted change) and a matching strongETag: "<version>". An actionPOSTmay sendIf-Match; a stale value is412 version-mismatchand a write that loses a race in the database is409 concurrent-modification. - Errors are RFC 7807
application/problem+jsonwithtype = https://errors.inbound-receiving.warehouse-systems.dev/<slug>. The slugs come from one table (problemCatalogueininternal/adapters/inbound/http/errors.go) and are listed in the description of the API info page:malformed-request,invalid-query,idempotency-key-required,idempotency-key-reused, theinvalid-*slugs for ASN number, supplier ref, line number, SKU, quantity, reason, appointment id, receipt id, door code, carrier, window and condition,asn-requires-lines,duplicate-sku,appointment-requires-asns,duplicate-asn-number,asn-not-found,appointment-not-found,receipt-not-found,asn-already-exists,asn-in-progress,asn-terminal,asn-not-receivable,appointment-cancelled,receipt-already-open,receipt-closed,unknown-sku,unknown-asn,unknown-appointment,asn-not-on-appointment,line-not-on-asn,version-mismatch,concurrent-modification,internal-errorand the410appointment-movedof the retired appointment writes (ADR 0019). The reports binary addsinvalid-report-range(400) andreport-store-error(500). - Request bodies reject unknown fields; JSON field names are camelCase on REST
(
asnNumber,expectedQty,windowStart) and snake_case on the events. - Paging. Lists use
limit(1 to 500, default 100) and the opaquecursorthat is the previous page'snextCursor; a response withoutnextCursoris the last page. - Auth: none. The fleet reverted REST and MCP auth on 2026-09-11, and
TestNoAuthMiddlewareReintroducedfails CI if auth middleware returns. - CORS:
GETandPOSTfromCORS_ALLOWED_ORIGINS, exposingETagandLocation.
Endpoint groups (tags)
| Tag | Endpoints |
|---|---|
ASNs | POST /asns, GET /asns, GET /asns/{asnNumber}, POST /asns/{asnNumber}/cancellations |
Appointments | deprecated (ADR 0019): GET /appointments, GET /appointments/{appointmentId} from the local copy; the three write routes POST /appointments, POST /appointments/{appointmentId}/check-ins and POST /appointments/{appointmentId}/cancellations answer 410 appointment-moved |
Receipts | POST /receipts, GET /receipts, GET /receipts/{receiptId}, POST /receipts/{receiptId}/lines, POST /receipts/{receiptId}/closures |
Docks | GET /docks |
Reports | GET /reports/receiving-performance, GET /reports/freshness (served by the separate inbound-reports binary on :8092 from the analytical database, server http://localhost:8092 in the spec, ADR 0006) |
Health | GET /healthz, GET /readyz |
GET /metrics (Prometheus) is served by cmd/api but is not part of
apis/openapi.yaml. The reports binary serves GET /healthz but no /readyz.
MCP tools
cmd/mcp registers seven tools, all read-only (annotated readOnlyHint and
idempotentHint) and backed by the same read use cases as the REST GETs:
| Tool | Arguments |
|---|---|
get_asn | asn_number |
list_asns | state, limit, cursor |
get_appointment | appointment_id |
list_appointments | door, state, from, to, limit, cursor |
get_receipt | receipt_id |
list_receipts | asn_number, state, limit, cursor |
list_docks | none |
Writes (register, cancel, book, check in, open, receive, close) stay on REST;
internal/adapters/inbound/mcp/governance_test.go fails the build on a
write-verb tool name. warehouse-ops-agent consumes these tools through
INBOUND_RECEIVING_MCP_ENDPOINT (its ADR 0021).