Every shipment in TranslogiX passes through a defined sequence of statuses from the moment it is created until it is either delivered or cancelled. This page explains each status, the rules that govern which transitions are permitted, who can trigger them, and the side effects that occur — such as a vehicle being marked as busy when it is assigned to a shipment.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fatelessdev/translogiX/llms.txt
Use this file to discover all available pages before exploring further.
Shipment statuses
TranslogiX defines six shipment statuses via theshipmentStatusEnum:
| Status | Meaning |
|---|---|
CREATED | Shipment record exists but has not yet been assigned to a transporter or vehicle |
ASSIGNED | A transporter and vehicle have been linked to the shipment |
PICKED_UP | The vehicle has collected the cargo from the source location |
IN_TRANSIT | The shipment is actively moving toward the destination |
DELIVERED | Cargo has been successfully delivered; terminal state |
CANCELLED | Shipment was cancelled at any point before delivery; terminal state |
Lifecycle flow
CREATED
A new shipment is created by an ADMIN or TRANSPORTER via
POST /api/shipments. The record is saved with status CREATED.At this point the shipment has a unique packageCode, a source, a destination, a materialType, a grossWeightKg, a quantity, a pickupDate, and a deliveryDeadline. The transporterId, vehicleId, and routeId fields are optional and may be set immediately or later.If a vehicleId is provided at creation time, the vehicle’s status is automatically updated to BUSY.Valid next states: ASSIGNED, CANCELLEDASSIGNED
An ADMIN or the owning TRANSPORTER sends a status update (
PATCH /api/shipments/:id) with { "status": "ASSIGNED" }. The shipment must already have a vehicleId set; when the transition to ASSIGNED occurs the vehicle’s status is confirmed as BUSY.This state signals that logistics planning is complete and the vehicle is committed to this shipment.Valid next states: PICKED_UP, CANCELLEDPICKED_UP
The status is advanced to
PICKED_UP once the driver collects the cargo from the source location. This transition is triggered via PATCH /api/shipments/:id with { "status": "PICKED_UP" } by an ADMIN or TRANSPORTER.Valid next states: IN_TRANSIT, CANCELLEDIN_TRANSIT
The shipment is on its way to the destination. The status advances to
IN_TRANSIT via PATCH /api/shipments/:id with { "status": "IN_TRANSIT" }.Tracking updates can be appended throughout this stage to record intermediate locations, GPS coordinates, and timestamps.Valid next states: DELIVERED, CANCELLEDDELIVERED
When the cargo reaches its destination, the status is set to
DELIVERED. This is a terminal state — no further transitions are possible.When a shipment is marked DELIVERED, the assigned vehicle’s status is automatically reset to AVAILABLE so it can be assigned to future shipments.Valid next states: (none)CANCELLED can be reached from any non-terminal state (CREATED, ASSIGNED, PICKED_UP, IN_TRANSIT). Once a shipment is DELIVERED or CANCELLED, the status cannot be changed further.Valid transition matrix
The allowed transitions are enforced server-side usingVALID_STATUS_TRANSITIONS in lib/validations/index.ts. Any attempt to move to an unlisted state returns a 400 error.
Who can update shipment status
Status updates are restricted to ADMIN and TRANSPORTER roles. A TRANSPORTER can only update shipments that belong to their own transporter entity — attempts to modify another transporter’s shipment return403 Forbidden.
| Role | Can update any shipment | Can update own shipments |
|---|---|---|
ADMIN | Yes | Yes |
TRANSPORTER | No | Yes |
DRIVER | No | No |
CUSTOMER | No | No |
Key shipment fields
| Field | Type | Description |
|---|---|---|
packageCode | text | Unique identifier for the shipment; used for customer-facing tracking |
source | text | Pickup address or location name |
destination | text | Delivery address or location name |
materialType | text | Description of the cargo being transported |
grossWeightKg | decimal | Total weight of cargo including packaging |
tareWeightKg | decimal | Weight of packaging alone (optional) |
quantity | integer | Number of units in the shipment |
pickupDate | date | Scheduled date for cargo collection |
deliveryDeadline | date | Latest acceptable delivery date; must be on or after pickupDate |
transporterId | uuid | Linked transporter; may be assigned at creation or later |
vehicleId | uuid | Assigned vehicle; setting this marks the vehicle as BUSY |
routeId | uuid | Optional link to a predefined route for distance and rate lookup |
Vehicle status side effects
TranslogiX automatically manages vehicle availability as shipments move through their lifecycle:- Vehicle → BUSY
- Vehicle → AVAILABLE
A vehicle is set to
BUSY in two situations:- When a shipment is created with a
vehicleIdalready set. - When a shipment transitions to ASSIGNED and a
vehicleIdis present.
Tracking updates
At any point during a shipment’s journey, location events can be appended as tracking updates. Each update records a location name, and optionally GPS coordinates (latitude and longitude). Tracking updates are append-only and are publicly accessible via the/track route using the shipment’s packageCode.