Skip to content
DocsSign inCreate an account

Create a delivery

POST/api/v1/external/dispatches

Creates one delivery in NEW, priced from the zone its pickup falls in, and returns it with the tracking token for your customer. Requires an Idempotency-Key header — see Idempotency.

Body

  • customerNamestringrequired
    Who the rider is delivering to. 1–200 characters.
  • customerPhonestringrequired
    The number the rider calls on arrival. 7–20 characters; send it in international form.
  • pickupobjectrequired
    Where the rider collects. address is required; lat, lng and notes are optional.
  • dropoffobjectrequired
    Same shape as pickup. Where the parcel is going.
  • paymentType'COD' | 'PREPAID'required
    COD means the rider collects payment on delivery and it is reconciled against the amount below.
  • externalIdstring
    Your own order id. Returned on every read and every webhook, so you never have to store ours.
  • amountCentsinteger
    Order value in minor units. Defaults to 0. Required in practice for COD.
  • currencystring
    Three-letter code. Defaults to KES.
  • targetPickupAtISO 8601
    When you want it collected by. Used for SLA reporting.
  • targetDeliveryAtISO 8601
    When you want it delivered by.

Coordinates#

Coordinates are optional on both ends. With them, the delivery is matched to a zone, priced from that zone and routed; without them the rider navigates by the address text and the fee falls back to defaults. Send coordinates whenever you have them.

What to keep#

Store id if you want to call back about this delivery, and trackingToken if you want to give your customer a live link — see Tracking. Status changes arrive on your webhook; there is no need to poll.

Bulk create#

POST /api/v1/external/dispatches/bulk takes { "orders": [ … ] } with up to 500 entries, each exactly the shape above, and the same Idempotency-Key rule. All rows are written in one transaction: if the batch fails, no deliveries are created. Each row is priced independently against its own zone.

Use it for a daily upload. For anything event-driven, create one at a time — you get a clearer failure and per-delivery idempotency.

Authorization: X-API-Key

Request
curl -X POST https://api.dispatch.gumza.ke/api/v1/external/dispatches \
  -H "X-API-Key: $DISPATCH_API_KEY" \
  -H "Idempotency-Key: 9b2f1c84-4e1a-4a7f-9f0e-2d3c5a6b7c8d" \
  -H "Content-Type: application/json" \
  -d '{
    "externalId": "order_10294",
    "customerName": "Customer 001",
    "customerPhone": "+254700000001",
    "pickup":  { "address": "Shop 4, Westlands, Nairobi", "lat": -1.2672, "lng": 36.8065 },
    "dropoff": { "address": "Kileleshwa, Nairobi", "lat": -1.2833, "lng": 36.7833,
                 "notes": "Gate 2, ask for reception" },
    "paymentType": "COD",
    "amountCents": 250000,
    "currency": "KES",
    "targetDeliveryAt": "2026-10-12T16:00:00.000Z"
  }'
Response
{
  "success": true,
  "data": {
    "id": "c0ffee11-2233-4455-6677-8899aabbccdd",
    "externalId": "order_10294",
    "status": "NEW",
    "riderId": null,
    "zoneId": "0b1e…",
    "customerName": "Customer 001",
    "customerPhone": "+254700000001",
    "pickup":  { "address": "Shop 4, Westlands, Nairobi", "lat": -1.2672, "lng": 36.8065 },
    "dropoff": { "address": "Kileleshwa, Nairobi", "lat": -1.2833, "lng": 36.7833,
                 "notes": "Gate 2, ask for reception" },
    "paymentType": "COD",
    "amountCents": 250000,
    "feeCents": 32000,
    "currency": "KES",
    "targetPickupAt": null,
    "targetDeliveryAt": "2026-10-12T16:00:00.000Z",
    "trackingToken": "Yk3n…",
    "source": "api",
    "createdAt": "2026-10-12T08:41:02.117Z",
    "updatedAt": "2026-10-12T08:41:02.117Z"
  }
}