> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unifystays.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Booking

> Request an idempotent cancellation for a confirmed or on-hold booking.

Use this endpoint to cancel a `CONFIRMED` or `ON_HOLD` booking. Cancellation is
idempotent: a repeat request for an already cancelled or cancelling booking
returns its current state rather than creating another cancellation.

## Request Example

<RequestExample>
  ```bash theme={null}
  curl "$UNIFYSTAYS_BASE_URL/hotels/book/ubk_eGQ0dW9uV1Vi/cancel" \
    -X POST \
    -H "x-api-key: $UNIFYSTAYS_API_KEY" \
    -H "language: en"
  ```
</RequestExample>

## Handle Cancellation State

| Status                 | Meaning                                                 | Next action                                                   |
| ---------------------- | ------------------------------------------------------- | ------------------------------------------------------------- |
| `CANCELLED`            | The supplier cancellation is complete.                  | Show the final cancellation outcome.                          |
| `CANCELLATION_PENDING` | The supplier is processing cancellation asynchronously. | Poll [Get Booking Status](/api-reference/get-booking-status). |

Keep the returned `booking_id` and request ID in your support record. If the
request returns `CANCELLATION_PENDING`, do not assume the booking is cancelled
until status polling reports `CANCELLED` or another final state.

<Warning>
  Booking cancellation follows the supplier's current terms. Retrieve booking
  details and show applicable cancellation information to the customer before
  they confirm the cancellation action.
</Warning>

The OpenAPI section below documents the required booking ID, success response,
and error response.


## OpenAPI

````yaml reference/openapi.json POST /hotels/book/{booking_id}/cancel
openapi: 3.0.0
info:
  title: Unifystays API
  description: >-
    One unified hotel API across suppliers. Integrate once, then enable and
    manage suppliers from the Unifystays portal.
  version: '1.0'
  contact: {}
servers:
  - url: https://api-sandbox.unifystays.com
    description: Sandbox
  - url: https://api.unifystays.com
    description: Production
security:
  - x-api-key: []
tags: []
paths:
  /hotels/book/{booking_id}/cancel:
    post:
      tags:
        - Hotels
      summary: Cancel a booking
      description: >-
        Cancels a CONFIRMED or ON_HOLD booking. Idempotent — calling again on an
        already

        cancelled/cancelling booking returns the current state.


        Cancellation is asynchronous at the supplier: the response status is
        `CANCELLED`

        (terminal) or `CANCELLATION_PENDING` (supplier processing offline — poll

        `GET /hotels/book/{booking_id}` until it becomes `CANCELLED`).
      operationId: HotelBookingController_cancelBooking
      parameters:
        - name: booking_id
          required: true
          in: path
          schema:
            type: string
            example: ubk_eGQ0dW9uV1Vi
        - name: language
          description: Enter language code(ex. en)
          in: header
          schema: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HotelBookingResponseDto'
        '404':
          description: Booking not found.
components:
  schemas:
    HotelBookingResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Booking request accepted and is being processed.
        data:
          $ref: '#/components/schemas/BookingStatusDataDto'
      required:
        - success
        - message
        - data
    BookingStatusDataDto:
      type: object
      properties:
        booking_id:
          type: string
          example: ubk_eGQ0dW9uV1Vi
        status:
          type: string
          enum:
            - PROCESSING
            - CONFIRMED
            - ON_HOLD
            - FAILED
            - CANCELLATION_PENDING
            - CANCELLED
          example: PROCESSING
        is_terminal:
          type: boolean
          example: false
        provider:
          $ref: '#/components/schemas/BookingProviderStatusDto'
        next_poll_after_ms:
          type: object
          description: Client hint to re-check booking status. Null when terminal.
          example: 5000
          nullable: true
        created_at:
          type: string
          example: '2026-04-15T12:12:11.000Z'
        updated_at:
          type: string
          example: '2026-04-15T12:12:11.000Z'
        metadata:
          type: object
          additionalProperties: true
          nullable: true
      required:
        - booking_id
        - status
        - is_terminal
        - provider
        - created_at
        - updated_at
    BookingProviderStatusDto:
      type: object
      properties:
        code:
          type: string
          example: TBO
        booking_id:
          type: object
          example: FL1IMA
          nullable: true
        booking_code:
          type: object
          example: REZ6A5A81E9
          nullable: true
        hotel_confirmation_number:
          type: object
          example: HCN-482910
          nullable: true
        hotel_confirmation_status:
          type: object
          example: Confirmed
          nullable: true
        hotel_confirmation_note:
          type: object
          nullable: true
        hotel_contact_phone:
          type: object
          nullable: true
        hotel_contact_name:
          type: object
          nullable: true
        raw_status:
          type: object
          example: SUCCESS
          nullable: true
        message:
          type: object
          example: Booking confirmed by supplier.
          nullable: true
      required:
        - code
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: Environment-specific API key created in the Unifystays portal

````