Skip to main content

Inspections

Compliance inspection checklists that gate docking, loading and leaving (ADR 0015).

📄️Open an inspection (OpenInspection)

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.

📄️Record an inspection item (RecordInspectionItem)

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.

📄️Complete an inspection (CompleteInspection)

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

📄️Publish an inspection template version (PublishInspectionTemplate)

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.