Add a booking item
Add an item line to a draft booking. The booking’s charged weight is recalculated.
POST /api/v5/bookings/{id}/itemsRequires your API key in the api-key header.
Make item changes before you confirm. Transdirect prices the booking again at confirm from the items it holds then, so quote again if you need to show your customer the new price first.
Path parameters
Section titled “Path parameters”| Parameter | Type | Description |
|---|---|---|
id | integer | The Transdirect booking id. |
Request body
Section titled “Request body”Send JSON with Content-Type: application/json. All fields are required and no others are accepted.
| Field | Type | Description |
|---|---|---|
description | string | Package type, for example Carton, Satchel or Pallet (any case). See items and packaging for the full list. What is inside the parcel belongs in the booking’s goods_description, not here. |
weight | number | Weight of one item in kg. Greater than 0. |
length | number | Length in cm. Greater than 0. |
width | number | Width in cm. Greater than 0. |
height | number | Height in cm. Greater than 0. |
quantity | integer | Number of identical items. At least 1. |
Example request
Section titled “Example request”curl -X POST https://api.transdirect.com.au/api/v5/bookings/623630/items \ -H "api-key: $TD_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "description": "Satchel", "weight": 1, "length": 30, "width": 25, "height": 5, "quantity": 2 }'import { client, postApiV5BookingsByIdItems } from '@transdirect/api-sdk';
client.setConfig({ headers: { 'api-key': process.env.TD_API_KEY! } });
const { data: item, error } = await postApiV5BookingsByIdItems({ path: { id: '623630' }, body: { description: 'Satchel', weight: 1, length: 30, width: 25, height: 5, quantity: 2 },});Response
Section titled “Response”201 Created with the new item. The package type is returned in its standard spelling.
{ "id": 46885333, "description": "Satchel", "weight": 1, "length": 30, "width": 25, "height": 5, "quantity": 2}Errors
Section titled “Errors”| Status | Body | Cause |
|---|---|---|
400 | {"errors":["Cannot update. Booking has been processed."]} | The booking has already been paid. |
400 | {"errors":"Invalid Item description."} | description is not a known package type. |
400 | {"errors":"Cannot update items is Multipick bookings"} | The booking is a multi-pickup booking, whose items cannot be changed. |
400 | {"success":false,"error":{"name":"ZodError","message":"..."}} | A field is missing, not positive, or not recognised. message is a JSON-encoded list of issues. |
401 | {"error":"missing_api_key"} or {"error":"invalid_api_key"} | No key, or a key that is not active. |
404 | {"error":"booking_not_found"} | No booking with that id belongs to your account. |
Try it
Section titled “Try it”Open the API Explorer, add your key, and find Create a booking item.