Skip to the content
YallaRoute

Help · Booking deliveries

Book deliveries through the API

Create an API key that can read and write, then send POST /api/v1/shipments with the service, the recipient, the address, the parcel and an Idempotency-Key header set to your order number. The booking is checked, priced and promised exactly as in the console, and the answer is the new shipment with a tracking number for each piece.

Updated

Where
Your own system, using a key made under Developers (or the sender portal's Developers page)
Who can do it
Developers with a key that can write
Plans
REST API is included in Growth, Scale and Enterprise

In detail

The API books through the same engine as the console: the address is placed and matched against your coverage, the price comes from the live rate card (with the account's contract rate), the promised window comes from the service, and the recipient is told like any other booking. It is a real booking, so test against a workspace you can tidy up.

What a booking needs

  • service: one of the services on your rate card.
  • The sender: an account id, or a one-off sender object. A sender-bound key always books for its own sender.
  • recipient: a name, plus a phone number or email for messages.
  • address: an object with the address lines, city, region, postal code and country, and optionally latitude and longitude. Send the parts your country uses; an exact position always wins over a lookup.
  • parcel: weight in kilograms, and optionally dimensions in centimetres, pieces, goods description and declared value.
  • Optional handling flags, cash to collect, a note, an order reference, a slot for timed services and a handover code.

Idempotency

Send an Idempotency-Key header with something unique to the order, such as your order number. If your request times out and you send it again with the same key and the same body within 24 hours, you get the first answer back instead of a second booking.

The answer

A 201 response with the new shipment as GET /api/v1/shipments/{id} returns it, the tracking numbers of every piece, the price with net, tax and total, and whether the position is approximate. Refusals come back with a code and the field that caused them, the same reasons the console shows.

Before you go live

  • Price with POST /api/v1/rates/quote before booking, if your checkout shows delivery prices.
  • Store the tracking number against your order.
  • Subscribe to webhooks rather than polling for status changes.
  • Handle 429 by waiting the number of seconds in Retry-After.

Try it in your own workspace

A new workspace has the Scale features for its first 14 days. Open one and follow this article with your own data.