CEND / Developers / Booking API

Secret key · JSON · v1

Booking API.

Book a delivery from your own system and get the tracking number back. Price it, book it, follow it.

Two ways to book

How a delivery is paid for is agreed with CEND when you go live, and it decides which call you use.

  • You pay (wallet or credit account). Your server prices the delivery and books it with POST /business/shipments. This page.
  • Your own shoppers pay CEND directly. Your server starts a booking with POST /business/bookings. The shopper pays on a payment page or a pop-up on your site, and the delivery is made when the payment is confirmed. Read taking payment on your own page.

If your customers pay CEND directly, POST /business/shipments answers 422 and tells you to use the other call.

Before you start

  • API access, approved. Ask for it on the Developers page.
  • A secret key (sk_test_ to try, sk_live_ to go live). It belongs on your server only. Booking never works with a publishable key.
  • For live deliveries: enough in your wallet, or a credit account, as agreed with CEND.
  • The receiver’s address with its map position (latitude and longitude), and yours too unless you save a pickup address. The address-suggestion call below gives you the positions.

Save your pickup address, send your items

Your key already tells us who you are, so you do not have to repeat yourself. Two things shorten every booking, and both are optional.

Your pickup address

In your CEND account, open Developers and save Your pickup address: who the courier meets, their phone, and where. After that, a price or a booking that leaves out the sender starts from there, so your software only sends who it is going to.

  • Send a pickup_name or pickup_phone with a booking and it is used instead of the saved one, for that delivery only.
  • Send your own pickup_address and it is used with its own map position. It never borrows the saved address’s position.
  • The sender’s email and business name always come from your account. They cannot be changed in a call.
  • A price can leave out the origin_* fields too. They start from the saved address.
  • Without a saved address, every call must send the sender as before.

Your order’s items

Instead of a description and a value, send the order’s items: each with a name, a quantity and the price the customer paid for one (after any discount, before delivery). We build the rest:

  • The description is made from the names, like “2 x Running shoes, 1 x Sports bag”. A very long order is cut to fit and ends with “and 12 more”.
  • The declared value is the total of quantity times price across all the items. It is the cost of the goods, not the delivery.
  • A item_description or declared_value you send yourself is used exactly as sent. item_type defaults to parcel.

With both, a booking is only the receiver, the items and the price token:

curl -X POST "https://api.cend.ng/api/v1/business/shipments"   -H "Authorization: Bearer $CEND_SECRET_KEY"   -H "Idempotency-Key: order-1001-book"   -H "Accept: application/json" -H "Content-Type: application/json"   -d '{
    "quote_token": "eyJ...",
    "dropoff_name": "Bola Adeyemi", "dropoff_phone": "+2348022222222", "dropoff_email": "[email protected]",
    "dropoff_address": "2 Lekki Road, Lekki", "dropoff_country": "NG", "dropoff_state": "Lagos", "dropoff_city": "Lekki",
    "dropoff_lat": 6.45, "dropoff_lng": 3.5,
    "items": [
      { "name": "Running shoes", "quantity": 2, "price": 15000 },
      { "name": "Sports bag", "quantity": 1, "price": 8500 }
    ],
    "eta_accepted": true
  }'

Step by step

  • Find the addresses (optional). GET /business/places?q=... suggests real places for what a person typed, each with its exact position. GET /business/options lists the speeds, boxes and extras you can offer.
  • Get a price. POST /business/quote with the route and weight. You get the price and a quote_token. Booking is held to exactly the price that token proves.
  • Book. POST /business/shipments with the token, the same route, the sender, the receiver and what is in the parcel.
  • Read the answer. payment.type is booked (done), payment_link (open the link to pay) or unpaid (answered with 402: add money and try again).
  • Follow it. Keep the shipment id and reference. Use webhooks to hear about every move, or GET /business/shipments/{id}.

1. Get a price

curl -X POST "https://api.cend.ng/api/v1/business/quote" \
  -H "Authorization: Bearer $CEND_SECRET_KEY" \
  -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{
    "origin_country": "NG", "origin_state": "Lagos",
    "origin_address": "12 Allen Ave, Ikeja", "origin_lat": 6.6018, "origin_lng": 3.3515,
    "destination_country": "NG", "destination_state": "Lagos",
    "destination_address": "2 Lekki Road, Lekki", "destination_lat": 6.45, "destination_lng": 3.5,
    "weight_grams": 2000
  }'
{
  "data": {
    "currency": "NGN",
    "total_minor": 446125,
    "total_formatted": "₦4,461.25",
    "service_level_label": "Standard",
    "quote_token": "eyJ...",
    "expires_at": "2026-11-16T12:30:00+01:00"
  }
}

2. Book it

curl -X POST "https://api.cend.ng/api/v1/business/shipments" \
  -H "Authorization: Bearer $CEND_SECRET_KEY" \
  -H "Idempotency-Key: order-1001-book" \
  -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{
    "quote_token": "eyJ...",
    "origin_country": "NG", "origin_state": "Lagos",
    "origin_address": "12 Allen Ave, Ikeja", "origin_lat": 6.6018, "origin_lng": 3.3515,
    "destination_country": "NG", "destination_state": "Lagos",
    "destination_address": "2 Lekki Road, Lekki", "destination_lat": 6.45, "destination_lng": 3.5,
    "weight_grams": 2000,

    "pickup_name": "Shop Ltd", "pickup_phone": "+2348031234567", "pickup_email": "[email protected]",
    "pickup_address": "12 Allen Ave, Ikeja", "pickup_country": "NG", "pickup_state": "Lagos", "pickup_city": "Ikeja",
    "pickup_lat": 6.6018, "pickup_lng": 3.3515,

    "dropoff_name": "Bola Adeyemi", "dropoff_phone": "+2348022222222", "dropoff_email": "[email protected]",
    "dropoff_address": "2 Lekki Road, Lekki", "dropoff_country": "NG", "dropoff_state": "Lagos", "dropoff_city": "Lekki",
    "dropoff_lat": 6.45, "dropoff_lng": 3.5,

    "item_type": "parcel", "item_description": "1 x Shoes", "declared_value": 15000,
    "eta_accepted": true
  }'
{
  "data": {
    "id": "0b9c4a5e-...",
    "reference": "RD482916307",
    "status": "awaiting_pickup",
    "price_minor": 446125,
    "currency": "NGN",
    "paid": true,
    "payment_channel": "wallet",
    "tracking_url": "https://cend.ng/track?code=RD482916307"
  },
  "payment": { "type": "booked" }
}

What to send when booking

  • quote_token from the price, and the same route fields you priced with. The sender and receiver positions must match the priced addresses (within about half a kilometre), or the booking is refused and you price again.
  • Sender and receiver: pickup_* (optional once you save a pickup address) and dropoff_*, each with name, phone (with country code, like +2348031234567), address, country, state, city, and optionally email, landmark and lat/lng. Deliveries to and from other countries also need a postal_code for each.
  • The parcel: items (see above), or item_description and declared_value (not needed for a document). item_type is parcel or document and defaults to parcel.
  • eta_accepted: true says the delivery date shown was accepted.
  • Optional: coupon_code, scheduled_for (a pickup time that has not passed), and packages when sizes differ.

Safe retries

Send an Idempotency-Key header (8 to 80 characters, new for each booking, such as your order number) on every booking and cancel. If your call times out and you send it again with the same key, you get the first answer back and the delivery is not booked twice. Answers are kept for a day. A call that failed can be tried again with the same key.

Cancelling

POST /business/shipments/{id}/cancel calls off a delivery that has not been picked up. Money paid from your wallet goes back to it. A delivery your own shopper paid for by card is refunded to them, so contact CEND for those.

Errors and limits

  • 401 the key is missing or wrong. 403 the key cannot be used yet (live keys open after approval), or it is the wrong kind of key.
  • 402 booked but not paid. Add money to your wallet and try again; the answer carries a message.
  • 422 something is wrong. The body has message and an errors list for each field. A quote_token error usually means the price expired: price again.
  • 429 too many calls. Wait for the Retry-After header. Limits are set per business.
  • 503 guest booking is paused for a moment. Try again shortly.

Try it with a test key

A test key checks everything a live key does, but books a pretend delivery: it is never charged, the answer has test: true and a reference starting TEST-, and it moves through the stages by itself so your webhooks can be tried. Read about test mode.

Every call in detail

The full description of every call, with all its fields and answers, is the API description file. Import it into Postman or a code generator. Ready-made code for the calls above is on the libraries page.

Stuck, or want something changed?

Tell us what you are building and we will reply within one working day.