Flights
Ce contenu n’est pas encore disponible dans votre langue.
Overview
Section titled “Overview”The Flights resource provides fake flight data with airlines, airports, departure/arrival times, prices, and status information.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/flights | List all flights |
| GET | /v1/flights/:id | Get a specific flight |
Flight Object
Section titled “Flight Object”{ "id": 1, "airlineId": 1, "flightNumber": "SWA101", "departureAirportId": 1, "arrivalAirportId": 2, "departureTime": "2026-03-15T08:00:00.000Z", "arrivalTime": "2026-03-15T11:30:00.000Z", "duration": 210, "price": 299.99, "currency": "USD", "availableSeats": 120, "status": "scheduled", "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
airlineId |
number |
ID of the airline |
flightNumber |
string |
Flight number (e.g. SWA101) |
departureAirportId |
number |
ID of the departure airport |
arrivalAirportId |
number |
ID of the arrival airport |
departureTime |
string |
Departure time (ISO 8601) |
arrivalTime |
string |
Arrival time (ISO 8601) |
duration |
number |
Duration in minutes |
price |
number |
Ticket price |
currency |
string |
Currency code (e.g. USD) |
availableSeats |
number |
Available seats |
status |
string |
Status (scheduled, delayed, cancelled, completed) |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Flights
Section titled “List Flights”curl https://api.phantomjson.app/v1/flightsQuery 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 |
airlineId |
number |
— | Filter by airline ID |
departureAirportId |
number |
— | Filter by departure airport |
arrivalAirportId |
number |
— | Filter by arrival airport |
status |
string |
— | Filter by status |
minPrice |
string |
— | Minimum price filter |
maxPrice |
string |
— | Maximum price filter |
departureDate |
string |
— | Filter by departure date |
Response
Section titled “Response”{ "data": [ { "id": 1, "airlineId": 1, "flightNumber": "SWA101", "departureAirportId": 1, "arrivalAirportId": 2, "departureTime": "2026-03-15T08:00:00.000Z", "arrivalTime": "2026-03-15T11:30:00.000Z", "duration": 210, "price": 299.99, "currency": "USD", "availableSeats": 120, "status": "scheduled" } ], "meta": { "total": 200, "page": 1, "limit": 20, "totalPages": 10 }}Get Flight by ID
Section titled “Get Flight by ID”curl https://api.phantomjson.app/v1/flights/1Response
Section titled “Response”{ "data": { "id": 1, "airlineId": 1, "flightNumber": "SWA101", "departureAirportId": 1, "arrivalAirportId": 2, "departureTime": "2026-03-15T08:00:00.000Z", "arrivalTime": "2026-03-15T11:30:00.000Z", "duration": 210, "price": 299.99, "currency": "USD", "availableSeats": 120, "status": "scheduled" }}Examples
Section titled “Examples”Search Flights
Section titled “Search Flights”curl "https://api.phantomjson.app/v1/flights?q=SWA101"Filter by Airline
Section titled “Filter by Airline”curl "https://api.phantomjson.app/v1/flights?airlineId=1"Filter by Departure Airport
Section titled “Filter by Departure Airport”curl "https://api.phantomjson.app/v1/flights?departureAirportId=1"Filter by Arrival Airport
Section titled “Filter by Arrival Airport”curl "https://api.phantomjson.app/v1/flights?arrivalAirportId=2"Filter by Status
Section titled “Filter by Status”curl "https://api.phantomjson.app/v1/flights?status=scheduled"Filter by Price Range
Section titled “Filter by Price Range”curl "https://api.phantomjson.app/v1/flights?minPrice=100&maxPrice=500"Filter by Departure Date
Section titled “Filter by Departure Date”curl "https://api.phantomjson.app/v1/flights?departureDate=2026-03-15"Sort by Price
Section titled “Sort by Price”# Cheapest firstcurl "https://api.phantomjson.app/v1/flights?sort=price:asc"
# Most expensive firstcurl "https://api.phantomjson.app/v1/flights?sort=price:desc"Sort by Departure Time
Section titled “Sort by Departure Time”# Earliest firstcurl "https://api.phantomjson.app/v1/flights?sort=departureTime:asc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/flights?fields=id,flightNumber,price,status"Combined Query
Section titled “Combined Query”# Cheap scheduled flights from airport 1curl "https://api.phantomjson.app/v1/flights?departureAirportId=1&status=scheduled&maxPrice=300&sort=price:asc"Relations
Section titled “Relations”- Airline — Each flight belongs to an airline (
airlineId) - Departure Airport — Each flight has a departure airport (
departureAirportId) - Arrival Airport — Each flight has an arrival airport (
arrivalAirportId)
