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

<Callout type="warn" title="A key in a page is a public key">
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.
</Callout>

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