> ## 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.

# Modify Reservation

> Update certain reservation attributes. Supports updating the following reservation attributes:

- guest_payment_method
- reservation dates




## OpenAPI

````yaml patch /rest/v1/reservation/{reservation_id}
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}:
    patch:
      description: >
        Update certain reservation attributes. Supports updating the following
        reservation attributes:


        - guest_payment_method

        - reservation dates
      operationId: UpdateReservationById
      parameters:
        - in: path
          name: reservation_id
          description: id of the reservation
          required: true
          schema:
            type: string
          style: simple
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                check_in_date:
                  description: ISO 8601.
                  example: '2024-05-20'
                  type: string
                check_out_date:
                  description: ISO 8601.
                  example: '2024-05-25'
                  type: string
                payment:
                  description: Payment object
                  type: object
                  properties:
                    guest:
                      description: Guest payment method attributes.
                      type: object
                      properties:
                        cvv:
                          description: Card security code.
                          example: '123'
                          type: string
                        token:
                          description: Updated tokenized payment method.
                          example: 01JECWTWR109MQKG55E58HK52J
                          type: string
                rate:
                  description: >-
                    Rate object. Include this when modifying reservation dates.
                    This is the rate corresponding to the modified dates.
                  type: object
                  properties:
                    booking_code:
                      description: Unique booking code.
                      example: 2QN57JU
                      type: string
                    channel_code:
                      description: Channel code.
                      example: SBT1
                      type: string
                    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: 139
                          type: number
                        total_price:
                          description: Total for the reservation.
                          example: 164.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
                    rate_description:
                      description: Description of rate.
                      type: string
                    room_description:
                      description: Description of room.
                      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?
                          example: true
                          type: boolean
                        cancel_note:
                          description: >-
                            Note included for cancel penalties. May or may not
                            be null.
                          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%
            examples:
              Update guest payment method, provide new payment token:
                value:
                  payment:
                    guest:
                      cvv: '123'
                      token: 01JECWTWR109MQKG55E58HK52J
              Update guest reservation dates, provide new dates and rate:
                value:
                  check_in_date: '2024-05-20'
                  check_out_date: '2024-05-30'
                  rate:
                    booking_code: 2QN57JU
                    channel_code: SBT1
                    number_of_rooms: 1
                    price:
                      base_price: 139
                      total_price: 164.24
                      total_taxes: 25.24
                      currency_code: USD
                    rate_description: Standard rate with flexible terms.
                    room_description: Deluxe King Room with a city view.
                    terms:
                      guarantee_type: DepositRequired
                      rate_payment_info: PrePay
                      refundable: true
                      cancel_note: ''
                      cancel_penalties:
                        - deadline_local: '2024-05-19T00:00:00-05:00'
                          cancel_short_description: >-
                            An estimated cancellation fee of 100.00 USD applies
                            starting from
                            2024-05-19T00:00-05:00[America/Chicago].
                          penalty:
                            estimated_amount: true
                            currency_amount:
                              amount: 100
                              currency: USD
                            original_penalty_info: 100%
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Reservation'
                  - type: object
                    properties:
                      payment:
                        example:
                          guest:
                            cvv: '123'
                            token: 01JECWTWR109MQKG55E58HK52J
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
                  - type: object
                    properties:
                      details:
                        example:
                          - message: token is missing
                            field:
                              - payment
                              - guest
                              - token
        '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

````