Skip to main content

Get Status History

Retrieve the complete status history for a package, including all status changes with timestamps and personnel information.

Endpoint

method
string
default:"GET"
GET
endpoint
string
/encomienda/getHistorialEstados

Query Parameters

id_encomienda
integer
required
Package ID

Response

data
array
Array of status history entries
id
integer
Status history entry ID
id_estado
integer
Status type ID
nombre
string
Status name/description
fecha
string
Date of status change
hora
string
Time of status change
comentario
string
Comment or notes about the status change
id_personal
integer
ID of personnel who made the change
nombre_personal
string
Name of personnel who made the change
nombre_agencia
string
Branch/agency where status was updated

Request Example

GET /encomienda/getHistorialEstados?id_encomienda=123

Response Example

{
  "data": [
    {
      "id": 1,
      "id_estado": 1,
      "nombre": "Registrado",
      "fecha": "2026-03-05",
      "hora": "09:30:00",
      "comentario": "Encomienda registrada en sistema",
      "id_personal": 10,
      "nombre_personal": "Carlos Mendoza",
      "nombre_agencia": "Lima Centro"
    },
    {
      "id": 2,
      "id_estado": 2,
      "nombre": "En tránsito",
      "fecha": "2026-03-05",
      "hora": "14:45:00",
      "comentario": "Paquete salió hacia destino",
      "id_personal": 12,
      "nombre_personal": "Ana Torres",
      "nombre_agencia": "Lima Centro"
    },
    {
      "id": 3,
      "id_estado": 5,
      "nombre": "En agencia destino",
      "fecha": "2026-03-06",
      "hora": "08:15:00",
      "comentario": "Llegó a agencia de destino",
      "id_personal": 15,
      "nombre_personal": "Luis Ramírez",
      "nombre_agencia": "Arequipa Norte"
    }
  ]
}

Update Package Status

Add a new status update to a package’s history.

Endpoint

method
string
default:"POST"
POST
endpoint
string
/encomienda/addEstadoEncomienda

Request Body

id_encomienda
integer
required
Package ID
id_estado
integer
required
New status ID to assign
comentario
string
required
Comment or notes about the status change

Response

success
boolean
Indicates if the status was updated successfully
message
string
Response message

Request Example

{
  "id_encomienda": 123,
  "id_estado": 6,
  "comentario": "Paquete entregado al destinatario"
}

Response Example

{
  "success": true,
  "message": "Estado actualizado exitosamente"
}

Get Available Statuses

Retrieve the list of statuses that can be assigned to a specific package based on its current state.

Endpoint

method
string
default:"GET"
GET
endpoint
string
/encomienda/getEstadosDisponibles

Query Parameters

id_encomienda
integer
required
Package ID

Response

data
array
Array of available status objects
id
integer
Status ID
nombre
string
Status name/description
color
string
Status color code

Request Example

GET /encomienda/getEstadosDisponibles?id_encomienda=123

Response Example

{
  "data": [
    {
      "id": 3,
      "nombre": "En reparto",
      "color": "#FF9800"
    },
    {
      "id": 6,
      "nombre": "Entregado",
      "color": "#4CAF50"
    },
    {
      "id": 7,
      "nombre": "No entregado",
      "color": "#F44336"
    }
  ]
}

Status Flow

Typical status progression for a package:
  1. Registrado - Package registered in the system
  2. En tránsito - Package in transit to destination
  3. En agencia destino - Package arrived at destination branch
  4. En reparto - Package out for delivery
  5. Entregado - Package delivered to recipient
Alternative statuses:
  • No entregado - Delivery attempt failed
  • Devuelto - Package returned to sender
  • Cancelado - Package cancelled

Notes

  • Status changes are tracked with timestamp and personnel information for audit purposes
  • Only certain status transitions are allowed based on the current package state
  • Use the “Get Available Statuses” endpoint to determine which statuses can be applied to a package
  • Comments are required when updating status to provide context for the change

Build docs developers (and LLMs) love