Airlines
Ce contenu n’est pas encore disponible dans votre langue.
Overview
Section titled “Overview”The Airlines resource provides fake airline data with names, codes, logos, websites, and country associations.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/airlines | List all airlines |
| GET | /v1/airlines/:id | Get a specific airline |
| GET | /v1/airlines/:id/flights | Get airline's flights |
Airline Object
Section titled “Airline Object”{ "id": 1, "name": "SkyWing Airlines", "code": "SWA", "slug": "skywing-airlines", "logo": "https://example.com/logos/skywing.png", "website": "https://skywing.example.com", "countryId": 1, "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
name |
string |
Airline name |
code |
string |
Airline code (e.g. SWA) |
slug |
string |
URL-friendly unique slug |
logo |
string |
Logo image URL |
website |
string |
Airline website URL |
countryId |
number |
ID of the country |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Airlines
Section titled “List Airlines”curl https://api.phantomjson.app/v1/airlinesQuery 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 |
code |
string |
— | Filter by airline code |
countryId |
number |
— | Filter by country ID |
Response
Section titled “Response”{ "data": [ { "id": 1, "name": "SkyWing Airlines", "code": "SWA", "slug": "skywing-airlines", "countryId": 1 } ], "meta": { "total": 30, "page": 1, "limit": 20, "totalPages": 2 }}Get Airline by ID
Section titled “Get Airline by ID”curl https://api.phantomjson.app/v1/airlines/1Response
Section titled “Response”{ "data": { "id": 1, "name": "SkyWing Airlines", "code": "SWA", "slug": "skywing-airlines", "logo": "https://example.com/logos/skywing.png", "website": "https://skywing.example.com", "countryId": 1 }}Get Airline’s Flights
Section titled “Get Airline’s Flights”curl https://api.phantomjson.app/v1/airlines/1/flightsResponse
Section titled “Response”{ "data": [ { "id": 1, "airlineId": 1, "flightNumber": "SWA101", "departureAirportId": 1, "arrivalAirportId": 2, "status": "scheduled" } ], "meta": { "total": 25, "page": 1, "limit": 20, "totalPages": 2 }}Examples
Section titled “Examples”Search Airlines
Section titled “Search Airlines”curl "https://api.phantomjson.app/v1/airlines?q=sky"Filter by Code
Section titled “Filter by Code”curl "https://api.phantomjson.app/v1/airlines?code=SWA"Filter by Country
Section titled “Filter by Country”curl "https://api.phantomjson.app/v1/airlines?countryId=1"Sort by Name
Section titled “Sort by Name”# A-Zcurl "https://api.phantomjson.app/v1/airlines?sort=name:asc"
# Z-Acurl "https://api.phantomjson.app/v1/airlines?sort=name:desc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/airlines?fields=id,name,code,countryId"Relations
Section titled “Relations”- Country — Each airline may belong to a country (
countryId) - Flights — Each airline has many flights (access via
/v1/airlines/:id/flights)
