Haulio API reference

Haulio API

The Haulio API lets your own systems price, book and follow vehicle transport with Haulio.

Base URL: the address this page is served from, followed by /v1.

Every error has the same shape:

{ "error": { "code": "not_found", "message": "…", "details": { } } }

code is stable - write your error handling against it. message is meant for a person.

Authentication

Send your API key on every request:

Authorization: Bearer hk_live_…

Keys are made in the Haulio portal under API & MCP. A key is shown once, when it is made - keep it secret, like a password. ⚠ There is no test mode: every key acts on your real orders, and so does "Send" on this page.

Status

Is the API up? For uptime checks and monitoring - needs no API key, and says nothing about your account.

Check the API is up

GET /v1/health

Answers 200 { "ok": true } while the API can serve requests, and 503 when it cannot - point your uptime monitor at the status code. Needs no API key.

Account

Which company and which API key a call acts as.

Make Who am I your first call: if it answers, your key works. It also tells you what the key may do - read keys can only look; read_write keys can also book, change and cancel.

Who am I

GET /v1/me

The company and the API key this call acts as. Call it first: if it answers, your key works.

Quotes

What moving your cars would cost, before you commit to anything. A quote saves nothing and books nothing.

  • Send the cars with their pickup and delivery addresses to Get a price. The VIN is the only detail of a car you must send - make, model and year are read from it.
  • Check the addresses that come back: match: approximate means we found only the street or the town.
  • Send the same body to Book transport, with the quoted total as expected_total.

Prices are in EUR, excluding VAT, per car and in total. A route the price list does not cover reads price_status: to_follow - it can still be booked, and Haulio sends a price.

Get a price

POST /v1/quotes

Price vehicles between two addresses. Nothing is saved or booked.

The VIN is optional here - a price needs only where from and where to. Booking needs each car's VIN.

Vehicles come back in the order you sent them. Send the same body, with the VINs, to Book transport to book at this price.

A large basket is split into one order per truckload, as on haulio.dk - order says which.

Orders

Book transport, then follow it to the door.

An order is one truckload of your cars, named by its code (HLO-…) - the reference on the invoice. Each car on it, named by its VIN, has its own pickup and delivery, dates, live position, photos and CMR.

  • booked - No car collected yet.
  • in_transit - At least one car is on its way.
  • delivered - Every car is delivered.
  • cancelled - The order, or every car on it, was cancelled.

Keeping your system in step: poll List orders with updated_since set to the time of your last poll. Download links in documents last one hour - fetch the order again for fresh ones.

Changing an order: contacts, references and ready dates change through Update a vehicle; a VIN correction and a cancellation are requests that Haulio answers. Addresses cannot be changed through the API.

Book transport

POST /v1/orders

Book the vehicles - this places a real order, exactly like booking on haulio.dk. Send the same body you sent to Get a price.

  • Send expected_total (the total you were quoted): if the price has changed, nothing is booked and you get 409 price_changed with the new total.
  • Send an Idempotency-Key header (a UUID you make): if the connection drops and you send the same request again with the same key, you get the first booking back instead of a second one.
  • A route we cannot price automatically (price_status: to_follow in the quote) can still be booked; Haulio sends a price.

A large booking is split into one order per truckload, so the answer is always a list of orders.

List orders

GET /v1/orders

Your orders, newest first, each in the same shape as Get an order.

  • Find the order a car is on: ?vin=WVWZZZAUZPW123456
  • Keep your system in step by polling: ?updated_since=<the time of your last poll>

⚠ Positions in a list are the last ones stored; Get an order fetches a fresh one.

Get an order

GET /v1/orders/{order}

One order with all its vehicles: status, dates, where each car is right now, its photos and CMR, and the price.

An order that is not on your account answers 404 not_found, exactly like one that does not exist.

Update a vehicle

PATCH /v1/orders/{order}/vehicles/{vin}

Change one car on an order. Send only the fields you are changing.

  • reference - Changed.
  • pickup.contact, delivery.contact - Changed, at any time. null removes it.
  • available_from - Changed while no carrier has planned the collection; then a request; refused once collected.
  • vin - Always a request (requests.vin_change), with an optional reason.

Pickup and delivery addresses cannot be changed here (422 address_change_not_supported) - moving an end changes the route and the price. Contact Haulio, or cancel the car and book it again.

The answer is the whole order, as Get an order returns it.

Ask to cancel

POST /v1/orders/{order}/cancel

Ask Haulio to cancel the whole order, or only some of its cars. This is a request: Haulio answers it, usually the same working day.

  • Until then each car shows requests.cancellation.
  • Approved: the car is removed from the order (the order too, with its last car).
  • Declined: the request disappears and the car stays booked.

A car that has already been collected cannot be cancelled (409 already_picked_up) - nothing is requested then, for any of the cars. Asking again for a car that is already waiting changes nothing.

Answer a price offer

POST /v1/orders/{order}/price

A route we cannot price automatically is booked with price.status: awaiting_haulio. Haulio then offers a price, and the order reads price.status: awaiting_you with price.offer.

  • Accept ({"accept": true}): the price is agreed and binding; the order reads agreed.
  • Decline ({"accept": false, "reason": "…"}): the order reads declined, and Haulio comes back with a new offer or contacts you.

Send expected_total with the amount you were shown, so a changed offer is never accepted by accident.

Webhooks

Haulio calls your URL the moment an order changes, so your system never has to ask. Every call is signed, so you can check it came from Haulio.

Set up endpoints in the Haulio portal under API & MCP → Webhooks: your URL (https://), and every event or only some. The signing secret (whsec_…) is shown once, when you add the endpoint. Send test event sends a webhook.test straight away, and the delivery log there shows every try and your server's answer, with Resend.

What arrives

A POST with a JSON body - the same envelope for every event:

  • id - The event id. The same on every retry - store it and ignore a repeat.
  • type - What happened - see the events below.
  • created_at - When it happened.
  • order_id, vin - The order and, for a car event, the car.
  • data - What changed, for the events that say more than the order does.
  • order - The whole order as it is now, in the shape of Get an order - so most receivers never need to call back.
  • order.created - When an order is booked
  • order.price_offered - When Haulio offers a price for an order it could not price automatically, and on every new offer after that
  • order.price_agreed - When the price of an order is agreed
  • order.delivered - When the last car on an order is delivered
  • order.cancelled - When a whole order is cancelled
  • vehicle.picked_up - When a car is collected
  • vehicle.eta_changed - When the estimated pickup or delivery date of a car moves
  • vehicle.delivered - When a car is delivered
  • vehicle.documents_added - When photos or documents are added to a car
  • vehicle.vin_changed - When a VIN correction is approved
  • vehicle.cancelled - When a car is cancelled

The truck's live position is not an event - read it from Get an order when you need it.

Verifying a call

Haulio signs by the open Standard Webhooks spec, so you can verify with its official library in your language (npm install standardwebhooks, pip install standardwebhooks, …):

import { Webhook } from 'standardwebhooks';

const wh = new Webhook(process.env.HAULIO_WEBHOOK_SECRET); // whsec_…

// Express: keep the RAW body - the signature is over the exact bytes sent.
app.post('/haulio-webhooks', express.raw({ type: 'application/json' }), (req, res) => {
  let event;
  try {
    event = wh.verify(req.body.toString(), req.headers);
  } catch {
    return res.status(400).end(); // not from Haulio
  }
  // event.type, event.order_id, event.vin, event.data, event.order
  res.status(204).end();
});

Three headers come with every call:

  • webhook-id - The event id - the same as id in the body.
  • webhook-timestamp - When this try was sent, in Unix seconds.
  • webhook-signature - v1, and a base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}.

Without the library: the key is your secret without whsec_, base64-decoded - the bytes, not the text. Sign the raw body exactly as it arrived (parsing and re-serialising the JSON changes it), compare in constant time, and refuse a timestamp more than a few minutes from your clock:

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

function fromHaulio(secret, headers, rawBody) {
  const id = headers['webhook-id'];
  const timestamp = headers['webhook-timestamp'];
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; // older than 5 minutes

  const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64'); // the decoded BYTES are the key
  const expected = createHmac('sha256', key).update(`${id}.${timestamp}.${rawBody}`).digest('base64');

  return String(headers['webhook-signature'] || '').split(' ').some((part) => {
    const [version, signature = ''] = part.split(',');
    return version === 'v1' && signature.length === expected.length &&
      timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
  });
}
import base64, hashlib, hmac, time

def from_haulio(secret: str, headers, raw_body: bytes) -> bool:
    msg_id = headers["webhook-id"]
    timestamp = headers["webhook-timestamp"]
    if abs(time.time() - int(timestamp)) > 300:  # older than 5 minutes
        return False

    key = base64.b64decode(secret.removeprefix("whsec_"))  # the decoded BYTES are the key
    signed = f"{msg_id}.{timestamp}.".encode() + raw_body
    expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()

    for part in headers.get("webhook-signature", "").split(" "):
        version, _, signature = part.partition(",")
        if version == "v1" and hmac.compare_digest(signature, expected):
            return True
    return False

Answering and retries

Answer with any 2xx within 10 seconds. Do the real work afterwards - a slow answer counts as a failure. Anything else is tried again: a 3xx (redirects are not followed), a 4xx or 5xx, a timeout, a refused connection.

  • Retries come after 5 s, 5 min, 30 min, 2 h, 5 h, 10 h, 10 h, 14 h and 24 h - ten tries over about 2.7 days, all with the same id.
  • After the tenth, the event is given up. If nothing at all reached the endpoint in that time, the endpoint is turned off, and the portal says why. Events made while it is off wait, and go out when you turn it on again.
  • In order: one endpoint gets its events in the order they happened, each sent only after the one before it got through or was given up. Within one change, the order's own events come after its cars' - vehicle.delivered before order.delivered.
  • At least once: a call that timed out on our side may still have reached you, so the same event can come twice. The id tells you.

The URL

https:// on a public address - Haulio does not call private or local network addresses, and does not follow redirects.

Order booked

WEBHOOK order.created

When an order is booked - on the portal, through the API or from an AI assistant.

data is null.

Price offered

WEBHOOK order.price_offered

When Haulio offers a price for an order it could not price automatically, and on every new offer after that. Answer it with Answer a price offer.

data: amount - the offer, EUR excl. VAT.

Price agreed

WEBHOOK order.price_agreed

When the price of an order is agreed - you accepted an offer, or Haulio set it.

data: total - the agreed price, EUR excl. VAT.

Order delivered

WEBHOOK order.delivered

When the last car on an order is delivered. Each car has had its own vehicle.delivered first.

data is null.

Order cancelled

WEBHOOK order.cancelled

When a whole order is cancelled. order is its last state, with every car still in play marked cancelled.

data is null.

Vehicle picked up

WEBHOOK vehicle.picked_up

When a car is collected.

data is null.

Estimated date changed

WEBHOOK vehicle.eta_changed

When the estimated pickup or delivery date of a car moves. Not sent for a car that is delivered or cancelled in the same change.

data: pickup and/or delivery - each { from, to }, dates as YYYY-MM-DD (Danish time); from is null when there was no estimate.

Vehicle delivered

WEBHOOK vehicle.delivered

When a car is delivered.

data is null.

Photos or documents added

WEBHOOK vehicle.documents_added

When photos or documents are added to a car - pickup and delivery photos, the CMR. Download them from the car's documents in order.

data: documents - the new ones: { type, name, added_at } each.

VIN changed

WEBHOOK vehicle.vin_changed

When a VIN correction is approved. vin is the new VIN.

data: previous_vin - the VIN it had.

Vehicle cancelled

WEBHOOK vehicle.cancelled

When a car is cancelled - a cancellation approved by Haulio removes it from the order.

data is null.

Test event

WEBHOOK webhook.test

Only when you press Send test event for an endpoint in the Haulio portal - never because of an order.

data: message - a line of text.

VIN decoder

Make, model and model year from a VIN - the same decoder that fills in your cars when you book. Free within fair use with any API key, read-only keys included.

Most European VINs carry no model year, so year is often null; that is normal, not an error.

Decode VINs

POST /v1/vins/decode

Make, model and model year from up to 100 VINs. Free to use within fair use with any API key.

Answers come back in the order you sent the VINs. A VIN that cannot be decoded gets an error on its own row - the rest are still answered.