# REST API

A JSON API for airport waits, FAA delays, forecasts and more. Register a free agent key in one request, or use a Pro or Enterprise developer key.

Source: https://flightqueue.com/docs/api

| Property | Value |
| --- | --- |
| Base URL | `https://flightqueue.com/api/v1` |
| Format | JSON over HTTPS |
| Authentication | API key in `Authorization: Bearer` or `X-API-Key` |
| OpenAPI | `https://flightqueue.com/openapi.json` |
| Endpoints | The [endpoint reference](https://flightqueue.com/docs/api/endpoints.md) lists every route with parameters and examples. |

## Authentication

Send your key in one of two headers. Send one, not both.

**Header options**

```bash
Authorization: Bearer fqagent_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# or
X-API-Key: fqagent_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

| Key | Prefix | How you get it | Reaches |
| --- | --- | --- | --- |
| Agent key | `fqagent_` | `POST /api/agent/register`. Free, no browser. | Endpoints marked free or any valid key |
| Developer key | `fq_live_` | A Pro or Enterprise API plan | Everything on your plan, including wait times, predictions and history |

A request without a key returns `MISSING_API_KEY`. A request with an unknown or revoked key returns `INVALID_API_KEY`. Both are HTTP 401.

## Get a free agent key

One request creates a free account and returns a key. The key is shown once.

```bash
curl -X POST https://flightqueue.com/api/agent/register \
  -H "Content-Type: application/json" \
  -d '{"agent_name":"my-agent","contact_email":"you@example.com"}'
```

Both body fields are optional. `agent_name` is cut to 60 characters. Registration is limited to 5 per minute and 50 per day per IP address. The key works on the free endpoints. Wait times, predictions and history return `PREMIUM_REQUIRED` until you use a plan that includes them.

> **Warning:** Free agent keys are for personal, non-commercial use. See [plans and limits](https://flightqueue.com/docs/plans.md#licence).

## Get a developer key

Developer keys come with a Pro or Enterprise API plan. Enterprise checks out at [/checkout/enterprise](https://flightqueue.com/checkout/enterprise). For Pro, or for help with a key, email [api@flightqueue.com](mailto:api@flightqueue.com). Once your account is on a plan, create a key while signed in:

```http
POST https://flightqueue.com/api/keys
Content-Type: application/json

{ "name": "my-app" }
```

The name is 1 to 50 characters. The response includes the full key once. Each account can hold 5 active keys. Revoke one with `DELETE /api/keys/{keyId}`.

## Make a request

**curl**

```bash
curl "https://flightqueue.com/api/v1/airports/JFK/delays" \
  -H "Authorization: Bearer $FLIGHTQUEUE_API_KEY"
```

**JavaScript**

```javascript
const response = await fetch("https://flightqueue.com/api/v1/airports/JFK/delays", {
  headers: {
    Authorization: `Bearer ${process.env.FLIGHTQUEUE_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`Flight Queue API ${response.status}`);
const { data } = await response.json();
console.log(data);
```

**Python**

```python
import os
import requests

response = requests.get(
    "https://flightqueue.com/api/v1/airports/JFK/delays",
    headers={"Authorization": f"Bearer {os.environ['FLIGHTQUEUE_API_KEY']}"},
    timeout=10,
)
response.raise_for_status()
print(response.json()["data"])
```

## Response format

Successful responses have `success: true`, a `data` object and `meta` with a `requestId` and `timestamp`. Responses are sent with `Cache-Control: public, max-age=300`, so a client or proxy may reuse one for up to 5 minutes.

**Success**

```json
{
  "success": true,
  "data": { },
  "meta": {
    "requestId": "3f8c2b1e-6d4a-4f7b-9a1e-2c5d8e7f0a12",
    "timestamp": "2026-11-07T12:00:00.000Z"
  }
}
```

## Rate limits

| Key | Requests per minute | Included calls | Overage |
| --- | --- | --- | --- |
| Agent key (free) | 30 | — | — |
| Pro API | 300 | 5,000 per month | $3 per 1,000 calls |
| Enterprise API | 1,000 | 100,000 per month | $1 per 1,000 calls |

The limit is per key and per minute. Past it the API returns HTTP 429 with `RATE_LIMIT_EXCEEDED`. Wait for the next minute and retry. Prices are on the [plans and limits](https://flightqueue.com/docs/plans.md) page.

## Errors

Errors have `success: false` and an `error` object with a stable `code` and a human-readable `message`. Branch on `code`.

**Error**

```json
{
  "success": false,
  "error": {
    "code": "PREMIUM_REQUIRED",
    "message": "Live wait times require a premium subscription"
  }
}
```

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `INVALID_AIRPORT` | The IATA airport code is not valid. |
| 400 | `INVALID_BODY` | The request body is not valid JSON or a required field is missing. |
| 400 | `INVALID_DATE` | A date parameter is not a valid `YYYY-MM-DD` date. |
| 400 | `INVALID_PARAMETER` | A query parameter is missing or out of range. |
| 400 | `TOO_MANY_AIRPORTS` | A bulk request sent more than 50 airport codes. |
| 401 | `INVALID_API_KEY` | The API key is unknown or has been revoked. |
| 401 | `MISSING_API_KEY` | No API key was sent in `X-API-Key` or `Authorization`. |
| 403 | `ENTERPRISE_REQUIRED` | The endpoint needs an Enterprise API key. |
| 403 | `PREMIUM_REQUIRED` | The key does not include the paid feature this endpoint needs. |
| 404 | `NOT_FOUND` | The airport, flight or other resource is not in the dataset. |
| 429 | `RATE_LIMIT_EXCEEDED` | The key sent more requests in a minute than its plan allows. |
| 500 | `INTERNAL_ERROR` | Something failed on our side. Retry later. |
| 503 | `UPSTREAM_UNAVAILABLE` | A data source behind the endpoint could not be reached. Retry later. |

## Check your key

For agent keys, `GET /api/agent/me` returns the tier, month-to-date usage and which MCP tools are available.

```bash
curl https://flightqueue.com/api/agent/me \
  -H "Authorization: Bearer $FLIGHTQUEUE_API_KEY"
```

### Command line

The `@flightqueue/cli` package wraps the same API for terminals and agents: `npx @flightqueue/cli register --name my-agent`, then `npx @flightqueue/cli delays JFK`.

> **Note:** Commercial use of the API, in a business, a paid product or for your own customers, needs an Enterprise plan.

- [Endpoint reference](https://flightqueue.com/docs/api/endpoints.md)
- [OpenAPI spec](https://flightqueue.com/docs/api/openapi.md)
- [Plans and limits](https://flightqueue.com/docs/plans.md)
