Legends Transport API

Connect your shop, order system or accounts software to the Legends Transport Hub.

A manager with full access makes an API key in the hub: Manager → Settings → Connect your other software. Keep it private: anyone with it can add jobs to your hub. Switch a key off there at any time.

Basics

Add a job

POST/api/v1/jobs

curl -X POST https://transport.stanleyappsltd.com/api/v1/jobs \
  -H "X-Api-Key: lt_your_key_here" -H "Content-Type: application/json" \
  -d '{
    "date": "2026-11-06",
    "customer": { "name": "Harbour View Hotel", "addr": "3 Marine Parade", "postcode": "ME12 2BP",
                  "phone": "01632 960111", "email": "[email protected]", "notify": true },
    "qty": 12,
    "ref": "ORDER-10432",
    "note": "Goods-in at the back",
    "codes": ["5012345678900", "5012345678917"],
    "cod": 45.50
  }'
FieldWhat it is
date (needed)The delivery date.
customer_id or customerAn existing customer's id (see GET /customers), or their details. A customer with the same name and postcode is reused, otherwise a new one is added. notify: true with an email sends them tracking emails.
driver_idOptional. Without it, the job waits on the hub's Today page until someone gives it to a driver or Auto-plan picks it up.
qtyHow many items to deliver, if known.
refYour order number. It comes back in webhooks and the deliveries download.
codesBarcodes on the parcels. The driver scans them at the drop and is warned about any that aren't for that drop.
codCash to collect on delivery, in pounds.
collectfalse if there's nothing to pick up.

Returns 201 with the job.

Read jobs and customers

GET/api/v1/jobs?date=2026-11-06 all jobs on a day

GET/api/v1/jobs/123 one job, including proof of delivery details

GET/api/v1/customers · GET/api/v1/drivers

A job looks like this

{ "id": 123, "date": "2026-11-06", "status": "done", "customer_id": 41, "customer": "Harbour View Hotel",
  "driver": "Dan Okafor", "planned": 12, "qty": 12, "delivered": 12, "collected": 4, "reason": "",
  "signer": "Pat Jones", "safe_place": null, "temp": null,
  "onway_at": "2026-11-06T09:12:03Z", "arrived_at": "2026-11-06T09:31:40Z", "done_at": "2026-11-06T09:36:15Z",
  "cod": 45.5, "cod_paid": 45.5, "cod_method": "card", "scans": ["5012345678900", "5012345678917"],
  "ext_ref": "ORDER-10432", "rating": 5, "feedback": "Lovely driver" }

status is todo, onway, here or done.

Webhooks

Add a webhook address in the hub (Settings → Connect your other software) and choose events. We send a POST with JSON when they happen:

EventWhen
job.on_the_wayThe driver sets off to the drop.
job.arrivedThe driver arrives.
job.deliveredThe drop is finished, with what was delivered, who signed, cash taken and barcodes scanned.
POST https://your-system.example.com/legends
X-Legends-Event: job.delivered
X-Legends-Signature: 5f2b…  (HMAC-SHA256 of the raw body, using your signing secret, in hex)

{ "event": "job.delivered", "at": "2026-11-06T09:36:15Z", "data": { …the job, as above… } }

Checking the signature (Node.js)

const crypto = require("crypto");
const ok = crypto.createHmac("sha256", SIGNING_SECRET).update(rawBody).digest("hex") === req.headers["x-legends-signature"];

Reply with any 2xx status. We wait up to 5 seconds and don't retry, so if you miss one, read the job with GET /api/v1/jobs/:id.

Deliveries download

For invoicing without a developer: in the hub, go to Manager → Customers → Download deliveries to get a spreadsheet of every drop between two dates, which most accounts software can import.

Legends Transport Hub · Created by Stanley Apps Ltd · [email protected]