Skip to main content

API overview

InterfaceSource of truthNotes
RESTapis/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).
Eventsapis/asyncapi.yaml (AsyncAPI 2.6.0, version 1.0.0)Summarised on the event catalogue.
MCPinternal/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 POST requires Idempotency-Key (1-128 printable ASCII): a missing key is 400 idempotency-key-required, a malformed one 400 idempotency-key-invalid, a replay with the same key and request returns the original response with Idempotency-Replayed: true, the same key with another request is 409 idempotency-key-reused.
  • Collections are keyset-paged: {items, nextCursor} with limit and cursor; undeclared query parameters are 400 unknown-query-parameter.
  • Versions and ETag. Mutable resources carry a version (starts at 1, +1 per accepted change) and a matching strong ETag: "<version>". An action POST may send If-Match; a stale value is 412 version-mismatch and a write that loses a race in the database is 409 concurrent-modification.
  • Errors are RFC 7807 application/problem+json with type = https://errors.inbound-receiving.warehouse-systems.dev/<slug>. The slugs come from one table (problemCatalogue in internal/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, the invalid-* 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-error and the 410 appointment-moved of the retired appointment writes (ADR 0019). The reports binary adds invalid-report-range (400) and report-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 opaque cursor that is the previous page's nextCursor; a response without nextCursor is the last page.
  • Auth: none. The fleet reverted REST and MCP auth on 2026-09-11, and TestNoAuthMiddlewareReintroduced fails CI if auth middleware returns.
  • CORS: GET and POST from CORS_ALLOWED_ORIGINS, exposing ETag and Location.

Endpoint groups (tags)​

TagEndpoints
ASNsPOST /asns, GET /asns, GET /asns/{asnNumber}, POST /asns/{asnNumber}/cancellations
Appointmentsdeprecated (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
ReceiptsPOST /receipts, GET /receipts, GET /receipts/{receiptId}, POST /receipts/{receiptId}/lines, POST /receipts/{receiptId}/closures
DocksGET /docks
ReportsGET /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)
HealthGET /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:

ToolArguments
get_asnasn_number
list_asnsstate, limit, cursor
get_appointmentappointment_id
list_appointmentsdoor, state, from, to, limit, cursor
get_receiptreceipt_id
list_receiptsasn_number, state, limit, cursor
list_docksnone

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).