> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flynet.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Hello API Key

> Confirm your API key works against a Discovery route.

# Hello API Key

**Goal:** Confirm your API key works and you know what a Discovery 401 looks like.\
**Prep time:** \~1 minute

## What you'll use

* `GET /flynet/v1/restaurants` with `X-API-Key: <key>`

## Code

```typescript theme={null}
const res = await fetch(
  "https://api.staging.blackbird.xyz/flynet/v1/restaurants?page=0&page_size=1",
  { headers: { "X-API-Key": process.env.API_KEY! } },
);

if (res.status === 401) {
  console.log(await res.json());
} else {
  console.log(res.status, await res.json());
}
```

```bash theme={null}
curl -i "https://api.staging.blackbird.xyz/flynet/v1/restaurants?page=0&page_size=1" \
  -H "X-API-Key: $API_KEY"
```

`200` returns `{ "restaurants": [...], "pagination": {...} }`.

A missing or invalid key returns `401` with a JSON envelope, different from the OAuth empty-body 401:

```json theme={null}
{
  "status": 401,
  "message": "API key is required. Include your key in the X-API-Key header.",
  "error_code": "MISSING_API_KEY"
}
```

<Warning>
  Discovery 401s are JSON. OAuth 401s are empty-body. The two envelopes are not interchangeable; see [Pagination + errors](/concepts/pagination-errors).
</Warning>

**Next:** [Fetch a restaurant list](/recipes/appetizers/restaurant-list): paginate the Discovery surface.
