Skip to main content

List Dispatches

GET /api/dispatches Retrieve all dispatches with vehicle information, optionally filtered by collection center.

Query Parameters

collectionCenterId
string
Filter dispatches by collection center ID. If not provided, uses the active center from configuration.

Response

Returns an array of dispatch objects sorted by created_at DESC, with vehicle information joined.

Example Request

curl http://localhost:4000/api/dispatches?collectionCenterId=center-1

Example Response

[
  {
    "id": "dispatch-1",
    "date": "09/03/2026",
    "description": "Aceite Vegetal Usado Filtrado",
    "presentation": "Tanque",
    "dispatched_quantity": 500.0,
    "destination_name": "Procesadora Central C.A.",
    "destination_rif": "J-11111111-1",
    "destination_address": "Zona Industrial, Galpón 5",
    "vehicle_id": "vehicle-1",
    "vehicle_plate": "ABC-123",
    "vehicle_brand": "Toyota",
    "vehicle_model": "Hilux 2020",
    "driver_name": "Carlos Rodríguez",
    "driver_id": "V-12345678",
    "minec_guide_number": "MG-2026-001234",
    "collection_center_id": "center-1",
    "created_at": "2026-03-09T14:00:00Z"
  }
]

Create Dispatch

POST /api/dispatches Create a new dispatch record.

Request Body

id
string
required
Unique dispatch identifier (UUID)
date
string
required
Dispatch date (DD/MM/YYYY or YYYY-MM-DD)
description
string
Description of the dispatched material
presentation
string
Presentation format (e.g., “Tanque”, “Bidones”)
dispatchedQuantity
number
Quantity dispatched in liters
destinationName
string
Name of the destination company/entity
destinationRif
string
Tax ID (RIF) of the destination
destinationAddress
string
Physical address of the destination
vehicleId
string
ID of the vehicle used for dispatch
driverName
string
Name of the driver
driverId
string
Driver’s identification number
minecGuideNumber
string
MINEC guide number (government transport guide)

Response

Returns the created dispatch object with created_at timestamp.
The collectionCenterId is automatically determined from the request context or active configuration.

Example Request

curl -X POST http://localhost:4000/api/dispatches \
  -H "Content-Type: application/json" \
  -d '{
    "id": "dispatch-new-1",
    "date": "09/03/2026",
    "description": "Aceite Vegetal Usado Filtrado",
    "presentation": "Tanque",
    "dispatchedQuantity": 500.0,
    "destinationName": "Procesadora Central C.A.",
    "destinationRif": "J-11111111-1",
    "destinationAddress": "Zona Industrial, Galpón 5",
    "vehicleId": "vehicle-1",
    "driverName": "Carlos Rodríguez",
    "driverId": "V-12345678",
    "minecGuideNumber": "MG-2026-001234"
  }'

Example Response

{
  "id": "dispatch-new-1",
  "date": "09/03/2026",
  "description": "Aceite Vegetal Usado Filtrado",
  "presentation": "Tanque",
  "dispatched_quantity": 500.0,
  "destination_name": "Procesadora Central C.A.",
  "destination_rif": "J-11111111-1",
  "destination_address": "Zona Industrial, Galpón 5",
  "vehicle_id": "vehicle-1",
  "driver_name": "Carlos Rodríguez",
  "driver_id": "V-12345678",
  "minec_guide_number": "MG-2026-001234",
  "collection_center_id": "center-1",
  "created_at": "2026-03-09T14:00:00Z"
}

Update Dispatch

PUT /api/dispatches/:id Update an existing dispatch.

Path Parameters

id
string
required
Dispatch ID

Request Body

date
string
required
Dispatch date
description
string
Description of the dispatched material
presentation
string
Presentation format
dispatchedQuantity
number
Quantity dispatched in liters
destinationName
string
Destination name
destinationRif
string
Destination RIF
destinationAddress
string
Destination address
vehicleId
string
Vehicle ID
driverName
string
Driver name
driverId
string
Driver identification
minecGuideNumber
string
MINEC guide number

Response

Returns the updated dispatch object.

Example Request

curl -X PUT http://localhost:4000/api/dispatches/dispatch-1 \
  -H "Content-Type: application/json" \
  -d '{
    "date": "09/03/2026",
    "description": "Aceite Vegetal Usado Filtrado Premium",
    "presentation": "Tanque",
    "dispatchedQuantity": 550.0,
    "destinationName": "Procesadora Central C.A.",
    "destinationRif": "J-11111111-1",
    "destinationAddress": "Zona Industrial, Galpón 5",
    "vehicleId": "vehicle-1",
    "driverName": "Carlos Rodríguez",
    "driverId": "V-12345678",
    "minecGuideNumber": "MG-2026-001234"
  }'

Delete Dispatch

DELETE /api/dispatches/:id Delete a dispatch by its ID.

Path Parameters

id
string
required
Dispatch ID

Response

ok
boolean
Returns true if deletion was successful

Example Request

curl -X DELETE http://localhost:4000/api/dispatches/dispatch-1

Example Response

{
  "ok": true
}

Error Response

{
  "error": "DB delete error"
}

Build docs developers (and LLMs) love