# Airlines API
> Search a database of 6,000+ airlines worldwide (OpenFlights open dataset). Find carriers by name and country, look one up by its IATA (2-letter) or ICAO (3-letter) code, and browse counts per country. Each record includes the airline name, codes, radio callsign, country and active status — ideal for travel apps, booking flows, flight dashboards and aviation tooling.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/airlines-api/..."
```

## Pricing
- **Free** (Free) — 1,000 calls/Mo, 2 req/s
- **Starter** ($8/Mo) — 35,000 calls/Mo, 5 req/s
- **Pro** ($23/Mo) — 175,000 calls/Mo, 15 req/s
- **Mega** ($60/Mo) — 700,000 calls/Mo, 40 req/s

## Endpoints

### Airlines

#### `GET /v1/airline` — A single airline by IATA, ICAO or id

**Parameters:**
- `iata` (query, optional, string) — 2-letter IATA code Example: `LH`
- `icao` (query, optional, string) — 3-letter ICAO code
- `id` (query, optional, string) — Dataset id

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/airlines-api/v1/airline?iata=LH"
```

**Response:**
```json
{
    "data": {
        "id": 3321,
        "iata": "LH",
        "icao": "GEC",
        "name": "Lufthansa Cargo",
        "alias": null,
        "active": true,
        "country": "Germany",
        "callsign": "LUFTHANSA CARGO"
    },
    "meta": {
        "timestamp": "2026-05-31T00:39:21.402Z",
        "request_id": "7ae716ae-b93c-4afa-9034-70bcbb1f1f89"
    },
    "status": "ok",
    "message": "Airline retrieved",
    "success": true
}
```

#### `GET /v1/search` — Search airlines by name, country and status

**Parameters:**
- `q` (query, optional, string) — Airline name / alias / callsign Example: `lufthansa`
- `country` (query, optional, string) — Filter by country Example: `Germany`
- `active` (query, optional, string) — Filter by active status (true/false) Example: `true`
- `limit` (query, optional, string) — Results per page (1-100, default 20) Example: `20`
- `offset` (query, optional, string) — Pagination offset Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/airlines-api/v1/search?q=lufthansa&country=Germany&active=true&limit=20&offset=0"
```

**Response:**
```json
{
    "data": {
        "count": 3,
        "limit": 20,
        "total": 3,
        "offset": 0,
        "filters": {
            "q": "lufthansa",
            "active": true,
            "country": "germany"
        },
        "results": [
            {
                "id": 3320,
                "iata": "LH",
                "icao": "DLH",
                "name": "Lufthansa",
                "alias": null,
                "active": true,
                "country": "Germany",
                "callsign": "LUFTHANSA"
            },
            {
                "id": 3321,
                "iata": "LH",
                "icao": "GEC",
                "name": "Lufthansa Cargo",
                "alias": null,
                "active": true,
                "country": "Germany",
                "callsign": "LUFTHANSA CARGO"
            },
            {
                "id": 3322,
                "iata": "CL",
                "icao": "CLH",
                "name": "Lufthansa CityLine",
                "alias": null,
                "active": true,
                "country": "Germany",
                "callsign": "HANSALINE"
            }
        ]
    },
    "meta": {
        "timestamp": "2026-05-31T00:39:21.478Z",
        "request_id": "342a7d4f-73dc-4eb5-8fd6-a31c3a0c3d71"
    },
    "status": "ok",
    "message": "Search completed",
    "success": true
}
```

### Countries

#### `GET /v1/countries` — Countries with airline counts

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/airlines-api/v1/countries"
```

**Response:**
```json
{
    "data": {
        "count": 276,
        "countries": [
            {
                "country": "United States",
                "airlines": 1099
            },
            {
                "country": "Mexico",
                "airlines": 440
            },
            {
                "country": "United Kingdom",
                "airlines": 414
            },
            {
                "country": "Canada",
                "airlines": 323
            },
            {
                "country": "Russia",
                "airlines": 238
            },
            {
                "country": "Spain",
                "airlines": 168
            },
            {
                "country": "Germany",
                "airlines": 135
            },
            {
                "country": "France",
                "airlines": 123
            },
            {
                "country": "Australia",
                "airlines": 93
            },
            {
                "country": "Italy",
                "airlines": 93
            },
            {
                "country": "South Africa",
                "airlines": 91
            },
            {
                "country": "Ukraine",
                "airlines": 90
            },
            {
                "country": "Nigeria",
                "airlines": 85
            },
            {
                "country": "Kazakhstan",
                "airlines": 79
            },
            {
                "country": "C
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Dataset totals & source

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/airlines-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "total": 6158,
        "active": 1252,
        "fields": [
            "id",
            "name",
            "alias",
            "iata",
            "icao",
            "callsign",
            "country",
            "active"
        ],
        "source": "OpenFlights airlines database",
        "countries": 276,
        "with_iata": 1533,
        "with_icao": 5885
    },
    "meta": {
        "timestamp": "2026-05-31T00:39:21.614Z",
        "request_id": "599f6b4a-4edb-4437-9b47-5cd2c07c377e"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/airlines-api
OpenAPI spec: https://www.oanor.com/api/airlines-api/openapi.json
