Skip to Content

Search hotels

Search hotels for a place and a stay, set the guests and currency, sort and page the answer, and read a running search by its id.

A search returns the hotels for one place and one stay, each with one price and its booking links. You can send it as a query string or as a JSON body; both run the same search.

Query string or JSON body

  • GET /v1/hotels/search takes the fields as a query string. Lists are comma-separated (child_ages=7,4, hotel_ids=lp19b5e,lp5f44c), and rooms is JSON text.
  • POST /v1/hotels/search takes the same fields as a JSON object, with real lists. The body must be a JSON object of at most 16 KB, or the answer is 400 invalid_body.

Both answer in the same shape, and the same stay sent either way is the same search, with the same search_id.

The same search as a JSON body
curl https://api.voyagelabs.ai/v1/hotels/search \
  -H "X-API-Key: $VOYAGE_LABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "city": "San Francisco",
    "country": "US",
    "check_in": "2027-02-09",
    "check_out": "2027-02-12",
    "rooms": [{ "adults": 2, "child_ages": [7] }]
  }'

Where to look

Say where in exactly one way. Sending none, or more than one, answers 400 invalid_parameter with param set to place.

FieldsMeaning
city and countryA city by name, with its 2-letter country code, such as US
latitude and longitude, with radius_kmHotels around a point. radius_km is 0.2 to 50; it is 5 when you leave it out
place_idA Google place id, such as ChIJIQBpAG2ahYAR_6128GcTUEo
hotel_idsUp to 200 hotel ids from earlier answers, to price hotels you already know about

The API does not look up a place by name beyond city and country.

The stay

check_in is the first night and check_out the day of departure, both written YYYY-MM-DD. check_in may be no earlier than yesterday and no more than 500 days ahead, and a stay is 1 to 30 nights.

Guests and rooms

For one room, send adults (1 to 8; 2 when you leave it out) and, for children, child_ages. For more than one room, send rooms instead: a list of 1 to 8 rooms, each {"adults": 2, "child_ages": [7]}. Sending rooms together with adults or child_ages is refused, because the two could disagree.

Give each child by age, 0 to 17, with up to 6 children in a room. Ages matter: they change which rooms a hotel offers.

With several rooms, each offer prices all of them together: total covers every room, and offers[].rooms has one entry per room, in the order you sent them.

Currency and nationality

  • currency: the 3-letter currency of the prices, USD when you leave it out. A charge in due_at_property carries its own currency.
  • nationality: the guests' 2-letter country code, US when you leave it out. Some rates depend on it.

Sort and page

There are no filters by price, stars or amenities: sort and page the answer, and choose from it.

FieldMeaningDefault
sortprice: cheapest first. rating: best guest rating first, with unrated hotels lastprice
limitHotels in this response, 1 to 10020
cursorThe next_cursor of the previous page

counts.found is the number of hotels in the whole answer and counts.returned the number on this page. next_cursor is null on the last page. A cursor is a position in the sorted answer, so keep the same sort while you follow one.

To page or sort an answer you already have, read the search by its id rather than searching again.

Waiting and freshness

FieldMeaning
response_modecomplete, the default, holds the request open while the supplier answers. partial answers at once, often with status running; you read the rest by search_id.
wait_msExactly how long to wait for a running search, 0 to 30000. When you send it, it decides the wait.
max_age_sThe oldest stored answer you accept, in seconds. 0 never takes a stored answer, though it still joins a search already running for the same stay. A whole number from 0 to 86400; anything else answers 400 with invalid_parameter. A stored answer is never reused past 900 seconds, so a value above 900 acts as 900.

Even with complete, a search the supplier has not finished in time answers status running. Handle both.

Every call to /v1/hotels/search counts toward your new searches for the minute, even when a stored answer serves it. Reading a search by its id does not. See Rate limits.

Example

curl --get https://api.voyagelabs.ai/v1/hotels/search \
  -H "X-API-Key: $VOYAGE_LABS_API_KEY" \
  --data-urlencode "city=San Francisco" \
  -d country=US \
  -d check_in=2027-02-09 \
  -d check_out=2027-02-12 \
  -d adults=2 \
  -d child_ages=7 \
  -d limit=1

This answer came from a test key, and the booking link tokens are shortened.

200 OK
{
  "data": {
    "search_id": "hs_0a29ce33d3a646fe9660",
    "status": "complete",
    "query": {
      "place": { "kind": "city", "city": "San Francisco", "country": "US" },
      "check_in": "2027-02-09",
      "check_out": "2027-02-12",
      "rooms": [{ "adults": 2, "child_ages": [7] }],
      "currency": "USD",
      "nationality": "US",
      "nights": 3
    },
    "pricing": { "priced_at": "2026-12-06T20:40:19.471Z", "age_s": 0 },
    "counts": { "found": 24, "returned": 1 },
    "next_cursor": "c_1",
    "hotels": [
      {
        "hotel": {
          "id": "lp5f44c",
          "name": "Motel 6 San Francisco, CA – Civic Center",
          "stars": 2,
          "rating": 7.4,
          "review_count": 145,
          "address": "587 Eddy St, San Francisco, California, 94109",
          "city": "San Francisco",
          "country": "US",
          "latitude": 37.783188,
          "longitude": -122.417244,
          "photo": "https://static.cupid.travel/hotels/ex_w3296h3170x0y0-058613f1_z.jpg"
        },
        "offers": [
          {
            "rooms": [
              {
                "name": "1 King Bed | Non-Smoking",
                "room_id": 1321822334,
                "adults": 2,
                "child_ages": [7]
              }
            ],
            "board_code": "RO",
            "board": "Room Only",
            "total": 223.54,
            "currency": "USD",
            "per_night": 74.51,
            "taxes_included": 28.95,
            "due_at_property": [],
            "refundable": false,
            "free_cancellation_until": null,
            "cancellation": []
          }
        ],
        "booking_links": [
          {
            "site": "hotels_com",
            "name": "Hotels.com",
            "url": "https://api.voyagelabs.ai/r/hl_GPr_mc0vhVHege…",
            "lands_on": "property",
            "found_by": "id",
            "verified": false,
            "checked": "2026-12-05",
            "note": "The hotel's id here is worked out from ours and not confirmed, so now and then it opens a missing page."
          },
          {
            "site": "google",
            "name": "Google Hotels",
            "url": "https://api.voyagelabs.ai/r/hl__Az-XUQMD3fXhn…",
            "lands_on": "search_results",
            "found_by": "name",
            "verified": false,
            "checked": "2026-12-05",
            "note": "Finds the hotel by its name, which is right for most hotels but not all."
          },
          {
            "site": "booking_com",
            "name": "Booking.com",
            "url": "https://api.voyagelabs.ai/r/hl_TC02KWLxid5pp5…",
            "lands_on": "search_results",
            "found_by": "name",
            "verified": true,
            "checked": "2026-12-05",
            "note": "Searches by the hotel's name; the hotel is normally the first result."
          }
        ]
      }
    ]
  },
  "meta": { "request_id": "req_3af51e458995", "mode": "test" }
}

Reading the answer

FieldMeaning
search_idNames this search, to read it again. Kept for 24 hours
statuscomplete, or running while the supplier has not answered
retry_after_msOnly while running: when to ask again, in milliseconds
queryThe stay as the service understood it, with nights. query.place.kind is the way you said where: city, point, place or hotels. A point's radius comes back as radius_m, in metres
pricingpriced_at, when the prices were fetched, and age_s, how many seconds ago. null while running
countsfound: hotels in the whole answer. returned: hotels on this page
next_cursorPass it as cursor for the next page. null on the last page
hotelsEach hotel with one offer and its booking links. See What one result is

The full field list is in the API reference.

Read a search by its id

GET /v1/hotels/search/{search_id} reads a stored search. It never searches again and does not count toward your new searches. Use it to:

  • wait for a running search, with wait_ms (0 to 30000). Without it, the read answers at once.
  • get the next page, with cursor and limit.
  • sort the same answer another way, with sort.

A search started with response_mode=partial usually answers before the supplier has:

200 OK, still running
{
  "data": {
    "search_id": "hs_6bd1d8a2db5441a28623",
    "status": "running",
    "retry_after_ms": 1000,
    "query": {
      "place": { "kind": "city", "city": "San Francisco", "country": "US" },
      "check_in": "2027-02-10",
      "check_out": "2027-02-12",
      "rooms": [{ "adults": 2, "child_ages": [] }],
      "currency": "USD",
      "nationality": "US",
      "nights": 2
    },
    "pricing": null,
    "counts": { "found": 0, "returned": 0 },
    "next_cursor": null,
    "hotels": []
  },
  "meta": { "request_id": "req_6faa8e62a8fb", "mode": "test" }
}

While a search runs, retry_after_ms says when to ask again. Better still, send wait_ms: the read is held until the search ends and answers at that moment, or answers running again when the wait runs out.

curl --get https://api.voyagelabs.ai/v1/hotels/search/hs_6bd1d8a2db5441a28623 \
  -H "X-API-Key: $VOYAGE_LABS_API_KEY" \
  -d wait_ms=10000

Reading a search never refreshes its prices

pricing.age_s keeps growing each time you read the same search. Past 900 seconds, search the stay again before you show a price.

A search is kept for 24 hours; after that, reading it answers 404 search_not_found. A search made with a test key cannot be read with a live key, nor the other way round.

Next

On this page