Free verdictCarrier X-raySign in
  • Getting a key
  • Scopes
  • One shape
  • Endpoints
  • Records
  • The sandbox
  • Webhooks
  • Rate limits
  • Errors
  • Versioning
  • Partner keys
  • Changelog

Developers The Leonard API.

Last updated November 15, 2026

The Leonard API lets a company's own systems (a TMS, an ERP, a data warehouse, a customer portal) read its loads, trucks, drivers, invoices, documents and a live load's tracking, file documents, and hear the moment something changes. This is version 1.1.0. The machine-readable version of this page is the OpenAPI 3.1 document.

Getting a keyScopesOne shapeEndpointsRecordsThe sandboxWebhooksRate limitsErrorsVersioningPartner keysChangelog

Getting a key

The API comes with Leonard Enterprise. The company's owner makes keys in Settings, API and webhooks. A key looks like lk_live_ab12… (40 characters). Leonard shows it once, when it is made, and keeps only its fingerprint, so a lost key is revoked and a new one made. Send it on every request:

Authorization: Bearer lk_live_…

A key can carry an expiry (30, 90 or 365 days) and a list of addresses it may be used from (single addresses or blocks like 203.0.113.0/24). Several keys can be live at once: to rotate one, make the new key, switch your system over, then revoke the old one. A key stops working the moment it is revoked or expires. Every key made or revoked, and every hour a key is used, is in the company's audit log; every call is kept, without its body, for 13 months.

curl https://desk.leonarddispatch.com/api/v1/loads?limit=2 \
  -H "Authorization: Bearer lk_test_…"

Scopes

A key does only what its scopes say. A call without the scope it needs answers 403 with the code missing_scope.

ScopeWhat it allows
loads:readRead loads
trucks:readRead trucks
drivers:readRead drivers (name and unit)
invoices:readRead invoices
documents:readRead and download documents
documents:writeUpload documents
tracking:readRead a live load's tracking
partner:readRead the program's totals (a partner's key only)

One shape for everything

The base address is https://desk.leonarddispatch.com/api/v1. Every answer is JSON, except a document download.

  • Lists answer { "data": [ … ], "next_cursor": "…" }, the latest change first. Pass next_cursor back as ?cursor= for the next page; it is null on the last one. Every row is returned once across the pages. ?limit= is 1 to 200 (default 50).
  • Keeping a copy in step: ?updated_since=2026-11-15T00:00:00Z returns only rows changed at or after that time.
  • Times are ISO 8601 in UTC, like 2026-11-15T14:02:11.482Z.
  • Money is a whole number of cents beside a currency: "rate_cents": 285000, "currency": "USD".
  • Every answer carries a Request-Id header. Quote it when you write to us.
  • Never in the API: a driver's phone number, email or licence, a message, a text, or a document's extracted text.

Endpoints

Loads

GET /loadsloads:read
List loads. The company's loads, the latest change first. Answers with a list of Load.
limit · cursor · updated_since · status
GET /loads/{id}loads:read
Get a load. Answers with a Load.

Tracking

GET /loads/{id}/trackingtracking:read
A live load's tracking events. Positions and stop events for one load, the newest first, while the load is live (booked, in transit or at the dock). After delivery the answer is live: false with no events; nothing is ever returned for the time between loads. Answers with a list of TrackingEvent.
limit · cursor

Trucks

GET /truckstrucks:read
List trucks. The trucks and the one state each is in. Answers with a list of Truck.
limit · cursor · updated_since · status

Drivers

GET /driversdrivers:read
List drivers. Name and unit only. Never a phone number or an email. Answers with a list of Driver.
limit · cursor · updated_since · status

Invoices

GET /invoicesinvoices:read
List invoices. Answers with a list of Invoice.
limit · cursor · updated_since · status
GET /invoices/{id}invoices:read
Get an invoice. Answers with a Invoice.

Documents

GET /documentsdocuments:read
List documents. Each document's facts, the newest first. updated_since reads the day it was added: a document doesn't change. Answers with a list of Document.
limit · cursor · updated_since · load_id · document_type
POST /documentsdocuments:write
Upload a document. multipart/form-data with the file in `file` (a PDF or a photo, up to 25 MB). Send an Idempotency-Key header: the same key with the same file answers with the first document again and never makes a second. Answers with the new Document.
Idempotency-Key (header)
GET /documents/{id}documents:read
Get a document's facts. Answers with a Document.
GET /documents/{id}/downloaddocuments:read
Download a document. The file itself, with its own content type.

Partner totals

GET /partner/overviewpartner:read
The program's totals. The same totals the partner console shows, from the same daily snapshot: never a single carrier, never a number with fewer than five carriers in it. Answers with a PartnerOverview.
GET /partner/pilotpartner:read
The pilot's measures, at the start and today. Answers with a PartnerPilot.

The spec

GET /openapi.jsonno key needed
This API as an OpenAPI 3.1 document. Needs no key.

Uploading a document:

curl https://desk.leonarddispatch.com/api/v1/documents \
  -H "Authorization: Bearer lk_live_…" \
  -H "Idempotency-Key: pod-EX-1004-2026-11-15" \
  -F document_type=pod \
  -F load_id=6f1c… \
  -F file=@pod.pdf

The Idempotency-Key is any string of yours, up to 200 characters, unique to the upload. If the request times out, send it again with the same key: you get the first document back (with Idempotent-Replayed: true) and no second one is made. The same key with a different file answers 422. Keys are remembered for 7 days.

Records

Load

FieldType
idstringA uuid.
referencestring or null
broker_referencestring or null
statusone of a fixed list
origin{ city, state }
destination{ city, state }
pickup_appointmenttime or null
delivery_appointmenttime or null
equipmentstring or null
rate_centsinteger or nullThe linehaul rate, in cents.
projected_net_profit_centsinteger or nullLeonard's projected net profit on the load, in cents.
currency"USD"ISO 4217. Leonard keeps US dollars.
ratenumber or nullDeprecated. The rate in dollars. Kept for keys made before 2026-11-15; read rate_cents.
projected_net_profitnumber or nullDeprecated. In dollars. Read projected_net_profit_cents.
milesnumber or null
verdictTAKE | COUNTER | BACKUP | SKIP | WAIT | REPOSITION or null
truck_idstring or null
driver_idstring or null
broker_idstring or null
delivered_attime or null
paid_attime or null
created_attimeISO 8601, UTC.
updated_attimeISO 8601, UTC.

TrackingEvent

FieldType
idstring
typeposition | dispatched | arrived_pickup | loaded | departed_pickup | arrived_delivery
attimeISO 8601, UTC.
sourcestring or nullWhere it came from: eld, driver_link, text, driver_sms, dispatcher or system.
latnumber or null
lngnumber or null
speed_mphnumber or null
headingnumber or null

Truck

FieldType
idstringA uuid.
unit_numberstring or null
statestring or nullThe one state the truck is in: empty_soon, searching, offered, booked, in_transit, at_dock, delivered, paperwork, invoiced or paid.
empty_attime or null
equipmentstring or null
trailer_typestring or null
yearnumber or null
makestring or null
modelstring or null
driver_idstring or null
current_load_idstring or null
carrier_idstring or null
updated_attimeISO 8601, UTC.

Driver

A driver: the name and the unit. Never a phone number, an email, a licence or a home address.

FieldType
idstringA uuid.
full_namestring
unit_numberstring or nullThe unit the driver is on.
statusstring or null
carrier_idstring or null
updated_attimeISO 8601, UTC.

Invoice

FieldType
idstringA uuid.
numberstring
kindstring
statusdraft | issued | submitted_to_factor | paid | void
load_idstring or null
broker_idstring or null
carrier_idstring or null
subtotal_centsintegerA whole number of cents.
total_centsintegerA whole number of cents.
paid_centsintegerA whole number of cents.
currency"USD"ISO 4217. Leonard keeps US dollars.
issued_attime or null
due_attime or null
submitted_attime or null
paid_attime or null
created_attimeISO 8601, UTC.
updated_attimeISO 8601, UTC.

Document

A document's facts. The file itself is GET /documents/{id}/download; its text is never in the API.

FieldType
idstringA uuid.
document_typeone of a fixed list
namestring or null
content_typestring or null
size_bytesinteger or null
load_idstring or null
invoice_idstring or null
truck_idstring or null
driver_idstring or null
broker_idstring or null
carrier_idstring or null
expires_onstring or nullA date, YYYY-MM-DD, for a document that runs out.
created_attimeISO 8601, UTC.

PartnerOverview

FieldType
enoughbooleanFalse while fewer than five carriers are in the program's totals; then there are no totals.
messagestring
as_ofstringThe day of the snapshot, YYYY-MM-DD. Totals change once a day.
invitednumber
metricsobjectThe console's totals. Each measure is { n, v }.
trendlist of object

PartnerPilot

FieldType
enoughboolean
messagestring
pilotboolean
startstring or null
at_start{ date, measures }
today{ date, measures }

The sandbox

In Settings, API and webhooks, Make a test key gives a key that starts lk_test_. It works on every endpoint above and reads a sandbox of example data (six example loads, one of them live with tracking, three invoices, four documents you can download), never the company's own. Uploads with a test key land in the sandbox. Test keys are rate-limited the same way as live ones. A sandbox never posts a webhook.

Webhooks

In Settings, API and webhooks, add an https address and pick what it hears about. Leonard posts JSON to it the moment the thing happens.

EventWhen
load.createdA load is created
load.status_changedA load changes state
load.deliveredA load is delivered
document.addedA document is added
invoice.createdAn invoice is made
invoice.sentAn invoice is sent
invoice.paidAn invoice is paid
{
  "id": "a5e0…",
  "type": "load.status_changed",
  "created_at": "2026-11-15T14:02:11Z",
  "data": { "id": "6f1c…", "reference": "LD-10482", "status": "in_transit", "previous_status": "booked", "truck_id": "…", "driver_id": "…", "broker_id": "…", "updated_at": "2026-11-15T14:02:11Z" }
}

A payload carries ids and what changed, never the whole record, a document's contents or anyone's phone or email. Read the record with its id when you need the rest. The headers are Leonard-Event, Leonard-Delivery (the same id on every retry and every redelivery, so you can drop a repeat) and Leonard-Signature.

Verifying a webhook

Leonard-Signature: t=1763215331,v1=5f2c…. t is when Leonard sent it, in Unix seconds. v1 is HMAC-SHA256, in hex, of t, a full stop and the raw body, keyed with the endpoint's signing secret (whsec_…). Check the signature against the raw body, and refuse a t more than 5 minutes old, so a post someone captured can't be sent to you again later.

Node

import { createHmac, timingSafeEqual } from "node:crypto";

// secret: the endpoint's signing secret (whsec_…)
// rawBody: the request body exactly as it arrived, before any JSON parsing
// header: the Leonard-Signature header
export function fromLeonard(secret, rawBody, header, nowSeconds = Date.now() / 1000) {
  const parts = header.split(",").map((p) => p.trim().split("="));
  const t = Number(parts.find(([k]) => k === "t")?.[1]);
  // Refuse anything older than 5 minutes: a captured post can't be replayed later.
  if (!Number.isFinite(t) || Math.abs(nowSeconds - t) > 300) return false;
  const want = createHmac("sha256", secret).update(t + "." + rawBody).digest();
  // After a secret is rotated there are two v1 values for 24 hours; either may match.
  return parts.some(([k, v]) => {
    if (k !== "v1" || !v) return false;
    const got = Buffer.from(v, "hex");
    return got.length === want.length && timingSafeEqual(got, want);
  });
}

Python

import hashlib, hmac, time

# secret: the endpoint's signing secret (whsec_…)
# raw_body: the request body as bytes, exactly as it arrived
# header: the Leonard-Signature header
def from_leonard(secret: str, raw_body: bytes, header: str, now: float | None = None) -> bool:
    parts = [p.strip().split("=", 1) for p in header.split(",")]
    t = next((v for k, v in parts if k == "t"), None)
    if t is None or not t.isdigit():
        return False
    # Refuse anything older than 5 minutes: a captured post can't be replayed later.
    if abs((now if now is not None else time.time()) - int(t)) > 300:
        return False
    want = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    # After a secret is rotated there are two v1 values for 24 hours; either may match.
    return any(k == "v1" and hmac.compare_digest(v, want) for k, v in parts)

Rotating a secret

Rotate gives the endpoint a new secret. For 24 hours each post carries two v1 values, the new secret's and the old one's, so your system keeps verifying while you switch it over.

Retries

Answer with any 2xx within 10 seconds. Anything else is tried again 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 14 hours and 24 hours after the first try, then marked not delivered. After 50 failures in a row the endpoint is paused; the owner gets an email and a card on the Desk, and turns it back on in Settings. A delivery that failed can be sent again from there with Redeliver. Leonard doesn't follow redirects. The last posts, and what each answered, are kept for 30 days.

Rate limits

600 requests a minute per key, live or test. Every answer says where you stand: RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds until the minute starts again). Past the limit the answer is 429 with Retry-After.

Errors

Every error has one shape. Branch on the code; show the message to a person; send us the request id.

{ "error": { "code": "missing_scope", "message": "This key doesn't carry the invoices:read scope.", "request_id": "req_4f0c…", "status": 403 } }
StatusCodeWhat happened
400invalid_requestA parameter or a field is wrong; the message says which.
401unauthorizedNo key, a key that isn't one of ours, or one that was revoked.
401key_expiredThe key's expiry date has passed.
403ip_not_allowedThe key has an address allowlist and the call came from outside it.
403missing_scopeThe key doesn't carry the scope this endpoint needs.
403wrong_key_kindA partner's key called a carrier endpoint, or a company's key called a partner one.
403plan_requiredThe company's plan, or the partner's contract, doesn't include the API.
403company_closedThe company asked to be deleted.
404not_foundNothing of yours has that id.
409idempotency_in_progressThe first request with this Idempotency-Key is still being worked. Try again shortly.
413payload_too_largeThe file is over 25 MB.
415unsupported_media_typeThe upload isn't multipart/form-data, or the file isn't a PDF or a photo.
422idempotency_key_reusedThis Idempotency-Key was already used with a different file or different fields.
429rate_limitedToo many requests. Retry-After says how many seconds to wait.
500server_errorLeonard couldn't answer just now. Try again; if it persists, send us the request id.

Versioning

The version is in the path. Within /api/v1 we add endpoints, fields and events, and never remove or rename one or change what it means; write your client to ignore fields it doesn't know. A breaking change means /api/v2, and /api/v1 keeps working for at least 12 months after v2 ships, with the date in the changelog below.

Partner keys

A partner program whose contract includes the API can make a key in its console. A partner's key reads the program's totals, the same ones the console shows, from the same once-a-day snapshot, and nothing else: never a single carrier, never a number with fewer than five carriers in it. It answers 403 on every carrier endpoint.

Changelog

1.1.0 · November 15, 2026

  • Scopes replace the single read scope: loads:read, trucks:read, drivers:read, invoices:read, documents:read, documents:write and tracking:read. A key made before today keeps working, as every :read scope.
  • A key can carry an expiry and an address allowlist, and several keys can be live at once, so a key is rotated without downtime.
  • New endpoints: invoices, documents (list, download, and upload with an Idempotency-Key) and a live load's tracking events.
  • One shape: money in whole cents beside a currency (rate_cents; rate in dollars stays, deprecated), times in UTC, updated_since on every list, one error format with a code and a request_id, and a Request-Id header on every answer.
  • Rate limits are per key, 600 requests a minute, with RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset on every answer.
  • Drivers answer with the name and the unit. home_base and hours_left_minutes are no longer returned.
  • Webhooks: new events document.added and invoice.sent; payloads carry ids and what changed, not the whole record; a signing secret can be rotated, and the old one verifies for 24 hours; retries now run for 24 hours; a failed delivery can be sent again from Settings.
  • Test keys (lk_test_…) read a sandbox of example data.
  • An OpenAPI 3.1 document at /api/v1/openapi.json.
  • Partner keys read a partner program's totals at /partner/overview and /partner/pilot.

1.0.0 · November 8, 2026

  • The first version: loads, a load by id, trucks and drivers, read with a key; webhooks for loads and invoices, signed, with retries.
TrustPrivacySecuritySub-processorsTermsWorks withDevelopersCareers