# 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.

<Steps>
<Step>
### 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_..."
```
</Step>

<Step>
### 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.

<Tabs items={["curl","JavaScript","Python"]}>
<Tab value="curl">
```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
```
</Tab>

<Tab value="JavaScript">
```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");
```
</Tab>

<Tab value="Python">
```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")
```
</Tab>
</Tabs>
</Step>

<Step>
### 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.
</Step>

<Step>
### 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).
</Step>
</Steps>

## 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]

<Cards>
<Card title="How flight search works" href="/flights" description="Searches, results, prices and how long an answer takes." />

<Card title="How hotel search works" href="/hotels" description="Places, stays, rooms and rates." />

<Card title="Try it in the console" href="https://developer.voyagelabs.ai/playground" description="Run searches in the browser with your own key." />
</Cards>