# Airports

Airports are used to identify origins and destinations in journey slices.

## Schema

**city**  
object nullable  
The metropolitan area where the airport is located. Only present for airports which are registered with IATA as belonging to a [metropolitan area](https://portal.iata.org/faq/articles/en_US/FAQ/How-do-I-create-a-new-Metropolitan-Area).

**city_name**  
string  
The name of the city (or cities separated by a `/`) where the airport is located  
Example: `"London"`

**iata_city_code**  
string  
The three-character IATA code for the city where the airport is located  
Example: `"LON"`

**iata_code**  
string  
The three-character IATA code for the airport  
Example: `"LHR"`

**iata_country_code**  
string  
The [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for the country where the airport is located  
Example: `"GB"`

**icao_code**  
string nullable  
The four-character ICAO code for the airport  
Example: `"EGLL"`

**id**  
string  
Duffel's unique identifier for the resource  
Example: `"arp_lhr_gb"`

**latitude**  
number  
The latitude position of the airport represented in [Decimal degrees](https://en.wikipedia.org/wiki/Decimal_degrees) with 6 decimal points with a range between -90° and 90°  
Example: `64.068865`

**longitude**  
number  
The longitude position of the airport represented in [Decimal degrees](https://en.wikipedia.org/wiki/Decimal_degrees) with 6 decimal points with a range between -180° and 180°  
Example: `-141.951519`

**name**  
string  
The name of the airport  
Example: `"Heathrow"`

**time_zone**  
string  
The time zone of the airport, specified by name from the [tz database](https://en.wikipedia.org/wiki/Tz_database)  
Example: `"Europe/London"`

## List airports

Retrieves a paginated list of all airports. The results may be returned in any order.

### Query parameters

**after**  
string  
A cursor pointing to the previous page of records. For more information on how to paginate through records, see the [Pagination](/content/docs/api/overview/pagination/index.html) section.  
Example: `"g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB="`

**before**  
string  
A cursor pointing to the next page of records. For more information on how to paginate through records, see the [Pagination](/content/docs/api/overview/pagination/index.html) section.  
Example: `"g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB="`

**limit**  
integer  
The maximum number of records to return per page. Defaults to `50`.  
May be set to any integer between `1` and `200`. For more information on how to paginate through records, see the [Pagination](/content/docs/api/overview/pagination/index.html) section.  
Example: `1`  
Default value: `50`

**iata_country_code**  
string  
Filters the returned airports by their `iata_country_code` - see the `iata_country_code` parameter in the [Airport schema](/content/docs/api/airports/schema/index.html) for details  
Example: `"GB"`

### Endpoint

group
```bash
GET https://api.duffel.com/air/airports
```

### Request

```bash
curl -X GET --compressed "https://api.duffel.com/air/airports?after=g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB=&before=g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB=&limit=1&iata_country_code=GB" \
  -H "Accept-Encoding: gzip" \
  -H "Accept: application/json" \
  -H "Duffel-Version: v2" \
  -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
```

### Response

```json
{
  "meta": {
    "limit": 50,
    "after": "g2wAAAACbQAAABBBZXJvbWlzdC1LaGFya2l2bQAAAB="
  },
  "data": [
    {
      "time_zone": "Europe/London",
      "name": "Heathrow",
      "longitude": -141.951519,
      "latitude": 64.068865,
      "id": "arp_lhr_gb",
      "icao_code": "EGLL",
      "iata_country_code": "GB",
      "iata_code": "LHR",
      "iata_city_code": "LON",
      "city_name": "London",
      "city": {
        "name": "London",
        "id": "cit_lon_gb",
        "iata_country_code": "GB",
        "iata_code": "LON",
        "airports": [
          {
            "time_zone": "Europe/London",
            "name": "Heathrow",
            "longitude": -141.951519,
            "latitude": 64.068865,
            "id": "arp_lhr_gb",
            "icao_code": "EGLL",
            "iata_country_code": "GB",
            "iata_code": "LHR"
          }
        ]
      }
    }
  ]
}
```

## Get a single airport

Retrieves an airport by its ID.

### URL parameters

**id**  
string required  
Duffel's unique identifier for the airport  
Example: `"arp_lhr_gb"`

### Endpoint

```bash
GET https://api.duffel.com/air/airports/{id}
```

### Request

```bash
curl -X GET --compressed "https://api.duffel.com/air/airports/{id}" \
  -H "Accept-Encoding: gzip" \
  -H "Accept: application/json" \
  -H "Duffel-Version: v2" \
  -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
```

### Response

```json
{
  "data": {
    "time_zone": "Europe/London",
    "name": "Heathrow",
    "longitude": -141.951519,
    "latitude": 64.068865,
    "id": "arp_lhr_gb",
    "icao_code": "EGLL",
    "iata_country_code": "GB",
    "iata_code": "LHR",
    "iata_city_code": "LON",
    "city_name": "London",
    "city": {
      "name": "London",
      "id": "cit_lon_gb",
      "iata_country_code": "GB",
      "iata_code": "LON",
      "airports": [
        {
          "time_zone": "Europe/London",
          "name": "Heathrow",
          "longitude": -141.951519,
          "latitude": 64.068865,
          "id": "arp_lhr_gb",
          "icao_code": "EGLL",
          "iata_country_code": "GB",
          "iata_code": "LHR"
        }
      ]
    }
  }
}
```
