SwiftDeliva API
Every Lagos courier, one API.
Compare prices and arrival times across couriers, book the best one, and follow the rider live, with one integration. Quotes are free. If a courier refuses a booking, we automatically try the next-best one.
Quick start
- Open a business account, then Dashboard → Developers → create a test key.
- Ask for quotes (below). Test keys only reach simulated couriers: realistic Lagos prices, riders moving on real roads, real webhooks, and no charges.
- Book an option, add a webhook endpoint, and watch the status events arrive.
- When you're ready, fund your wallet and switch to a live key. Nothing else changes.
Keys & test mode
Send your key as a bearer token on every request, from your server only. Keys belong to a project; each project has its own keys, webhooks and logs.
sd_test_…: simulated couriers, never a real rider, never charged.sd_live_…: real couriers; bookings are paid from your wallet.
With a test key, add X-SwiftDeliva-Scenario to make the simulator misbehave, so you can test the unhappy paths: timeout, reject_quote, reject_booking, ambiguous_booking, rider_cancels, delivery_failed, no_gps.
Quotes
POST /quotes asks every eligible courier at once (slow ones are cut off after a few seconds) and returns priced options. Each is labelled recommended, express or economy where it fits. Amounts are integer kobo: ₦2,450 is 245000. Send coordinates; a landmark helps riders a lot.
curl -X POST https://swiftdeliva.com/api/v1/quotes \
-H "Authorization: Bearer $SWIFTDELIVA_KEY" \
-H "Content-Type: application/json" \
-d '{
"pickup": {
"address": "Ikeja City Mall, Alausa",
"landmark": "Main entrance",
"lat": 6.6142,
"lng": 3.3581
},
"dropoff": {
"address": "Admiralty Way, Lekki Phase 1",
"landmark": "Blue gate beside the pharmacy",
"lat": 6.4474,
"lng": 3.4723
},
"parcel": {
"weight_kg": 2,
"size": "SMALL",
"item_type": "Food"
}
}'Booking
POST /shipments with the quote and option ids. Always send an Idempotency-Key (your order id is ideal): if your request times out, retry with the same key and you'll get the same shipment back, never a second rider.
Outcomes: 201 booked; 202 sent but the courier hasn't confirmed yet (don't rebook: we reconcile it and send a webhook); 422 BOOKING_FAILED nobody could take it and you weren't charged. booking.fell_back tells you when the first choice refused and another courier took it at the same price or less.
curl -X POST https://swiftdeliva.com/api/v1/shipments \
-H "Authorization: Bearer $SWIFTDELIVA_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_10432" \
-d '{
"quote_id": "qte_…",
"option_id": "opt_1",
"sender": {
"name": "Mama Nkechi Foods",
"phone": "0803 123 4567"
},
"recipient": {
"name": "Tunde Bakare",
"phone": "0809 765 4321"
},
"notes": "Call on arrival"
}'Cancel with POST /shipments/:id/cancel until the rider has the parcel. Your wallet is refunded, less any courier cancellation fee (returned as cancellation_fee_kobo).
Tracking
Every shipment has a tracking_code (like SD-7KQ4-M2XP) and a tracking_url with a live map you can send to your customer as-is. For your own UI, use webhooks, or GET /tracking/:code for the same recipient-safe view.
| Status | Meaning |
|---|---|
| pending | We're confirming your delivery with the courier. |
| accepted | The courier has accepted your delivery and is finding a rider. |
| rider_assigned | A rider is heading to the pickup point. |
| picked_up | Your package has been collected. |
| in_transit | Your package is moving to the drop-off. |
| arriving | The rider is close to the drop-off. |
| delivered | Your package has been delivered. |
| failed | The courier couldn't complete this delivery. |
| cancelled | This delivery was cancelled. |
| returned | The package was returned to the sender. |
Webhooks
Add an endpoint under Dashboard → Developers → Webhooks. We POST JSON to it on every status change, retrying with backoff for about a day until you answer with a 2xx. Events: shipment.created, shipment.accepted, shipment.rider_assigned, shipment.picked_up, shipment.in_transit, shipment.arriving, shipment.delivered, shipment.failed, shipment.cancelled, shipment.returned, shipment.location_updated.
Delivery order isn't guaranteed and an event can arrive twice. Use the event id to ignore duplicates, and created_at or the shipment's status rather than arrival order. Always verify the signature:
import crypto from "node:crypto";
// Use the RAW request body (before JSON parsing).
function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false; // replay window
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? ""));
}
// verify(req.rawBody, req.headers["swiftdeliva-signature"], process.env.SWIFTDELIVA_WEBHOOK_SECRET)Errors
Every error has the same shape, and the code is stable (messages may change):
{ "error": { "code": "QUOTE_EXPIRED", "message": "This quote has expired. Request a new quote.", "details": null }, "request_id": "req_…" }| Code | HTTP | What to do |
|---|---|---|
| UNAUTHORIZED | 401 | Missing, malformed or revoked API key. |
| FORBIDDEN | 403 | The key can't do this (e.g. another project's shipment). |
| INVALID_REQUEST | 400 | Body or query failed validation; details lists each field. |
| IDEMPOTENCY_KEY_REQUIRED | 400 | POST /shipments needs an Idempotency-Key header. |
| IDEMPOTENCY_CONFLICT | 409 | That key was already used for a different quote. |
| RATE_LIMITED | 429 | Too many requests; wait until X-RateLimit-Reset. |
| QUOTE_EXPIRED | 410 | Prices last about 10 minutes. Quote again. |
| QUOTE_ALREADY_USED | 409 | Each quote books once. Quote again for another delivery. |
| ENVIRONMENT_MISMATCH | 409 | A test-key quote can't be booked with a live key, and vice versa. |
| NO_QUOTES_AVAILABLE | 422 | No courier can take this route or parcel right now. |
| INSUFFICIENT_WALLET_BALANCE | 402 | Fund your wallet in the dashboard; details has the amounts. |
| BOOKING_FAILED | 422 | Every eligible courier refused. You weren't charged. |
| BOOKING_UNCONFIRMED | 202 | Sent but not confirmed yet. Don't rebook; wait for a webhook. |
| SHIPMENT_NOT_CANCELLABLE | 409 | The rider already has it, or it's finished. |
| CANCELLATION_UNCONFIRMED | 502 | The courier didn't answer. Check status before retrying. |
| MAINTENANCE | 503 | Planned maintenance; retry after retry_after seconds. |
Limits & idempotency
Each key may make 120 requests a minute by default. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; a 429 also has Retry-After. Lists are cursor-paginated (limit, starting_after, has_more). Quote the X-Request-Id when you contact us. During planned maintenance the API may answer 503 MAINTENANCE with a Retry-After.
Your own courier accounts
Some couriers don't allow resale. To use them, connect your own account with the courier under Dashboard → Courier accounts (live details for live keys, sandbox details for test keys). Their quotes then appear alongside the others with connection.model set to merchant_account.
For those options the courier bills connection.billed_by_courier_kobo to your account directly. SwiftDeliva doesn't mark it up or collect it: amount.courier_kobo is 0 and amount.total_kobo is only our platform fee, which is what your wallet is charged. These bookings never fall back to another courier, and cancelling refunds our fee in full (the courier bills any cancellation fee to you). Options booked through SwiftDeliva's own courier accounts have connection.model resale and work as before.
Fee-free internal use
Projects that belong to Jonadest products (Topeater, Wegetam, All Slay) are marked fee-exempt: the API, responses and webhooks are identical, but amount.fee_kobo is always 0 and you pay only the courier price. Nothing changes in your code; the exemption is set on the project by SwiftDeliva staff.
Reference
The full machine-readable description is at /api/v1/openapi.json (OpenAPI 3.1). Import it into Postman, Insomnia or a client generator.