Skip to main content
Version: 0.1.0

Last-Mile Delivery API

REST contract of the last-mile-delivery bounded context of the retail network (logistics tier), derived from retail-network-docs model/model.yaml (contexts[last-mile-delivery].rest, .aggregates, .publishes, conventions.errors) and adjusted by the orchestrator's contracts-delta and Gap Register resolutions (G5, G11, G16, G17, G34). The context runs the network's delivery stations: it schedules delivery waves (induct cutoff, delivery window, stop capacity), inducts arrived packages into them, plans routes for delivery service partners (DSPs) and records delivery attempts. No endpoint carries an address or any other PII: packages are identified by tracking number and grouped into stops by the opaque stopKey that shipping-and-tracking derives at label time. No authentication, consistent with the rest of the network. Every state changing POST takes a required Idempotency-Key header (table idempotency_keys, 24 h): a missing key is 400 idempotency-key-required, a key that is not 1 to 128 printable ASCII characters is 400 idempotency-key-invalid, a key reused with another method, path or body is 409 idempotency-key-reused, and a repeated request replays the stored answer with the header Idempotency-Replayed: true. A 2xx is stored and a 5xx never; a refusal is stored (and replayed) only when it is final for the request, and a refusal that depends on state that can change is not stored, so its key is released and the retry executes again (the lists are on the Idempotency-Key parameter; ADR 0019). Every collection is paged with limit and cursor and answers {items, nextCursor}; an undeclared query parameter is 400 unknown-query-parameter. Errors are RFC 9457 application/problem+json; the type is a slug. The shared slugs are not-found (404), illegal-transition (409), concurrent-update (409) and validation-failed (422), plus one slug per model Err name (kebab-case without the Err prefix). Request bodies are decoded strictly (unknown fields, an empty body, trailing data and a body over 64 KiB are 422 validation-failed); a NUL character (U+0000) in the query string or a body is 422 validation-failed, in the path it is 404 resource-not-found. A path no route serves is 404 resource-not-found, a method a path does not serve is 405 method-not-allowed (problem+json), and an unmapped failure is an opaque 500 internal-error (never stored for replay). Every problem body carries type, title, status, detail and instance. The first eight operations of this file are the model's REST list; getWaveStops, cancelWave, getRoute, deactivatePartner and declareWaveCost are the additions of Gap Register G11, G17, G34 and roadmap F7 (ADR 0002, ADR 0011). The read-only analytics reports (tag reports, ADR 0012) are served by cmd/lm-reports on its own port (per-path server) from the separate analytical database.

Contact

last-mile-delivery maintainers:

URL: https://github.com/IQVO/last-mile-delivery