# Rooms and rates (/hotels/rooms-and-rates)

Fetch every room and rate one hotel has for a stay, with meals, cancellation terms and what is paid at the hotel, before you quote a price.

A search gives one price per hotel. `GET /v1/hotels/rates/{hotel_id}` gives every room and rate that hotel has for the stay, cheapest first. Call it before you tell a traveller what a hotel costs or how its stay can be cancelled: it can find a lower price than the search did.

## The request [#the-request]

- `hotel_id`, in the path: the hotel's `id` exactly as a search returned it, such as `lp19b5e`. Anything else answers `400` `invalid_parameter` with `param` set to `hotel_id`.
- The stay, as in a [search](/hotels/search): `check_in` and `check_out` (both required), the guests as `adults` and `child_ages` or as `rooms`, `currency` and `nationality`. Send the stay the traveller searched, so the rates match it.
- `response_mode`, `wait_ms` and `max_age_s` work as they do in a search.

The answer has a `search_id` of its own. Read it again with `GET /v1/hotels/search/{search_id}` to wait for it while it runs. Each rates call counts toward your new searches for the minute, as a search does.

## The answer [#the-answer]

The answer has the same shape as a search. `data.hotels` holds the one hotel with all of its `offers`, cheapest first. When the hotel has no rooms for the stay, `data.hotels` is empty and `counts.found` is 0, so check before you read the first item.

## Example [#example]

<Tabs items={["curl","JavaScript","Python"]}>
<Tab value="curl">
```bash
curl --get https://api.voyagelabs.ai/v1/hotels/rates/lp19b5e \
  -H "X-API-Key: $VOYAGE_LABS_API_KEY" \
  -d check_in=2027-02-09 \
  -d check_out=2027-02-12 \
  -d adults=2 \
  -d child_ages=7
```
</Tab>

<Tab value="JavaScript">
```js title="rates.mjs"
const url = new URL("https://api.voyagelabs.ai/v1/hotels/rates/lp19b5e");
url.search = new URLSearchParams({
  check_in: "2027-02-09",
  check_out: "2027-02-12",
  adults: "2",
  child_ages: "7",
}).toString();

const response = await fetch(url, {
  headers: { "X-API-Key": process.env.VOYAGE_LABS_API_KEY },
});
const body = await response.json();
if (!response.ok) {
  throw new Error(`${body.error.code}: ${body.error.message}`);
}

const [stay] = body.data.hotels;
if (stay === undefined) {
  console.log("No rooms for this stay.");
} else {
  for (const offer of stay.offers) {
    const room = offer.rooms.map((one) => one.name).join(" + ");
    const terms = offer.free_cancellation_until !== null
      ? `free cancellation until ${offer.free_cancellation_until}`
      : offer.refundable
      ? "refundable"
      : "non-refundable";
    console.log(`${room}, ${offer.board}: ${offer.total} ${offer.currency}, ${terms}`);
  }
}
```
</Tab>

<Tab value="Python">
```python title="rates.py"
import os

import requests

response = requests.get(
    "https://api.voyagelabs.ai/v1/hotels/rates/lp19b5e",
    headers={"X-API-Key": os.environ["VOYAGE_LABS_API_KEY"]},
    params={
        "check_in": "2027-02-09",
        "check_out": "2027-02-12",
        "adults": 2,
        "child_ages": "7",
    },
    timeout=40,
)
body = response.json()
if not response.ok:
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")

hotels = body["data"]["hotels"]
if not hotels:
    print("No rooms for this stay.")
else:
    for offer in hotels[0]["offers"]:
        room = " + ".join(one["name"] for one in offer["rooms"])
        if offer["free_cancellation_until"] is not None:
            terms = f"free cancellation until {offer['free_cancellation_until']}"
        elif offer["refundable"]:
            terms = "refundable"
        else:
            terms = "non-refundable"
        print(f"{room}, {offer['board']}: {offer['total']} {offer['currency']}, {terms}")
```
</Tab>
</Tabs>

This answer came from a test key. It is trimmed to two of the hotel's ten offers, and the booking link tokens are shortened.

```json title="200 OK"
{
  "data": {
    "search_id": "hs_e1eb13c6ba344d13aa75",
    "status": "complete",
    "query": {
      "place": { "kind": "hotels", "hotel_ids": ["lp19b5e"] },
      "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.534Z", "age_s": 0 },
    "counts": { "found": 1, "returned": 1 },
    "next_cursor": null,
    "hotels": [
      {
        "hotel": {
          "id": "lp19b5e",
          "name": "The Westin St. Francis San Francisco on Union Square",
          "stars": 4,
          "rating": 8.3,
          "review_count": 1024,
          "address": "335 Powell Street",
          "city": "San Francisco",
          "country": "US",
          "latitude": 37.787638,
          "longitude": -122.408391,
          "photo": "https://cache.marriott.com/content/dam/marriott-renditions/SFOUW/sfouw-exterior-1716-hor-clsc.jpg?output-quality=70&interpolation=progressive-bilinear&downsize=1300px:*"
        },
        "offers": [
          {
            "rooms": [
              {
                "name": "Traditional Room, 1 King Bed",
                "room_id": 105310002,
                "adults": 2,
                "child_ages": [7]
              }
            ],
            "board_code": "RO",
            "board": "Room Only",
            "total": 2839.52,
            "currency": "USD",
            "per_night": 946.51,
            "taxes_included": 392.4,
            "due_at_property": [
              {
                "description": "Taxes and Fees",
                "amount": 133.92,
                "currency": "USD"
              }
            ],
            "refundable": false,
            "free_cancellation_until": null,
            "cancellation": []
          },
          {
            "rooms": [
              {
                "name": "Traditional Room, 1 King Bed",
                "room_id": 105310002,
                "adults": 2,
                "child_ages": [7]
              }
            ],
            "board_code": "RO",
            "board": "Room Only",
            "total": 2899.92,
            "currency": "USD",
            "per_night": 966.64,
            "taxes_included": 392.76,
            "due_at_property": [
              {
                "description": "Taxes and Fees",
                "amount": 133.92,
                "currency": "USD"
              }
            ],
            "refundable": true,
            "free_cancellation_until": "2026-12-07T04:00:00Z",
            "cancellation": [
              {
                "from": "2026-12-07T04:00:00Z",
                "charge": { "amount": 952.9, "currency": "USD" }
              },
              {
                "from": "2027-02-08T10:00:00Z",
                "charge": { "amount": 2781.4, "currency": "USD" }
              }
            ]
          }
        ],
        "booking_links": [
          {
            "site": "hotels_com",
            "name": "Hotels.com",
            "url": "https://api.voyagelabs.ai/r/hl_S8i61dZ9uppJaB…",
            "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_gTZRpHXTLfew6Y…",
            "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_JU7trOjeADVEnW…",
            "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_3e81a5d35666", "mode": "test" }
}
```

<Callout type="info" title="Test keys answer with one saved hotel">
With a `vl_test_` key, every rates call answers with The Westin St. Francis San Francisco on Union Square (`lp19b5e`), whatever `hotel_id` you send. Its rooms, prices and cancellation dates come from the saved sample.
</Callout>

## Rooms and rates [#rooms-and-rates]

Each offer is one rate for the whole stay. Its `rooms` has one entry per room you asked for, in your order:

- `name`: the hotel's name for the room.
- `room_id`: the hotel's room type, the same across rates and searches. It is `null` when the rate could not be tied to a room.
- `adults` and `child_ages`: who the room was priced for.

Several offers often share a `room_id`: the same room sold at different rates. In the example, the Traditional Room, 1 King Bed (`105310002`) costs 2,839.52 without a refund and 2,899.92 with free cancellation. Group offers by `room_id` to show each room with its choices.

## Meals [#meals]

`board` names the meals included, such as `Room Only`; `board_code` is its short code, such as `RO`. Show `board` to travellers.

## Cancellation [#cancellation]

- `refundable`: whether the stay can be cancelled for a refund. For several rooms it is `true` only when every room can.
- `free_cancellation_until`: the last moment to cancel at no charge, in UTC. `null` when there is none.
- `cancellation`: each moment from which cancelling costs more, earliest first. `from` is the moment, in UTC, and `charge` the `amount` and `currency` of cancelling the whole stay from then on. Empty when the stay is not refundable.

In the example, the refundable rate can be cancelled at no charge until 04:00 UTC on 7 December 2026. From then it costs 952.90, and from 10:00 UTC on 8 February 2027 it costs 2,781.40. Times are UTC: convert them before you show them to a traveller.

## Price breakdown [#price-breakdown]

- `total`: the whole stay, every room and every night, taxes in.
- `per_night`: `total` divided by the nights.
- `taxes_included`: the taxes and fees already inside `total`, or `null` when the supplier does not split them out.
- `due_at_property`: what the hotel collects itself, on top of `total`. Each charge has a `description`, an `amount` and its own `currency`.

To tell a traveller what the stay costs, add `due_at_property` to `total`. In the example, the cheapest rate is 2,839.52, plus 133.92 paid at the hotel.

## How long a rate is good for [#how-long-a-rate-is-good-for]

A rate has no expiry time of its own. `pricing.priced_at` says when the hotel was priced and `pricing.age_s` how many seconds ago. Reading the answer again by `search_id` never refreshes it, and asking for the same stay within 15 minutes is answered from the stored answer. Past 900 seconds, ask for the rates again before you quote one, or send `max_age_s=0` to price the stay afresh.

The travel site the traveller books on shows its own price, which can differ from this one, and the traveller chooses the room and rate there. See [Send travellers to book](/hotels/booking-links).