Endpoint
POST /api/v1/envios/retirar
Process the package pickup by the recipient. This endpoint validates the delivery password and marks the shipment as delivered.
Request Body
The tracking code of the shipment to retrieve
The delivery password provided when the shipment was created. This is used to verify the recipient’s identity.
Delivery date in ISO format (YYYY-MM-DD). If null or not provided, uses the current date.
Response
Success message confirming the package was delivered
The tracking code of the delivered shipment
Example Request
curl -X POST http://localhost:8080/api/v1/envios/retirar \
-H "Content-Type: application/json" \
-d '{
"codigoSeguimiento": "ENV-20260309-ABCD1234",
"contrasenaEntrega": "SEGURA123",
"fechaEntrega": "2026-03-12"
}'
Example Response
{
"mensaje": "Paquete entregado exitosamente",
"codigoSeguimiento": "ENV-20260309-ABCD1234"
}
Error Responses
Shipment Not Found
{
"error": "EnvioNotFoundException",
"message": "Envío no encontrado con código: ENV-20260309-ABCD1234"
}
Invalid Password
{
"error": "InvalidPasswordException",
"message": "Contraseña de entrega incorrecta"
}
Shipment Not Available
{
"error": "InvalidStateException",
"message": "El envío debe estar en estado DISPONIBLE para ser retirado"
}
The delivery password must match exactly. This endpoint automatically updates the shipment status to ENTREGADO and sets the delivery timestamp.
Workflow
- Recipient arrives at the destination branch office
- Recipient provides the tracking code and delivery password
- Branch office staff calls this endpoint
- System validates the password
- System checks that the shipment is in
DISPONIBLE status
- System marks the shipment as
ENTREGADO
- System records the delivery date and time
Before calling this endpoint, ensure the shipment is in DISPONIBLE status. Use the PUT /api/v1/envios//disponible endpoint to mark a shipment as available for pickup.
Security Considerations
- The delivery password should be communicated securely to the recipient
- Only the person with the correct password can retrieve the package
- The password is case-sensitive
- Failed attempts should be logged for security monitoring