openapi: 3.0.0
info:
  version: 0.0.1
  title: channels-plus-export-api

paths:
  /properties:
    get:
      operationId: listProperties
      description: List properties for the channel
      parameters:
        - $ref: "#/components/parameters/SmApiId"
        - $ref: "#/components/parameters/SmApiKey"
        - name: page
          description: The page number of the results to fetch
          in: query
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: perPage
          description: The number of results per page
          in: query
          schema:
            type: integer
            minimum: 10
            maximum: 500
            default: 100
            multipleOf: 10

      responses:
        "200":
          description: successful
          headers:
            x-sm-request-id:
              schema:
                type: string
              description: uuid of the request, useful to provide to SiteMinder when raising issues.
            x-sm-trace-token:
              schema:
                type: string
              description: uuid used for tracing, useful to provide to SiteMinder when raising issues.
            ratelimit-policy:
              schema:
                type: string
              description: Shows the number of request allowed per number of seconds window. e.g. '100;w=60' means 100 request in a 60 seconds window.
            ratelimit-limit:
              schema:
                type: integer
              description: The number of requests allowed per window
            ratelimit-remaining:
              schema:
                type: integer
              description: The number of requests left for the time window.
            ratelimit-reset:
              schema:
                type: integer
              description: The number of seconds left for the window to reset
            link:
              schema:
                type: string
              description: |
                When a response is paginated, the response headers will include a link header. If the endpoint does not support pagination, or if all results fit on a single page, the link header will be omitted.
                The link header contains URLs that you can use to fetch additional pages of results. For example, the previous, next, first, and last page of results.
                e.g. '<http://127.0.0.1/properties?page=1>; rel="first", <http://127.0.0.1/properties?page=3>; rel="last", <http://127.0.0.1/properties?page=3>; rel="next", <http://127.0.0.1/properties?page=1>; rel="prev"'
                The URL for the previous page is followed by rel="prev".
                The URL for the next page is followed by rel="next".
                The URL for the last page is followed by rel="last".
                The URL for the first page is followed by rel="first".
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    uuid:
                      type: string
                    name:
                      type: string
                  required:
                    - uuid
                    - name
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/RateLimitError"
        "500":
          $ref: "#/components/responses/ServerError"

  /properties/{uuid}/room-rates:
    get:
      operationId: listPropertyRoomRates
      description: List room rates of the given property (To be deprecated by 2024-10-31)
      summary: To be deprecated by 2024-10-31
      deprecated: true
      parameters:
        - $ref: "#/components/parameters/SmApiId"
        - $ref: "#/components/parameters/SmApiKey"
        - name: uuid
          description: The uuid of the property
          required: true
          in: path
          schema:
            type: string

      responses:
        "200":
          description: successful
          headers:
            x-sm-request-id:
              schema:
                type: string
              description: uuid of the request, useful to provide to SiteMinder when raising issues.
            x-sm-trace-token:
              schema:
                type: string
              description: uuid used for tracing, useful to provide to SiteMinder when raising issues.
            ratelimit-policy:
              schema:
                type: string
              description: Shows the number of request allowed per number of seconds window. e.g. '100;w=60' means 100 request in a 60 seconds window.
            ratelimit-limit:
              schema:
                type: integer
              description: The number of requests allowed per window
            ratelimit-remaining:
              schema:
                type: integer
              description: The number of requests left for the time window.
            ratelimit-reset:
              schema:
                type: integer
              description: The number of seconds left for the window to reset
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    roomType:
                      type: object
                      additionalProperties: false
                      properties:
                        uuid:
                          type: string
                        name:
                          type: string
                      required:
                        - uuid
                        - name
                    ratePlan:
                      type: object
                      additionalProperties: false
                      properties:
                        uuid:
                          type: string
                        name:
                          type: string
                      required:
                        - uuid
                        - name
                    roomRate:
                      type: object
                      additionalProperties: false
                      properties:
                        uuid:
                          type: string
                      required:
                        - uuid
                  required:
                    - roomType
                    - ratePlan
                    - roomRate
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/RateLimitError"
        "500":
          $ref: "#/components/responses/ServerError"

  /properties/{uuid}:
    get:
      operationId: showProperty
      description: show room with the given uuid
      parameters:
        - $ref: "#/components/parameters/SmApiId"
        - $ref: "#/components/parameters/SmApiKey"
        - name: uuid
          description: The uuid of the property
          required: true
          in: path
          schema:
            type: string
        - name: languages
          description: The language codes for the property information
          in: query
          schema:
            type: array
            items:
              type: string
              enum:
                - de
                - en
                - es
                - fr
                - id
                - it
                - pt
                - th

      responses:
        "200":
          description: successful
          headers:
            x-sm-request-id:
              schema:
                type: string
              description: uuid of the request, useful to provide to SiteMinder when raising issues.
            x-sm-trace-token:
              schema:
                type: string
              description: uuid used for tracing, useful to provide to SiteMinder when raising issues.
            ratelimit-policy:
              schema:
                type: string
              description: Shows the number of request allowed per number of seconds window. e.g. '100;w=60' means 100 request in a 60 seconds window.
            ratelimit-limit:
              schema:
                type: integer
              description: The number of requests allowed per window
            ratelimit-remaining:
              schema:
                type: integer
              description: The number of requests left for the time window.
            ratelimit-reset:
              schema:
                type: integer
              description: The number of seconds left for the window to reset
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  name:
                    type: string
                  address:
                    type: string
                  suburb:
                    type: string
                  state:
                    type: string
                  country:
                    type: string
                  latitude:
                    type: number
                  longitude:
                    type: number
                  phoneNumber:
                    type: string
                  emailAddress:
                    type: string
                  propertyType:
                    type: array
                    items:
                      $ref: "#/components/schemas/TranslationText"
                  description:
                    type: array
                    items:
                      $ref: "#/components/schemas/TranslationText"
                  language:
                    type: string
                  starRating:
                    type: number
                  currency:
                    type: string
                  amenities:
                    type: array
                    items:
                      $ref: "#/components/schemas/TranslationText"
                  unitsOfMeasurement:
                    type: string
                    description: The units of measurement used for the property (m^2 or ft^2)
                  totalCommissionPercentage:
                    type: number
                  siteminderCommissionPercentage:
                    type: number
                  channelCommissionPercentage:
                    type: number
                  licenses:
                    type: array
                    items:
                      type: object
                      properties:
                        licenseType:
                          type: string
                          enum: ["property", "room"]
                        licenseNumber:
                          type: string
                        licenseIssueDate:
                          type: string
                      required:
                        - licenseType
                        - licenseNumber
                        - licenseIssueDate
                  checkinStartTime:
                    type: string
                  checkinEndTime:
                    type: string
                  checkoutEndTime:
                    type: string
                  photos:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                        position:
                          type: integer
                        captions:
                          type: array
                          items:
                            $ref: "#/components/schemas/TranslationText"
                  acceptedCardTypes:
                    type: array
                    items:
                      type: string
                      enum: ["AX", "DN", "DS", "JC", "MC", "CU", "VI"]
                  taxes:
                    type: array
                    items:
                      type: object
                      additionalProperties: false
                      properties:
                        name:
                          type: string
                        taxType:
                          type: string
                          enum: ["percentage", "fixed"]
                        rate:
                          type: number
                        application:
                          type: string
                          enum: ["per-room-per-night", "per-stay"]
                      required:
                        - name
                        - taxType
                        - rate
                        - application
                  fees:
                    type: array
                    items:
                      type: object
                      additionalProperties: false
                      properties:
                        name:
                          type: string
                        feeType:
                          type: string
                          enum: ["percentage", "fixed"]
                        rate:
                          type: number
                        application:
                          type: string
                          enum: ["per-room-per-night", "per-stay"]
                      required:
                        - name
                        - feeType
                        - rate
                        - application
                  roomTypes:
                    type: array
                    items:
                      type: object
                      additionalProperties: false
                      properties:
                        name:
                          type: array
                          items:
                            $ref: "#/components/schemas/TranslationText"
                        uuid:
                          type: string
                        roomArea:
                          type: string
                        photos:
                          type: array
                          items:
                            type: object
                            properties:
                              url:
                                type: string
                              position:
                                type: integer
                              captions:
                                type: array
                                items:
                                  $ref: "#/components/schemas/TranslationText"
                        description:
                          type: array
                          items:
                            $ref: "#/components/schemas/TranslationText"
                        bedConfigurations:
                          type: array
                          items:
                            type: object
                            additionalProperties: false
                            properties:
                              text:
                                type: string
                              language:
                                type: string
                              quantity:
                                type: number
                                minimum: 1
                            required:
                              - text
                              - language
                              - quantity
                        amenities:
                          type: array
                          items:
                            $ref: "#/components/schemas/TranslationText"
                        views:
                          type: array
                          items:
                            $ref: "#/components/schemas/TranslationText"
                        maxAdults:
                          type: number
                        maxChildren:
                          type: number
                        maxOccupancy:
                          type: number
                        roomRates:
                          type: array
                          items:
                            type: object
                            additionalProperties: false
                            properties:
                              uuid:
                                type: string
                              ratePlanUuid:
                                type: string
                              ratePlanName:
                                type: string
                              breakfastIncluded:
                                type: boolean
                              cancellationPolicy:
                                type: object
                                properties:
                                  policyType:
                                    type: string
                                    enum:
                                      ["non-refundable", "free-cancellation"]
                                  freeCancellationUntilDays:
                                    type: integer

        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/RateLimitError"
        "500":
          $ref: "#/components/responses/ServerError"

  /room-rates/{uuid}/prices:
    get:
      operationId: listRoomRatePrices
      description: list room rate prices with the given uuid
      parameters:
        - $ref: "#/components/parameters/SmApiId"
        - $ref: "#/components/parameters/SmApiKey"
        - name: uuid
          description: The uuid of the property
          required: true
          in: path
          schema:
            type: string
        - name: sinceHoursAgo
          description: Use this to receive prices changed in the last x hours. Default value is 4. Set this to 0 to receive all prices regardless of when they were updated.
          in: query
          schema:
            type: integer
            default: 4
            minimum: 0
            maximum: 168
        - name: maxAdults
          description: The max number of adults to return pricing results for. If blank, we will return prices for all occupancies.
          in: query
          schema:
            type: integer
            minimum: 1
        - name: maxChildren
          description: The max number of children to return pricing results for. If blank, we will return prices for all occupancies.
          in: query
          schema:
            type: integer
            minimum: 1
      responses:
        "200":
          description: successful
          headers:
            x-sm-request-id:
              schema:
                type: string
              description: uuid of the request, useful to provide to SiteMinder when raising issues.
            x-sm-trace-token:
              schema:
                type: string
              description: uuid used for tracing, useful to provide to SiteMinder when raising issues.
            ratelimit-policy:
              schema:
                type: string
              description: Shows the number of request allowed per number of seconds window. e.g. '100;w=60' means 100 request in a 60 seconds window.
            ratelimit-limit:
              schema:
                type: integer
              description: The number of requests allowed per window
            ratelimit-remaining:
              schema:
                type: integer
              description: The number of requests left for the time window.
            ratelimit-reset:
              schema:
                type: integer
              description: The number of seconds left for the window to reset
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    date:
                      type: string
                      format: date
                      description: The date for the price
                    adults:
                      type: integer
                      description: Number of adults included in the price
                    children:
                      type: integer
                      description: Number of children included in the price
                    baseRate:
                      type: number
                      format: float
                      description: The daily rate net of taxes and fees applicable for the adult and child occupancy combination

        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "429":
          $ref: "#/components/responses/RateLimitError"
        "500":
          $ref: "#/components/responses/ServerError"

components:
  parameters:
    SmApiId:
      name: x-sm-api-id
      description: The api id for channel
      required: true
      in: header
      schema:
        type: string
    SmApiKey:
      name: x-sm-api-key
      description: The api key for channel
      required: true
      in: header
      schema:
        type: string

  responses:
    BadRequest:
      description: Invalid request
      headers:
        x-sm-request-id:
          schema:
            type: string
          description: uuid of the request, useful to provide to SiteMinder when raising issues.
        x-sm-trace-token:
          schema:
            type: string
          description: uuid used for tracing, useful to provide to SiteMinder when raising issues.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    NotFound:
      description: The specified resource was not found
      headers:
        x-sm-request-id:
          schema:
            type: string
          description: uuid of the request, useful to provide to SiteMinder when raising issues.
        x-sm-trace-token:
          schema:
            type: string
          description: uuid used for tracing, useful to provide to SiteMinder when raising issues.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    RateLimitError:
      description: The number of requests for the last 5 minutes window has reached the limit for the given channel
      headers:
        x-sm-request-id:
          schema:
            type: string
          description: uuid of the request, useful to provide to SiteMinder when raising issues.
        x-sm-trace-token:
          schema:
            type: string
          description: uuid used for tracing, useful to provide to SiteMinder when raising issues.
        ratelimit-policy:
          schema:
            type: string
          description: Shows the number of request allowed per number of seconds window. e.g. '100;w=60' means 100 request in a 60 seconds window.
        ratelimit-limit:
          schema:
            type: integer
          description: The number of requests allowed per window
        ratelimit-remaining:
          schema:
            type: integer
          description: The number of requests left for the time window.
        ratelimit-reset:
          schema:
            type: integer
          description: The number of seconds left for the window to reset
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    ServerError:
      description: Unexpected error occurred
      headers:
        x-sm-request-id:
          schema:
            type: string
          description: uuid of the request, useful to provide to SiteMinder when raising issues.
        x-sm-trace-token:
          schema:
            type: string
          description: uuid used for tracing, useful to provide to SiteMinder when raising issues.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"

  schemas:
    Error:
      type: object
      required:
        - errors
      properties:
        errors:
          minItems: 1
          type: array
          description: An array of error objects, for most errors, this array would only contain one error object. An errors array must contain at least one error object.
          items:
            type: object
            required:
              - code
            properties:
              code:
                type: string
              message:
                type: string
              meta:
                type: object
    TranslationText:
      type: object
      additionalProperties: false
      properties:
        text:
          type: string
        language:
          type: string
      required:
        - text
        - language
