Airports
Overview
Section titled “Overview”The Airports resource provides fake airport data with names, codes, IATA codes, coordinates, and timezone information.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/airports | List all airports |
| GET | /v1/airports/:id | Get a specific airport |
Airport Object
Section titled “Airport Object”{ "id": 1, "cityId": 1, "name": "John F. Kennedy International Airport", "code": "KJFK", "iataCode": "JFK", "latitude": 40.6413111, "longitude": -73.7781391, "timezone": "America/New_York", "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
cityId |
number |
ID of the city |
name |
string |
Airport name |
code |
string |
ICAO code (e.g. KJFK) |
iataCode |
string |
IATA code (e.g. JFK) |
latitude |
number |
Latitude coordinate |
longitude |
number |
Longitude coordinate |
timezone |
string |
Timezone |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Airports
Section titled “List Airports”curl https://api.phantomjson.app/v1/airportsQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
q |
string |
— | Search query |
fields |
string |
— | Fields to return |
cityId |
number |
— | Filter by city ID |
iataCode |
string |
— | Filter by IATA code |
Response
Section titled “Response”{ "data": [ { "id": 1, "cityId": 1, "name": "John F. Kennedy International Airport", "code": "KJFK", "iataCode": "JFK" } ], "meta": { "total": 50, "page": 1, "limit": 20, "totalPages": 3 }}Get Airport by ID
Section titled “Get Airport by ID”curl https://api.phantomjson.app/v1/airports/1Response
Section titled “Response”{ "data": { "id": 1, "cityId": 1, "name": "John F. Kennedy International Airport", "code": "KJFK", "iataCode": "JFK", "latitude": 40.6413111, "longitude": -73.7781391, "timezone": "America/New_York" }}Examples
Section titled “Examples”Search Airports
Section titled “Search Airports”curl "https://api.phantomjson.app/v1/airports?q=kennedy"Filter by City
Section titled “Filter by City”curl "https://api.phantomjson.app/v1/airports?cityId=1"Filter by IATA Code
Section titled “Filter by IATA Code”curl "https://api.phantomjson.app/v1/airports?iataCode=JFK"Sort by Name
Section titled “Sort by Name”# A-Zcurl "https://api.phantomjson.app/v1/airports?sort=name:asc"
# Z-Acurl "https://api.phantomjson.app/v1/airports?sort=name:desc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/airports?fields=id,name,iataCode,cityId"Relations
Section titled “Relations”- City — Each airport belongs to a city (
cityId)
