Skip to main content
POST
This is step 2 of cancelling. Step 1 is Quote Cancellation, which returns the penalty and a quote_id. Show the penalty to the user, and only after they accept, send that quote_id here together with an Idempotency-Key.

The cancellation flow

1

Check that cancelling is possible

The booking’s available_actions (from Get Booking Status) contains CANCEL. This is true for CONFIRMED and ON_HOLD bookings.
2

Get a quote

Call Quote Cancellation. Show penalty_status, penalty and the policy to the user.
3

Cancel with the quote

Send cancellation_quote_id before expires_at. Use a new Idempotency-Key for this cancellation.
4

Follow the outcome

The response is CANCELLED or CANCELLATION_PENDING. Poll status until it is CANCELLED.

Request example

Response example

The response is a booking status object, the same as Get Booking Status.

Request fields

Outcomes

CANCELLATION_PENDING can also be the result when the supplier’s answer was uncertain. Unifystays then verifies the real outcome. The booking stays CANCELLATION_PENDING until that is known, and available_actions can include CONTACT_SUPPORT if it cannot be resolved.

Errors and retries

Retrying with the same Idempotency-Key and the same quote returns the same result. It never cancels twice. Calling cancel on a booking that is already CANCELLED or CANCELLATION_PENDING returns its current state.
If the penalty changes between the quote and the click, the quote is no longer valid and the cancel call fails with CANCELLATION_QUOTE_INVALID. Nothing is cancelled. Always request a fresh quote and show the new penalty before trying again.
penalty_status: UNKNOWN means no reliable amount exists. Do not display it as zero. Accepting that quote means the user accepts an unknown charge.
Keep the booking_id and the X-Request-Id response header in your support record.

Authorizations

x-api-key
string
header
required

Environment-specific API key created in the Unifystays portal

Headers

Idempotency-Key
string
required

Unique key (up to 128 characters) for this cancellation attempt. Reuse the same key and the same quote_id when retrying after a timeout.

X-Unifystays-Contract-Version
enum<string>
default:2

Hotel API contract version. Optional: 2 is the current version and the default.

Available options:
2
X-Unifystays-Currency
string

ISO 4217 currency for display amounts (display_ledger, display_amount, commercial_display). Optional: defaults to your organization's display currency, USD unless configured. Read pricing.display_currency in the response.

Required string length: 3
Example:

"EUR"

Path Parameters

booking_id
string
required

Unifystays booking ID returned by Create Booking (ubk_...).

Example:

"ubk_eGQ0dW9uV1Vi"

Body

application/json
cancellation_quote_id
string
required

The quote_id from Cancellation Quote that the user accepted. Must belong to this booking, be unexpired and unused.

Example:

"cq_6c4f6abf5bbc4c6eae53e0d7411389a8"

Response

contract_version
string
required

Response contract version. Always "2".

Example:

"2"

success
boolean
required

false only when the booking status is FAILED. true for every other status, including AWAITING_REVIEW and PROCESSING, which are not confirmations. Read data.status for the real state.

Example:

true

message
string
required

Human-readable summary for logs and support; for FAILED it carries the reason. Do not parse it; use data.status.

Example:

"Booking request accepted and is being processed."

data
object
required

The booking's current state.