openapi: 3.0.3 info: title: Yard Management API version: 1.0.0 contact: name: yard-management maintainers url: https://github.com/IQVO/yard-management license: name: UNLICENSED description: 'The WMS-tier owner of everything physically on site outside the four walls (ADR 0001, ADR 0002): visits through the gate (YardVisit), the trailers on site and where each is (Trailer), the moves hostlers and visiting drivers make (YardMove), yard checks (YardCheck) and the per-site yard rules (YardPolicy). It is the source of dwell, door occupancy and yard truck productivity facts. A trailer on site is at exactly one place: one yard spot, one door, or one open move. A spot or a door holds at most one trailer. Moves are pulled by hostlers (claim-next with a lease), never pushed. Appointments, door closures, locations and ASN contents come from event-fed local copies (ADR 0003); this API never calls a sibling context. Events are published as CloudEvents on `warehouse.yard-management.events` and `.analytics` through a transactional outbox (see `apis/asyncapi.yaml`). Sites are addressed by siteCode and doors and spots by their facility-layout locationCode (globally unique). Errors are RFC 7807 problem documents with `type = https://errors.yard-management.warehouse-systems.dev/`, the slug being the kebab-case of the domain error name (`ErrLocationOccupied` is `location-occupied`). There is no authentication layer (fleet decision 2026-09-11). Three problem types belong to no single operation. A path that matches no route, or one that carries a NUL character, is a 404 `resource-not-found`. A method that a path does not take is a 405 `method-not-allowed`, with an `Allow` header that lists the methods the path does take. Every command (each POST and PUT except the two sweeps) can answer 409 `concurrent-modification` when another request changed the same aggregate first (the optimistic `version` guard, ADR 0008): nothing is persisted, and the refusal is not stored under the Idempotency-Key of the request (replay class RETRYABLE, ADR 0019), so read the resource again and retry, with the same key or a new one.' servers: - url: http://localhost:8080 description: Local development - url: http://localhost:8000/api/yard-management description: Local kind cluster through Kong tags: - name: Visits description: Gate check-in, rejection and check-out. - name: Trailers description: Trailers on site, door work, holds and seals. - name: Inspections description: Compliance inspection checklists that gate docking, loading and leaving (ADR 0015). - name: Moves description: 'Yard moves: request, claim-next, complete, cancel.' - name: Yard checks description: Yard audits. - name: Yard board description: The live spot and door map. - name: Yard policy description: Per-site yard rules. - name: Sweeps description: Scheduler-driven sweeps (CronJobs). - name: Reports description: Read-only analytics reports (ADR 0006). - name: Health description: Liveness and readiness probes. paths: /healthz: get: operationId: getHealthz summary: Liveness probe description: Answers 200 while the process runs. tags: - Health responses: '200': description: Alive. content: application/json: schema: $ref: '#/components/schemas/Status' example: status: ok /readyz: get: operationId: getReadyz summary: Readiness probe description: 200 `ready` only when the process is not draining and Postgres and Kafka answer; otherwise 503 `dependency-unavailable`. tags: - Health responses: '200': description: Ready. content: application/json: schema: $ref: '#/components/schemas/Status' example: status: ready '503': $ref: '#/components/responses/ServiceUnavailable' /visits: post: operationId: checkInVisit summary: Check a visit in at the gate (CheckInVisit) description: 'Records a tractor and driver passing the gate and the trailers they bring. DirectOnCheckIn creates, per trailer, a move created already CLAIMED by the VISITING_DRIVER (no lease): to the appointment door when it is free, open and flow-compatible, otherwise to the first free spot of the site''s parking zones, and a walk-in or an arrival earlier than the appointment tolerance goes to a holding spot (TO_HOLDING). SealCheckAtGate compares each recorded seal with the appointment''s expected seal; a mismatch raises SealExceptionRaised and, under the REJECT policy, records a REJECTED visit instead (reason SEAL_MISMATCH). A refused check-in persists nothing: 409 `appointment-required`, `visit-already-open`, `trailer-already-on-site`, `door-closed`, `door-flow-mismatch`, `no-free-spot`, `placement-rule-violated`, `seal-class-too-low` (the site yard policy sets `minimumSealClass` and the seal is of a lower class or has none); 422 `invalid-carrier`, `unknown-appointment` (also when the visit names an appointment but does not carry exactly one trailer), `invalid-unit-number`, `invalid-seal-class`, `invalid-hazmat-class`, `invalid-un-number`, `validation`. The unit number of a `CONTAINER` trailer, and of any trailer whose `unitNumberScheme` is `ISO6346`, must be an ISO 6346 container number (4 letters: a 3-letter owner code and the category U, J or Z; 6 digits; the check digit), else 422 `invalid-unit-number` whose detail names the expected check digit; a domestic road trailer keeps a free-form number. A matching seal ends `VERIFIED` and a different one `MISMATCH` (ADR 0012). A trailer may declare what it carries: `hazmatClass`, `unNumber`, `requiresTemperatureControl` (ADR 0014). A trailer that declares a hazard class is placed only on a HAZMAT spot (a site with none refuses it, unless the policy sets `allowHazmatOnUnclassifiedSpots`, then only spots whose kind is unknown); a trailer that requires temperature control only on a REEFER_PLUG spot where the site has any. A site with no suitable free spot answers 409 `no-free-spot` (all taken) or `placement-rule-violated` (none exists); doors are exempt; a trailer that declares nothing, and a spot with no known kind, are judged as before. The gate clerk may then record the refusal with `POST /visit-rejections`. A carrier that dock-scheduling has suspended (the local copy of its registry, ADR 0016) is handled by the site yard policy `suspendedCarrierAction`: NONE admits the visit as before; FLAG admits it and sets the visit `carrierFlag` to SUSPENDED; REJECT records a REJECTED visit (reason CARRIER_SUSPENDED, VisitRejected published, no trailer persisted) and answers 409 `carrier-suspended`, so that turn-away is on record although the call is a 409.' tags: - Visits parameters: - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CheckInVisitRequest' example: siteId: WH1 carrier: Acme Freight carrierScac: ACME tractorPlate: ABC1D23 driverRef: drv-77 purpose: LIVE_UNLOAD appointmentId: appt-0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d trailers: - unitNumber: TR-1042 kind: DRY_VAN loadState: LOADED sealNumber: SL-778 sealClass: S responses: '201': description: The visit is checked in (or REJECTED under the REJECT seal policy). headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' Location: description: Path of the visit, `/visits/{visitId}`. schema: type: string content: application/json: schema: $ref: '#/components/schemas/CheckIn' '400': $ref: '#/components/responses/BadRequest' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' get: operationId: listVisits summary: List visits description: 'Lists visits newest first, one keyset page at a time (`limit` 1-500, default 100; `cursor` is the opaque `nextCursor` of the previous page). Filters: `siteId`, `state`, `tractorPlate`. A query parameter this operation does not define is a 400 `unknown-query-parameter`.' tags: - Visits parameters: - name: siteId in: query required: false description: Only visits of this site. schema: type: string - name: state in: query required: false description: CHECKED_IN, CHECKED_OUT or REJECTED. Any other non-empty value is a 400 `invalid-state`. schema: type: string enum: - CHECKED_IN - CHECKED_OUT - REJECTED - name: tractorPlate in: query required: false description: Only visits of this plate. schema: type: string - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: A page of visits. content: application/json: schema: $ref: '#/components/schemas/VisitPage' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /visits/{visitId}: get: operationId: getVisit summary: Get a visit description: Returns the visit with an `ETag` of its version. tags: - Visits parameters: - name: visitId in: path required: true description: The visit id. schema: type: string minLength: 1 maxLength: 128 responses: '200': description: The visit. headers: ETag: $ref: '#/components/headers/ETag' content: application/json: schema: $ref: '#/components/schemas/Visit' example: visitId: visit-5b1f0c3e-7a24-4d1e-9c55-0e7d3f2a9b10 siteId: WH1 carrier: Acme Freight carrierScac: ACME tractorPlate: ABC1D23 driverRef: drv-77 purpose: LIVE_UNLOAD appointmentId: appt-0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d state: CHECKED_IN rejectionReason: null trailersIn: - trl-8f7e6d5c-4b3a-4291-8071-6f5e4d3c2b1a trailersOut: [] arrivedAt: '2026-11-05T14:02:11Z' departedAt: null version: 1 '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /visits/{visitId}/check-outs: post: operationId: checkOutVisit summary: Check a visit out (CheckOutVisit) description: 'The visit leaves the site with `trailersOut`. Every trailer taken out must be on site and released: no open move and either PARKED or DOCKED with door work DONE (`trailer-not-released` 409), and every LOADED trailer of a LIVE_LOAD or PICKUP visit must carry a seal (`seal-required` 409). Each trailer departs (TrailerDeparted, and TrailerUndocked when it leaves a door); a trailer the visit brought and does not take stays PARKED (a drop). Only a CHECKED_IN visit checks out (409 `illegal-transition`). A DOCKED trailer that is still secured does not depart (409 `trailer-still-secured`, ADR 0013): release the securing first.' tags: - Visits parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: visitId in: path required: true description: The visit id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CheckOutRequest' responses: '200': description: The visit is checked out. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Visit' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /visit-rejections: post: operationId: rejectAtGate summary: Turn a visit away at the gate (RejectAtGate) description: Records a REJECTED visit and raises VisitRejected (consumed by dock-scheduling and exception-management). Nothing is persisted for the trailers. tags: - Visits parameters: - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RejectVisitRequest' responses: '201': description: The rejected visit. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' Location: description: Path of the visit, `/visits/{visitId}`. schema: type: string content: application/json: schema: $ref: '#/components/schemas/Visit' '400': $ref: '#/components/responses/BadRequest' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /trailers: get: operationId: listTrailers summary: List trailers description: 'Lists trailers by arrival, one keyset page at a time. Filters: `siteId`, `state` (default: not DEPARTED), `kind`, `locationCode`, `unitNumber`, `visitId` (the visit the trailer is attached to: the one that brought it, until a later visit takes it). A query parameter this operation does not define is a 400 `unknown-query-parameter`.' tags: - Trailers parameters: - name: siteId in: query required: false description: Only trailers of this site. schema: type: string - name: state in: query required: false description: PARKED, IN_MOVE, DOCKED or DEPARTED. Any other non-empty value is a 400 `invalid-state`. schema: type: string enum: - PARKED - IN_MOVE - DOCKED - DEPARTED - name: kind in: query required: false description: Trailer kind. A non-empty value outside the enumeration is a 400 `invalid-state`. schema: type: string enum: - DRY_VAN - REEFER - FLATBED - CONTAINER - name: locationCode in: query required: false description: Where it is now. schema: type: string - name: unitNumber in: query required: false description: Unit number. schema: type: string - name: visitId in: query required: false description: Only the trailers attached to this visit. schema: type: string - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: A page of trailers. content: application/json: schema: $ref: '#/components/schemas/TrailerPage' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}: get: operationId: getTrailer summary: Get a trailer description: Returns the trailer with an `ETag` of its version. tags: - Trailers parameters: - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 responses: '200': description: The trailer. headers: ETag: $ref: '#/components/headers/ETag' content: application/json: schema: $ref: '#/components/schemas/Trailer' example: trailerId: trl-8f7e6d5c-4b3a-4291-8071-6f5e4d3c2b1a siteId: WH1 unitNumber: TR-1042 unitNumberScheme: null carrierScac: ACME kind: DRY_VAN loadState: LOADED state: PARKED location: kind: SPOT code: WH1-YARD-P014 doorWork: null securedAt: null securedBy: null securerRef: null hazmatClass: null unNumber: null requiresTemperatureControl: false seal: number: SL-778 state: INTACT class: S hold: null asnNumbers: - ASN-1001 outboundRef: null visitId: visit-5b1f0c3e-7a24-4d1e-9c55-0e7d3f2a9b10 appointmentId: appt-0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d arrivedAt: '2026-11-05T14:02:11Z' departedAt: null openMoveId: null version: 1 '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/door-work-starts: post: operationId: startDoorWork summary: Start door work (StartDoorWork) description: 'Unloading or loading begins on a DOCKED trailer: WAITING to IN_PROGRESS. Refused while the trailer is held (409 `trailer-on-hold`). Where the site yard policy sets `requireSecuringBeforeDoorWork`, an unsecured trailer is refused with 409 `trailer-not-secured` (ADR 0013); with the policy off (the default) nothing changes.' tags: - Trailers parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 responses: '200': description: The trailer. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Trailer' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/door-work-completions: post: operationId: completeDoorWork summary: Complete door work (CompleteDoorWork) description: 'Door work ends: IN_PROGRESS to DONE, recording the resulting `loadState` (a completed unload is EMPTY). ClearDoorAfterWork then queues a FROM_DOOR move for a DROP trailer; a live trailer stays until its visit checks out.' tags: - Trailers parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DoorWorkCompletionRequest' responses: '200': description: The trailer. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Trailer' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/holds: post: operationId: placeHold summary: Place a hold (PlaceHold) description: Puts the trailer on hold; a held trailer cannot be docked and its door work cannot start. A DOCKED trailer may be held. tags: - Trailers parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/HoldRequest' responses: '200': description: The trailer. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Trailer' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/hold-releases: post: operationId: releaseHold summary: Release the hold (ReleaseHold) description: Removes the hold (409 `trailer-not-on-hold` when there is none). tags: - Trailers parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 responses: '200': description: The trailer. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Trailer' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/seals: post: operationId: recordSeal summary: Record or break the seal (RecordSeal, BreakSeal) description: '`INTACT` records the seal number found on the doors; `APPLIED` records a seal put on at the origin or dock; `BROKEN` marks it broken and places a SEAL_BROKEN hold. `sealClass` (I, S or H, ISO 17712) is optional with INTACT and APPLIED: an unknown class is 422 `invalid-seal-class`, and when the site yard policy sets `minimumSealClass` a seal of a lower class, or with no class, is 409 `seal-class-too-low`. `VERIFIED` and `MISMATCH` are never recorded by a caller: SealCheckAtGate sets them at check-in (ADR 0012).' tags: - Trailers parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SealRequest' responses: '200': description: The trailer. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Trailer' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/classifications: post: operationId: classifyTrailer summary: Set what a trailer carries (ClassifyTrailer) description: 'Sets the hazard class, the UN number and the temperature-control need of a trailer that is on site (ADR 0014): a full replacement, so a field left out is cleared and `{}` declares nothing. The same facts again change nothing and answer 200. Classifying a parked trailer does not move it; the placement rules judge the next placement (`POST /moves`, check-in, and the spot where a move is completed). An unknown hazard class is 422 `invalid-hazmat-class`, a malformed UN number 422 `invalid-un-number`, a UN number without a class 422 `validation`; a departed trailer is 409 `illegal-transition`.' tags: - Trailers parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ClassificationRequest' example: hazmatClass: '3' unNumber: UN1203 requiresTemperatureControl: false responses: '200': description: The trailer. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Trailer' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/securings: post: operationId: secureTrailer summary: Secure a docked trailer (SecureTrailer) description: 'Records that the DOCKED trailer is secured, by a vehicle restraint (`RESTRAINT`) or wheel chocks (`WHEEL_CHOCKS`): the dock safety interlock of OSHA 29 CFR 1910.178(k)(1) and ANSI MH30.3 (ADR 0013). Where the site yard policy sets `requireSecuringBeforeDoorWork`, door work does not start until this is recorded. Securing the same way again changes nothing and answers 200. A trailer that is not DOCKED, or is already secured another way (release it first), is 409 `illegal-transition`; a trailer with an open move is 409 `trailer-has-open-move`; a method other than the two is 422 `validation`. Raises TrailerSecured.' tags: - Trailers parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SecuringRequest' example: method: WHEEL_CHOCKS securerRef: dock-op-7 responses: '200': description: The trailer. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Trailer' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/securing-releases: post: operationId: releaseTrailerSecuring summary: Release the securing (ReleaseTrailerSecuring) description: 'Records that the restraint was released or the chocks removed. It is required before a trailer is moved away from its door (`POST /moves` answers 409 `trailer-still-secured`) and before its visit checks out (409 `trailer-still-secured`). A trailer that is not secured is 409 `trailer-not-secured`; the securing stays while door work is IN_PROGRESS (409 `door-work-open`). A DROP trailer whose door work is done then gets its FROM_DOOR move. Raises TrailerSecuringReleased.' tags: - Trailers parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 responses: '200': description: The trailer. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Trailer' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '500': $ref: '#/components/responses/InternalError' /trailers/{trailerId}/inspections: post: operationId: openInspection summary: Open an inspection (OpenInspection) description: 'Opens a compliance inspection of a trailer on site (ADR 0015): a SNAPSHOT of the template version (the latest unless `templateVersion` is sent) with every item pending, for a `gate` (`PRE_DOCK`, `PRE_LOAD`, `PRE_DEPARTURE`, or `ON_DEMAND`, which opens no gate). `visitId` defaults to the visit the trailer is on. One inspection per trailer, template and gate is OPEN at a time (409 `inspection-already-open`); a trailer that left is 409 `illegal-transition`; an unknown template or version is 422 `unknown-template`; an unknown visit is 404 `visit-not-found`. Raises nothing: events are raised when the inspection completes.' tags: - Inspections parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/OpenInspectionRequest' example: templateId: tractor-trailer-17-point gate: PRE_DOCK performerRef: emp-7 responses: '201': description: The inspection, every item pending. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' Location: description: Path of the inspection, `/inspections/{inspectionId}`. schema: type: string content: application/json: schema: $ref: '#/components/schemas/Inspection' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' get: operationId: listTrailerInspections summary: List the inspections of a trailer description: 'Lists the inspections of one trailer, newest first, one keyset page at a time (ADR 0015). 404 `trailer-not-found` for an unknown trailer. A query parameter this operation does not define is a 400 `unknown-query-parameter`.' tags: - Inspections parameters: - name: trailerId in: path required: true description: The trailer id. schema: type: string minLength: 1 maxLength: 128 - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: A page of inspections. content: application/json: schema: $ref: '#/components/schemas/InspectionPage' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /moves: post: operationId: requestMove summary: Request a move (RequestMove) description: 'A supervisor asks for a HOSTLER move of a trailer to a spot or door. The destination is validated now (known active slot of the site, closure, door flow, hold) and RESERVED: no two open moves share a destination (409 `destination-reserved`), the destination must be free (409 `location-occupied`), and a trailer has at most one open move (409 `trailer-has-open-move`). A trailer that is secured at its door (ADR 0013) is not moved away until the securing is released (409 `trailer-still-secured`). A trailer that carries a hazard class or needs temperature control is sent only to a yard spot its kind allows (409 `placement-rule-violated`, ADR 0014); the same rule judges the spot where the hostler completes the move.' tags: - Moves parameters: - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RequestMoveRequest' responses: '201': description: The move. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Move' example: moveId: mv-2d3e4f50-6172-4839-8a9b-0c1d2e3f4a5b siteId: WH1 trailerId: trl-8f7e6d5c-4b3a-4291-8071-6f5e4d3c2b1a appointmentId: appt-0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d performer: HOSTLER from: kind: SPOT code: WH1-YARD-P014 to: kind: DOOR code: WH1-DOCK-D01 reason: TO_DOOR priority: band: 1 dueBy: '2026-11-05T14:30:00Z' state: CLAIMED hostlerRef: hostler-07 leaseExpiresAt: '2026-11-05T14:07:11Z' actualLocation: kind: DOOR code: WH1-DOCK-D01 claimedAt: '2026-11-05T14:02:11Z' completedAt: null requestedAt: '2026-11-05T14:02:11Z' version: 1 '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' get: operationId: listMoves summary: List moves description: 'Lists moves oldest first, one keyset page at a time. Filters: `siteId`, `state`, `trailerId`, `hostlerRef` (the moves a hostler holds or held). A query parameter this operation does not define is a 400 `unknown-query-parameter`.' tags: - Moves parameters: - name: siteId in: query required: false description: Only moves of this site. schema: type: string - name: state in: query required: false description: REQUESTED, CLAIMED, COMPLETED or CANCELLED. Any other non-empty value is a 400 `invalid-state`. schema: type: string enum: - REQUESTED - CLAIMED - COMPLETED - CANCELLED - name: trailerId in: query required: false description: Only moves of this trailer. schema: type: string - name: hostlerRef in: query required: false description: Only moves leased to this hostler. schema: type: string - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: A page of moves. content: application/json: schema: $ref: '#/components/schemas/MovePage' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /moves/claims: post: operationId: claimNextMove summary: Claim the next move (ClaimNextMove) description: 'Pull dispatch: the system, never the caller, picks the REQUESTED HOSTLER move of the site with the lowest priority band, then the earliest dueBy, then the oldest request, and leases it to the hostler for the site''s `leaseSeconds`. The trailer leaves its place (StartMoving). A hostler holds at most one CLAIMED move (409 `hostler-busy`). 404 `no-claimable-move` when nothing waits.' tags: - Moves parameters: - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ClaimMoveRequest' responses: '201': description: The claimed move. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Move' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /moves/{moveId}/completions: post: operationId: completeMove summary: Complete a move (CompleteMove) description: 'The trailer arrives at `actualLocation` (default: the destination); a location other than the destination needs a `deviationNote` (422 `unexplained-destination`). Only the lease holder completes a HOSTLER move (409 `not-lease-holder`); a gate clerk or dock operator completes a VISITING_DRIVER move without `hostlerRef`. The trailer and the move change in one transaction; an occupied destination is refused (409 `location-occupied`) and the move stays CLAIMED.' tags: - Moves parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: moveId in: path required: true description: The move id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CompleteMoveRequest' responses: '200': description: The completed move. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Move' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /moves/{moveId}/cancellations: post: operationId: cancelMove summary: Cancel a move (CancelMove) description: Cancels a REQUESTED or CLAIMED move. Cancelling a CLAIMED HOSTLER move returns the trailer to where it was (ReturnToOrigin); a VISITING_DRIVER move cannot be cancelled once the trailer is at the gate (409 `illegal-transition`). tags: - Moves parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: moveId in: path required: true description: The move id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CancelMoveRequest' responses: '200': description: The cancelled move. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Move' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /inspections/{inspectionId}: get: operationId: getInspection summary: Get an inspection description: Returns the inspection with an `ETag` of its version (404 `inspection-not-found`). tags: - Inspections parameters: - name: inspectionId in: path required: true description: The inspection id. schema: type: string minLength: 1 maxLength: 128 responses: '200': description: The inspection. headers: ETag: $ref: '#/components/headers/ETag' content: application/json: schema: $ref: '#/components/schemas/Inspection' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /inspections/{inspectionId}/items/{itemCode}: put: operationId: recordInspectionItem summary: Record an inspection item (RecordInspectionItem) description: 'Records what the inspector found at one item of an OPEN inspection: `PASS`, `FAIL` or `NOT_APPLICABLE` (only where the template item has `allowNotApplicable`, else 422 `not-applicable-not-allowed`), with an optional note (500 characters) and opaque evidence references (strings that point at photos or documents held elsewhere; at most 20, each at most 256 characters, no binary). Recording again replaces the earlier result. A completed inspection is final: 409 `inspection-closed`; an item the snapshot does not have is 422 `unknown-item`. Raises nothing.' tags: - Inspections parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: inspectionId in: path required: true description: The inspection id. schema: type: string minLength: 1 maxLength: 128 - name: itemCode in: path required: true description: The item code of the template snapshot. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RecordInspectionItemRequest' example: result: FAIL note: bolt cut at the hinge evidenceRefs: - photo:2026-11-05/abc responses: '200': description: The inspection. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Inspection' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /inspections/{inspectionId}/completions: post: operationId: completeInspection summary: Complete an inspection (CompleteInspection) description: 'Completes an OPEN inspection, once and for good. Every REQUIRED item needs a result first (409 `required-item-pending`). The outcome is `FAILED` when any required item failed, `PASSED` otherwise. A FAILED inspection places a hold on the trailer in the SAME transaction, with the reason of its most severe failed item (the template item says which: `SECURITY`, `SEAL_BROKEN`, `DAMAGED`, `NOT_FOUND` or `QUALITY`, the default), unless the trailer already carries a hold; releasing it stays the existing human action (`POST /trailers/{trailerId}/hold-releases`), and a re-inspection can then be opened. `conditionGrade` is an optional record of the equipment, never the verdict. Raises InspectionCompleted and, for a FAILED inspection, InspectionFailed (and TrailerHeld when it held the trailer). Completing again is 409 `inspection-closed`.' tags: - Inspections parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: inspectionId in: path required: true description: The inspection id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/CompleteInspectionRequest' example: conditionGrade: CLEAN responses: '200': description: The completed inspection, PASSED or FAILED. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Inspection' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /inspection-templates: get: operationId: listInspectionTemplates summary: List the inspection templates description: 'Lists the LATEST version of every template, by id, one keyset page at a time: the built-in ones (`tractor-trailer-17-point`, `empty-container-7-point`, `reefer-pre-cool-and-sanitation`, read-only, `builtIn` true) and the ones a site published (ADR 0015). A query parameter this operation does not define is a 400 `unknown-query-parameter`.' tags: - Inspections parameters: - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: A page of templates. content: application/json: schema: $ref: '#/components/schemas/InspectionTemplatePage' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/InternalError' /inspection-templates/{templateId}: get: operationId: getInspectionTemplate summary: Get the latest version of an inspection template description: Returns the highest published version of the template (404 `template-not-found`). tags: - Inspections parameters: - name: templateId in: path required: true description: The template id, lowercase letters, digits and hyphens. schema: type: string minLength: 1 maxLength: 128 x-pagination-exempt: view responses: '200': description: The template. content: application/json: schema: $ref: '#/components/schemas/InspectionTemplate' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /inspection-templates/{templateId}/versions/{version}: get: operationId: getInspectionTemplateVersion summary: Get one version of an inspection template description: Returns that version, exactly as published (404 `template-not-found`). tags: - Inspections parameters: - name: templateId in: path required: true description: The template id. schema: type: string minLength: 1 maxLength: 128 - name: version in: path required: true description: The template version. schema: type: integer minimum: 1 x-pagination-exempt: view responses: '200': description: The template version. content: application/json: schema: $ref: '#/components/schemas/InspectionTemplate' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' put: operationId: publishInspectionTemplate summary: Publish an inspection template version (PublishInspectionTemplate) description: 'Publishes version N of a custom checklist (ADR 0015). A published version is IMMUTABLE: the same content again answers 200 and changes nothing, other content under a published version is 409 `template-version-immutable`; a new version is a new number. An inspection keeps a snapshot of the version it was opened from, so a later version never rewrites history. The built-in template ids are read-only (409 `template-is-built-in`). Item codes are lowercase letters, digits and hyphens, unique in the template; at most 100 items; an item without a `holdReason` holds a failed trailer for `QUALITY`. A malformed template is 422 `validation`. Raises nothing.' tags: - Inspections parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: templateId in: path required: true description: The template id. schema: type: string minLength: 1 maxLength: 128 - name: version in: path required: true description: The version to publish, 1 or more. schema: type: integer minimum: 1 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PublishInspectionTemplateRequest' example: title: Yard entry check items: - itemCode: lights text: Lights and reflectors work. required: true - itemCode: seal-intact text: The seal is intact and matches the paperwork. required: true holdReason: SEAL_BROKEN responses: '200': description: The same version was already published with this content. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/InspectionTemplate' '201': description: The version is published. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/InspectionTemplate' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /yard-checks: post: operationId: openYardCheck summary: Open a yard check (OpenYardCheck) description: At most one OPEN yard check per site (409 `yard-check-open`). tags: - Yard checks parameters: - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/OpenYardCheckRequest' responses: '201': description: The open yard check. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/YardCheck' example: yardCheckId: yck-3a4b5c6d-7e8f-4091-a2b3-c4d5e6f70819 siteId: WH1 state: OPEN openedAt: '2026-11-05T15:00:00Z' closedAt: null observations: [] discrepancies: [] version: 1 '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /yard-checks/{yardCheckId}/observations: post: operationId: recordObservation summary: Record an observation (RecordObservation) description: Records what was found at one location (a unit number, or empty). A location is observed at most once per check (409 `location-already-observed`). tags: - Yard checks parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: yardCheckId in: path required: true description: The yard check id. schema: type: string minLength: 1 maxLength: 128 requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ObservationRequest' responses: '200': description: The yard check. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/YardCheck' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /yard-checks/{yardCheckId}/closures: post: operationId: closeYardCheck summary: Close a yard check (CloseYardCheck) description: Reconciles the observations with the model and raises YardCheckClosed with the discrepancies. A location not observed is MISSING when the model records a trailer there. Closing only reports; the supervisor corrects with moves. tags: - Yard checks parameters: - $ref: '#/components/parameters/IdempotencyKey' - name: yardCheckId in: path required: true description: The yard check id. schema: type: string minLength: 1 maxLength: 128 responses: '200': description: The closed yard check. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/YardCheck' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /sites/{siteId}/yard-board: get: operationId: getYardBoard summary: Get the yard board description: 'The live spot and door map of one site: every active Yard and Dock slot with the trailer on it, the trailers in motion and the open moves. A site with no known locations answers 404.' tags: - Yard board parameters: - name: siteId in: path required: true description: The site code. schema: type: string minLength: 1 maxLength: 128 x-pagination-exempt: view responses: '200': description: The board. content: application/json: schema: $ref: '#/components/schemas/YardBoard' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /sites/{siteId}/yard-policy: get: operationId: getYardPolicy summary: Get the yard policy description: 'Answers the declared policy, or the default one (`declared` false) for a site that never declared one: appointments not required, seal mismatch FLAG, lease 300 s, no detention free time. An unknown site is not an error; the only 404 is `resource-not-found` (a NUL character in the path).' tags: - Yard policy parameters: - name: siteId in: path required: true description: The site code. schema: type: string minLength: 1 maxLength: 128 x-pagination-exempt: view responses: '200': description: The policy. headers: ETag: $ref: '#/components/headers/ETag' content: application/json: schema: $ref: '#/components/schemas/YardPolicy' example: siteId: WH1 requireAppointment: false holdingSpotCodes: - WH1-YARD-H01 parkingZoneIds: - zone-yard dwellThresholdMinutes: DRY_VAN: 1440 REEFER: 720 leaseSeconds: 300 sealMismatchAction: FLAG suspendedCarrierAction: NONE freeTimeMinutes: 120 minimumSealClass: null requireSecuringBeforeDoorWork: false allowHazmatOnUnclassifiedSpots: false requiredInspections: - gate: PRE_DOCK templateId: tractor-trailer-17-point appliesTo: purposes: [] trailerKinds: - REEFER version: 1 declared: true '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' put: operationId: declareYardPolicy summary: Declare the yard policy (DeclareYardPolicy) description: Replaces the policy of the site. Holding spots must be known Yard slots of the site (422 `unknown-location`); thresholds and lease must be positive (422 `validation`). `If-Match` makes the replacement conditional on the policy version (412 `precondition-failed`). The only 404 is `resource-not-found` (a NUL character in the path). tags: - Yard policy parameters: - name: siteId in: path required: true description: The site code. schema: type: string minLength: 1 maxLength: 128 - $ref: '#/components/parameters/IdempotencyKey' - $ref: '#/components/parameters/IfMatch' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DeclareYardPolicyRequest' responses: '200': description: The declared policy. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' ETag: $ref: '#/components/headers/ETag' content: application/json: schema: $ref: '#/components/schemas/YardPolicy' example: siteId: WH1 requireAppointment: false holdingSpotCodes: - WH1-YARD-H01 parkingZoneIds: - zone-yard dwellThresholdMinutes: DRY_VAN: 1440 REEFER: 720 leaseSeconds: 300 sealMismatchAction: FLAG suspendedCarrierAction: NONE freeTimeMinutes: 120 minimumSealClass: null requireSecuringBeforeDoorWork: false allowHazmatOnUnclassifiedSpots: false requiredInspections: - gate: PRE_DOCK templateId: tractor-trailer-17-point appliesTo: purposes: [] trailerKinds: - REEFER version: 1 declared: true '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '412': $ref: '#/components/responses/PreconditionFailed' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /dwell-sweeps: post: operationId: sweepDwell summary: Run the dwell sweep (DwellSweep) description: Raises TrailerDwellExceeded once per trailer and threshold crossing (the trailer remembers the highest threshold alerted). Naturally idempotent; run by a CronJob. A trailer that another request changed meanwhile is skipped (the next sweep sees it), so the sweep never answers 409 `concurrent-modification`. tags: - Sweeps parameters: - $ref: '#/components/parameters/OptionalIdempotencyKey' requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/DwellSweepRequest' responses: '200': description: The sweep result. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Sweep' '400': $ref: '#/components/responses/BadRequest' '409': $ref: '#/components/responses/Conflict' '500': $ref: '#/components/responses/InternalError' /move-lease-sweeps: post: operationId: sweepMoveLeases summary: Run the lease-expiry sweep (ExpireLease) description: Returns every CLAIMED HOSTLER move whose lease ran out to REQUESTED and the trailer to where it was (ReturnToOrigin). Naturally idempotent; run by a CronJob. A move that another request changed meanwhile is skipped (the next sweep sees it), so the sweep never answers 409 `concurrent-modification`. tags: - Sweeps parameters: - $ref: '#/components/parameters/OptionalIdempotencyKey' responses: '200': description: The sweep result. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Sweep' '400': $ref: '#/components/responses/BadRequest' '409': $ref: '#/components/responses/Conflict' '500': $ref: '#/components/responses/InternalError' /reports/yard-dwell: get: operationId: getYardDwellReport summary: Yard dwell report description: Read-only analytics over the analytical database (ADR 0006). The API answers the contract shape from the analytics read-side port; until the analytics read side is wired the report has no rows. `from` and `to` are required RFC 3339 instants (to after from, at most 92 days). tags: - Reports parameters: - $ref: '#/components/parameters/ReportFrom' - $ref: '#/components/parameters/ReportTo' - name: siteId in: query required: false description: Only this site. schema: type: string responses: '200': description: The report. content: application/json: schema: $ref: '#/components/schemas/YardDwellReport' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/InternalError' /reports/door-utilisation: get: operationId: getDoorUtilisationReport summary: Door utilisation report description: Read-only analytics over the analytical database (ADR 0006). The API answers the contract shape from the analytics read-side port; until the analytics read side is wired the report has no rows. `from` and `to` are required RFC 3339 instants (to after from, at most 92 days). tags: - Reports parameters: - $ref: '#/components/parameters/ReportFrom' - $ref: '#/components/parameters/ReportTo' - name: siteId in: query required: false description: Only this site. schema: type: string responses: '200': description: The report. content: application/json: schema: $ref: '#/components/schemas/DoorUtilisationReport' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/InternalError' /reports/hostler-productivity: get: operationId: getHostlerProductivityReport summary: Hostler productivity report description: Read-only analytics over the analytical database (ADR 0006). The API answers the contract shape from the analytics read-side port; until the analytics read side is wired the report has no rows. `from` and `to` are required RFC 3339 instants (to after from, at most 92 days). tags: - Reports parameters: - $ref: '#/components/parameters/ReportFrom' - $ref: '#/components/parameters/ReportTo' - name: siteId in: query required: false description: Only this site. schema: type: string responses: '200': description: The report. content: application/json: schema: $ref: '#/components/schemas/HostlerProductivityReport' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/InternalError' /reports/turn-time: get: operationId: getTurnTimeReport summary: Gate-to-gate turn time report description: 'Minutes from VisitCheckedIn.arrived_at to VisitCheckedOut.departed_at (the event''s on_site_minutes) per visit purpose, over the visits that checked OUT in the window, with the average, the median (p50), the 90th percentile (p90) and the maximum. Percentiles are reported because an average hides the long tail. A visit whose check-in the projection never saw has no purpose and is left out. Until the analytics read side is wired the report has no rows. `from` and `to` are required RFC 3339 instants (to after from, at most 92 days). Definitions: ADR 0011.' tags: - Reports parameters: - $ref: '#/components/parameters/ReportFrom' - $ref: '#/components/parameters/ReportTo' - name: siteId in: query required: false description: Only this site. schema: type: string responses: '200': description: The report. content: application/json: schema: $ref: '#/components/schemas/TurnTimeReport' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/InternalError' /reports/detention-exposure: get: operationId: getDetentionExposureReport summary: Detention exposure report description: 'Among the trailers that DEPARTED in the window, those whose dwell exceeded `thresholdMinutes` (default 120, the two hour norm), per trailer kind. This is exposure, a proxy: no standard definition of detention exists and charging is out of scope. A dwell equal to the threshold does not exceed it. Until the analytics read side is wired the report has no rows. `from` and `to` are required RFC 3339 instants (to after from, at most 92 days). Definitions: ADR 0011.' tags: - Reports parameters: - $ref: '#/components/parameters/ReportFrom' - $ref: '#/components/parameters/ReportTo' - name: siteId in: query required: false description: Only this site. schema: type: string - $ref: '#/components/parameters/DetentionThresholdMinutes' responses: '200': description: The report. content: application/json: schema: $ref: '#/components/schemas/DetentionExposureReport' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/InternalError' /reports/exceptions: get: operationId: getExceptionsReport summary: Exception rates report description: 'Per site, for the window: visits checked in and rejected (rejectionRate = rejected / (checkedIn + rejected)), seal exceptions (sealExceptionRate = per check-in; it counts the exceptions raised at the gate of rejected visits too, so it is not capped at 1), trailer holds placed by reason, yard checks closed and the discrepancies they found. Rates are null when their denominator is zero. Until the analytics read side is wired the report has no rows. `from` and `to` are required RFC 3339 instants (to after from, at most 92 days). Definitions: ADR 0011.' tags: - Reports parameters: - $ref: '#/components/parameters/ReportFrom' - $ref: '#/components/parameters/ReportTo' - name: siteId in: query required: false description: Only this site. schema: type: string responses: '200': description: The report. content: application/json: schema: $ref: '#/components/schemas/ExceptionsReport' '400': $ref: '#/components/responses/BadRequest' '500': $ref: '#/components/responses/InternalError' /reports/freshness: get: operationId: getReportsFreshness summary: Report freshness description: When the projector last folded an event. tags: - Reports responses: '200': description: The freshness. content: application/json: schema: type: object properties: lastEventAt: type: string format: date-time nullable: true asOf: type: string format: date-time required: - asOf '500': $ref: '#/components/responses/InternalError' components: parameters: IdempotencyKey: name: Idempotency-Key in: header required: true description: 'Caller-generated unique key (a UUID per logical submit, 1-128 printable ASCII characters) that makes a retried request safe. Required on every POST and PUT (400 `idempotency-key-required`; `idempotency-key-invalid` when malformed). A replay with the same key, method, path and body returns the original response with `Idempotency-Replayed: true`; the same key with a different method, path or body is 409 `idempotency-key-reused`. What is replayed depends on the replay class of the problem type (ADR 0019). A success is replayed. A refusal that cannot change for that request (a malformed or invalid field, a 404 on an id this service minted, 422 `validation`) is replayed too, and so is 409 `carrier-suspended`, whose REJECTED visit was committed with it. A refusal the same request could pass later is NOT stored: the key stays free and the retry runs the command again. Those are the optimistic-lock conflict 409 `concurrent-modification`, a state the aggregate is not in yet (409 `visit-already-open`, 409 `trailer-on-hold`, 409 `location-occupied`), a fact that has not arrived yet (422 `unknown-location`, 422 `unknown-appointment`) and 404 `no-claimable-move`. A 5xx is never stored. After such a refusal the key is free, so the same key with a different body is a new request, not `idempotency-key-reused`.' schema: type: string minLength: 1 maxLength: 128 OptionalIdempotencyKey: name: Idempotency-Key in: header required: false description: 'Optional on the sweeps, which are naturally idempotent (a repeat finds nothing new to do). When sent it behaves as on every other POST: a replay with the same key, method, path and body returns the stored answer with `Idempotency-Replayed: true`, and the same key with a different request is 409 `idempotency-key-reused`. A refusal the same request could pass later is not stored (ADR 0019).' schema: type: string minLength: 1 maxLength: 128 IfMatch: name: If-Match in: header required: false description: The ETag of the policy version the caller read. A value that is not an entity tag of a policy version is a 400 `invalid-if-match`. schema: type: string Limit: name: limit in: query required: false description: Page size, 1-500, default 100. Anything else is a 400 `invalid-limit`. schema: type: integer minimum: 1 maximum: 500 default: 100 Cursor: name: cursor in: query required: false description: The opaque `nextCursor` of the previous page. A non-empty value this API did not issue is a 400 `invalid-cursor`. schema: type: string ReportFrom: name: from in: query required: true description: Start of the report window (RFC 3339). A missing or unparsable value is a 400 `invalid-report-range`. schema: type: string format: date-time ReportTo: name: to in: query required: true description: End of the report window (RFC 3339), after `from`, at most 92 days later. Anything else is a 400 `invalid-report-range`. schema: type: string format: date-time DetentionThresholdMinutes: name: thresholdMinutes in: query required: false description: A departed trailer whose dwell exceeds this many minutes counts as detention exposure. Defaults to 120 (the two hour norm). Anything else than an integer from 1 to 10080 is a 400 `invalid-threshold-minutes`. schema: type: integer minimum: 1 maximum: 10080 default: 120 headers: IdempotencyReplayed: description: Present, with the value `true`, only when the answer is a replay of the stored answer of an earlier request with the same Idempotency-Key (a success or a refusal that cannot change; a refusal the same request could pass later is never stored). schema: type: string enum: - 'true' ETag: description: A weak validator of the aggregate version, e.g. `W/"3"`. schema: type: string responses: BadRequest: description: Malformed JSON body, an unknown field, a NUL byte, a missing or invalid Idempotency-Key, or an invalid path or query parameter (on the list operations an unknown query parameter, `limit`, `cursor` or filter value; on the reports the `from`/`to` window; on the yard policy an `If-Match` that is not an entity tag). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' examples: malformedBody: value: type: https://errors.yard-management.warehouse-systems.dev/malformed-request-body title: Malformed request body status: 400 detail: request body is not valid JSON for this operation instance: /trailers idempotencyKeyRequired: value: type: https://errors.yard-management.warehouse-systems.dev/idempotency-key-required title: Idempotency-Key header is required status: 400 detail: send an Idempotency-Key header instance: /trailers unknownQueryParameter: value: type: https://errors.yard-management.warehouse-systems.dev/unknown-query-parameter title: Unknown query parameter status: 400 detail: 'unknown query parameter: "colour"' instance: /trailers invalidLimit: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-limit title: Limit is invalid status: 400 detail: limit must be an integer between 1 and 500 instance: /trailers invalidCursor: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-cursor title: Cursor is invalid status: 400 detail: cursor is not a valid page token instance: /trailers invalidState: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-state title: State is invalid status: 400 detail: 'state is not one of the values of this operation: "PARKING"' instance: /trailers invalidIfMatch: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-if-match title: If-Match is invalid status: 400 detail: 'If-Match is not an entity tag of a policy version: "abc"' instance: /sites/WH1/yard-policy invalidReportRange: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-report-range title: Report range is invalid status: 400 detail: from and to must be RFC 3339 instants, to after from and at most 92 days later instance: /reports/yard-dwell NotFound: description: The addressed resource does not exist, or the path carries a NUL character (`resource-not-found`). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' examples: trailerNotFound: value: type: https://errors.yard-management.warehouse-systems.dev/trailer-not-found title: Trailer not found status: 404 detail: trailer not found instance: /trailers visitNotFound: value: type: https://errors.yard-management.warehouse-systems.dev/visit-not-found title: Visit not found status: 404 detail: visit not found instance: /visits inspectionNotFound: value: type: https://errors.yard-management.warehouse-systems.dev/inspection-not-found title: Inspection not found status: 404 detail: inspection not found instance: /inspections/insp-nope templateNotFound: value: type: https://errors.yard-management.warehouse-systems.dev/template-not-found title: Inspection template not found status: 404 detail: inspection template not found instance: /inspection-templates/nope moveNotFound: value: type: https://errors.yard-management.warehouse-systems.dev/move-not-found title: Move not found status: 404 detail: move not found instance: /moves yardCheckNotFound: value: type: https://errors.yard-management.warehouse-systems.dev/yard-check-not-found title: Yard check not found status: 404 detail: yard check not found instance: /yard-checks siteNotFound: value: type: https://errors.yard-management.warehouse-systems.dev/site-not-found title: Site not found status: 404 detail: site not found instance: /sites noClaimableMove: value: type: https://errors.yard-management.warehouse-systems.dev/no-claimable-move title: No move waits for a hostler status: 404 detail: no claimable move instance: /moves/claims resourceNotFound: value: type: https://errors.yard-management.warehouse-systems.dev/resource-not-found title: Resource not found status: 404 detail: no resource matches the requested path instance: /trailers/trl-%00 Conflict: description: The request conflicts with the state of the yard (an occupied place, an open move, an illegal transition) or reuses an Idempotency-Key. On every POST and PUT except the two sweeps it is also the answer when another request changed the same aggregate first (`concurrent-modification`); read the resource again and retry with a new Idempotency-Key. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' examples: locationOccupied: value: type: https://errors.yard-management.warehouse-systems.dev/location-occupied title: The location already holds a trailer status: 409 detail: location is occupied instance: /trailers carrierSuspended: value: type: https://errors.yard-management.warehouse-systems.dev/carrier-suspended title: The carrier is suspended status: 409 detail: 'the carrier is suspended: SCAC ACME is suspended; visit vis-0a1b is recorded as REJECTED' instance: /visits sealClassTooLow: value: type: https://errors.yard-management.warehouse-systems.dev/seal-class-too-low title: The seal class is below the minimum of the site status: 409 detail: 'seal class is too low: the site requires class H and the seal is class I' instance: /visits placementRuleViolated: value: type: https://errors.yard-management.warehouse-systems.dev/placement-rule-violated title: The spot is not allowed for what the trailer carries status: 409 detail: 'placement rule violated: a trailer with hazmat class 3 may only be placed on a HAZMAT spot; spot WH1-YARD-P014 is not classified' instance: /moves trailerNotSecured: value: type: https://errors.yard-management.warehouse-systems.dev/trailer-not-secured title: The trailer is not secured status: 409 detail: 'trailer is not secured: secure the trailer (restraint or wheel chocks) before door work starts' instance: /trailers/trl-8f7e6d5c-4b3a-4291-8071-6f5e4d3c2b1a/door-work-starts trailerStillSecured: value: type: https://errors.yard-management.warehouse-systems.dev/trailer-still-secured title: The trailer is still secured status: 409 detail: 'trailer is still secured: secured by WHEEL_CHOCKS at door WH1-D02' instance: /moves inspectionRequired: value: type: https://errors.yard-management.warehouse-systems.dev/inspection-required title: A passed inspection is required first status: 409 detail: 'inspection required: no passed PRE_DOCK inspection of yard-entry for this visit' instance: /moves inspectionFailed: value: type: https://errors.yard-management.warehouse-systems.dev/inspection-failed title: The latest inspection failed status: 409 detail: 'inspection failed: the latest PRE_DOCK inspection of yard-entry failed; inspect again' instance: /moves requiredItemPending: value: type: https://errors.yard-management.warehouse-systems.dev/required-item-pending title: A required item has no result yet status: 409 detail: 'required item pending: lights' instance: /inspections/insp-5b6c7d8e-9f01-4a2b-8c3d-4e5f60718293/completions idempotencyKeyReused: value: type: https://errors.yard-management.warehouse-systems.dev/idempotency-key-reused title: Idempotency-Key was already used with a different request status: 409 detail: the key was used with another request instance: /trailers concurrentModification: value: type: https://errors.yard-management.warehouse-systems.dev/concurrent-modification title: The resource was modified by another request; re-fetch the latest version and retry status: 409 detail: 'ports: concurrent modification' instance: /moves/mv-2d3e4f50-6172-4839-8a9b-0c1d2e3f4a5b/completions Unprocessable: description: A value or reference rule failed (unknown location, appointment or inspection template, unknown inspection item, invalid carrier, invalid unit number, seal class, hazmat class or UN number, unexplained destination, validation). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' examples: unknownTemplate: value: type: https://errors.yard-management.warehouse-systems.dev/unknown-template title: Unknown inspection template status: 422 detail: 'unknown inspection template: ghost' instance: /trailers/trl-8f7e6d5c-4b3a-4291-8071-6f5e4d3c2b1a/inspections unknownLocation: value: type: https://errors.yard-management.warehouse-systems.dev/unknown-location title: Unknown location status: 422 detail: location is not an active slot of the site instance: /trailers invalidUnitNumber: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-unit-number title: The unit number is invalid status: 422 detail: 'invalid unit number: "CSQU3054380" has check digit 0; the expected check digit is 3' instance: /visits invalidHazmatClass: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-hazmat-class title: The hazmat class is invalid status: 422 detail: 'invalid hazmat class: "1.7" is not a US DOT hazard class (1 to 9) or division (such as 1.4, 2.1, 4.3, 6.1)' instance: /visits invalidUnNumber: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-un-number title: The UN number is invalid status: 422 detail: 'invalid UN number: "UN12" is not UN and four digits (for example UN1203)' instance: /visits invalidSealClass: value: type: https://errors.yard-management.warehouse-systems.dev/invalid-seal-class title: The seal class is invalid status: 422 detail: 'invalid seal class: "X" is not one of I, S or H' instance: /visits PreconditionFailed: description: The If-Match version is not the current version. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' examples: stale: value: type: https://errors.yard-management.warehouse-systems.dev/precondition-failed title: Precondition failed status: 412 detail: the policy version changed instance: /trailers InternalError: description: Unexpected failure; the detail never leaks internals. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' examples: internal: value: type: https://errors.yard-management.warehouse-systems.dev/internal-error title: Internal server error status: 500 detail: an unexpected error occurred instance: /trailers ServiceUnavailable: description: A runtime dependency (Postgres or Kafka) is unavailable or the process is draining. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' examples: down: value: type: https://errors.yard-management.warehouse-systems.dev/dependency-unavailable title: A runtime dependency is unavailable status: 503 detail: 'postgres: connection refused' instance: /trailers schemas: Problem: type: object properties: type: type: string format: uri title: type: string status: type: integer format: int32 detail: type: string instance: type: string required: - type - title - status - detail - instance description: RFC 7807 problem document used for every non-2xx response. Status: type: object properties: status: type: string description: '`ok` (healthz), `ready` or `not_ready` (readyz).' required: - status Location: type: object properties: kind: type: string enum: - SPOT - DOOR code: type: string minLength: 1 maxLength: 128 description: A facility-layout locationCode. required: - kind - code TrailerIn: type: object properties: unitNumber: type: string minLength: 1 maxLength: 64 description: Free-form for a domestic road trailer. For a CONTAINER, or when `unitNumberScheme` is ISO6346, an ISO 6346 container number such as CSQU3054383 (422 `invalid-unit-number` otherwise). unitNumberScheme: type: string enum: - ISO6346 description: Optional. Declares that the unit number is an ISO 6346 number and must pass its check digit. A CONTAINER is always checked. carrierScac: type: string pattern: ^[A-Z]{2,4}$ description: Defaults to the visit's carrierScac. kind: type: string enum: - DRY_VAN - REEFER - FLATBED - CONTAINER loadState: type: string enum: - EMPTY - LOADED - PARTIAL sealNumber: type: string maxLength: 64 description: The seal found at the gate; compared with the appointment's expected seal. sealClass: type: string enum: - I - S - H description: Optional ISO 17712 class of the seal (I indicative, S security, H high security); needs a sealNumber. Refused with 409 `seal-class-too-low` when below the `minimumSealClass` of the site yard policy. hazmatClass: type: string enum: - '1' - '1.1' - '1.2' - '1.3' - '1.4' - '1.5' - '1.6' - '2' - '2.1' - '2.2' - '2.3' - '3' - '4' - '4.1' - '4.2' - '4.3' - '5' - '5.1' - '5.2' - '6' - '6.1' - '6.2' - '7' - '8' - '9' description: Optional. The US DOT hazard class or division of what the trailer carries (49 CFR 172.101). Any other value is 422 `invalid-hazmat-class`. A trailer that declares one is placed only on a HAZMAT spot (ADR 0014). unNumber: type: string pattern: ^UN[0-9]{4}$ description: Optional. The UN number of the material, `UN` and four digits; needs a `hazmatClass` (422 `validation`), malformed is 422 `invalid-un-number`. requiresTemperatureControl: type: boolean default: false description: Optional. True for a load that needs a refrigeration plug; such a trailer is placed only on a REEFER_PLUG spot where the site has any (ADR 0014). required: - unitNumber - kind - loadState CheckInVisitRequest: type: object properties: siteId: type: string minLength: 1 maxLength: 64 carrier: type: string minLength: 1 maxLength: 100 carrierScac: type: string pattern: ^[A-Z]{2,4}$ tractorPlate: type: string minLength: 1 maxLength: 32 driverRef: type: string maxLength: 64 description: Opaque reference, never a name or licence number. purpose: type: string enum: - DROP - LIVE_UNLOAD - LIVE_LOAD - PICKUP - BOBTAIL appointmentId: type: string maxLength: 64 trailers: type: array items: $ref: '#/components/schemas/TrailerIn' description: Trailers brought in. BOBTAIL and PICKUP bring none; a visit that names an appointment brings exactly one. required: - siteId - carrier - tractorPlate - purpose RejectVisitRequest: type: object properties: siteId: type: string minLength: 1 maxLength: 64 carrier: type: string minLength: 1 maxLength: 100 carrierScac: type: string pattern: ^[A-Z]{2,4}$ tractorPlate: type: string minLength: 1 maxLength: 32 appointmentId: type: string maxLength: 64 reason: type: string enum: - APPOINTMENT_REQUIRED - UNKNOWN_APPOINTMENT - SEAL_MISMATCH - TRAILER_ALREADY_ON_SITE - SITE_REQUEST required: - siteId - carrier - tractorPlate - reason Visit: type: object properties: visitId: type: string siteId: type: string carrier: type: string carrierScac: type: string nullable: true tractorPlate: type: string driverRef: type: string nullable: true purpose: type: string enum: - DROP - LIVE_UNLOAD - LIVE_LOAD - PICKUP - BOBTAIL appointmentId: type: string nullable: true state: type: string enum: - CHECKED_IN - CHECKED_OUT - REJECTED rejectionReason: type: string enum: - APPOINTMENT_REQUIRED - UNKNOWN_APPOINTMENT - SEAL_MISMATCH - TRAILER_ALREADY_ON_SITE - SITE_REQUEST - CARRIER_SUSPENDED - null nullable: true carrierFlag: type: string enum: - SUSPENDED - null nullable: true description: SUSPENDED when the gate admitted the visit of a suspended carrier because the yard policy action is FLAG (ADR 0016); null otherwise. trailersIn: type: array items: type: string trailersOut: type: array items: type: string arrivedAt: type: string format: date-time departedAt: type: string format: date-time nullable: true version: type: integer minimum: 1 required: - visitId - siteId - carrier - tractorPlate - purpose - state - trailersIn - trailersOut - arrivedAt - version Seal: type: object properties: number: type: string nullable: true state: type: string enum: - NONE - INTACT - BROKEN - APPLIED - VERIFIED - MISMATCH description: 'INTACT: present and unbroken, not yet verified (what existing flows produce). APPLIED: recorded as applied at the origin or dock. VERIFIED: checked at the gate against the expected number and equal. MISMATCH: checked and different (SealExceptionRaised was raised). BROKEN: found broken. NONE: no seal.' class: type: string enum: - I - S - H - null nullable: true description: The ISO 17712 class of the seal; null when none was declared. required: - number - state Trailer: type: object properties: trailerId: type: string siteId: type: string unitNumber: type: string unitNumberScheme: type: string enum: - ISO6346 - null nullable: true description: ISO6346 when the unit number was validated as an ISO 6346 container number; null for a free-form number (and for a trailer stored before ADR 0012). carrierScac: type: string nullable: true kind: type: string enum: - DRY_VAN - REEFER - FLATBED - CONTAINER loadState: type: string enum: - EMPTY - LOADED - PARTIAL state: type: string enum: - PARKED - IN_MOVE - DOCKED - DEPARTED location: type: object allOf: - $ref: '#/components/schemas/Location' nullable: true doorWork: type: string enum: - WAITING - IN_PROGRESS - DONE - null nullable: true securedAt: type: string format: date-time nullable: true description: When the DOCKED trailer was secured (ADR 0013); null while it is not secured, and for every trailer stored before the interlock. securedBy: type: string enum: - RESTRAINT - WHEEL_CHOCKS - null nullable: true description: How the trailer is secured, a vehicle restraint engaged or the wheels chocked (OSHA 29 CFR 1910.178(k)(1), ANSI MH30.3); null while it is not secured. securerRef: type: string nullable: true description: The optional reference of the person who secured the trailer. hazmatClass: type: string enum: - '1' - '1.1' - '1.2' - '1.3' - '1.4' - '1.5' - '1.6' - '2' - '2.1' - '2.2' - '2.3' - '3' - '4' - '4.1' - '4.2' - '4.3' - '5' - '5.1' - '5.2' - '6' - '6.1' - '6.2' - '7' - '8' - '9' - null nullable: true description: The US DOT hazard class or division the trailer carries (ADR 0014); null when none was declared, and for every trailer stored before it. unNumber: type: string nullable: true pattern: ^UN[0-9]{4}$ description: The UN number of the material; null when none was declared. requiresTemperatureControl: type: boolean description: True for a load that needs a refrigeration plug; false when not declared. seal: $ref: '#/components/schemas/Seal' hold: type: string enum: - DAMAGED - SEAL_BROKEN - NOT_FOUND - QUALITY - SECURITY - null nullable: true asnNumbers: type: array items: type: string outboundRef: type: string nullable: true visitId: type: string nullable: true appointmentId: type: string nullable: true arrivedAt: type: string format: date-time departedAt: type: string format: date-time nullable: true openMoveId: type: string nullable: true version: type: integer minimum: 1 required: - trailerId - siteId - unitNumber - kind - loadState - state - seal - asnNumbers - arrivedAt - version Priority: type: object properties: band: type: integer minimum: 1 maximum: 9 description: 1 is the most urgent. dueBy: type: string format: date-time nullable: true required: - band Move: type: object properties: moveId: type: string siteId: type: string trailerId: type: string appointmentId: type: string nullable: true performer: type: string enum: - HOSTLER - VISITING_DRIVER from: type: object allOf: - $ref: '#/components/schemas/Location' nullable: true to: $ref: '#/components/schemas/Location' reason: type: string enum: - TO_DOOR - FROM_DOOR - TO_SPOT - RELOCATE - TO_HOLDING priority: $ref: '#/components/schemas/Priority' state: type: string enum: - REQUESTED - CLAIMED - COMPLETED - CANCELLED hostlerRef: type: string nullable: true leaseExpiresAt: type: string format: date-time nullable: true actualLocation: type: object allOf: - $ref: '#/components/schemas/Location' nullable: true claimedAt: type: string format: date-time nullable: true completedAt: type: string format: date-time nullable: true requestedAt: type: string format: date-time version: type: integer minimum: 1 required: - moveId - siteId - trailerId - performer - to - reason - priority - state - requestedAt - version CheckIn: type: object properties: visit: $ref: '#/components/schemas/Visit' trailers: type: array items: $ref: '#/components/schemas/Trailer' moves: type: array items: $ref: '#/components/schemas/Move' required: - visit - trailers - moves description: The visit, the trailers it brought and the moves DirectOnCheckIn created (one per trailer, created CLAIMED by the VISITING_DRIVER). A seal mismatch under the REJECT policy answers 201 with a REJECTED visit, no trailers and no moves. CheckOutRequest: type: object properties: trailersOut: type: array items: type: object properties: trailerId: type: string required: - trailerId description: Trailers leaving with the tractor. Empty for a drop or a bobtail. required: - trailersOut RequestMoveRequest: type: object properties: trailerId: type: string to: $ref: '#/components/schemas/Location' reason: type: string enum: - TO_DOOR - FROM_DOOR - TO_SPOT - RELOCATE - TO_HOLDING priorityBand: type: integer minimum: 1 maximum: 9 default: 5 dueBy: type: string format: date-time required: - trailerId - to ClaimMoveRequest: type: object properties: siteId: type: string minLength: 1 hostlerRef: type: string minLength: 1 maxLength: 64 description: Opaque hostler reference. required: - siteId - hostlerRef CompleteMoveRequest: type: object properties: hostlerRef: type: string description: The lease holder; omitted when a gate clerk or dock operator completes a VISITING_DRIVER move. actualLocation: $ref: '#/components/schemas/Location' deviationNote: type: string description: Required when actualLocation is not the destination. CancelMoveRequest: type: object properties: reason: type: string maxLength: 200 DoorWorkCompletionRequest: type: object properties: loadState: type: string enum: - EMPTY - LOADED - PARTIAL HoldRequest: type: object properties: reason: type: string enum: - DAMAGED - SEAL_BROKEN - NOT_FOUND - QUALITY - SECURITY required: - reason ClassificationRequest: type: object properties: hazmatClass: type: string enum: - '1' - '1.1' - '1.2' - '1.3' - '1.4' - '1.5' - '1.6' - '2' - '2.1' - '2.2' - '2.3' - '3' - '4' - '4.1' - '4.2' - '4.3' - '5' - '5.1' - '5.2' - '6' - '6.1' - '6.2' - '7' - '8' - '9' description: Optional. The US DOT hazard class or division; left out clears it. unNumber: type: string pattern: ^UN[0-9]{4}$ description: Optional. `UN` and four digits; needs a `hazmatClass`. requiresTemperatureControl: type: boolean default: false description: Optional. True for a load that needs a refrigeration plug. SecuringRequest: type: object properties: method: type: string enum: - RESTRAINT - WHEEL_CHOCKS description: A vehicle restraint engaged, or the wheels chocked. securerRef: type: string maxLength: 64 description: Optional reference of the person who secured the trailer. required: - method SealRequest: type: object properties: state: type: string enum: - INTACT - APPLIED - BROKEN sealNumber: type: string maxLength: 64 description: Required for INTACT and APPLIED; BROKEN keeps the recorded number. sealClass: type: string enum: - I - S - H description: Optional ISO 17712 class, for INTACT and APPLIED only. required: - state YardCheck: type: object properties: yardCheckId: type: string siteId: type: string state: type: string enum: - OPEN - CLOSED openedAt: type: string format: date-time closedAt: type: string format: date-time nullable: true observations: type: array items: type: object properties: locationCode: type: string unitNumber: type: string nullable: true required: - locationCode discrepancies: type: array items: type: object properties: kind: type: string enum: - MISSING - UNEXPECTED - WRONG_LOCATION locationCode: type: string trailerId: type: string nullable: true unitNumber: type: string nullable: true required: - kind - locationCode version: type: integer minimum: 1 required: - yardCheckId - siteId - state - openedAt - observations - discrepancies - version OpenYardCheckRequest: type: object properties: siteId: type: string minLength: 1 required: - siteId ObservationRequest: type: object properties: locationCode: type: string minLength: 1 unitNumber: type: string description: Absent when the location was found empty. required: - locationCode YardPolicy: type: object properties: siteId: type: string requireAppointment: type: boolean holdingSpotCodes: type: array items: type: string parkingZoneIds: type: array items: type: string dwellThresholdMinutes: type: object additionalProperties: type: integer minimum: 1 description: Per trailer kind (DRY_VAN, REEFER, FLATBED, CONTAINER); a kind without an entry is never alerted. leaseSeconds: type: integer minimum: 1 sealMismatchAction: type: string enum: - FLAG - REJECT freeTimeMinutes: type: integer minimum: 1 nullable: true minimumSealClass: type: string enum: - I - S - H - null nullable: true description: The lowest ISO 17712 class a seal may have at check-in and record-seal (I below S below H); null = no minimum, today's behaviour. requireSecuringBeforeDoorWork: type: boolean description: When true, door work starts only on a secured trailer (409 `trailer-not-secured` otherwise; ADR 0013). false (the default) is the behaviour before the interlock existed. A regulated site (OSHA 29 CFR 1910.178(k)(1)) sets it true; a later ADR may flip the default. allowHazmatOnUnclassifiedSpots: type: boolean description: When true, a trailer with a hazard class may take a spot whose kind is unknown at a site that has no HAZMAT spot (ADR 0014). false (the default) refuses it with 409 `placement-rule-violated`. Never lets a hazmat trailer onto a spot of another kind, nor onto an unclassified one where the site has a HAZMAT spot. suspendedCarrierAction: type: string enum: - NONE - FLAG - REJECT description: What the gate does with a visit of a carrier that dock-scheduling has suspended (ADR 0016). NONE admits it as before, FLAG admits it and sets the visit's `carrierFlag` to SUSPENDED, REJECT records a REJECTED visit (reason CARRIER_SUSPENDED) and answers 409 `carrier-suspended`. requiredInspections: type: array items: $ref: '#/components/schemas/InspectionRule' description: The inspections a trailer needs before it docks, loads or leaves (ADR 0015); empty = none, the behaviour before them. version: type: integer minimum: 1 declared: type: boolean description: False while the answer is the default policy of an undeclared site. required: - siteId - requireAppointment - holdingSpotCodes - parkingZoneIds - dwellThresholdMinutes - leaseSeconds - sealMismatchAction - suspendedCarrierAction - version - declared DeclareYardPolicyRequest: type: object properties: requireAppointment: type: boolean holdingSpotCodes: type: array items: type: string parkingZoneIds: type: array items: type: string dwellThresholdMinutes: type: object additionalProperties: type: integer minimum: 1 leaseSeconds: type: integer minimum: 1 sealMismatchAction: type: string enum: - FLAG - REJECT freeTimeMinutes: type: integer minimum: 1 minimumSealClass: type: string enum: - I - S - H description: Optional. Seals of a lower class, or with no class, are refused with 409 `seal-class-too-low`. Left out = no minimum. requireSecuringBeforeDoorWork: type: boolean default: false description: Optional. When true, door work starts only on a secured trailer (409 `trailer-not-secured`; ADR 0013). Left out = false. allowHazmatOnUnclassifiedSpots: type: boolean default: false description: Optional. When true, a trailer with a hazard class may take a spot of unknown kind at a site with no HAZMAT spot (ADR 0014). Left out = false. suspendedCarrierAction: type: string enum: - NONE - FLAG - REJECT default: NONE description: Optional. What the gate does with a visit of a carrier that dock-scheduling has suspended (ADR 0016); see the YardPolicy field of the same name. Left out it is NONE. requiredInspections: type: array maxItems: 20 items: $ref: '#/components/schemas/InspectionRule' description: Optional. The inspections a trailer must have PASSED, for its current visit, before the gated step (ADR 0015). A template nobody published is 422 `unknown-template`. Left out = none. required: - requireAppointment - sealMismatchAction - leaseSeconds InspectionRule: type: object properties: gate: type: string enum: - PRE_DOCK - PRE_LOAD - PRE_DEPARTURE description: The step that is refused (409 `inspection-required`, or `inspection-failed`) until a PASSED inspection of the template exists for the trailer's current visit. PRE_DOCK gates the move to a door, PRE_LOAD the start of door work on a trailer that is being loaded, PRE_DEPARTURE the check-out that takes the trailer. ON_DEMAND is never required. templateId: type: string appliesTo: type: object properties: purposes: type: array items: type: string enum: - DROP - LIVE_UNLOAD - LIVE_LOAD - PICKUP - BOBTAIL description: Only visits with one of these purposes; empty = every purpose. trailerKinds: type: array items: type: string enum: - DRY_VAN - REEFER - FLATBED - CONTAINER description: Only trailers of one of these kinds; empty = every kind. required: - gate - templateId OpenInspectionRequest: type: object properties: templateId: type: string templateVersion: type: integer minimum: 1 description: Optional. The template version; left out = the latest published version. gate: type: string enum: - PRE_DOCK - PRE_LOAD - PRE_DEPARTURE - ON_DEMAND visitId: type: string description: Optional. The visit the inspection is made for; left out = the visit the trailer is on. performerRef: type: string maxLength: 64 description: Optional reference of the inspector (an employee id, never a driver's name). required: - templateId - gate RecordInspectionItemRequest: type: object properties: result: type: string enum: - PASS - FAIL - NOT_APPLICABLE note: type: string maxLength: 500 evidenceRefs: type: array maxItems: 20 items: type: string maxLength: 256 description: Opaque references to photos or documents held elsewhere; strings only. required: - result CompleteInspectionRequest: type: object properties: conditionGrade: type: string enum: - CLEAN - DIRTY - ODOUR - DAMAGED description: Optional record of the equipment; never the verdict. TemplateItem: type: object properties: itemCode: type: string maxLength: 64 pattern: '^[a-z0-9][a-z0-9-]*$' text: type: string maxLength: 300 required: type: boolean allowNotApplicable: type: boolean description: Whether NOT_APPLICABLE may be recorded on the item. Left out = false. holdReason: type: string enum: - DAMAGED - SEAL_BROKEN - NOT_FOUND - QUALITY - SECURITY description: The hold a failed REQUIRED item places; left out when publishing = QUALITY. required: - itemCode - text - required PublishInspectionTemplateRequest: type: object properties: title: type: string maxLength: 120 items: type: array minItems: 1 maxItems: 100 items: $ref: '#/components/schemas/TemplateItem' required: - title - items InspectionTemplate: type: object properties: templateId: type: string version: type: integer minimum: 1 latestVersion: type: integer minimum: 1 description: The highest published version of the same template id. title: type: string builtIn: type: boolean description: A built-in template ships with the service, is read-only, and has no `publishedAt`. items: type: array items: $ref: '#/components/schemas/TemplateItem' publishedAt: type: string format: date-time nullable: true required: - templateId - version - latestVersion - title - builtIn - items - publishedAt InspectionTemplatePage: type: object properties: items: type: array items: $ref: '#/components/schemas/InspectionTemplate' nextCursor: type: string nullable: true description: Absent on the last page. required: - items InspectionItem: type: object properties: itemCode: type: string text: type: string required: type: boolean allowNotApplicable: type: boolean holdReason: type: string enum: - DAMAGED - SEAL_BROKEN - NOT_FOUND - QUALITY - SECURITY result: type: string enum: - PASS - FAIL - NOT_APPLICABLE - null nullable: true description: null while the item is pending. note: type: string nullable: true evidenceRefs: type: array items: type: string required: - itemCode - text - required - allowNotApplicable - holdReason - result - note - evidenceRefs Inspection: type: object properties: inspectionId: type: string siteId: type: string trailerId: type: string visitId: type: string nullable: true templateId: type: string templateVersion: type: integer minimum: 1 description: The version the inspection was opened from; the items below are that version's snapshot. gate: type: string enum: - PRE_DOCK - PRE_LOAD - PRE_DEPARTURE - ON_DEMAND status: type: string enum: - OPEN - PASSED - FAILED items: type: array items: $ref: '#/components/schemas/InspectionItem' performerRef: type: string nullable: true conditionGrade: type: string enum: - CLEAN - DIRTY - ODOUR - DAMAGED - null nullable: true openedAt: type: string format: date-time completedAt: type: string format: date-time nullable: true version: type: integer minimum: 1 required: - inspectionId - siteId - trailerId - visitId - templateId - templateVersion - gate - status - items - performerRef - conditionGrade - openedAt - completedAt - version InspectionPage: type: object properties: items: type: array items: $ref: '#/components/schemas/Inspection' nextCursor: type: string nullable: true description: Absent on the last page. required: - items YardBoard: type: object properties: siteId: type: string asOf: type: string format: date-time spots: type: array items: $ref: '#/components/schemas/BoardPlace' doors: type: array items: $ref: '#/components/schemas/BoardPlace' inMove: type: array items: $ref: '#/components/schemas/Trailer' openMoves: type: array items: $ref: '#/components/schemas/Move' required: - siteId - asOf - spots - doors - inMove - openMoves BoardPlace: type: object properties: code: type: string kind: type: string enum: - SPOT - DOOR dockFlow: type: string enum: - Inbound - Outbound - Both - null nullable: true closed: type: boolean trailer: type: object allOf: - $ref: '#/components/schemas/Trailer' nullable: true required: - code - kind - closed Sweep: type: object properties: sweptAt: type: string format: date-time count: type: integer minimum: 0 required: - sweptAt - count description: How many trailers were alerted (dwell) or moves returned to REQUESTED (lease). DwellSweepRequest: type: object properties: siteId: type: string description: Limit the sweep to one site; absent sweeps every site. YardDwellReport: type: object properties: from: type: string format: date-time to: type: string format: date-time siteId: type: string nullable: true rows: type: array items: type: object properties: kind: type: string enum: - DRY_VAN - REEFER - FLATBED - CONTAINER trailers: type: integer avgDwellMinutes: type: number maxDwellMinutes: type: integer avgDriverWaitMinutes: type: number nullable: true description: The wait. Mean of arrival to the first DoorWorkStarted; null when no trailer had door work. p50DwellMinutes: type: number nullable: true description: Median dwell, the typical trailer (additive, ADR 0011). p90DwellMinutes: type: number nullable: true description: 90th percentile of the dwell, the long tail an average hides (additive, ADR 0011). avgProcessingMinutes: type: number nullable: true description: The processing. Mean of DoorWorkStarted to DoorWorkCompleted over the completed door work sessions of these trailers; null when none completed (additive, ADR 0011). required: - kind - trailers - avgDwellMinutes - maxDwellMinutes - avgDriverWaitMinutes - p50DwellMinutes - p90DwellMinutes - avgProcessingMinutes required: - from - to - siteId - rows DoorUtilisationReport: type: object properties: from: type: string format: date-time to: type: string format: date-time siteId: type: string nullable: true rows: type: array items: type: object properties: siteId: type: string doorCode: type: string dockings: type: integer occupiedMinutes: type: integer utilisation: type: number description: occupied minutes over the report window, 0..1. required: - siteId - doorCode - dockings - occupiedMinutes - utilisation required: - from - to - siteId - rows HostlerProductivityReport: type: object properties: from: type: string format: date-time to: type: string format: date-time siteId: type: string nullable: true rows: type: array items: type: object properties: siteId: type: string hostlerRef: type: string moves: type: integer avgMoveSeconds: type: number movesPerHour: type: number description: moves over the elapsed time between the hostler's first claim and last completion in the window. required: - siteId - hostlerRef - moves - avgMoveSeconds - movesPerHour required: - from - to - siteId - rows TurnTimeReport: type: object properties: from: type: string format: date-time to: type: string format: date-time siteId: type: string nullable: true rows: type: array items: type: object properties: purpose: type: string enum: - DROP - LIVE_UNLOAD - LIVE_LOAD - PICKUP - BOBTAIL visits: type: integer description: Visits of this purpose that checked out in the window. avgMinutes: type: number p50Minutes: type: number description: Median gate-to-gate minutes. p90Minutes: type: number description: 90th percentile of the gate-to-gate minutes. maxMinutes: type: integer required: - purpose - visits - avgMinutes - p50Minutes - p90Minutes - maxMinutes required: - from - to - siteId - rows DetentionExposureReport: type: object properties: from: type: string format: date-time to: type: string format: date-time siteId: type: string nullable: true thresholdMinutes: type: integer description: The threshold the report was computed with (the request's, or 120). rows: type: array items: type: object properties: kind: type: string enum: - DRY_VAN - REEFER - FLATBED - CONTAINER trailers: type: integer description: Trailers of this kind that departed in the window. exceeding: type: integer description: Of those, the ones whose dwell exceeded thresholdMinutes. share: type: number nullable: true description: exceeding / trailers, 0..1; null when there were no trailers. excessMinutes: type: integer description: Sum of (dwell - thresholdMinutes) over the exceeding trailers. Exposure, not a billed amount. required: - kind - trailers - exceeding - share - excessMinutes required: - from - to - siteId - thresholdMinutes - rows ExceptionsReport: type: object properties: from: type: string format: date-time to: type: string format: date-time siteId: type: string nullable: true rows: type: array items: type: object properties: siteId: type: string visitsCheckedIn: type: integer visitsRejected: type: integer rejectionRate: type: number nullable: true description: visitsRejected / (visitsCheckedIn + visitsRejected), 0..1; null when both are zero. sealExceptions: type: integer sealExceptionRate: type: number nullable: true description: sealExceptions per check-in; null when no visit checked in. Not capped at 1. holdsByReason: type: object description: Holds placed in the window; every reason is listed, zero included. properties: DAMAGED: type: integer SEAL_BROKEN: type: integer NOT_FOUND: type: integer QUALITY: type: integer SECURITY: type: integer required: - DAMAGED - SEAL_BROKEN - NOT_FOUND - QUALITY - SECURITY yardChecksClosed: type: integer discrepancies: type: integer description: Total discrepancies (the length of YardCheckClosed.discrepancies) over the yard checks closed. required: - siteId - visitsCheckedIn - visitsRejected - rejectionRate - sealExceptions - sealExceptionRate - holdsByReason - yardChecksClosed - discrepancies required: - from - to - siteId - rows VisitPage: type: object properties: items: type: array items: $ref: '#/components/schemas/Visit' nextCursor: type: string nullable: true description: Absent on the last page. required: - items TrailerPage: type: object properties: items: type: array items: $ref: '#/components/schemas/Trailer' nextCursor: type: string nullable: true description: Absent on the last page. required: - items MovePage: type: object properties: items: type: array items: $ref: '#/components/schemas/Move' nextCursor: type: string nullable: true description: Absent on the last page. required: - items