{
  "info": {
    "name": "ApiXV Hotel API",
    "description": "ApiXV HotelXV API specification 1.2.10, generated from https://docs.apixv.com/openapi/latest.json.\n\nSet the `apiKey` collection variable to your API key (sent as `Authorization: ApiKey <key>`), check `baseUrl`, then run the requests in order: each one stores the ids the next one needs (`hotel_uids`, `option_uid`, `confirmation_uid`, `booking_uid`). Documentation: https://docs.apixv.com/",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "key",
        "value": "Authorization",
        "type": "string"
      },
      {
        "key": "value",
        "value": "ApiKey {{apiKey}}",
        "type": "string"
      },
      {
        "key": "in",
        "value": "header",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://demo.apixv.com",
      "type": "string"
    },
    {
      "key": "apiKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "hotel_uids",
      "value": "",
      "type": "string"
    },
    {
      "key": "check_in",
      "value": "",
      "type": "string"
    },
    {
      "key": "check_out",
      "value": "",
      "type": "string"
    },
    {
      "key": "option_uid",
      "value": "",
      "type": "string"
    },
    {
      "key": "confirmation_uid",
      "value": "",
      "type": "string"
    },
    {
      "key": "booking_uid",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "1. Get Static Data Downloads",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/hotelxv/api/v2/datasets",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "hotelxv",
            "api",
            "v2",
            "datasets"
          ],
          "query": []
        },
        "description": "Retrieves a list of available static data sets for download.\n\nThese datasets (e.g., hotel catalogs, destination lists, board codes) are generated periodically and are intended for bulk download. The endpoint returns a list of resources, each with a direct download URL (`href`)."
      },
      "event": []
    },
    {
      "name": "2. Get Hotel Content",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/hotelxv/api/v2/hotels",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "hotelxv",
            "api",
            "v2",
            "hotels"
          ],
          "query": [
            {
              "key": "hotel_uids",
              "value": "{{hotel_uids}}",
              "disabled": true
            },
            {
              "key": "page_token",
              "value": "",
              "disabled": true
            },
            {
              "key": "size",
              "value": "100",
              "disabled": true
            }
          ]
        },
        "description": "Retrieves detailed content for one or more hotels from the local master database.\n\n- **To get specific hotels**, provide a list of ApiXV Hotel UIDs (Master IDs) in `hotel_uids`.\n\n- **To get all hotels available to you**, omit the `hotel_uids` parameter. The system will return the complete list of hotels from your latest active whitelist.\n\nThe response is paginated."
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const hotels = pm.response.json().hotels || [];",
              "if (!pm.collectionVariables.get('hotel_uids') && hotels.length) {",
              "    pm.collectionVariables.set('hotel_uids', hotels.slice(0, 5).map(h => h.hotel_uid).join(','));",
              "}"
            ]
          }
        }
      ]
    },
    {
      "name": "3. Get Availability and Pricing",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/hotelxv/api/v2/options?hotel_uids={{hotel_uids}}&check_in={{check_in}}&check_out={{check_out}}&occupancy=A-A&currency=USD&market=US&language=en&nationality=US",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "hotelxv",
            "api",
            "v2",
            "options"
          ],
          "query": [
            {
              "key": "hotel_uids",
              "value": "{{hotel_uids}}",
              "disabled": false
            },
            {
              "key": "check_in",
              "value": "{{check_in}}",
              "disabled": false
            },
            {
              "key": "check_out",
              "value": "{{check_out}}",
              "disabled": false
            },
            {
              "key": "occupancy",
              "value": "A-A",
              "disabled": false
            },
            {
              "key": "currency",
              "value": "USD",
              "disabled": false
            },
            {
              "key": "market",
              "value": "US",
              "disabled": false
            },
            {
              "key": "language",
              "value": "en",
              "disabled": false
            },
            {
              "key": "nationality",
              "value": "US",
              "disabled": false
            }
          ]
        },
        "description": "Searches for available rooms and rates for the given hotels and criteria.\n\nThis endpoint proxies requests to the underlying supplier systems corresponding to the provided `hotel_uids`. It performs a \"fan-out\" to gather options from multiple sources in parallel and aggregates the results into a single list.\n\nAll unique identifiers (`hotel_uid`, `option_uid`) in the response are wrapped in the standardized ApiXV format."
      },
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// Default stay: two nights, 30 days from today (unless check_in is set to a future date)",
              "const day = n => new Date(Date.now() + n * 864e5).toISOString().slice(0, 10);",
              "if (!pm.collectionVariables.get('check_in') || pm.collectionVariables.get('check_in') <= day(0)) {",
              "    pm.collectionVariables.set('check_in', day(30));",
              "    pm.collectionVariables.set('check_out', day(32));",
              "}"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const option = (pm.response.json().options || []).find(o => o.status === 'AVAILABLE');",
              "if (option) pm.collectionVariables.set('option_uid', option.option_uid);"
            ]
          }
        }
      ]
    },
    {
      "name": "4. Confirm a Rate (Pre-booking)",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/hotelxv/api/v2/options/{{option_uid}}/actions/confirm",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "hotelxv",
            "api",
            "v2",
            "options",
            "{{option_uid}}",
            "actions",
            "confirm"
          ],
          "query": []
        },
        "description": "Confirms a selected rate and retrieves the final details required for booking.\n\nThis is a pre-booking step that re-validates the price and availability of a specific `option_uid` from the availability search. It returns a `confirmation_uid` and a list of required fields that must be provided to the `book` action.\n\nSend the parameters as a JSON body (at least `{}`): some hotel systems reject a confirm without one.",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"price_tolerance\": 5\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.collectionVariables.set('confirmation_uid', pm.response.json().confirmation_uid || '');"
            ]
          }
        }
      ]
    },
    {
      "name": "5. Book a Confirmed Option",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/hotelxv/api/v2/confirmations/{{confirmation_uid}}/actions/book",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "hotelxv",
            "api",
            "v2",
            "confirmations",
            "{{confirmation_uid}}",
            "actions",
            "book"
          ],
          "query": []
        },
        "description": "Executes the final booking for an option that has already been confirmed.\n\nThis action is the final step in the booking process. It requires the `confirmation_uid` returned by the `confirm` action. The request is routed to the correct supplier to finalize the transaction.\n\nUpon success, the full booking details are saved to the platform's database and a booking record is returned.",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"client_reference\": \"my-reference-123\",\n  \"price_tolerance\": 5,\n  \"holder\": {\n    \"title\": \"Mr\",\n    \"first_name\": \"John\",\n    \"last_name\": \"Appleseed\",\n    \"birth_date\": \"1985-04-12\",\n    \"email\": \"john.appleseed@example.com\",\n    \"phone\": \"+1 555 0100\",\n    \"country\": \"US\"\n  },\n  \"guests\": [\n    {\n      \"title\": \"Mr\",\n      \"first_name\": \"John\",\n      \"last_name\": \"Appleseed\",\n      \"birth_date\": \"1985-04-12\"\n    },\n    {\n      \"title\": \"Mrs\",\n      \"first_name\": \"Jane\",\n      \"last_name\": \"Appleseed\",\n      \"birth_date\": \"1987-09-30\"\n    }\n  ],\n  \"addons\": []\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.collectionVariables.set('booking_uid', pm.response.json().booking_uid || '');"
            ]
          }
        }
      ]
    },
    {
      "name": "6. Get Booking Details",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/hotelxv/api/v2/bookings",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "hotelxv",
            "api",
            "v2",
            "bookings"
          ],
          "query": [
            {
              "key": "booking_uids",
              "value": "{{booking_uid}}",
              "disabled": true
            },
            {
              "key": "page_token",
              "value": "",
              "disabled": true
            }
          ]
        },
        "description": "Retrieves booking information. The behavior of this endpoint changes based on the parameters provided:\n\n- **By `booking_uids`**: If a list of `booking_uids` is given, the endpoint will fetch the details for those specific bookings. It employs a local-first strategy, checking its own database before proxying requests for any missing bookings to the original supplier.\n\n- **By User**: If `booking_uids` is omitted, the endpoint returns a paginated list of all bookings associated with the authenticated user (based on the `sub` claim in the JWT token)."
      },
      "event": []
    },
    {
      "name": "7. Cancel a Booking",
      "request": {
        "method": "POST",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/hotelxv/api/v2/bookings/{{booking_uid}}/actions/cancel",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "hotelxv",
            "api",
            "v2",
            "bookings",
            "{{booking_uid}}",
            "actions",
            "cancel"
          ],
          "query": []
        },
        "description": "Initiates the cancellation process for a specific booking.\n\nThe request is proxied to the corresponding supplier's backend system for processing. Upon successful cancellation, the booking's status and cancellation details are updated in the platform's local database."
      },
      "event": []
    }
  ]
}