# Introduction (/) Search flights and hotels from your app or AI agent, and send travellers to book the exact flight or room. Voyage Labs gives you two search APIs on one host. Ask for a trip or a stay and get back priced results, each with booking links that open the same flights or the same room on a site where the traveller can book. The APIs only search. They never hold, book or charge, so a call can't spend anyone's money. ## Start here [#start-here] ## What both APIs share [#what-both-apis-share] - **One host.** Every call goes to `https://api.voyagelabs.ai`. - **One kind of key.** Keys start `vl_live_` for live prices or `vl_test_` for saved sample data. You send one in the `X-API-Key` header. - **One envelope.** A success has `data` and `meta`. A failure has `error`, with a stable `code` and advice on whether to retry. See [Conventions](/conventions) and [Errors](/errors). - **Prices with an age.** Every answer says when its prices were found, so you know when to search again before you show one. - **Links shown as given.** Booking links are made for you. Show them as they are, and never build or edit one. The [API reference](/api-reference) lists every endpoint and field, and you can call each one from the page with your own key. # Quickstart (/quickstart) Get a test key, search a trip, and read the answer. Then switch to a live key without changing your code. This walkthrough uses a test key, which answers from saved sample data. It costs nothing, and you can run it as often as you like. ### Get a key [#get-a-key] Sign in to the [console](https://developer.voyagelabs.ai) and open **Keys**. Create a test key and copy it. The console shows a key only once. Keep it in an environment variable rather than in your code: ```bash title="Terminal" export VOYAGE_LABS_API_KEY="vl_test_..." ``` ### Search a trip [#search-a-trip] Ask for San Francisco to Tokyo Narita, out on 9 February 2027 and back a week later. That is the trip the test data holds. A test key returns it whatever you ask for. ```bash curl -G https://api.voyagelabs.ai/v1/flights/search \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" \ -d origin=SFO \ -d destination=NRT \ -d depart_date=2027-02-09 \ -d return_date=2027-02-16 \ -d adults=2 ``` ```js title="search.mjs" const params = new URLSearchParams({ origin: "SFO", destination: "NRT", depart_date: "2027-02-09", return_date: "2027-02-16", adults: "2", }); const response = await fetch(`https://api.voyagelabs.ai/v1/flights/search?${params}`, { 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}`); console.log(body.data.status, body.data.results.length, "results"); ``` ```python title="search.py" import os import requests response = requests.get( "https://api.voyagelabs.ai/v1/flights/search", headers={"X-API-Key": os.environ["VOYAGE_LABS_API_KEY"]}, params={ "origin": "SFO", "destination": "NRT", "depart_date": "2027-02-09", "return_date": "2027-02-16", "adults": 2, }, timeout=40, ) body = response.json() if not response.ok: raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}") print(body["data"]["status"], len(body["data"]["results"]), "results") ``` ### Read the answer [#read-the-answer] A successful answer has `data` and `meta`. This is the test key's answer, cut to one result and the fields you need first. Each result also has its `slices` (the flights, with times) and its `fare`. ```json title="Response (one result, link tokens shortened)" { "data": { "search_id": "srch_17a3c431-779c-4a88-9ebf-5f4b1eee0736", "status": "complete", "pricing": { "priced_at": "2026-12-06T20:46:06.727Z", "age_s": 0, "refreshing": false }, "counts": { "found": 6, "matched": 6, "returned": 1 }, "results": [ { "id": "it_U0ZPLk5SVC4yMDI3MDIwOS4yMDI3MDIxNi4yLjAuMC5ZLlVTRHxaRzI1QDAyMDksWkcyNkAwMjE2", "airlines": [{ "code": "ZG", "name": "ZIPAIR" }], "price": { "total": 1445.02, "per_adult": 722.51, "currency": "USD" }, "stops": 0, "total_duration_min": 1230, "booking_links": { "supplier": { "url": null, "available": false, "lands_on": null }, "airline": { "url": "https://api.voyagelabs.ai/r/al_sE0Iy5Op1BXDrG9I…", "available": true, "lands_on": "booking_page", "airline": "ZG" }, "google_flights": { "url": "https://api.voyagelabs.ai/r/al_-v1RAtbiIi6v3Etm…", "available": true, "lands_on": "itinerary" } } } ] }, "meta": { "request_id": "req_4252794c71f0", "mode": "test" } } ``` - `status` is `complete` when the search has finished. It is `partial` while results are still arriving. [Read a search](/flights/read-a-search) shows how to collect the rest. - `price.total` is for all the travellers, in `price.currency`. - `pricing.age_s` says how old the prices are. Over 240 seconds, search again before you show a price or a link. - `booking_links` holds the links to show. Use a link only when its `available` is `true`, and show its `url` as it is. See [Send travellers to book](/flights/booking-links). - `meta.mode` is `test` here, because the key is a test key. ### Go live [#go-live] Create a live key in the console and put it in `VOYAGE_LABS_API_KEY`. The code stays the same. Live keys search real prices, and the trip you ask for is the trip you get. Before you go live, handle the [errors](/errors) your code can meet, and check your [limits](/rate-limits). ## Search hotels instead [#search-hotels-instead] The Hotels Search API works the same way. A test key returns the same San Francisco hotels whatever you ask for. ```bash curl -G 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 ``` [Search hotels](/hotels/search) explains the request and the answer. ## Next [#next] # Keys and authentication (/authentication) Get a key in the console, send it in a header, and keep live keys on your server. Every API call, except a few public files, needs a key. You make and manage keys in the [console](https://developer.voyagelabs.ai). ## Live and test keys [#live-and-test-keys] | Key starts | What it reaches | | --- | --- | | `vl_live_` | Live prices from real suppliers. | | `vl_test_` | Saved sample data. Free and repeatable, and it never reaches a supplier. See [Test mode](/test-mode). | Keys made before the `vl_` prefix start `fs_live_` and `fs_test_`. They still work, and mean the same. Live and test calls are counted separately against your limits, and have separate searches. A search made with one kind of key can't be read with the other. ## Send the key [#send-the-key] Send the key in the `X-API-Key` header: ```bash curl https://api.voyagelabs.ai/v1/flights/usage \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" ``` `Authorization: Bearer` is read as well, for clients that only know that form: ```bash curl https://api.voyagelabs.ai/v1/flights/usage \ -H "Authorization: Bearer $VOYAGE_LABS_API_KEY" ``` Never put a key in a URL. URLs end up in logs, browser history and analytics. ## Keep live keys on your server [#keep-live-keys-on-your-server] The API answers requests from any web origin, so a browser can call it. That doesn't make a browser a safe place for a live key: anyone who opens the page can read it. Call the API from your own server, or from an agent's backend, and send the results to the browser. If a live key has been in a web page, a mobile app bundle or a public repository, revoke it in the console and make another. ## Manage keys [#manage-keys] - **A key is shown once.** We keep only a hash of it, so a lost key can't be recovered. Make a new one. - **Rotate** a key in the console to replace it with a new one. - **Revoke** a key to switch it off. Requests with it then answer `403` `forbidden`. - **Live access.** A live key works once live access is on for your account. Until then it gets `403` `forbidden`, and a test key still works. - **Products.** A key reaches the products on your account. A key without access to a product gets `403` `forbidden` on that product's endpoints. - **Networks.** If your account limits its keys to your own networks, a request from anywhere else gets `403` `forbidden`, and its message names the address the request came from. ## What needs no key [#what-needs-no-key] These are public, so a traveller's browser or a tool can open them: - Booking links (`https://api.voyagelabs.ai/r/...`), which a traveller opens. See [Send travellers to book](/flights/booking-links). - Airline logos (`/logos/{code}.png`). - The files that describe the APIs to tools and models. See [Build with AI agents](/agents). ## When a key is refused [#when-a-key-is-refused] | Status | `code` | What it means | | --- | --- | --- | | `401` | `unauthenticated` | No key, or a key we don't know. Check the header name and that the whole key was sent. | | `403` | `forbidden` | The key is revoked or has expired, your account doesn't have live access yet, the key can't use this product or endpoint, or it was used from outside your networks. The console shows the key's state. | Neither is worth retrying as it is. See [Errors](/errors) for the rest. # Test mode (/test-mode) Build against saved sample data with a test key. It costs nothing, never reaches a supplier and always answers the same way. A test key, one that starts `vl_test_`, answers from saved sample data instead of searching suppliers. Use it to build and test your integration. Then switch to a live key, and your code stays the same. ## What a test key returns [#what-a-test-key-returns] | Product | What you get, whatever you ask for | | --- | --- | | Flights Search API | One saved search: San Francisco (SFO) to Tokyo Narita (NRT), 9 to 16 February 2027. | | Hotels Search API | The same saved San Francisco hotels for any search, and one saved hotel, The Westin St. Francis San Francisco on Union Square, for any rates call. The sample stay is 9 to 12 February 2027, for two adults and a child of 7. | The request is still checked. A malformed date or a missing field fails just as it would with a live key, so test mode catches request bugs. The saved flight search is a round trip, so its results have two directions even when you ask for a one-way trip. ## How to tell which mode answered [#how-to-tell-which-mode-answered] Every answer says so in `meta.mode`: ```json { "data": { }, "meta": { "request_id": "req_41ab9c", "mode": "test" } } ``` `mode` is `test` for a test key and `live` for a live key. ## What is the same, and what isn't [#what-is-the-same-and-what-isnt] - **The same:** request validation, the response shapes, errors, headers, and paging through results. - **Not the same:** the prices and places are samples, and don't change with your request. Don't show test results to travellers. - **Separate:** test and live calls are counted separately against your limits, and have their own searches. A `search_id` from a test key can't be read with a live key. Test calls still count against your limits, apart from live ones. Check them with each product's usage endpoint: [flights](/api-reference/flights/usage) and [hotels](/api-reference/hotels/usage). # Build with AI agents (/agents) Ready-made tool definitions for each API, guides written for models, and an MCP server that lets an agent read these docs. Both APIs were designed for agents as well as apps. Answers are small by default, and every error says whether to retry. Each API publishes the files a model needs to use it, and these docs can be read by an agent too. ## Give a model the tools [#give-a-model-the-tools] Each API serves tool definitions, one for each call your key can make. Hand them to a model and run the calls it asks for with your key. | API | Tool definitions | Tools | | --- | --- | --- | | Flights Search API | `https://api.voyagelabs.ai/v1/tools.json` | `search_flights`, `get_search_results` | | Hotels Search API | `https://api.voyagelabs.ai/v1/hotels/tools.json` | `search_hotels`, `get_hotel_search`, `get_hotel_rates` | Add `?format=anthropic` or `?format=openai` to get each provider's own tool shape: ```bash curl "https://api.voyagelabs.ai/v1/tools.json?format=anthropic" ``` The schemas carry limits such as `minimum`, `maximum` and `maxLength`. A provider's strict mode may not accept those keywords. If it doesn't, strip them: the API still checks every input. These files need no key. Your key goes only on the calls themselves, which your code makes. ## Give a model the guide [#give-a-model-the-guide] Each API also has a short description and a full guide written for a model: the whole loop of search, wait, narrow down and show a result, and what to do after each error. | API | Summary | Full guide | OpenAPI document | | --- | --- | --- | --- | | Flights Search API | `/llms.txt` | `/llms-full.txt` | `/v1/openapi.json` | | Hotels Search API | `/v1/hotels/llms.txt` | `/v1/hotels/llms-full.txt` | `/v1/hotels/openapi.json` | All of these are on `https://api.voyagelabs.ai` and need no key. Put the full guide in your agent's system prompt, or let the agent fetch it. ## Rules your agent must follow [#rules-your-agent-must-follow] The guides spell these out. They matter enough to repeat here: - **Show a link exactly as given.** Never build, edit or shorten a booking link. - **Check the age of a price.** Both APIs say how old their prices are, in `pricing.age_s`. When it is over 240 for flights, or over 900 for hotels, search again before showing a price or a link. Reading a search again never refreshes its prices. - **Say that the price can change.** The airline or hotel site shows its own price, which can differ from the one in the answer. - **Follow `error.retry`.** `never` means change the request or stop. `now` means try again. `after` means wait `error.retry_after_s` seconds first. - **Don't search again while a search runs.** A flight search whose `status` is `partial`, or a hotel search whose `status` is `running`, is still filling in. Read it again by its `search_id`. ## Let an agent read these docs [#let-an-agent-read-these-docs] These docs are published in forms an agent can read directly. - **Any page as Markdown.** Add `.md` to its address, as in [`/quickstart.md`](/quickstart.md). A request that sends `Accept: text/markdown` gets Markdown at the normal address. - **An index, and everything at once.** [`/llms.txt`](/llms.txt) lists every page. [`/llms-full.txt`](/llms-full.txt) is the whole site in one file. - **The OpenAPI documents** as shown in the reference: [`/openapi/flights.json`](/openapi/flights.json) and [`/openapi/hotels.json`](/openapi/hotels.json). ### Docs MCP server [#docs-mcp-server] `https://docs.voyagelabs.ai/mcp` is an MCP server, over Streamable HTTP, with three tools: - `list_pages` lists every page. - `search` searches the docs. - `get_page` reads a page as Markdown. It needs no key. It reads the docs only, and never calls the APIs they describe. ```bash claude mcp add --transport http voyage-labs-docs https://docs.voyagelabs.ai/mcp ``` ```json title=".cursor/mcp.json" { "mcpServers": { "voyage-labs-docs": { "url": "https://docs.voyagelabs.ai/mcp" } } } ``` In the agent panel, open the **…** menu, then **MCP Servers**, **Manage MCP Servers** and **View raw config**. Add the server to the file: ```json title="~/.gemini/config/mcp_config.json" { "mcpServers": { "voyage-labs-docs": { "serverUrl": "https://docs.voyagelabs.ai/mcp" } } } ``` Add a remote MCP server with the address `https://docs.voyagelabs.ai/mcp` and the Streamable HTTP transport. It needs no authentication. # How flight search works (/flights) The model behind the Flights Search API. How a search is created and read as it fills in, what a result holds, and which endpoint to call. The Flights Search API searches one trip and answers with priced itineraries. Each itinerary carries links that open the airline's own site or Google Flights on those flights, so the traveller books there. The API never books, holds a seat or takes payment. ## A search fills in over time [#a-search-fills-in-over-time] You start a search with `GET /v1/flights/search` (or `POST` with a JSON body). The answer names the search with a `search_id` and says how far it has got in `status`: | `status` | What it means | | --- | --- | | `complete` | Every itinerary has arrived. The list will not change. | | `partial` | Itineraries are still arriving. The ones you have are real and usable, but the cheapest may not be among them yet. | A partial answer is still HTTP `200`. To get the rest, read the same search again with `GET /v1/flights/search/{search_id}`. That never starts another search. A search that fails ends with an error instead of a status: `supplier_timeout` or `supplier_error`. Once that happens, search the trip again. How long a search takes depends on whether the trip was searched recently: - **A trip searched in the last few minutes answers at once**, from the stored search. - **A new trip starts a search with the supplier.** Itineraries arrive as the supplier finds them, most within the first 5 to 15 seconds. The supplier's closing answer can take about 30 seconds on a large route. The supplier is given 45 seconds in all. - **By default, a search waits for the complete answer, up to 30 seconds.** Ask for `response_mode=partial` (or send a `wait_ms`) to get what has arrived sooner, then read the rest by `search_id`. [Read a search](/flights/read-a-search) shows the loop. Searches are stored by trip: the route, the dates, the number of travellers, the cabin and the currency. Asking for the same trip again while its stored answer is fresh returns that stored search, however you sort or filter it. ### How fresh a price is [#how-fresh-a-price-is] Every answer says how old its prices are, in `data.pricing`: | Field | What it is | | --- | --- | | `priced_at` | When the supplier priced this answer, in UTC | | `age_s` | How many seconds ago that was | | `refreshing` | `true` when the answer came from a stored search and a new search is running behind it | A stored answer under 4 minutes old is served as it is. One up to 30 minutes old is served at once and searched again behind the reply. An older one is searched again before the reply. Reading a search by its `search_id` never refreshes it, so its `age_s` keeps growing. A supplier's fares run out about five minutes after a search. When `age_s` is over 240, search the trip again before you show a price or a booking link. ## What one result holds [#what-one-result-holds] Each entry in `data.results` is one itinerary: the same flights in each direction, at the cheapest fare found for them. | Field | What it holds | | --- | --- | | `id` | Names these flights on this trip. The same flights on the same trip always get the same `id`, in every answer and every later search. | | `airlines` | The airlines selling the flights, in flying order, with `code` and `name`. | | `price` | The cheapest fare: `total` for all travellers, `per_adult`, and the `currency` you asked for. Prices are numbers with at most two decimals. | | `stops`, `total_duration_min` | The most stops in any direction, and each direction's minutes from departure to arrival, added together. | | `slices` | One per direction. `depart` and `arrive` are local to each airport, as the airline prints them. `depart_utc` and `arrive_utc` are the same moments in UTC. `flights` lists the flight numbers in flying order. | | `fare` | What the cheapest fare includes: its `family` name, the `cabins` it flies in, whether it is `refundable` or `changeable`, whether a carry-on or checked bag is included, and `seats_left` at that price. | | `booking_links` | Where to send the traveller to book. See [Send travellers to book](/flights/booking-links). | The same itinerary can be sold at several fares. In the default `detail=summary`, a result shows only the cheapest, in `fare`. With `detail=full` it shows up to 10 fares in `fares`, cheapest first, each with its base fare, taxes, bag allowances and conditions. Full detail also adds every flight segment, layovers, aircraft and airline logos. Suppliers fill in some details for some airlines and not for others. A detail the supplier did not give is `null`, which means "not known", not "no". ## Live and test keys [#live-and-test-keys] A live key searches live prices. A test key is answered from saved sample data: one round trip from San Francisco to Tokyo Narita, 9 to 16 February 2027, whatever trip you ask for. It costs nothing and gives the same answer every time, so build against it first. Test and live keys keep separate searches. Every answer says which kind of key was used, in `meta.mode` (`live` or `test`). See [Test mode](/test-mode). ## Which endpoint to use [#which-endpoint-to-use] | You want to | Call | | --- | --- | | Search a trip | [`GET /v1/flights/search`](/api-reference/flights/search) | | Search a trip, with the fields in a JSON body | [`POST /v1/flights/search`](/api-reference/flights/search-with-a-body) | | Get the rest of a partial search, sort, filter or page it, or read one result in full | [`GET /v1/flights/search/{search_id}`](/api-reference/flights/read-a-search) | | See your key's limits and how much of them is used | [`GET /v1/flights/usage`](/api-reference/flights/usage) | | Show an airline's logo | [`GET /logos/{code}.png`](/api-reference/flights/airline-logo) | | Send a traveller to book | Open a `booking_links` address in the traveller's browser | The API searches one-way and round trips. It does not search multi-city trips. # Search flights (/flights/search) Name a trip with GET or POST, choose how long to wait, and shape the answer. With a full example and a real response. A search names one trip and answers with priced itineraries. You choose how long the call waits, and how the answer is filtered, sorted and trimmed. ## Make a search [#make-a-search] `GET /v1/flights/search` is the main form: a search changes nothing, so the whole request fits in a URL. This one asks for a round trip for two adults and one result. ```bash curl -sS "https://api.voyagelabs.ai/v1/flights/search?origin=SFO&destination=NRT&depart_date=2027-02-09&return_date=2027-02-16&adults=2&limit=1" \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" ``` ```js title="search.mjs" const params = new URLSearchParams({ origin: "SFO", destination: "NRT", depart_date: "2027-02-09", return_date: "2027-02-16", adults: "2", limit: "1", }); const response = await fetch( `https://api.voyagelabs.ai/v1/flights/search?${params}`, { headers: { "X-API-Key": process.env.VOYAGE_LABS_API_KEY } }, ); const body = await response.json(); if (body.error) { throw new Error(`${body.error.code}: ${body.error.message}`); } console.log(body.data.status, body.data.counts.found, "itineraries found"); ``` ```python title="search.py" import os import requests response = requests.get( "https://api.voyagelabs.ai/v1/flights/search", params={ "origin": "SFO", "destination": "NRT", "depart_date": "2027-02-09", "return_date": "2027-02-16", "adults": 2, "limit": 1, }, headers={"X-API-Key": os.environ["VOYAGE_LABS_API_KEY"]}, timeout=40, ) body = response.json() if "error" in body: raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}") print(body["data"]["status"], body["data"]["counts"]["found"], "itineraries found") ``` By default the call waits for the complete answer, for up to 30 seconds, so give your HTTP client a timeout longer than that. The Python example uses 40 seconds. This is the answer to that request, made with a test key. The link tokens are shortened here; real ones are much longer. ```json title="Response" { "data": { "search_id": "srch_17a3c431-779c-4a88-9ebf-5f4b1eee0736", "status": "complete", "query": { "origin": "SFO", "destination": "NRT", "depart_date": "2027-02-09", "return_date": "2027-02-16", "adults": 2, "children": 0, "infants": 0, "cabin": "economy", "currency": "USD" }, "pricing": { "priced_at": "2026-12-06T20:46:06.727Z", "age_s": 0, "refreshing": false }, "counts": { "found": 6, "matched": 6, "returned": 1 }, "next_cursor": "c_eyJvIjoxLCJzIjoiMTdhM2M0MzEtNzc5Yy00YTg4LTllYmYtNWY0YjFlZWUwNzM2IiwidiI6ImJlc3R8fCJ9", "airlines": [ { "code": "ZG", "name": "ZIPAIR", "results": 1, "from": 1445.02, "best_link": "itinerary" }, { "code": "UA", "name": "United", "results": 1, "from": 2792.18, "best_link": "itinerary" }, { "code": "JL", "name": "JAL", "results": 2, "from": 2808.18, "best_link": "itinerary" }, { "code": "NH", "name": "ANA", "results": 1, "from": 2823.38, "best_link": "flights_selected" }, { "code": "AS", "name": "Alaska", "results": 1, "from": 2920.18, "best_link": "itinerary" } ], "results": [ { "id": "it_U0ZPLk5SVC4yMDI3MDIwOS4yMDI3MDIxNi4yLjAuMC5ZLlVTRHxaRzI1QDAyMDksWkcyNkAwMjE2", "airlines": [{ "code": "ZG", "name": "ZIPAIR" }], "price": { "total": 1445.02, "per_adult": 722.51, "currency": "USD" }, "stops": 0, "total_duration_min": 1230, "slices": [ { "direction": "outbound", "origin": "SFO", "destination": "NRT", "depart": "2027-02-09T15:45:00", "depart_utc": "2027-02-09T23:45:00Z", "arrive": "2027-02-10T19:55:00", "arrive_utc": "2027-02-10T10:55:00Z", "duration_min": 670, "stops": 0, "flights": ["ZG25"] }, { "direction": "return", "origin": "NRT", "destination": "SFO", "depart": "2027-02-16T21:25:00", "depart_utc": "2027-02-16T12:25:00Z", "arrive": "2027-02-16T13:45:00", "arrive_utc": "2027-02-16T21:45:00Z", "duration_min": 560, "stops": 0, "flights": ["ZG26"] } ], "fare": { "family": "STANDARD", "cabins": ["Economy"], "refundable": true, "changeable": false, "carry_on_included": true, "checked_bag_included": false, "seats_left": 6 }, "booking_links": { "supplier": { "url": null, "available": false, "lands_on": null }, "airline": { "url": "https://api.voyagelabs.ai/r/al_sE0Iy5Op1B…", "available": true, "lands_on": "booking_page", "airline": "ZG" }, "google_flights": { "url": "https://api.voyagelabs.ai/r/al_-v1RAtbiIi…", "available": true, "lands_on": "itinerary" } } } ] }, "meta": { "request_id": "req_4252794c71f0", "mode": "test" } } ``` `counts.found` is every itinerary in the search, `matched` is what is left after your filters, and `returned` is how many are in this response. `next_cursor` fetches the next page. [How flight search works](/flights#what-one-result-holds) explains each field of a result. ## The trip [#the-trip] These fields name the trip. They decide which stored search answers the request. A trip is one-way or a round trip. Multi-city trips are not supported: a trip with more than one destination is refused with `invalid_parameter`. Travellers are counted, not described: the API takes no ages or names. ## Shape the answer [#shape-the-answer] These fields filter, sort and trim the answer for this one response. `data.airlines` always lists every airline in the whole search, cheapest first, so you can offer airline filters without guessing codes. ## Fields that start a supplier search, and fields that do not [#fields-that-start-a-supplier-search-and-fields-that-do-not] The trip fields decide which stored search answers. The shape fields never cause a supplier search. In detail: - **The same trip fields reach the same stored search.** While its answer is fresh, every request for that trip is answered from it, whatever its `sort`, `max_stops`, `airlines`, `limit` or `detail`. A `GET` and a `POST` for the same trip reach the same search. - **A trip with no fresh stored answer starts a supplier search.** A stored answer under 4 minutes old is used as it is. One up to 30 minutes old is used at once and searched again behind the reply, with `pricing.refreshing` set to `true`. An older one is searched again first. - **Shape fields only reshape the stored answer.** Changing them filters, sorts and trims the same itineraries again. It never asks the supplier for more. - **`max_age_s` can start a supplier search.** It sets the oldest price you accept, in seconds (0 to 86,400). A stored answer older than that is searched again before the reply; `max_age_s=0` always searches again. If no new search can start just then, the request is refused with `search_capacity` rather than answered with older prices. - **`wait_ms` and `response_mode` change only when you are answered**, never what is searched. See the next section. Every call to `GET` or `POST /v1/flights/search` without a `cursor` counts toward your key's new-trips limit, even when it is answered from a stored search. To sort, filter, page or read one result again, use [`GET /v1/flights/search/{search_id}`](/flights/read-a-search), which counts only toward your requests. See [Rate limits and usage](/rate-limits). ## Choose how long to wait [#choose-how-long-to-wait] | `response_mode` | What you get | | --- | --- | | `complete` (default) | One JSON answer when the search is complete, or after 30 seconds with what has arrived, whichever comes first. | | `partial` | One JSON answer when the search is complete, or after `wait_ms` with what has arrived, whichever comes first. Without a `wait_ms`, that is 8 seconds. | | `stream` | Server-sent events, as itineraries arrive. | `wait_ms` (0 to 30,000 milliseconds) answers with whatever has arrived by then, even when you leave `response_mode` out. A search that is still running when you are answered carries on, and the answer has `status` `partial`, possibly with no results yet. Read the rest by `search_id`, as [Read a search](/flights/read-a-search) shows. A trip searched recently answers at once in every mode. To stream, send `response_mode=stream`, `stream=1` or the header `Accept: text/event-stream`. Each `results` event carries the whole answer so far, shaped by your filters, sort and limit, so keep only the latest. The stream ends with one `complete` event or one `error` event, and sends a comment line every 15 seconds to keep the connection open. A request refused before the search starts, such as one with a bad field or a bad key, is answered as plain JSON, not as a stream. ## Search with a JSON body [#search-with-a-json-body] `POST /v1/flights/search` takes the same fields as a JSON object of up to 16 KB. It returns the same answer as the `GET` form. ```json title="A round trip, with flat fields" { "origin": "SFO", "destination": "NRT", "depart_date": "2027-02-09", "return_date": "2027-02-16", "adults": 2 } ``` A body can also name the trip as `legs`, one entry per direction: one leg for a one-way trip, or two that return to the start for a round trip. A mistake inside a leg is reported with the leg's own name, such as `legs[1].date`. Traveller counts can also go in a `passengers` object. ```json title="The same trip, with legs" { "legs": [ { "origin": "SFO", "destination": "NRT", "date": "2027-02-09" }, { "origin": "NRT", "destination": "SFO", "date": "2027-02-16" } ], "passengers": { "adults": 2 } } ``` ```bash curl -sS "https://api.voyagelabs.ai/v1/flights/search" \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"origin":"SFO","destination":"NRT","depart_date":"2027-02-09","return_date":"2027-02-16","adults":2,"limit":1}' ``` ```js title="search-body.mjs" const response = await fetch("https://api.voyagelabs.ai/v1/flights/search", { method: "POST", headers: { "X-API-Key": process.env.VOYAGE_LABS_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ origin: "SFO", destination: "NRT", depart_date: "2027-02-09", return_date: "2027-02-16", adults: 2, limit: 1, }), }); const body = await response.json(); console.log(body.data?.search_id ?? body.error); ``` ```python title="search_body.py" import os import requests response = requests.post( "https://api.voyagelabs.ai/v1/flights/search", json={ "origin": "SFO", "destination": "NRT", "depart_date": "2027-02-09", "return_date": "2027-02-16", "adults": 2, "limit": 1, }, headers={"X-API-Key": os.environ["VOYAGE_LABS_API_KEY"]}, timeout=40, ) body = response.json() print(body["data"]["search_id"] if "data" in body else body["error"]) ``` A body that is not a JSON object, or is over 16 KB, is refused with `invalid_body`. ## When a search is refused [#when-a-search-is-refused] A field that is missing, malformed or out of range is refused with HTTP `400` and `invalid_parameter`. `param` names the field, and `message` says what is allowed. ```json title="Response: origin left out" { "error": { "code": "invalid_parameter", "message": "origin must be a 3-letter airport code such as SFO.", "param": "origin", "retry": "never", "request_id": "req_b5737a1edf58" } } ``` Branch on `error.code`, never on the wording of `message`. [Errors](/errors) lists every code and what to do about it. # Read a search (/flights/read-a-search) Wait for a partial search to finish, then sort, filter, page or read one result in full, all without starting another search. Every search has a `search_id`. Read it again with `GET /v1/flights/search/{search_id}` to get the rest of a partial search, to sort, filter or page it differently, or to read one result in full. Reading a search never starts a supplier search, and it counts only toward your key's requests, not its new trips. ## What a read takes [#what-a-read-takes] A read takes only the fields that shape the answer. The trip is already fixed by the search. A key reads only searches made in its own mode: a test key cannot read a live key's search, and a live key cannot read a test key's. ## Wait for a partial search [#wait-for-a-partial-search] While a search runs, its answers have `status` `partial` and a `retry_after_ms` hint: how many milliseconds to wait before you ask again. This is part of a real partial answer: ```json title="Partial answer (excerpt)" { "search_id": "srch_2795d01a-c7bf-4851-afd8-438ab774b547", "status": "partial", "retry_after_ms": 2000, "counts": { "found": 2, "matched": 2, "returned": 2 }, "next_cursor": null } ``` There are two ways to wait for the rest: - **Let the read wait.** Send `wait_ms`, up to 30,000. The read answers as soon as the search is complete, or when the wait runs out with what has arrived. This is the simplest loop, and the one below. - **Read at once, then pause.** Leave `wait_ms` out, and wait `retry_after_ms` before each read. Read with a `wait_ms` of 10,000, the same search answered complete with all six itineraries: ```json title="The same search, read again (excerpt)" { "search_id": "srch_2795d01a-c7bf-4851-afd8-438ab774b547", "status": "complete", "counts": { "found": 6, "matched": 6, "returned": 2 }, "next_cursor": "c_eyJvIjoyLCJzIjoiMjc5NWQwMWEtYzdiZi00ODUxLWFmZDgtNDM4YWI3NzRiNTQ3IiwidiI6ImJlc3R8fCJ9" } ``` While a search is partial, you can show its results as "so far": they are real fares. Its `counts` and `airlines` are also "so far". Most itineraries arrive within the first 5 to 15 seconds, and a large route can take about 30 seconds to complete. The supplier is given 45 seconds; a search still running after that ends with `supplier_timeout`. A test key replays its saved sample in well under a second, so its searches are usually complete before you read them. To see a partial answer with a test key, search with `response_mode=partial&wait_ms=0`. ## A polling loop [#a-polling-loop] This loop starts a search, then reads it until it is complete. It stops on the first error, and after a minute of its own. ```bash title="poll.sh" # Needs jq. SEARCH_ID is data.search_id from your search. BASE="https://api.voyagelabs.ai" SEARCH_ID="srch_2795d01a-c7bf-4851-afd8-438ab774b547" # Up to six reads, each waiting up to 10 seconds. for attempt in 1 2 3 4 5 6; do body=$(curl -sS "$BASE/v1/flights/search/$SEARCH_ID?wait_ms=10000" \ -H "X-API-Key: $VOYAGE_LABS_API_KEY") status=$(printf '%s' "$body" | jq -r '.data.status // .error.code') echo "$status" [ "$status" = "partial" ] || break done ``` ```js title="poll.mjs" const BASE = "https://api.voyagelabs.ai"; const headers = { "X-API-Key": process.env.VOYAGE_LABS_API_KEY }; async function get(path) { const response = await fetch(`${BASE}${path}`, { headers }); return response.json(); } // Start the search, and take what has arrived within 8 seconds. const trip = new URLSearchParams({ origin: "SFO", destination: "NRT", depart_date: "2027-02-09", return_date: "2027-02-16", adults: "2", response_mode: "partial", }); let body = await get(`/v1/flights/search?${trip}`); // Read the same search until it is complete, fails, or a minute has passed. const deadline = Date.now() + 60_000; while (body.data?.status === "partial" && Date.now() < deadline) { const id = encodeURIComponent(body.data.search_id); body = await get(`/v1/flights/search/${id}?wait_ms=10000`); } if (body.error) { // supplier_timeout, supplier_error or search_not_found: search the trip again. console.error(body.error.code, body.error.message); } else { // complete, or still partial at the deadline: show what there is. console.log(body.data.status, body.data.counts.found, "itineraries"); } ``` ```python title="poll.py" import os import time import requests BASE = "https://api.voyagelabs.ai" HEADERS = {"X-API-Key": os.environ["VOYAGE_LABS_API_KEY"]} def get(path, params): response = requests.get(BASE + path, params=params, headers=HEADERS, timeout=40) return response.json() # Start the search, and take what has arrived within 8 seconds. body = get( "/v1/flights/search", { "origin": "SFO", "destination": "NRT", "depart_date": "2027-02-09", "return_date": "2027-02-16", "adults": 2, "response_mode": "partial", }, ) # Read the same search until it is complete, fails, or a minute has passed. deadline = time.monotonic() + 60 while "data" in body and body["data"]["status"] == "partial" and time.monotonic() < deadline: search_id = body["data"]["search_id"] body = get(f"/v1/flights/search/{search_id}", {"wait_ms": 10000}) if "error" in body: # supplier_timeout, supplier_error or search_not_found: search the trip again. print(body["error"]["code"], body["error"]["message"]) else: # complete, or still partial at the deadline: show what there is. print(body["data"]["status"], body["data"]["counts"]["found"], "itineraries") ``` ### When to stop [#when-to-stop] | The read answers | Do this | | --- | --- | | `status` `complete` | Stop. The list will not change. | | `supplier_timeout` or `supplier_error` | Stop. That search is over, and reading it again gives the same error. Search the trip again. | | `search_not_found` | Stop. The search is no longer kept. Search the trip again. | | `search_capacity` | Wait `error.retry_after_s` seconds, then search the trip again. | | `rate_limited` | Wait `error.retry_after_s` seconds, then read again. | | `status` `partial` past your own deadline | Stop, and show what you have as "so far". | Calling `GET /v1/flights/search` again for the same trip answers from the same running search, but it counts toward your new-trips limit each time. Read the `search_id` instead. ## Sort, filter and page [#sort-filter-and-page] Once a search is complete, read it with any `sort`, `max_stops`, `airlines` and `limit`. Each read reshapes the same stored itineraries, so you can offer "cheapest", "fastest" and "nonstop only" views without searching again. ```bash title="Two pages, cheapest first" curl -sS "https://api.voyagelabs.ai/v1/flights/search/srch_2795d01a-c7bf-4851-afd8-438ab774b547?sort=price&limit=2" \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" # Then pass that answer's data.next_cursor as cursor, with the same sort. curl -sS "https://api.voyagelabs.ai/v1/flights/search/srch_2795d01a-c7bf-4851-afd8-438ab774b547?sort=price&limit=2&cursor=c_eyJvIjoyLCJzIjoiMjc5NWQwMWEtYzdiZi00ODUxLWFmZDgtNDM4YWI3NzRiNTQ3IiwidiI6InByaWNlfHwifQ" \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" ``` - **A cursor belongs to one search, sort and set of filters.** Send it with the same `sort`, `max_stops` and `airlines` as the page it came from. Sent with any others, it is refused with `invalid_parameter` on `cursor`. - **`next_cursor` is `null` on the last page.** - **Page only a complete search.** While a search is partial the list is still changing: a page can repeat or miss itineraries, and `next_cursor` can be `null` although more are coming. ## Read one result in full [#read-one-result-in-full] To show the itinerary a traveller picked, read it with `itinerary_id` set to that result's `id`, exactly as given, and `detail=full`. The answer holds just that result, wherever it would sort or page, with every flight segment, layover and up to `fares` fares (3 unless set, 10 at most). ```bash curl -sS "https://api.voyagelabs.ai/v1/flights/search/srch_2795d01a-c7bf-4851-afd8-438ab774b547?itinerary_id=it_U0ZPLk5SVC4yMDI3MDIwOS4yMDI3MDIxNi4yLjAuMC5ZLlVTRHxaRzI1QDAyMDksWkcyNkAwMjE2&detail=full&fares=3" \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" ``` - **Send no `cursor` with it.** One result is not a page, so `cursor` is refused. `max_stops` and `airlines` still apply, so leave them out too. - **An `id` the search does not hold answers `200` with no results**, not an error. Search the trip again and read the new `search_id` with the same `itinerary_id`, waiting while it is partial: the same flights on the same trip always get the same `id`. Only an empty answer from a complete search means those flights are no longer offered. ## How long a search is kept [#how-long-a-search-is-kept] A search is kept for at least 30 minutes. After that, reading it answers `404` with `search_not_found`: search the trip again. Reading a search never refreshes its prices: its `pricing.age_s` keeps growing. Before you show a price or a booking link that is more than 240 seconds old, search the trip again and read the chosen result from the new search by its `itinerary_id`. # Send travellers to book (/flights/booking-links) What the booking links in each result open, how long they last, what to tell the traveller, and how to show airline logos. Every result carries `booking_links`: up to three addresses that open a page where the traveller can book those flights. You show the links; the traveller's browser opens them. The API itself never books, holds a seat or takes payment. ## The three links [#the-three-links] This is the `booking_links` object of a real ANA result, from a test key. The link tokens are shortened here. ```json title="booking_links" { "supplier": { "url": null, "available": false, "lands_on": null }, "airline": { "url": "https://api.voyagelabs.ai/r/al_Mr3J-vqIKt…", "available": true, "lands_on": "flights_selected", "airline": "NH" }, "google_flights": { "url": "https://api.voyagelabs.ai/r/al_2CUD6SgBEd…", "available": true, "lands_on": "itinerary" } } ``` | Slot | Opens | | --- | --- | | `airline` | The airline's own site. `airline` is the code of the airline it opens. | | `google_flights` | Google Flights, on exactly these flights. | | `supplier` | Reserved for a checkout where the traveller books and pays. It is not offered yet, so today its `available` is always `false`. | All three slots are always present. Use a slot only when its `available` is `true`. When it is `false`, its `url` and `lands_on` are `null`. ## Where each link lands [#where-each-link-lands] `lands_on` says where the traveller arrives. Tell them before they click, so the page they see is the page they expect. It also says how close each link gets to the flights, which helps you choose which link to show first. | `lands_on` | The traveller arrives at | Say something like | | --- | --- | --- | | `cart` | The airline's cart, with the flights and fare chosen | "This opens the airline's site with your flights in the cart." | | `passenger_details` | The airline's passenger page, with the flights and fare chosen | "This opens the airline's site, ready for your passenger details." | | `flights_selected` | The airline's results, with these flights already selected | "This opens the airline's site with these flights selected." | | `search_results` | The airline's results for the route and dates, with nothing selected | "This opens the airline's results for your dates. Pick these flights there." | | `booking_page` | The airline's own booking page, with nothing filled in | "This opens the airline's booking page. Search for these flights there." | | `itinerary` | Google Flights, on exactly these flights | "This opens Google Flights on these exact flights, where you can choose who to book with." | The first five come from the `airline` slot, and `itinerary` from `google_flights`. ## Coverage by airline [#coverage-by-airline] The closest each airline's own link gets to the chosen flights, and the trips it works for. Every flight also has a Google Flights link to exactly those flights. We checked each airline by hand on 1 December 2026, and Frontier again on 5 December. | Airline | Its link lands on | Works for | Good to know | | --- | --- | --- | --- | | American Airlines (`AA`) | `passenger_details` | Round trip, one-way and connections, on any fare | Adults only. Trips with children or infants open on Google Flights. | | Air Canada (`AC`) | `cart` | Round trip, one-way and connections, on Standard, Flex and Comfort fares | The fare must carry its brand name. | | Alaska Airlines (`AS`) | `cart` | Round trip, one-way and connections, on Saver, Main and First fares | Refundable Main opens on Google Flights. | | Delta Air Lines (`DL`) | `cart` | Round trip, one-way and connections, on Main and Comfort fares | Adults only. Other cabins open on Google Flights. | | ANA (`NH`) | `flights_selected` | The cheapest fare on a nonstop, round trip or one-way | Opens through a short page on `api.voyagelabs.ai` first. | | Japan Airlines (`JL`) | `flights_selected` | Economy Special Saver, US to Japan | Opens on Google Flights when JAL's selection page is unavailable. | | Korean Air (`KE`) | `flights_selected` | Nonstop economy round trips for adults | One-way trips, connections and premium cabins open on Google Flights. | | Virgin Atlantic (`VS`) | `cart` | Nonstop Economy Light round trips for adults | Other fares open on Google Flights. | | United Airlines (`UA`) | Google Flights | The exact flights on Google Flights, and United's results page | United's cart can't be opened from a link. | | JetBlue (`B6`) | Google Flights | The exact flights on Google Flights, and JetBlue's results page | JetBlue's own links need a partner agreement. | | Lufthansa (`LH`) | Google Flights | The exact flights on Google Flights, and Lufthansa's results page | Lufthansa's own links need a partner agreement. | | British Airways (`BA`) | Google Flights | The exact flights on Google Flights | Not confirmed: the airline's link didn't finish loading when we checked it. | | Singapore Airlines (`SQ`) | Google Flights | The exact flights on Google Flights | A link to the airline's cart needs a partner agreement. | | ZIPAIR (`ZG`) | Google Flights | The exact flights on Google Flights | The airline only accepts links to a search. | | Air France (`AF`) | Google Flights | The exact flights on Google Flights, and Air France's results page | Google Flights is the main link. | | Frontier Airlines (`F9`) | Google Flights | The exact flights on Google Flights, and Frontier's results page for adults | Trips with children or lap infants open Frontier's booking page, because its search needs each child's age. | | Emirates (`EK`) | Google Flights | The exact flights on Google Flights, and Emirates' flight list | The airline's link opens a flight list, not the chosen fare. | Whatever this table says, each result's own `lands_on` is the answer for that result. ## How a link works [#how-a-link-works] - **Every `url` is an address on `https://api.voyagelabs.ai/r/`.** Its token is encrypted: nothing in the address says where it leads, who you are or what the trip is. - **The traveller's browser opens it, with no key.** The address answers with a redirect to the airline or Google Flights. Some airline links first pass through a short page on the same host that opens the airline's site with the flights selected. - **Give it to the traveller exactly as it is.** Never build, edit, shorten or re-encode one. A link with a changed token answers `403` with `forbidden`. - **Each answer carries new addresses**, even for the same search read twice. Any of them works until it expires. - **Some airlines ask who sent the traveller.** Set a link label of 1 to 16 capital letters or digits in **Settings** in the [console](https://developer.voyagelabs.ai/console/settings), and it is sent with those airlines' links. - **A link can be opened again.** Every open is sent on. Opens of one link from the same network address within the same fixed half-hour in UTC (from :00 to :30, or from :30 to the hour) count as one click. Opens from another address, such as a server that fetches link previews, count as clicks of their own. ## How long a link lasts [#how-long-a-link-lasts] A link stops working 24 hours after the answer that carried it, unless your account is set up otherwise. An expired link answers `410` with the error code `gone`. For an older conversation, search the trip again and use the new link of the result with the same `id`. A link lasts a day, but a supplier's fares run out about five minutes after a search. When a result's `pricing.age_s` is over 240, search the trip again before you show its price or its link. ## What to tell the traveller [#what-to-tell-the-traveller] - **Where the link lands**, from the table above. - **That the airline shows the final price.** The price on the airline's page is the airline's own, and it can differ from the price in the answer. Say so rather than promise a price. - **Nothing is booked yet.** The traveller books on the page the link opens. If an AI agent shows the links, hand it each `url` as data and tell it never to change one. [Build with AI agents](/agents) covers the rest. ## Show airline logos [#show-airline-logos] Each airline has a logo at `https://api.voyagelabs.ai/logos/{code}.png`, where `{code}` is its 2-character code in capitals, such as `NH`. The address needs no key, so a page can use it straight in an image: ```html ANA ``` - **With `detail=full`, the addresses are in the answer.** Each entry of `data.airlines` and of a result's `airlines` has a `logo`, and each flight segment has a `marketing_logo` and an `operating_logo`. A `logo` of `null` means there is none. - **Keep the image for a day.** It is small, and its `Cache-Control` header is `public, max-age=86400`. Its `Content-Type` says whether it is a PNG, JPEG, WebP or GIF. - **A code with no logo answers `404` with `not_found`.** So does a code that is not two capitals or digits. Show the airline's name instead. - **If the image cannot be fetched just now**, the answer is `502` with `supplier_error`. Try again later. See the [airline logo reference](/api-reference/flights/airline-logo) for the full contract. # How hotel search works (/hotels) Search a place and dates, read the search as it fills in, then fetch one hotel's rooms and rates before you quote a price. The Hotels Search API finds hotels with prices for a place and a stay, and gives each hotel links that open it on travel sites with the dates and guests filled in. It is read-only: it never books, holds or charges. ## The flow [#the-flow] ### Search a place and dates [#search-a-place-and-dates] Send where to look, `check_in`, `check_out` and the guests to `GET /v1/hotels/search`, or send the same fields as a JSON body with `POST`. The answer carries a `search_id` and, once the supplier has answered, the hotels. ### Read the search until it is complete [#read-the-search-until-it-is-complete] If `data.status` is `running`, read the search again by its `search_id`, with `wait_ms` to hold the request until it ends. Reading a search again never runs it again, so it is also how you page through the answer and sort it another way. ### Fetch one hotel's rooms and rates [#fetch-one-hotels-rooms-and-rates] A search carries one price per hotel. Before you quote a price or cancellation terms, call `GET /v1/hotels/rates/{hotel_id}` for every room and rate the hotel has for the stay, cheapest first. ### Send the traveller to book [#send-the-traveller-to-book] Show the hotel's `booking_links`. The traveller opens one in their browser and books on that site. ## A search as it fills in [#a-search-as-it-fills-in] Every search has a `search_id`, such as `hs_0a29ce33d3a646fe9660`. Both states below answer with HTTP `200`. | `status` | What it means | What to do | | ---------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | `running` | The supplier has not answered yet. `hotels` is empty, `pricing` is `null`, and `retry_after_ms` is set. | Read the search by `search_id` with `wait_ms`, or again after `retry_after_ms`. | | `complete` | The answer is in. `counts.found` is the number of hotels in the whole answer. | Page through it, sort it, or read one hotel's rates. | A search can also end without an answer. Then the search, and every later read of it, answers with an error instead: `supplier_error` (`502`), `supplier_timeout` (`504`) or `search_capacity` (`503`). That search is over; search again. [Errors](/errors) lists every code. How long things take: - A new search takes about 6 seconds. - The same stay (the same place, dates, guests, currency and nationality) searched in the last 15 minutes answers at once from the stored answer, with the same `search_id`. `max_age_s` sets the oldest stored answer you accept. - A search is kept for 24 hours. After that, reading it answers `search_not_found`. - Reading a search again never refreshes its prices. `pricing.age_s` says how old they are. Past 900 seconds, search again before you quote a price. ## What one result is [#what-one-result-is] Each item in `data.hotels` has three parts: - `hotel`: the hotel's `id` and `name`, and, where known, `stars`, `rating` (guest rating out of 10), `review_count`, `address`, `city`, `country`, `latitude`, `longitude` and `photo`. Every field but `id` and `name` can be `null`. - `offers`: in a search, one offer, the first price the supplier found in time. It is close to the hotel's cheapest and not promised to be it. From [rooms and rates](/hotels/rooms-and-rates), every offer, cheapest first. - `booking_links`: where the stay can be booked, best first. See [Send travellers to book](/hotels/booking-links). An offer is one price for the whole stay: ```json title="One offer" { "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": [] } ``` To tell a traveller what a stay costs, add `due_at_property` to `total`. ## Live and test keys [#live-and-test-keys] A `vl_live_` key searches live prices. A `vl_test_` key costs nothing and never reaches the supplier: every search answers with the same saved San Francisco hotels, whatever place, dates or guests you send, and every rates call answers with one saved hotel, The Westin St. Francis San Francisco on Union Square (`lp19b5e`), whatever `hotel_id` you send. The `query` in the answer and the booking links follow your request. The prices, rooms and guests in the offers come from the sample, a stay of 9 to 12 February 2027 for two adults and a child of 7, so they only add up when you search that stay. `meta.mode` says which kind of key answered. See [Test mode](/test-mode). ## Which endpoint to use [#which-endpoint-to-use] | You want to | Call | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | List hotels for a place and a stay | [`GET /v1/hotels/search`](/api-reference/hotels/search), or [`POST /v1/hotels/search`](/api-reference/hotels/search-with-a-body) with a JSON body | | Wait for a running search, get the next page or sort it another way | [`GET /v1/hotels/search/{search_id}`](/api-reference/hotels/read-a-search) | | See every room and rate of one hotel before you quote a price or its cancellation terms | [`GET /v1/hotels/rates/{hotel_id}`](/api-reference/hotels/rooms-and-rates) | | Check your key's limits and what it has used today | [`GET /v1/hotels/usage`](/api-reference/hotels/usage) | ## Access [#access] A key reaches only the products its partner account has. If your account does not have the Hotels Search API, every hotel call, `/v1/hotels/usage` included, answers `403` with the code `forbidden`: ```json title="403 Forbidden" { "error": { "code": "forbidden", "message": "This request is not permitted by your partner policy or key status.", "retry": "never", "request_id": "req_54f44b10243c" } } ``` The same answer comes back for a revoked or expired key, a suspended account, and a live key on an account that is not yet cleared for live prices. If your account lists the networks its keys may be used from, a request from anywhere else also answers `403` `forbidden`, with a message that says so. ## Next [#next] # Search hotels (/hotels/search) 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 [#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`. ```bash title="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 [#where-to-look] Say where in exactly one way. Sending none, or more than one, answers `400` `invalid_parameter` with `param` set to `place`. | Fields | Meaning | | -------------------------------------------- | ------------------------------------------------------------------------------------ | | `city` and `country` | A city by name, with its 2-letter country code, such as `US` | | `latitude` and `longitude`, with `radius_km` | Hotels around a point. `radius_km` is 0.2 to 50; it is 5 when you leave it out | | `place_id` | A Google place id, such as `ChIJIQBpAG2ahYAR_6128GcTUEo` | | `hotel_ids` | Up 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 [#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 [#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-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 [#sort-and-page] There are no filters by price, stars or amenities: sort and page the answer, and choose from it. | Field | Meaning | Default | | -------- | ------------------------------------------------------------------------------------------------------------------ | ------- | | `sort` | `price`: cheapest first. `rating`: best guest rating first, with unrated hotels last | `price` | | `limit` | Hotels in this response, 1 to 100 | 20 | | `cursor` | The `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](#read-a-search-by-its-id) rather than searching again. ## Waiting and freshness [#waiting-and-freshness] | Field | Meaning | | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `response_mode` | `complete`, 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_ms` | Exactly how long to wait for a running search, 0 to 30000. When you send it, it decides the wait. | | `max_age_s` | The 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](/rate-limits). ## Example [#example] ```bash 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 ``` ```js title="search.mjs" const url = new URL("https://api.voyagelabs.ai/v1/hotels/search"); url.search = new URLSearchParams({ city: "San Francisco", country: "US", check_in: "2027-02-09", check_out: "2027-02-12", adults: "2", child_ages: "7", limit: "1", }).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 { status, counts, hotels } = body.data; console.log(status, counts.found, hotels[0]?.hotel.name); ``` ```python title="search.py" import os import requests response = requests.get( "https://api.voyagelabs.ai/v1/hotels/search", headers={"X-API-Key": os.environ["VOYAGE_LABS_API_KEY"]}, params={ "city": "San Francisco", "country": "US", "check_in": "2027-02-09", "check_out": "2027-02-12", "adults": 2, "child_ages": "7", "limit": 1, }, timeout=40, ) body = response.json() if not response.ok: raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}") data = body["data"] print(data["status"], data["counts"]["found"]) ``` This answer came from a test key, and the booking link tokens are shortened. ```json title="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 [#reading-the-answer] | Field | Meaning | | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `search_id` | Names this search, to read it again. Kept for 24 hours | | `status` | `complete`, or `running` while the supplier has not answered | | `retry_after_ms` | Only while `running`: when to ask again, in milliseconds | | `query` | The 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 | | `pricing` | `priced_at`, when the prices were fetched, and `age_s`, how many seconds ago. `null` while `running` | | `counts` | `found`: hotels in the whole answer. `returned`: hotels on this page | | `next_cursor` | Pass it as `cursor` for the next page. `null` on the last page | | `hotels` | Each hotel with one offer and its booking links. See [What one result is](/hotels#what-one-result-is) | The full field list is in the [API reference](/api-reference/hotels/search). ## Read a search by its id [#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: ```json title="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. ```bash curl --get https://api.voyagelabs.ai/v1/hotels/search/hs_6bd1d8a2db5441a28623 \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" \ -d wait_ms=10000 ``` ```js title="poll.mjs" const BASE = "https://api.voyagelabs.ai"; const headers = { "X-API-Key": process.env.VOYAGE_LABS_API_KEY }; async function get(path, params) { const url = new URL(path, BASE); url.search = new URLSearchParams(params).toString(); const response = await fetch(url, { headers }); const body = await response.json(); if (!response.ok) { // supplier_error, supplier_timeout and search_capacity end the search: // search again rather than reading this one. throw new Error(`${body.error.code}: ${body.error.message}`); } return body.data; } let data = await get("/v1/hotels/search", { city: "San Francisco", country: "US", check_in: "2027-02-10", check_out: "2027-02-12", response_mode: "partial", }); while (data.status === "running") { // Held until the search ends, or for at most 10 seconds. data = await get(`/v1/hotels/search/${data.search_id}`, { wait_ms: "10000" }); } console.log(`${data.counts.found} hotels, priced ${data.pricing.age_s}s ago`); ``` ```python title="poll.py" import os import requests BASE = "https://api.voyagelabs.ai" HEADERS = {"X-API-Key": os.environ["VOYAGE_LABS_API_KEY"]} def get(path, params): response = requests.get(BASE + path, headers=HEADERS, params=params, timeout=40) body = response.json() if not response.ok: # supplier_error, supplier_timeout and search_capacity end the search: # search again rather than reading this one. raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}") return body["data"] data = get("/v1/hotels/search", { "city": "San Francisco", "country": "US", "check_in": "2027-02-10", "check_out": "2027-02-12", "response_mode": "partial", }) while data["status"] == "running": # Held until the search ends, or for at most 10 seconds. data = get(f"/v1/hotels/search/{data['search_id']}", {"wait_ms": 10000}) print(f"{data['counts']['found']} hotels, priced {data['pricing']['age_s']}s ago") ``` `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 [#next] # 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] ```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 ``` ```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}`); } } ``` ```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}") ``` 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" } } ``` 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. ## 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). # Send travellers to book (/hotels/booking-links) Show each hotel's booking links, open them in the traveller's browser, and know what each link promises and how long it lasts. Every hotel in an answer comes with `booking_links`: addresses that open the hotel on a travel site with the dates and guests filled in. The traveller books on that site. The API never books, holds or charges anything. ## What a link looks like [#what-a-link-looks-like] These are the links of one hotel from a search, with their tokens shortened: ```json title="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." } ] ``` | Field | Meaning | | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `site` | Where the link opens: `hotels_com`, `trip_com`, `expedia`, `agoda`, `booking_com` or `google` (Google Hotels) | | `name` | The site's name, to show the traveller | | `url` | The address to open. It lasts 24 hours | | `lands_on` | `property`: the hotel's own page on the site. `pinned_results`: the site's results for the stay, with this hotel first. `search_results`: the site's results for a search by the hotel's name | | `found_by` | `id`: the link carries the site's own id for this hotel, so no other hotel can open. `name`: the site is searched by the hotel's name | | `verified` | `true` when this kind of link was opened in a real browser and did what `lands_on` says | | `checked` | The day this kind of link was last checked in a browser, or `null` | | `note` | What the link cannot promise, in a sentence, or `null` | ## Which links a hotel gets [#which-links-a-hotel-gets] Every hotel has a Google Hotels link and a Booking.com link. A site that the service holds the hotel's own id for also gets a link that opens on that hotel, with `found_by` set to `id`. Links are listed best first: links by id, then Google Hotels, then Booking.com searched by name where there is no Booking.com link by id. Keep that order when you show them. Some links say plainly what they cannot promise: - Google Hotels found by its own id for the hotel opens the hotel and lists each seller's price for the stay. Found by name, it lands on results and is not verified. - For a stay of more than one room, every link is unverified. Its `note` says the site's way of writing rooms has not been opened in a browser yet, except on Google Hotels found by name, which keeps its own note. - A Hotels.com link whose id was worked out from the hotel's own id is not verified, and now and then opens a missing page. ## Open the link in the traveller's browser [#open-the-link-in-the-travellers-browser] A link's `url` is an address on `api.voyagelabs.ai`. It needs no key: the traveller's browser opens it, and the API sends it on to the travel site. ```http title="Opening a link" GET /r/hl_TC02KWLxid5pp5… HTTP/1.1 Host: api.voyagelabs.ai HTTP/1.1 302 Found location: https://www.booking.com/searchresults.html?ss=Motel+6+San+Francisco%2C+CA+%E2%80%93+Civic+Center&checkin=2027-02-09&checkout=2027-02-12&group_adults=2&group_children=1&age=7&no_rooms=1&selected_currency=USD ``` Never build, edit or shorten a link, and never add your key to it. A changed link opens nothing: it answers `403` `forbidden`. Each open is recorded as a click on that link, so open links only for travellers, not from your server to check them. ## How long a link lasts [#how-long-a-link-lasts] A link lasts 24 hours from the answer that carried it. Each answer seals its links afresh, so reading a search again by its `search_id` gives new links, for as long as the search is kept. After 24 hours, opening a link answers `410` `gone` in the traveller's browser instead of the travel site. Don't show a link from an answer more than a day old. Read the search again while it is kept, or search again. ## What to tell the traveller [#what-to-tell-the-traveller] - Which site the link opens, from `name`. - That the site shows its own price, which can differ from the one in your answer. - That they choose the room and rate on the site. No travel site accepts a link that picks them. - Where `lands_on` is `search_results`, that they may need to pick the hotel from the site's results. ## Nothing is booked by the API [#nothing-is-booked-by-the-api] The API is read-only. It never books, holds or charges. The booking, its payment and its confirmation all happen on the travel site, between the traveller and that site. # Conventions (/conventions) Versions, request and response shapes, formats, paging and identifiers, shared by both APIs. Both APIs follow the same rules, so code you write for one carries over to the other. ## Versions [#versions] The version is in the path: `https://api.voyagelabs.ai/v1/...`. - Within `v1`, fields are only ever added. Your code must ignore fields it doesn't know. - A field or endpoint is never removed, or changed in meaning, within `v1`. A change like that means `v2`. `v1` keeps running beside it, and its answers carry a `Sunset` header once an end date is set. - New error codes can be added within `v1`. Handle unknown codes by their `retry` advice. ## Requests [#requests] - Send the key in the `X-API-Key` header. See [Keys and authentication](/authentication). - Search endpoints take either query parameters (`GET`) or a JSON body (`POST`) with `Content-Type: application/json`. A body may be up to 16 KB. - Everything is UTF-8. ## Responses [#responses] Every JSON answer is one of two shapes. A response has `data` or `error`, never both. ```json title="Success" { "data": { }, "meta": { "request_id": "req_41ab9c", "mode": "live" } } ``` ```json title="Failure" { "error": { "code": "search_not_found", "message": "No search with that id. Searches are kept for at least 30 minutes; run the search again.", "retry": "never", "request_id": "req_41ab9c" } } ``` - `meta.request_id` names the request, and is also in the `X-Request-Id` header. - `meta.mode` is `live` or `test`, after the key that made the call. - Finding nothing is a success, with an empty list. - [Errors](/errors) lists every `code`. ## Formats [#formats] | Kind | Format | Example | | --- | --- | --- | | Dates | `YYYY-MM-DD` | `2027-02-09` | | Moments | ISO 8601 in UTC, ending `Z` | `2026-12-02T00:20:11Z` | | Flight times | Local time at the airport, with no offset. A `_utc` twin gives the same moment in UTC. | `"depart": "2027-02-09T10:45:00"`, `"depart_utc": "2027-02-09T18:45:00Z"` | | Money | A number in the currency's main unit, beside a 3-letter `currency` code | `"total": 2823.38, "currency": "USD"` | | Durations | Whole units, named in the field | `duration_min`, `age_s`, `retry_after_s` | | Airports | 3-letter IATA codes | `SFO` | | Airlines | 2-character codes | `NH` | | Countries | 2-letter ISO codes | `US` | ## Identifiers [#identifiers] Ids such as `search_id`, result ids and `request_id` are opaque strings. Store them and pass them back as they are. Never parse them, build them or rely on their length. ## Paging [#paging] Lists come one page at a time: 1. Ask for a page size with `limit`. 2. If the answer's `next_cursor` is not `null`, pass it back as `cursor` to get the next page. 3. When `next_cursor` is `null`, you have the whole list. Page a search once it has finished. While a search is still running, the list can change between pages. ## Prices have an age [#prices-have-an-age] Every search answer says when its prices were found, in `pricing.priced_at`, and how many seconds ago that was, in `pricing.age_s`. Prices go stale as rooms and seats sell. Search again before you show a price once `age_s` is over 240 for flights, or over 900 for hotels. ## Browsers and CORS [#browsers-and-cors] The APIs answer requests from any web origin. Calls with a live key still belong on your server, because a key in a web page is public. See [Keep live keys on your server](/authentication#keep-live-keys-on-your-server). # Errors (/errors) Every failure has a stable code to branch on and says whether to retry. The codes and their HTTP statuses are the same for both APIs. A failed request answers with an `error` object and no `data`: ```json title="Response · 400" { "error": { "code": "invalid_parameter", "message": "origin must be a 3-letter airport code such as SFO.", "param": "origin", "retry": "never", "request_id": "req_41ab9c" } } ``` ## What to do [#what-to-do] One rule covers every code: - **`never`:** the same request will fail again. Change the request, or stop. - **`now`:** an immediate retry can succeed. Retry once or twice, with a short pause. - **`after`:** wait `retry_after_s` seconds, then retry. Finding nothing is not an error. A search with no results is a success, with an empty list. ## Codes [#codes] Each code always comes with the same HTTP status. | Status | `code` | When | `retry` | | --- | --- | --- | --- | | 400 | `invalid_parameter` | A field is missing, malformed or out of range. `param` names it. | `never` | | 400 | `invalid_body` | A POST body is not a JSON object, or is over 16 KB. | `never` | | 401 | `unauthenticated` | No key, or a key we don't know. | `never` | | 403 | `forbidden` | The key may not do this: it is revoked or expired, lacks live access or this product, or was used from outside your networks. A booking link that was changed also answers this. | `never` | | 404 | `not_found` | Nothing at this address. | `never` | | 404 | `search_not_found` | No search with that id for this key. Search again. | `never` | | 405 | `method_not_allowed` | The address exists, but not for this method. The `Allow` header lists the methods it answers. | `never` | | 410 | `gone` | A booking link has expired. | `never` | | 429 | `rate_limited` | Over one of your [limits](/rate-limits). | `after` | | 502 | `supplier_error` | The supplier failed the search. | `now` | | 503 | `search_capacity` | No capacity to start new searches just now. Recent searches still answer. | `after` | | 503 | `service_unavailable` | Keys or limits can't be checked just now. | `after` | | 504 | `supplier_timeout` | The supplier took too long. | `now` | | 500 | `internal_error` | A fault on our side. The detail is logged, never sent. | `now` | If reading a search by its `search_id` answers `supplier_error` or `supplier_timeout`, that search is over. Reading it again gives the same error. `retry: "now"` there means search the trip again. ## Handle errors in code [#handle-errors-in-code] Branch on `error.retry`, not on the status or the message: ```js title="call.mjs" const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); export async function call(url, init = {}, attempts = 3) { for (let attempt = 1; ; attempt += 1) { const response = await fetch(url, { ...init, headers: { ...init.headers, "X-API-Key": process.env.VOYAGE_LABS_API_KEY }, }); const body = await response.json(); if (response.ok) return body; const { code, message, retry, retry_after_s, request_id } = body.error; if (retry === "never" || attempt >= attempts) { throw new Error(`${code}: ${message} (request ${request_id})`); } await sleep(retry === "after" ? (retry_after_s ?? 1) * 1000 : 500 * attempt); } } ``` ```python title="call.py" import os import time import requests def call(method, url, attempts=3, **kwargs): headers = {**kwargs.pop("headers", {}), "X-API-Key": os.environ["VOYAGE_LABS_API_KEY"]} for attempt in range(1, attempts + 1): response = requests.request(method, url, headers=headers, timeout=40, **kwargs) body = response.json() if response.ok: return body error = body["error"] if error["retry"] == "never" or attempt == attempts: raise RuntimeError(f"{error['code']}: {error['message']} (request {error['request_id']})") if error["retry"] == "after": time.sleep(error.get("retry_after_s", 1)) else: time.sleep(0.5 * attempt) ``` ## Asking for help [#asking-for-help] Every answer, success or failure, carries a request id in `meta.request_id` or `error.request_id`, and in the `X-Request-Id` header. Log it. With it, we can find the exact request. # Rate limits and usage (/rate-limits) How your limits work, which calls count against them, and how to read your usage and handle a 429. Limits keep the service fast for everyone. They belong to your account and are set by your plan. Test and live calls are counted separately, so building in test mode never uses up your live allowance. Read your numbers from the usage endpoints, rather than writing them into your code. ## What is limited [#what-is-limited] Each API limits requests a minute, and new searches a minute. ### Flights Search API [#flights-search-api] | Limit | What counts | | --- | --- | | `requests_per_minute` | Every call with a key. | | `new_trips_per_minute` | Every search call (`GET` or `POST /v1/flights/search`) without a `cursor`, even when a stored answer serves it. | ### Hotels Search API [#hotels-search-api] | Limit | What counts | | --- | --- | | `requests_per_minute` | Every call with a key. | | `new_searches_per_minute` | Every search or rates call, even when a stored answer serves it. | | `search_reads_per_minute` | Reading a search again by its `search_id`. When your plan sets it, it sits below the request limit, so polling can't use up all your requests. | ### What doesn't count as a new search [#what-doesnt-count-as-a-new-search] Reading a search by its `search_id`, and paging with `cursor`, never counts as a new search. So the cheapest way to collect results is to search once, then read that search. ### Over a limit [#over-a-limit] Over any limit, the answer is `429` `rate_limited`, with `retry: "after"`. Separately, the service has a limit on the new searches it can start for everyone at once. When that is reached, a new search answers `503` `search_capacity`. Trips searched recently still answer. ## Headers [#headers] Every answer to a key we accept carries: | Header | Meaning | | --- | --- | | `RateLimit-Limit` | Requests you may make a minute. | | `RateLimit-Remaining` | Requests left in the current minute. | | `RateLimit-Reset` | Seconds until the minute starts again. | | `X-Request-Id` | Names this request. | | `Retry-After` | On `429` and `503`: seconds to wait. | ## Handle a 429 [#handle-a-429] Wait for `Retry-After` seconds (the same number as `error.retry_after_s`), then try again. Don't retry at once in a loop: requests over the limit still count as errors. The sample in [Errors](/errors#handle-errors-in-code) does this for you. ## Read your usage [#read-your-usage] Each API has a usage endpoint that reports your limits and what you have used: ```bash curl https://api.voyagelabs.ai/v1/flights/usage \ -H "X-API-Key: $VOYAGE_LABS_API_KEY" ``` ```json title="Response (test key)" { "data": { "key": { "id": "key_2c4b3dc27e82", "name": "Docs local test", "mode": "test" }, "limits": { "requests_per_minute": 1200, "new_trips_per_minute": 200 }, "this_minute": { "requests": 15, "new_trips": 9 }, "today": { "requests": 22, "answered_from_memory": 8, "new_trips": 9, "errors": 7 }, "partner": { "id": "prt_ef6091cb3df6", "tier": "tier_standard_v1", "active_streams": 0, "today": { "requests": 22, "answered_from_memory": 8, "new_trips": 9, "errors": 7 } } }, "meta": { "request_id": "req_47aaa0fad039", "mode": "test" } } ``` - `key` names the key that made the call. It never includes the key itself. - `this_minute` counts from the start of the current minute. - `today` counts this key since midnight UTC. `errors` includes requests refused for being over a limit. - `partner` is your account: its plan (`tier`) and its totals today across all its keys. The hotels endpoint, `GET /v1/hotels/usage`, answers the same way for its own calls, with `new_searches` in place of `new_trips`. Its `limits` also has `search_reads_per_minute`, which is `null` when only `requests_per_minute` applies, and it has no `partner` block. See the reference for [flights](/api-reference/flights/usage) and [hotels](/api-reference/hotels/usage). The console shows the same numbers over time, with a log of your recent requests. # Changelog (/changelog) Changes to the Flights Search API, the Hotels Search API and these docs. Changes within `v1` only add things, so nothing here breaks existing code. See [Versions](/conventions#versions). ## December 2026 [#december-2026] - **These docs.** Guides and the API reference for both APIs now live at `docs.voyagelabs.ai`. Every page is also available as Markdown, and there is an [MCP server](/agents#docs-mcp-server) for agents. - **Hotels Search API.** Search hotels for a place and a stay, read a search as it fills in, get every room and rate for one hotel, and send travellers to book. See [How hotel search works](/hotels). - **New key prefix.** New keys start `vl_live_` and `vl_test_`. Keys that start `fs_live_` and `fs_test_` keep working. # API reference (/api-reference) Every endpoint of both APIs, with its parameters, answers and errors. Call any of them from the page with your own key. Each page shows one endpoint: its parameters, every answer it can give, and samples in several languages. Open the playground on a page, paste a key, and send a real request. All endpoints live on `https://api.voyagelabs.ai` and need a key in the `X-API-Key` header. A `vl_test_` key returns saved samples at no cost. See [Test mode](/test-mode). ## Flights Search API [#flights-search-api] | Endpoint | What it does | | --- | --- | | [`GET /v1/flights/search`](/api-reference/flights/search) | Search a trip. | | [`POST /v1/flights/search`](/api-reference/flights/search-with-a-body) | Search a trip, with the fields in a JSON body. | | [`GET /v1/flights/search/{search_id}`](/api-reference/flights/read-a-search) | Read a search again: wait for it, page it, sort or filter it. | | [`GET /v1/flights/usage`](/api-reference/flights/usage) | Your limits and what you have used. | | [`GET /logos/{code}.png`](/api-reference/flights/airline-logo) | An airline's logo, to show beside its results. | ## Hotels Search API [#hotels-search-api] | Endpoint | What it does | | --- | --- | | [`GET /v1/hotels/search`](/api-reference/hotels/search) | Hotels for a place and a stay, with one price each. | | [`POST /v1/hotels/search`](/api-reference/hotels/search-with-a-body) | The same search, with the fields in a JSON body. | | [`GET /v1/hotels/search/{search_id}`](/api-reference/hotels/read-a-search) | Read a search again: wait for it, page it, sort it. | | [`GET /v1/hotels/rates/{hotel_id}`](/api-reference/hotels/rooms-and-rates) | Every room and rate of one hotel for a stay. | | [`GET /v1/hotels/usage`](/api-reference/hotels/usage) | Your limits and what you have used. | ## As files [#as-files] The reference is generated from each API's OpenAPI document. Download the documents as shown here: [flights](/openapi/flights.json) and [hotels](/openapi/hotels.json). For guides to the concepts behind these endpoints, start with [How flight search works](/flights) or [How hotel search works](/hotels). # Search flights (/api-reference/flights/search) `GET https://api.voyagelabs.ai/v1/flights/search` **Search a trip** A search changes nothing, so GET is the main form. Trip fields decide which stored search answers; the other fields only shape the answer and never cause a supplier search. Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `origin` | query | string | yes | 3-letter airport code. | | `destination` | query | string | yes | 3-letter airport code, different from origin. | | `depart_date` | query | string | yes | YYYY-MM-DD, not in the past, at most 11 months ahead. `depart` is accepted as an older name. | | `return_date` | query | string | no | YYYY-MM-DD, on or after depart_date. Leave out for one-way. `return` is accepted as an older name. | | `adults` | query | integer | no | Travellers aged 12 and over. | | `children` | query | integer | no | Adults plus children at most 9. | | `infants` | query | integer | no | At most one per adult. | | `cabin` | query | `economy` \| `premium_economy` \| `business` \| `first` | no | The cabin to search. | | `currency` | query | string | no | 3-letter code. | | `max_stops` | query | integer | no | Keep itineraries with at most this many stops in each direction. | | `airlines` | query | string | no | 2-character codes, comma separated. Keeps trips sold entirely by these airlines. | | `sort` | query | `best` \| `price` \| `duration` | no | How to order results. | | `limit` | query | integer | no | Results in this response. | | `cursor` | query | string | no | The next_cursor of the previous page. | | `detail` | query | `summary` \| `full` | no | How much of each result to send. | | `fares` | query | integer | no | Fares per result. Only read when detail is full. `offers` is accepted as an older name. | | `wait_ms` | query | integer | no | Answer with whatever has arrived by then, in milliseconds. Left out: 8000, so a new trip is answered when its search finishes or after 8 seconds with what has arrived (status partial); read the rest by search_id. Left out, an answer is never sent empty while the search runs: it waits on for the first itineraries, up to 30 seconds. | | `max_age_s` | query | integer | no | The oldest price the caller accepts, in seconds. A stored answer older than this is searched again before the reply. | | `stream` | query | `1` | no | Answer as server-sent events. The same as sending Accept: text/event-stream. | | `debug` | query | `1` | no | Also say how the answer was produced, in meta.debug. For diagnosis; its shape may change within v1. | | `response_mode` | query | `complete` \| `stream` \| `partial` | no | Delivery mode for partner searches: complete (default JSON — waits up to 30s for full results), stream (Server-Sent Events), or partial (fast return with search_id to poll). | ## Responses - `200`: The search, complete or partial. - `400`: `invalid_parameter`: A field is missing, malformed or out of range. `param` names it. - `401`: `unauthenticated`: No key, or a key that is not known. - `403`: `forbidden`: The key is switched off, may not use this route, or was used from outside its partner's listed networks, by the address our load balancer saw (never an address the caller wrote in X-Forwarded-For). - `429`: `rate_limited`: This key is over its own limit. - `500`: `internal_error`: A fault in the service. The detail is logged, never sent. - `502`: `supplier_error`: The supplier failed. - `503`: `search_capacity`: New searches are temporarily unavailable. Trips already in memory can still answer. - `504`: `supplier_timeout`: The search did not finish in time: 45 seconds for the first supplier. # Search flights (JSON body) (/api-reference/flights/search-with-a-body) `POST https://api.voyagelabs.ai/v1/flights/search` **Search a trip, with the fields in a JSON body** Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Request body - `application/json`: object (SearchBody) ## Responses - `200`: The search, complete or partial. - `400`: `invalid_parameter`: A field is missing, malformed or out of range. `param` names it. `invalid_body`: A POST body is not a JSON object, or is over 16 KB. - `401`: `unauthenticated`: No key, or a key that is not known. - `403`: `forbidden`: The key is switched off, may not use this route, or was used from outside its partner's listed networks, by the address our load balancer saw (never an address the caller wrote in X-Forwarded-For). - `429`: `rate_limited`: This key is over its own limit. - `500`: `internal_error`: A fault in the service. The detail is logged, never sent. - `502`: `supplier_error`: The supplier failed. - `503`: `search_capacity`: New searches are temporarily unavailable. Trips already in memory can still answer. - `504`: `supplier_timeout`: The search did not finish in time: 45 seconds for the first supplier. # Read a search (/api-reference/flights/read-a-search) `GET https://api.voyagelabs.ai/v1/flights/search/{search_id}` **The same search again** Poll a partial answer, filter, sort and page a finished one differently, or read one result again by itinerary_id. Only the shape fields are read. Reading a search again never refreshes it: its pricing.age_s keeps growing, so search the trip again before showing a price or link more than 240 seconds old. The search must belong to the inventory scope assigned to your key. Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `search_id` | path | string | yes | From a search response. | | `itinerary_id` | query | string | no | A result's id (data.results[].id), exactly as an answer gave it. Keeps only that result, wherever it would sort or page, to read it again with detail full. An id this search does not hold answers with no results, not an error: search the trip again for those flights. max_stops and airlines still apply; cursor is refused with it. | | `max_stops` | query | integer | no | Keep itineraries with at most this many stops in each direction. | | `airlines` | query | string | no | 2-character codes, comma separated. Keeps trips sold entirely by these airlines. | | `sort` | query | `best` \| `price` \| `duration` | no | How to order results. | | `limit` | query | integer | no | Results in this response. | | `cursor` | query | string | no | The next_cursor of the previous page. | | `detail` | query | `summary` \| `full` | no | How much of each result to send. | | `fares` | query | integer | no | Fares per result. Only read when detail is full. `offers` is accepted as an older name. | | `wait_ms` | query | integer | no | Wait up to this long for a search that is still running. Left out: answer at once with what there is. | | `debug` | query | `1` | no | Also say how the answer was produced, in meta.debug. For diagnosis; its shape may change within v1. | ## Responses - `200`: The search as it stands now. - `400`: `invalid_parameter`: A field is missing, malformed or out of range. `param` names it. - `401`: `unauthenticated`: No key, or a key that is not known. - `403`: `forbidden`: The key is switched off, may not use this route, or was used from outside its partner's listed networks, by the address our load balancer saw (never an address the caller wrote in X-Forwarded-For). - `404`: `search_not_found`: No search has that id. Search again. - `429`: `rate_limited`: This key is over its own limit. - `500`: `internal_error`: A fault in the service. The detail is logged, never sent. - `502`: `supplier_error`: The supplier failed. - `503`: `search_capacity`: New searches are temporarily unavailable. Trips already in memory can still answer. - `504`: `supplier_timeout`: The search did not finish in time: 45 seconds for the first supplier. # Usage and limits (/api-reference/flights/usage) `GET https://api.voyagelabs.ai/v1/flights/usage` **This key's limits and how much of them is used** Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Responses - `200`: A key sees only its own numbers. - `401`: `unauthenticated`: No key, or a key that is not known. - `403`: `forbidden`: The key is switched off, may not use this route, or was used from outside its partner's listed networks, by the address our load balancer saw (never an address the caller wrote in X-Forwarded-For). - `429`: `rate_limited`: This key is over its own limit. - `500`: `internal_error`: A fault in the service. The detail is logged, never sent. # Airline logo (/api-reference/flights/airline-logo) `GET https://api.voyagelabs.ai/logos/{code}.png` **An airline's logo** The address a result's logo fields carry. It needs no key, so a page can use it in an image. The image is small and can be kept for a day. No key needed. ## Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `code` | path | string | yes | The airline's 2-character code, in capitals and digits. | ## Responses - `200`: The image. Content-Type says whether it is a PNG, JPEG, WebP or GIF. - `404`: `not_found`: No such route. - `500`: `internal_error`: A fault in the service. The detail is logged, never sent. - `502`: `supplier_error`: The supplier failed. # Search hotels (/api-reference/hotels/search) `GET https://api.voyagelabs.ai/v1/hotels/search` **Hotels for a place and a stay, one price each** Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `city` | query | string | no | A city by name. With country. | | `country` | query | string | no | The city's 2-letter country code. | | `latitude` | query | number | no | A point. With longitude. | | `longitude` | query | number | no | With latitude. | | `radius_km` | query | number | no | How far around the point to look. | | `place_id` | query | string | no | A Google place id, such as ChIJIQBpAG2ahYAR_6128GcTUEo. | | `hotel_ids` | query | string | no | Up to 200 hotel ids from earlier answers, comma-separated. | | `check_in` | query | string | yes | First night, YYYY-MM-DD. Not before yesterday, at most 500 days ahead. | | `check_out` | query | string | yes | Departure day, YYYY-MM-DD. 1 to 30 nights after check_in. | | `adults` | query | integer | no | Adults in the one room. Use rooms for more than one room. | | `child_ages` | query | string | no | Each child's age in the one room, comma-separated, such as 7,4. | | `rooms` | query | string | no | More than one room: a JSON list such as [{"adults":2,"child_ages":[7]},{"adults":1}]. Not with adults or child_ages. | | `currency` | query | string | no | 3-letter currency of the prices. | | `nationality` | query | string | no | The guests' 2-letter country code. Some rates depend on it. | | `sort` | query | `price` \| `rating` | no | The order of the hotels: cheapest first, or best rated first. | | `limit` | query | integer | no | Hotels in this response. | | `cursor` | query | string | no | The next_cursor of the previous page. | | `response_mode` | query | `complete` \| `partial` | no | complete waits for the supplier. partial answers at once; read the rest by search_id. | | `wait_ms` | query | integer | no | Exactly how long to wait for a running search. | | `max_age_s` | query | integer | no | The oldest stored answer to accept, in seconds. 0 forces a new search. A stored answer is never reused past 900 seconds, so a larger value is read as 900. | ## Responses - `200`: The page asked for. status is running while the supplier has not answered. - `400`: The request cannot be read. - `401`: No key, or one nobody issued. - `403`: The key may not do this, or not from this network. - `429`: Over a limit. Retry-After says when. - `502`: The supplier failed. - `503`: Temporarily unavailable. Retry-After says when. - `504`: The supplier took too long. # Search hotels (JSON body) (/api-reference/hotels/search-with-a-body) `POST https://api.voyagelabs.ai/v1/hotels/search` **The same search, with its fields in a JSON body** Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Request body - `application/json`: object (SearchRequest) ## Responses - `200`: The page asked for. - `400`: The request cannot be read. - `401`: No key, or one nobody issued. - `403`: The key may not do this, or not from this network. - `429`: Over a limit. Retry-After says when. - `502`: The supplier failed. - `503`: Temporarily unavailable. Retry-After says when. - `504`: The supplier took too long. # Read a search (/api-reference/hotels/read-a-search) `GET https://api.voyagelabs.ai/v1/hotels/search/{search_id}` **The same search again: wait for it, page it, sort it** Never searches again and never counts as a new search. A search is kept for 24 hours. Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `search_id` | path | string | yes | A search_id from a search or rates answer. | | `sort` | query | `price` \| `rating` | no | The order of the hotels: cheapest first, or best rated first. | | `limit` | query | integer | no | Hotels in this response. | | `cursor` | query | string | no | The next_cursor of the previous page. | | `wait_ms` | query | integer | no | Exactly how long to wait for a running search. | ## Responses - `200`: The page asked for. - `400`: The request cannot be read. - `401`: No key, or one nobody issued. - `403`: The key may not do this, or not from this network. - `404`: Nothing at this address, or no such search. - `429`: Over a limit. Retry-After says when. - `502`: The supplier failed. - `503`: Temporarily unavailable. Retry-After says when. - `504`: The supplier took too long. # Rooms and rates (/api-reference/hotels/rooms-and-rates) `GET https://api.voyagelabs.ai/v1/hotels/rates/{hotel_id}` **One hotel's every room and rate for a stay** Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `hotel_id` | path | string | yes | A hotel's id from a search, such as lp19b5e. | | `check_in` | query | string | yes | First night, YYYY-MM-DD. Not before yesterday, at most 500 days ahead. | | `check_out` | query | string | yes | Departure day, YYYY-MM-DD. 1 to 30 nights after check_in. | | `adults` | query | integer | no | Adults in the one room. Use rooms for more than one room. | | `child_ages` | query | string | no | Each child's age in the one room, comma-separated, such as 7,4. | | `rooms` | query | string | no | More than one room: a JSON list such as [{"adults":2,"child_ages":[7]},{"adults":1}]. Not with adults or child_ages. | | `currency` | query | string | no | 3-letter currency of the prices. | | `nationality` | query | string | no | The guests' 2-letter country code. Some rates depend on it. | | `response_mode` | query | `complete` \| `partial` | no | complete waits for the supplier. partial answers at once; read the rest by search_id. | | `wait_ms` | query | integer | no | Exactly how long to wait for a running search. | | `max_age_s` | query | integer | no | The oldest stored answer to accept, in seconds. 0 forces a new search. A stored answer is never reused past 900 seconds, so a larger value is read as 900. | ## Responses - `200`: The hotel with all its offers, cheapest first. hotels is empty when it has no rooms for the stay. - `400`: The request cannot be read. - `401`: No key, or one nobody issued. - `403`: The key may not do this, or not from this network. - `429`: Over a limit. Retry-After says when. - `502`: The supplier failed. - `503`: Temporarily unavailable. Retry-After says when. - `504`: The supplier took too long. # Usage and limits (/api-reference/hotels/usage) `GET https://api.voyagelabs.ai/v1/hotels/usage` **The calling key's limits and use** Needs a key: `X-API-Key: vl_live_...` (or `vl_test_...`), or `Authorization: Bearer `. ## Responses - `200`: Limits, this minute, and today in UTC. - `401`: No key, or one nobody issued. - `403`: The key may not do this, or not from this network. - `429`: Over a limit. Retry-After says when. - `503`: Temporarily unavailable. Retry-After says when.