Delivery

The Delivery API manages medication delivery, specimen collection, and medical equipment delivery services. Track deliveries in real-time and receive status updates.

Endpoints

POST/api/v1/deliveries/Create a delivery order
GET/api/v1/deliveries/List deliveries
GET/api/v1/deliveries/{id}/Get delivery details
GET/api/v1/deliveries/{id}/track/Track delivery
POST/api/v1/deliveries/{id}/cancel/Cancel delivery

Create a Delivery Order

Create a new delivery order for medication, specimen collection, or equipment.

POST/api/v1/deliveries/

Request Body

patient_uhidstringrequired

Patient UHID

delivery_typestringrequired

Type: medication, specimen, equipment

pickup_addressstringrequired

Pickup location

delivery_addressstringrequired

Delivery location

pickup_facility_iduuidoptional

Pickup facility ID

itemsarrayrequired

Items to deliver

prioritystringoptional

Priority: standard, express, urgent

special_instructionsstringoptional

Special handling instructions

scheduled_pickupdatetimeoptional

Scheduled pickup time

Request
bash
curl -X POST https://api.mediloop.co/api/v1/deliveries/ \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "patient_uhid": "UG123456789A",
    "delivery_type": "medication",
    "pickup_address": "City Pharmacy, Kampala Road",
    "delivery_address": "Plot 45, Ntinda, Kampala",
    "items": [
      {"name": "Amoxicillin 500mg", "quantity": 21},
      {"name": "Paracetamol 500mg", "quantity": 10}
    ],
    "priority": "standard"
  }'
RESPONSE201
{
  "id": "del-123-456-789",
  "order_number": "DEL-2024-001234",
  "patient_uhid": "UG123456789A",
  "delivery_type": "medication",
  "status": "pending",
  "estimated_delivery": "2024-01-15T16:00:00Z",
  "created_at": "2024-01-15T10:00:00Z"
}

Track Delivery

Get real-time tracking information for a delivery.

GET/api/v1/deliveries/{id}/track/
Request
bash
curl https://api.mediloop.co/api/v1/deliveries/del-123-456/track/ \
  -H "Authorization: Bearer sk_test_..."
RESPONSE200
{
  "id": "del-123-456",
  "order_number": "DEL-2024-001234",
  "status": "in_transit",
  "courier": {
    "name": "James Okello",
    "phone": "+256700555666",
    "vehicle": "Motorcycle"
  },
  "current_location": {
    "latitude": 0.3234,
    "longitude": 32.5678,
    "updated_at": "2024-01-15T14:30:00Z"
  },
  "estimated_arrival": "2024-01-15T15:00:00Z",
  "timeline": [
    {
      "status": "pending",
      "timestamp": "2024-01-15T10:00:00Z"
    },
    {
      "status": "assigned",
      "timestamp": "2024-01-15T10:15:00Z"
    },
    {
      "status": "picked_up",
      "timestamp": "2024-01-15T14:00:00Z"
    },
    {
      "status": "in_transit",
      "timestamp": "2024-01-15T14:05:00Z"
    }
  ]
}

Delivery Status

StatusDescription
pendingOrder created, awaiting assignment
assignedCourier assigned to order
picked_upItems picked up from origin
in_transitEn route to destination
deliveredSuccessfully delivered
failedDelivery attempt failed
cancelledOrder cancelled

Delivery Types

TypeDescription
medicationPrescription medication delivery
specimenLab specimen collection from patient
equipmentMedical equipment delivery
documentsMedical documents/records