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

# Create Reservation

> Creates a reservation.




## OpenAPI

````yaml post /rest/v1/reservation
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:
    post:
      description: |
        Creates a reservation.
      operationId: CreateReservation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateReservationRequest'
            examples:
              Create a Reservation, first time tokenization (no cvv):
                value:
                  check_in_date: '2024-05-20'
                  check_out_date: '2024-05-25'
                  guests:
                    number_of_adults: 1
                    number_of_children: 1
                    primary:
                      address: 123 Main St, Apt 152
                      city: Miami
                      country: US
                      email: guest@somedomain.com
                      given_name: John
                      postal_code: '33123'
                      state: FL
                      surname: Doe
                      telephone_number: '+13055551234'
                  hotel:
                    chain_code: HI
                    name: Holiday Inn
                    property_code: E8597
                  payment:
                    guest:
                      amount: 164.24
                      token: 01JKA2V3A58ZXN2EH5CK6B10AY
                  rate:
                    booking_code: 2QN57JU
                    channel_code: SBT1
                    number_of_rooms: 1
                    price:
                      total_price: 164.24
                      base_price: 139
                      total_taxes: 25.24
                      currency_code: USD
                    terms:
                      rate_payment_info: PrePay
                      guarantee_type: DepositRequired
                      refundable: true
                      cancel_note: null
                      cancel_penalties:
                        - deadline_local: 2024-04-19T00:00-06:00
                          cancel_short_description: >-
                            An estimated cancellation fee of 106.90 USD applies
                            starting from
                            2024-04-20T00:00-06:00[America/Chicago].
                          penalty:
                            estimated_amount: true
                            currency_amount:
                              amount: 106.9
                              currency: USD
                            original_penalty_info: 100%
              Create a Reservation, reuse token (include cvv):
                value:
                  check_in_date: '2024-05-20'
                  check_out_date: '2024-05-25'
                  guests:
                    number_of_adults: 1
                    number_of_children: 1
                    primary:
                      address: 123 Main St, Apt 152
                      city: Miami
                      country: US
                      email: guest@somedomain.com
                      given_name: John
                      postal_code: '33123'
                      state: FL
                      surname: Doe
                      telephone_number: '+13055551234'
                  hotel:
                    chain_code: HI
                    name: Holiday Inn
                    property_code: E8597
                  payment:
                    guest:
                      amount: 164.24
                      cvv: '123'
                      token: 01JKA2V3A58ZXN2EH5CK6B10AY
                  rate:
                    booking_code: 2QN57JU
                    channel_code: SBT1
                    number_of_rooms: 1
                    price:
                      total_price: 164.24
                      base_price: 139
                      total_taxes: 25.24
                      currency_code: USD
                    terms:
                      rate_payment_info: PrePay
                      guarantee_type: DepositRequired
                      refundable: true
                      cancel_note: null
                      cancel_penalties:
                        - deadline_local: 2024-04-19T00:00-06:00
                          cancel_short_description: >-
                            An estimated cancellation fee of 106.90 USD applies
                            starting from
                            2024-04-19T00:00-06:00[America/Chicago].
                          penalty:
                            estimated_amount: true
                            currency_amount:
                              amount: 106.9
                              currency: USD
                            original_penalty_info: 100%
              Create a Reservation, include 2nd payment method:
                value:
                  check_in_date: '2024-05-20'
                  check_out_date: '2024-05-25'
                  guests:
                    number_of_adults: 1
                    number_of_children: 1
                    primary:
                      address: 123 Main St, Apt 152
                      city: Miami
                      country: US
                      email: guest@somedomain.com
                      given_name: John
                      postal_code: '33123'
                      state: FL
                      surname: Doe
                      telephone_number: '+13055551234'
                  hotel:
                    chain_code: HI
                    name: Holiday Inn
                    property_code: E8597
                  payment:
                    guest:
                      amount: 164.24
                      token: 01JKA2V3A58ZXN2EH5CK6B10AY
                    partner:
                      amount: 20
                      token: 01JKA13A6TWPV9R4VPWBTAV4KS
                  rate:
                    booking_code: 2QN57JU
                    channel_code: SBT1
                    number_of_rooms: 1
                    price:
                      total_price: 184.24
                      base_price: 159
                      total_taxes: 25.24
                      currency_code: USD
                    terms:
                      rate_payment_info: PrePay
                      guarantee_type: DepositRequired
                      refundable: true
                      cancel_note: null
                      cancel_penalties:
                        - deadline_local: 2024-04-19T00:00-06:00
                          cancel_short_description: >-
                            An estimated cancellation fee of 106.90 USD applies
                            starting from
                            2024-04-19T00:00-06:00[America/Chicago].
                          penalty:
                            estimated_amount: true
                            currency_amount:
                              amount: 106.9
                              currency: USD
                            original_penalty_info: 100%
              Create a Reservation, using stripe object for payment:
                value:
                  check_in_date: '2024-05-20'
                  check_out_date: '2024-05-25'
                  guests:
                    number_of_adults: 1
                    number_of_children: 1
                    primary:
                      address: 123 Main St, Apt 152
                      city: Miami
                      country: US
                      email: guest@somedomain.com
                      given_name: John
                      postal_code: '33123'
                      state: FL
                      surname: Doe
                      telephone_number: '+13055551234'
                  hotel:
                    chain_code: HI
                    name: Holiday Inn
                    property_code: E8597
                  payment:
                    guest:
                      amount: 164.24
                      stripe:
                        customer: cus_TestRce2zv5tRe
                        payment_method: pm_Test5aAWTcmv4K1R71vVugBD
                    partner:
                      amount: 20
                      stripe:
                        customer: cus_Test5R5ajq0MZH
                        payment_method: pm_Test5aAWTcmv4K1R71vVugBD
                  rate:
                    booking_code: 2QN57JU
                    channel_code: SBT1
                    number_of_rooms: 1
                    price:
                      total_price: 184.24
                      base_price: 159
                      total_taxes: 25.24
                      taxes_and_fees_included: false
                      currency_code: USD
                    terms:
                      rate_payment_info: PrePay
                      guarantee_type: DepositRequired
                      refundable: true
                      cancel_note: null
                      cancel_penalties:
                        - deadline_local: 2024-04-19T00:00-06:00
                          cancel_short_description: >-
                            An estimated cancellation fee of 106.90 USD applies
                            starting from
                            2024-04-19T00:00-06:00[America/Chicago].
                          penalty:
                            estimated_amount: true
                            currency_amount:
                              amount: 106.9
                              currency: USD
                            original_penalty_info: 100%
              Create a Reservation, include custom_data:
                value:
                  check_in_date: '2024-05-20'
                  check_out_date: '2024-05-25'
                  custom_data:
                    tag1: value1
                    other_tag: value2
                  guests:
                    number_of_adults: 1
                    number_of_children: 1
                    primary:
                      address: 123 Main St, Apt 152
                      city: Miami
                      country: US
                      email: guest@somedomain.com
                      given_name: John
                      postal_code: '33123'
                      state: FL
                      surname: Doe
                      telephone_number: '+13055551234'
                  hotel:
                    chain_code: HI
                    name: Holiday Inn
                    property_code: E8597
                  payment:
                    guest:
                      amount: 164.24
                      stripe:
                        customer: cus_TestRce2zv5tRe
                        payment_method: pm_Test5aAWTcmv4K1R71vVugBD
                    partner:
                      amount: 20
                      stripe:
                        customer: cus_Test5R5ajq0MZH
                        payment_method: pm_Test5aAWTcmv4K1R71vVugBD
                  rate:
                    booking_code: 2QN57JU
                    channel_code: SBT1
                    number_of_rooms: 1
                    price:
                      total_price: 184.24
                      base_price: 159
                      total_taxes: 25.24
                      taxes_and_fees_included: false
                      currency_code: USD
                    terms:
                      rate_payment_info: PrePay
                      guarantee_type: DepositRequired
                      refundable: true
                      cancel_note: null
                      cancel_penalties:
                        - deadline_local: 2024-04-19T00:00-06:00
                          cancel_short_description: >-
                            An estimated cancellation fee of 106.90 USD applies
                            starting from
                            2024-04-19T00:00-06:00[America/Chicago].
                          penalty:
                            estimated_amount: true
                            currency_amount:
                              amount: 106.9
                              currency: USD
                            original_penalty_info: 100%
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reservation'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/REST-401'
        '403':
          $ref: '#/components/responses/REST-403'
      security:
        - BasicAuthentication: []
components:
  schemas:
    CreateReservationRequest:
      type: object
      properties:
        check_in_date:
          description: >-
            ISO 8601. This date will be stored in UTC but evaluated in the
            context of the hotel's local timezone.
          example: '2024-05-20'
          type: string
        check_out_date:
          description: >-
            ISO 8601. This date will be stored in UTC but evaluated in the
            context of the hotel's local timezone.
          example: '2024-05-25'
          type: string
        custom_data:
          description: >
            Optional, custom object. Use to include additional data with the
            reservation. This data is not passed to hotels and will only be
            stored with Selfbook. Allows up to 5 key value pairs.


            Keys have a max-length of 32 characters. Allowable characters are
            letters, numbers, underscore(_) or hyphen (-). 


            Values can be strings, numbers, or booleans. Max-length of 128
            characters. Allowable characters are any except: greater-than symbol
            (>), less-than symbol (<), double quote("), single quote(') or
            backslash (\\).
          type: object
          additionalProperties: true
        customer_loyalty:
          description: Optional. Customer Loyalty details
          type: object
          properties:
            code:
              description: >-
                Required if passing customer_loyalty. Loyalty account code or
                number.
              example: 123456789
              type: string
        guests:
          type: object
          properties:
            number_of_adults:
              description: Number of adults.
              example: 1
              type: integer
            number_of_children:
              description: Optional. 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
                given_name:
                  description: Primary guest first name.
                  example: John
                email:
                  description: Email.
                  example: guest@somedomain.com
                  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 property code.
              example: E8597
              type: string
        payment:
          type: object
          properties:
            guest:
              description: Payment information for the guest.
              type: object
              properties:
                amount:
                  description: >-
                    Amount charged to the payment instrument represented by
                    'stripe' or 'token' attributes. Currency used will be the
                    rate.price.currency_code.
                  example: 164.24
                  type: number
                cvv:
                  description: >-
                    Card security code. This is optional. Only pass this when
                    reusing a Spreedly token.
                  example: '123'
                  type: string
                stripe:
                  description: >-
                    Stripe payment details. Pass this instead of 'token' if you
                    intend 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's payment method. Accepts
                    Spreedly payment method tokens.
                  example: 01JKA2V3A58ZXN2EH5CK6B10AY
                  type: string
            partner:
              description: >-
                Payment information for a 2nd payer. If using a partner, you
                must also include a guest.
              type: object
              properties:
                amount:
                  description: >-
                    Amount charged to the payment instrument represented by
                    'stripe' or 'token' attributes. Currency used will be the
                    rate.price.currency_code.
                  example: 20
                  type: number
                cvv:
                  description: >-
                    Card security code. This is optional. Only pass this when
                    reusing a Spreedly token.
                  example: '123'
                  type: string
                stripe:
                  description: >-
                    Stripe payment details. Pass this instead of 'token' if you
                    intend to use a specific Stripe customer and payment method.
                  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 the 2nd payer's payment method. Accepts
                    Spreedly payment method tokens.
                  example: 01JKA13A6TWPV9R4VPWBTAV4KS
                  type: string
        rate:
          type: object
          properties:
            booking_code:
              description: Unique booking code.
              example: 2QN57JU
              type: string
            channel_code:
              description: Channel code.
              example: SBT1
              type: string
            pcc:
              description: Internal rate identifier
              type: string
              example: KR5
            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? If SBT2 and marked false, the rate
                    is also non-cancellable.
                  example: true
                  type: boolean
                cancel_note:
                  description: Note included for cancel penalties. May or may not be null.
                  type: string
                  example: ''
                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%
      required:
        - check_in_date
        - check_out_date
        - guests
        - hotel
        - payment
        - rate
    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-403:
      description: |
        Forbidden
        the API key token cannot access the specified resource
  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

````