Getting Started with the Xeni Activities APIHow to Book an ActivityHow to Browse Activity Tags and CategoriesHow to Cancel an Activity BookingHow to Check Activity AvailabilityHow to Get Activity DetailsHow to Retrieve Activity Booking DetailsHow to Search for Activities with FiltersHow to Search for Activity DestinationsCar Rental API - Getting StartedCar Rental API - Understanding Response FieldsHow to Book a Car RentalHow to Get Rental Car Details and Equipment Add-OnsHow to Retrieve or Cancel a Car Rental BookingHow to Search for Available Rental CarsHow to Search for Pickup LocationsHow to Use Car Rental Search FiltersDeals API Best Practices for IntegrationDeals API Frequently Asked QuestionsGetting Started with the Xeni Deals APIDeals API Request Parameters and Headers ReferenceDeals API Supported Currencies and LocalizationHow to Display Deals in Your ApplicationHow to Fetch Hotel Deals by LocationFlights API Error Codes and TroubleshootingGetting Started with the Xeni Flights APIHow to Book a FlightHow to Check Flight Availability and PricingHow to Confirm or Cancel a Flight BookingHow to Retrieve Fare Rules for a FlightHow to Retrieve Flight Booking DetailsHow to Search for Airports Using AutocompleteHow to Search for FlightsHow to Use Flight Search Filters, Sorting, and PaginationHow to Check Room Availability and PricingHow to Filter Vacation Rental ResultsHow to Get Resort Property Details, Amenities, and AccessibilityHow to Hold and Confirm a Resort BookingHow to Release a Resort HoldHow to Retrieve Resort Booking DetailsHow to Search for Available ResortsHow to Search for Resort DestinationsHow to Search for Vacation Rental LocationsHow to Search for Vacation RentalsHow to Use Resort Search Filters and SortingGetting Started with the Xeni Resorts APIResorts API: Understanding Booking Statuses and PoliciesGetting Started with the Vacation Rentals APIVacation Rentals Frequently Asked QuestionsVacation Rentals Supported Property TypesUnderstanding Async Search for Vacation RentalsAuthentication & API SignaturesBooking Hotels — Direct API & SSO CheckoutError Handling, Rate Limits & Best PracticesGetting Started with the Xeni Hotels APIManaging Bookings: Status, Retrieval & CancellationPricing Confirmation & Token LifecycleRetrieving Hotel Details & Room AvailabilitySearching for Hotels: Locations, Filters & PaginationSearching for HotelsSession Management & Correlation IDsAPI authentication and getting your API keys

Searching for Hotels

Last updated: 2026-02-13

Searching for Hotels: Locations, Filters & Pagination

Hotel search is a two-step process. First, resolve a destination name to geographic coordinates using the autocomplete endpoint. Then, use those coordinates to search for available properties. This article covers both steps in full detail, including how to apply filters and paginate through large result sets.

Step 1: Search Locations (Autocomplete)

The autocomplete endpoint resolves a free-text query into structured location results with coordinates. It supports city names, region names, country names, and even specific hotel names.

Endpoint

GET /hotels/api/v2/autocomplete?key={query}

Parameters

ParameterTypeRequiredDescription
keystringYesSearch query. Examples: "Miami", "Paris", "Hilton Garden Inn"

Example Request

GET /hotels/api/v2/autocomplete?key=MiamiAuthorization: {signature}Content-Type: application/json

Example Response

JSON
{
  "data": [
    {
      "id": "12345",
      "name": "Miami",
      "full_name": "Miami, Florida, United States",
      "country": "United States",
      "state": "Florida",
      "location": {
        "lat": 25.7617,
        "long": -80.1918
      }
    },
    {
      "id": "12346",
      "name": "Miami Beach",
      "full_name": "Miami Beach, Florida, United States",
      "country": "United States",
      "state": "Florida",
      "location": {
        "lat": 25.7907,
        "long": -80.13
      }
    }
  ]
}

Response Fields

FieldTypeDescription
idstringUnique location identifier.
namestringShort location name.
full_namestringFully qualified name (city, state, country).
countrystringCountry name.
statestringState or province (where applicable).
location.latnumberLatitude coordinate.
location.longnumberLongitude coordinate.

Important: The response headers will include an x-correlation-id value. You must capture and pass this value in the headers of all subsequent API calls within the same search session. See Session Management & Correlation IDs for details.

*

Step 2: Search Hotels

Once you have coordinates from the autocomplete step, use the hotel search endpoint to find available properties.

Endpoint

POST /hotels/api/v2/properties?page={page}&limit={limit}

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number for pagination.
limitinteger20Number of results per page.

Request Body

FieldTypeRequiredDescription
checkindatestringYesCheck-in date in YYYY-MM-DD format.
checkoutdatestringYesCheck-out date in YYYY-MM-DD format. Must be after checkindate.
occupancyarrayYesArray of room occupancy objects (see below).
latnumberYesLatitude from autocomplete results.
longnumberYesLongitude from autocomplete results.
countryofresidencestringYesISO 2-letter country code of the guest (e.g., "US").
sortarrayNoSorting criteria. See Sorting section below.
filtersobjectNoFilter criteria. See Filters section below.
isasyncbooleanNoSet to false for synchronous results (recommended).

Occupancy Object

Each element in the occupancy array represents one room:

FieldTypeDescription
adultsintegerNumber of adult guests (18+). Minimum: 1.
childsintegerNumber of children. Set to 0 if none.
childagesarray of integersAges of each child. Must have exactly childs elements. Example: [5, 12].

Example: Single room, 2 adults

JSON
"occupancy": [  {    "adults": 2,    "childs": 0,    "childages": []  }]

Example: Single room, 2 adults + 1 child age 8

JSON
"occupancy": [  {    "adults": 2,    "childs": 1,    "childages": [8]  }]

Example: Two rooms

JSON
"occupancy": [  {    "adults": 2,    "childs": 0,    "childages": []  },  {    "adults": 1,    "childs": 2,    "childages": [5, 10]  }]

*

Filters

The filters object lets you narrow search results. All filter fields are optional.

FieldTypeDescription
ratingsarray of integersStar ratings to include. Values: 1 through 5. Example: [4, 5] for 4- and 5-star hotels.
amenitiesarray of stringsFilter by amenities. Common values: "Free WiFi", "Pool", "Gym", "Parking", "Restaurant", "Spa", "Pet-friendly", "Airport shuttle".
minpricenumberMinimum total price (USD).
maxpricenumberMaximum total price (USD).
namestringFilter by hotel name (partial match). Example: "Marriott".

Example: 4+ star hotels with a pool under $300

JSON
"filters": {  "ratings": [4, 5],  "amenities": ["Pool"],  "max_price": 300}

*

Sorting

The sort array controls result ordering. Each element is an object with key and order fields.

Sort KeyDescription
priceSort by total rate.
OrderDescription
ascAscending (lowest first).
descDescending (highest first).

Example

JSON
"sort": [{ "key": "price", "order": "asc" }]

*

Full Search Request Example

POST /hotels/api/v2/properties?page=1&limit=20Authorization: {signature}x-correlation-id: {correlation_id}Content-Type: application/json

{ "checkindate": "2025-06-01", "checkoutdate": "2025-06-05", "occupancy": [ { "adults": 2, "childs": 0, "childages": [] } ], "lat": 25.7617, "long": -80.1918, "countryofresidence": "US", "sort": [{ "key": "price", "order": "asc" }], "filters": { "ratings": [4, 5], "amenities": ["Free WiFi", "Pool"], "maxprice": 400 }, "isasync": false}

Search Response

JSON
{
  "data": {
    "total": 147,
    "hotels": [
      {
        "property_id": "XN00012345",
        "name": "Oceanview Resort & Spa",
        "ratings": {
          "star_rating": 4,
          "user_rating": 8.5,
          "review_count": 1240
        },
        "rate": {
          "base_rate": 756,
          "total_rate": 891.08,
          "currency": "USD",
          "taxandfees": 135.08,
          "recommendedsellingprice": 950,
          "saved_price": 58.92
        },
        "amenities": [
          "Free WiFi",
          "Pool",
          "Spa",
          "Restaurant",
          "Fitness Center"
        ],
        "image": {
          "large": "https://images.xeni.com/hotels/12345/main.jpg"
        },
        "contact": {
          "address": {
            "line_1": "123 Ocean Drive",
            "city": "Miami Beach",
            "state": "FL",
            "postal_code": "33139"
          }
        },
        "chain": "Independent",
        "distance": 2.4
      }
    ]
  }
}

Key Response Fields

FieldDescription
data.totalTotal number of matching properties across all pages.
propertyidUnique hotel identifier. Use this for detail and availability calls.
rate.baserateRoom rate before taxes and fees (for the full stay).
rate.totalrateTotal price including taxes and fees.
rate.taxandfeesTax and fee amount.
rate.recommendedsellingpriceRecommended retail price (for markup calculations).
rate.savedpriceSavings compared to the recommended selling price.
distanceDistance from the search center in miles.

*

Pagination

Results are paginated using the page and limit query parameters.

  • The default page size is 20 results.
  • The data.total field in the response tells you the total number of matching properties.
  • Calculate total pages: Math.ceil(total / limit).
  • Increment the page parameter to fetch the next batch.

Example: Fetching page 2

POST /hotels/api/v2/properties?page=2&limit=20

Use the same request body and headers as the original search. The correlation ID must remain the same throughout the session.

Pagination Tips

  • If you receive fewer results than the limit, you've reached the last page.
  • Append new results to your existing list rather than replacing them, to build a complete view for the user.
  • Avoid requesting very large page sizes. The default of 20 provides a good balance of performance and completeness.
* ](#article-4)_

Was this article helpful?