Skip to content

Cancel a booking

POST /api/v5/bookings/{id}/cancel

Cancels a paid booking and records the reason. When the booking can be cancelled automatically, it is cancelled and any account-credit refund is applied. When it cannot (for example the courier has already collected it), the same call submits the request to support instead of cancelling it in place.

An immediately cancelled booking stays on record with status cancelled or cancelled_refund. To remove an unpaid draft entirely, delete it.

ParameterTypeRequiredDescription
idintegerYesThe unique booking ID.

Send a JSON object with Content-Type: application/json. The reason is trimmed and must not be empty.

FieldTypeRequiredDescription
reasonstringYesWhy the booking is being cancelled. A blank reason is refused.
Terminal window
curl -X POST \
-H "Api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "reason": "Customer requested cancellation" }' \
https://api.transdirect.com.au/api/v5/bookings/12345678/cancel

A cancellation that completes immediately returns 200 with:

{ "success": true, "cancelled": true }

A request that had to be sent to support returns 200 with:

{
"success": true,
"cancelled": false,
"message": "Cancellation request submitted to support"
}

cancelled: false means the booking is still active and support has the request. It is not a failure.

import { client, postApiV5BookingsByIdCancel } from '@transdirect/api-sdk';
client.setConfig({ headers: { 'api-key': process.env.TD_API_KEY! } });
const { data, error, response } = await postApiV5BookingsByIdCancel({
path: { id: '12345678' },
body: { reason: 'Customer requested cancellation' },
});
if (response.status !== 200 || error) throw new Error(JSON.stringify(error));
console.log(data?.cancelled ? 'Cancelled' : 'Submitted to support');

Automatic cancellation and the account-credit refund are available for account-credit bookings, and for demo bookings that were never charged. A card or PayPal booking is refused with 422. Contact support@transdirect.com.au to cancel one of those.

The booking must be in paid, request_sent, confirmed, pending_review, under_review, reviewed or demo status. A quote (new or pending_payment) cannot be cancelled this way; delete removes an unpaid draft instead.

Status codeDescription
400The reason is missing, the body is not a JSON object, or the booking is not in a cancellable state.
401Unauthorised: invalid or missing API key.
404No booking exists with the given ID, or it belongs to another member.
409A cancellation for this booking is already in progress.
422Only account-credit bookings can be cancelled through the API, or the refund was refused.
429More than 600 requests a minute on this key. Wait for the retry-after seconds.
502The booking could not be cancelled automatically and support could not be reached.

PHP business-rule errors use { "errors": ["..."] }. The Worker returns 401 with {"error":"missing_api_key"} or {"error":"invalid_api_key"}, and 404 with {"error":"booking_not_found"}. Invalid request bodies can instead return a Zod validation error with 400. Rate limiting returns 429 {"error":"rate_limited"} with a retry-after header.