# FlightStats Search API Documentation

<p><strong>FlightStats Search API Documentation</strong> Search carriers or airports by name and get the codes for the flight and airport endpoints. Set type to airline or airport. An empty result costs no credit. Cost: 1 credit per successful request.</p>

- **Documentation:** [https://scrappa.co/docs/flightstats-api/flightstats_search](https://scrappa.co/docs/flightstats-api/flightstats_search)
- **API group:** FlightStats API
- **Endpoint:** `GET https://scrappa.co/api/flightstats/search`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | Name or code to search, at least 2 characters, e.g. lufthansa. |
| `type` | string | Yes | airline or airport. |

## Example response

```json
{
    "data": {
        "type": "airline",
        "count": 4,
        "query": "lufth",
        "results": [
            {
                "code": "LH",
                "iata": "LH",
                "name": "Lufthansa"
            },
            {
                "code": "CL",
                "iata": "CL",
                "name": "Lufthansa CityLine"
            },
            {
                "code": "GEC",
                "iata": "GEC",
                "name": "Lufthansa Cargo"
            },
            {
                "code": "LHX",
                "iata": "LHX",
                "name": "Lufthansa City Airlines"
            }
        ]
    },
    "meta": {
        "credits": 1,
        "billable": true,
        "endpoint_family": "search"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A parameter is missing or invalid. This response is not billable. |
| 503 | Upstream Unavailable | FlightStats could not be read after retries. This response is not billable. Retry later. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
