Update a booking item
Change one item line on a draft booking. Fields you leave out keep their current value, and the booking’s charged weight is recalculated.
PUT /api/v5/bookings/{id}/items/{item_id}Requires 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. To change several lines in one request, send items to update a booking.
Path parameters
Section titled “Path parameters”| Parameter | Type | Description |
|---|---|---|
id | integer | The Transdirect booking id. |
item_id | integer | The item line id. |
Request body
Section titled “Request body”Send JSON with Content-Type: application/json. Every field is optional.
| Field | Type | Description |
|---|---|---|
description | string | Package type, for example Carton or Pallet. See items and packaging. |
weight | number | Weight of one item in kg. Greater than 0. |
length, width, height | number | Dimensions in cm. Greater than 0. |
quantity | integer | Number of identical items. At least 1. |
Example request
Section titled “Example request”curl -X PUT https://api.transdirect.com.au/api/v5/bookings/623630/items/46885332 \ -H "api-key: $TD_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "weight": 6.5, "quantity": 2 }'import { client, putApiV5BookingsByIdItemsByItemId } from '@transdirect/api-sdk';
client.setConfig({ headers: { 'api-key': process.env.TD_API_KEY! } });
const { data: item } = await putApiV5BookingsByIdItemsByItemId({ path: { id: '623630', item_id: '46885332' }, body: { weight: 6.5, quantity: 2 },});Response
Section titled “Response”200 OK with the whole item after the change.
{ "id": 46885332, "description": "Carton", "weight": 6.5, "length": 40, "width": 30, "height": 20, "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. |
400 | {"success":false,"error":{"name":"ZodError","message":"..."}} | A value is not positive, or a field is not recognised. |
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. |
404 | {"error":"item_not_found"} | The item is not on this booking. |
Try it
Section titled “Try it”Open the API Explorer, add your key, and find Update a booking item.