Developers

Your books, by API.

A key you create under More → API keys, shown once, revocable at once. It reads (or writes) exactly one company, the one that made it. Every call it makes is written to that company’s activity log as “API key <name>”.

Authentication

Create a key in the app (owner or admin only): More → API keys → New key. Pick read-only or read-write. The key is shown once; MileBrain stores a hash and cannot show it again. Send it as a bearer token:

curl https://milebrain.com/api/v1/loads \
  -H "Authorization: Bearer mbk_0123456789abcdef0123456789abcdef01234567"

A driver, a mechanic (outside shop), a customer-portal login and a demo sandbox can never create a key. A revoked key is refused on its very next call with 401 {"code":"REVOKED"}.

Limits

60 calls a minute and 1,000 an hour per key; past that you get 429 with a Retry-After header. Lists return at most 200 items a page — use limit and offset. Records are at most 300 KB.

Resources

PathMethodsWhat it is
/api/v1/meGETThe company this key belongs to, the key’s name and scope.
/api/v1/loads, /api/v1/loads/:idGET, PUT, DELETELoads. Filters: from, to (YYYY-MM-DD, on the delivery date), status.
/api/v1/customers, /:idGET, PUT, DELETECustomers (brokers and shippers).
/api/v1/trucks, /:idGET, PUT, DELETETrucks. Creating one counts against the plan exactly as in the app (402 PLAN_LIMIT).
/api/v1/fuel, /:idGET, PUT, DELETEFuel stops. from/to on the stop date.
/api/v1/repairs, /:idGET, PUT, DELETERepairs and services (the app’s maintenance records).
/api/v1/invoices, /:idGETInvoiced loads with the invoice total, dates and paid state. Read-only: an invoice is made in the app.
/api/v1/settlements, /:idGETDriver settlements as paid. Read-only: the settlement engine computes them.
/api/v1/claims, /:idGETDamage and shortage claims.

PUT and DELETE need a read-write key; a read-only key gets 403 {"code":"READ_ONLY"}. Invoices, settlements and claims are read-only for every key — their numbers come out of the app’s own engines and are not accepted from outside.

Examples

List this month’s delivered loads

curl "https://milebrain.com/api/v1/loads?from=2026-09-01&to=2026-09-30&status=Delivered" \
  -H "Authorization: Bearer $MB_KEY"

{"ok":true,"total":14,"limit":200,"offset":0,"items":[{"id":"l-7f3a","customerName":"Acme Freight Brokers",
  "origin":"Detroit, MI","destination":"Chicago, IL","pickupDate":"2026-09-03","deliveryDate":"2026-09-04",
  "rate":"1850.00","miles":"283","status":"Delivered", ...}]}

Create or replace a load (read-write key)

PUT is an upsert on the id you choose. Fields you leave out of a PUT on an existing record are kept.

curl -X PUT https://milebrain.com/api/v1/loads/l-tms-10442 \
  -H "Authorization: Bearer $MB_KEY" -H "Content-Type: application/json" \
  -d '{"customerName":"Acme Freight Brokers","origin":"Detroit, MI","destination":"Chicago, IL",
       "pickupDate":"2026-09-12","deliveryDate":"2026-09-13","rate":"1850.00","miles":"283","status":"Booked","refNo":"PO 10442"}'

{"ok":true,"created":true,"load":{"id":"l-tms-10442", ...}}

Outstanding invoices for the accountant

curl "https://milebrain.com/api/v1/invoices" -H "Authorization: Bearer $MB_KEY" \
  | jq '.items[] | select(.paidAt=="") | {invoiceNo, customer, total, invoicedAt}'

Fuel stops, in Python

import requests
r = requests.get("https://milebrain.com/api/v1/fuel", params={"from": "2026-07-01", "to": "2026-09-30"},
                 headers={"Authorization": "Bearer " + MB_KEY})
for f in r.json()["items"]:
    print(f["date"], f.get("state"), f.get("gallons"), f.get("amount"))

Errors

StatusCodeMeaning
401NO_KEY / BAD_KEY / REVOKEDNo bearer token, an unknown key, or a key the owner revoked.
403READ_ONLY / SUSPENDEDA write with a read-only key; a suspended company.
404NOT_FOUNDNo such record in this company. Another company’s record answers 404 too, never 403.
402PLAN_LIMITThe free plan’s one truck / one employee, or a paid plan at the seats it is billed for (a PayPal plan answers with its approveUrl). The cap is applied inside the write itself, so parallel creates cannot slip past it.
429RATE_LIMITED60 a minute or 1,000 an hour on that key.
Scope is the company, not the person. A key sees what the owner sees and nothing about any other MileBrain company. There are no per-driver keys, on purpose: a driver’s view is a stripped view, and stripping is done by the app, not by a token.

Files instead of code

If what you actually need is a spreadsheet, the app already exports CSV for loads, fuel, repairs, the team, QuickBooks invoices and expenses, IFTA and payroll — under More → Exports. No key required.

The API is included on every plan — see pricing for the plan limits a key inherits, the features whose records it reads, and the help center for how those records get entered in the first place.

Free for your first truck.

Every feature, the API included, on the free tier. Upgrade when the fleet grows.

Start free

No card needed