Skip to main content

Book Freight

POST 

/api/freight/shipments/:id/book

Book one of the load's rates with the freight provider. This books a real truck and is charged to the merchant's freight account unless the connection uses a sandbox key (is_sandbox is then true and nothing is charged).

Required scope: orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Body fields

  • rate_id (required): one of the load's current rates.
  • pickup_date (Y-m-d, today or later; defaults to the load's pickup date).
  • pickup_window / delivery_window: from and to (H:i, required together, to after from).
  • pickup_contact / delivery_contact: name (max 80), phone (max 30), email; each overrides the stop's contact for this booking.
  • acknowledge_retailer_routing (boolean): required as true when the retailer already routed the linked shipment to a carrier (see retailer_routing on Get Freight Load); booking replaces that carrier on the ship notice.

The booking is reserved before the provider is called, so two calls can't book twice. If the provider's answer is lost the load stays booking_unknown and the call returns 502; use Check Freight Booking to resolve it. A provider refusal returns the load to quoted with a 422.

Refused with 409 when: the load is not quoted, the quote is stale or the rate expired or was replaced, the shipment already has an active booking, the retailer routing was not acknowledged (reasons: ["retailer_routing"]), or a stop lacks company, street, city, state, ZIP, contact name, phone or email.

On success the load is booked and gets a bill of lading number (SKU.io numbers it when the provider does not), the carrier PRO, SCAC and carrier name.

Side effect on the linked shipment. When the load is linked to a sales order shipment, booking writes the load's references into that shipment's freight details, which retailer EDI ship notices (856) are built from: bill_of_lading_number, carrier_pro_number, carrier_scac, carrier_name, transportation method M (motor) and the scheduled delivery date (the estimated delivery date). Fields the booking does not set (ship notice number, routing sequence, status code) are kept. If the shipment's ship notice was already sent, nothing is changed and booking.fulfillment_locked is true. Cancelling the load later restores the previous values of any field still holding the booked value.

Errors. 409 when the load is in a state that does not allow this action; the body carries message and reasons (every problem, one per entry). 422 when the freight provider rejected the request; errors maps each field the provider named to its messages (an invalid API key appears under credentials). 502 when the freight provider did not answer; code carries the provider's error code when it sent one.

Authentication: Requires Bearer token with the orders:write scope.

Requires permission: freight.book

Request​

Responses​

OK

Response Headers
    Content-Type