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

# Cancel Reservation

> Cancels a reservation.




## OpenAPI

````yaml post /rest/v1/reservation/{reservation_id}/cancel
openapi: 3.0.4
info:
  title: Selfbook Travel API
  version: '1.0'
  description: |
    This is the OpenAPI specification for `Selfbook Travel API`.
servers:
  - url: https://sandbox.travel.selfbook.com
    description: Sandbox server
  - url: https://travel.selfbook.com
    description: Production
security: []
paths:
  /rest/v1/reservation/{reservation_id}/cancel:
    post:
      summary: Cancel a reservation
      description: |
        Cancels a reservation.
      operationId: CancelReservationById
      parameters:
        - in: path
          name: reservation_id
          description: id of the reservation
          required: true
          schema:
            type: string
          style: simple
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Reservation'
                  - type: object
                    properties:
                      status:
                        example: CANCELED
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/REST-401'
        '404':
          $ref: '#/components/responses/REST-404'
      security:
        - BasicAuthentication: []
components:
  schemas:
    Reservation:
      type: object
      properties:
        check_in_date:
          description: ISO 8601.
          type: string
          example: '2024-05-20T00:00:00Z'
        check_out_date:
          description: ISO 8601.
          example: '2024-05-25T00:00:00Z'
          type: string
        confirmation:
          type: object
          properties:
            hotel_confirmation_number:
              description: >-
                Hotel's confirmation id. This is returned only if Reservation
                status is CONFIRMED.
              example: CONFIRMATION_ID
              type: string
            record_locator:
              description: >-
                Additional identifier for the reservation. This is returned only
                if Reservation status is CONFIRMED.
              example: LOCATOR_CODE
              type: string
        custom_data:
          description: >-
            Custom data object. Returned only if included in
            CreateReservationRequest.
          type: object
          properties:
            key:
              example: value
              type: string
        created_at:
          description: ISO 8601.
          example: '2024-05-20T18:00:00Z'
          type: string
        guests:
          type: object
          properties:
            number_of_adults:
              description: Number of adults.
              example: 1
              type: integer
            number_of_children:
              description: Number of children.
              example: 1
              type: integer
            primary:
              type: object
              properties:
                address:
                  description: Address.
                  example: 123 Main Street Apt 152
                  type: string
                city:
                  description: City.
                  example: Miami
                  type: string
                country:
                  description: ISO 3166-1 alpha-2 Country code.
                  example: US
                  type: string
                email:
                  description: Email.
                  example: guest@somedomain.com
                  type: string
                given_name:
                  description: Primary guest first name.
                  example: John
                  type: string
                surname:
                  description: Primary guest last name.
                  example: Doe
                  type: string
                telephone_number:
                  description: Phone number.
                  example: '+13055551234'
                  type: string
                state:
                  description: ISO 3166-2 province/region/state/subdivision.
                  example: FL
                  type: string
                postal_code:
                  description: Postal code.
                  example: '33123'
                  type: string
        hotel:
          type: object
          properties:
            chain_code:
              description: Alphanumeric, hotel chain code.
              example: HI
              type: string
            name:
              description: Hotel name.
              example: Holiday Inn
              type: string
            property_code:
              description: Alphanumeric, hotel code.
              example: E8597
              type: string
        id:
          description: 32-character alphanumeric Selfbook identifier.
          example: ZHPOGBXVQVFRVXXCHXRJATLEJWKNBERS
          type: string
        payment:
          type: object
          properties:
            guest:
              type: object
              properties:
                amount:
                  description: >-
                    Amount charged to the payment instrument represented by
                    guest payment method.
                  example: 164.24
                  type: number
                stripe:
                  description: >-
                    Stripe payment details. Pass this want to use a specific
                    Stripe customer and payment method.
                  type: object
                  properties:
                    customer:
                      description: Stripe customer id.
                      example: cus_TestRce2zv5tRe
                      type: string
                    payment_method:
                      description: Stripe payment method.
                      example: pm_Test5aAWTcmv4K1R71vVugBD
                      type: string
                token:
                  description: >-
                    A token representing the guest payment method. This is not
                    returned if a stripe object is returned.
                  example: 01JKA2V3A58ZXN2EH5CK6B10AY
                  type: string
            partner:
              type: object
              properties:
                amount:
                  description: >-
                    Amount charged to the payment instrument represented by a
                    2nd payer's payment method. This is included only if
                    included when creating a reservation.
                  example: 20
                  type: number
                stripe:
                  description: >-
                    This object is returned only when it is used to create the
                    reservation.
                  type: object
                  properties:
                    customer:
                      description: Stripe customer id.
                      example: cus_Test5R5ajq0MZH
                      type: string
                    payment_method:
                      description: Stripe payment method.
                      example: pm_TestsWAWTcmv4K1ROuWIkGXP
                      type: string
                token:
                  description: >-
                    A token representing a 2nd payer's payment method. This is
                    not returned if a stripe object is returned.
                  example: 01JKA13A6TWPV9R4VPWBTAV4KS
                  type: string
        rate:
          type: object
          properties:
            booking_code:
              description: Unique booking code.
              example: 2QN57JU
              type: string
            channel_code:
              description: Channel code for room rate
              type: string
              example: SBT1
            number_of_rooms:
              description: Number of rooms requested.
              example: 1
              default: 1
              type: integer
            price:
              type: object
              properties:
                base_price:
                  description: Base total of the reservation.
                  example: 159
                  type: number
                total_price:
                  description: Total for the reservation.
                  example: 184.24
                  type: number
                total_taxes:
                  description: Total taxes for the reservation.
                  example: 25.24
                  type: number
                currency_code:
                  description: ISO 4217.
                  example: USD
                  type: string
            terms:
              type: object
              properties:
                guarantee_type:
                  description: Type of guarantee required
                  example: DepositRequired
                  type: string
                rate_payment_info:
                  description: Type of rate payment (usually PrePay or PostPay)
                  type: string
                  example: PrePay
                refundable:
                  description: Is the rate refundable?
                  type: boolean
                cancel_note:
                  description: Note left if cancel penalties are unavailable
                  type: string
                  example: >-
                    Rate returned without cancel policy requires a rule request
                    for complete information
                cancel_penalties:
                  description: Penalties for cancellation
                  type: array
                  items:
                    type: object
                    properties:
                      deadline_local:
                        description: >-
                          Local date time deadline for when the cancellation fee
                          will be enforced
                        type: string
                        example: '2024-09-17T00:00:00-05:00'
                      cancel_short_description:
                        description: >-
                          Short description of the cancellation policy and
                          penalties
                        type: string
                        example: >-
                          An estimated cancellation fee of 177.44 USD applies
                          starting from 2024-09-17T00:00-05:00[America/Chicago].
                      penalty:
                        description: Object describing the penalty amount.
                        type: object
                        properties:
                          estimated_amount:
                            description: Is the penalty amount estimated?
                            type: boolean
                            example: true
                          currency_amount:
                            description: Amount of currency for the penalty
                            type: object
                            properties:
                              amount:
                                description: Amount
                                type: number
                                example: 177.44
                              currency:
                                description: Currency code
                                type: string
                                example: USD
                          original_penalty_info:
                            description: Original penalty information
                            type: string
                            example: 100%
        status:
          type: string
          enum:
            - CANCELED
            - CONFIRMED
            - CREATED
          example: CONFIRMED
    Error:
      type: object
      properties:
        code:
          type: integer
          description: Numeric error code.
          example: 2001
        details:
          type: array
          description: One or more additional details about error condtion.
          items:
            type: object
            properties:
              message:
                description: A more detailed error message.
                type: string
                example: check_out_date is missing
              field:
                description: >-
                  Included for validation errors. Indicating the path to the
                  problem field.
                type: array
                items:
                  type: string
                  example: check_out_date
        message:
          type: string
          description: A summary of the error.
          example: >-
            Unable to process your request. Missing or invalid request
            parameters.
        type:
          type: string
          enum:
            - APPLICATION_ERROR
            - BOOKING_CANCELLATION_ERROR
            - BOOKING_CREATION_ERROR
            - BOOKING_ERROR
            - PAYMENT_PROCESSING_ERROR
            - VALIDATION
          example: VALIDATION
  responses:
    REST-401:
      description: |
        Unauthorized
        the API key token is missing, invalid, or expired
    REST-404:
      description: |
        Not Found
        the request resource cannot be found
  securitySchemes:
    BasicAuthentication:
      type: http
      description: |
        Basic authentication where:
          - user-id is a partner account ID
          - user-password is an API key token associated with the partner account
      scheme: basic

````