Skip to main content
PUT
/
api
/
v1
/
envios
/
actualizar-estado
Update Shipment Status
curl --request PUT \
  --url https://api.example.com/api/v1/envios/actualizar-estado \
  --header 'Content-Type: application/json' \
  --data '
{
  "envioId": 123,
  "nuevoEstado": "<string>"
}
'
{
  "mensaje": "<string>",
  "envioId": "<string>",
  "nuevoEstado": "<string>"
}

Endpoint

PUT /api/v1/envios/actualizar-estado
Update the status of an existing shipment. This endpoint allows manual status transitions for shipment workflow management.

Request Body

envioId
number
required
ID of the shipment to update
nuevoEstado
string
required
New status for the shipment. Valid values:
  • PENDIENTE - Shipment pending/registered
  • EN_TRANSITO - In transit
  • DISPONIBLE - Available for pickup
  • ENTREGADO - Delivered
  • CANCELADO - Cancelled

Response

mensaje
string
Success message indicating the status was updated
envioId
string
ID of the updated shipment
nuevoEstado
string
The new status that was applied

Example Request

curl -X PUT http://localhost:8080/api/v1/envios/actualizar-estado \
  -H "Content-Type: application/json" \
  -d '{
    "envioId": 42,
    "nuevoEstado": "EN_TRANSITO"
  }'

Example Response

{
  "mensaje": "Estado actualizado exitosamente a: EN_TRANSITO",
  "envioId": "42",
  "nuevoEstado": "EN_TRANSITO"
}

Error Response

If the shipment is not found:
{
  "error": "EnvioNotFoundException",
  "message": "Envío no encontrado con id: 42"
}
Ensure status transitions follow your business logic. Invalid transitions (e.g., from ENTREGADO to PENDIENTE) are not validated by this endpoint.

Alternative Status Update Endpoints

For specific status transitions, consider using these specialized endpoints:
  • PUT /api/v1/envios//disponible - Mark as available for pickup
  • PUT /api/v1/envios//cancelar - Cancel a shipment
  • POST /api/v1/envios/retirar - Process delivery (sets to ENTREGADO)

Valid Status Transitions

Typical workflow:
  1. PENDIENTE → Initial state when created
  2. EN_TRANSITO → When assigned to a vehicle
  3. DISPONIBLE → When arrived at destination
  4. ENTREGADO → When picked up by recipient
Alternative:
  • CANCELADO → Can be set from any state before delivery
This endpoint provides flexibility for manual status updates. For automated workflows, use the specialized endpoints that include additional validations.

Build docs developers (and LLMs) love