Aller au contenu

Flights

Ce contenu n’est pas encore disponible dans votre langue.

The Flights resource provides fake flight data with airlines, airports, departure/arrival times, prices, and status information.

MethodEndpointDescription
GET/v1/flightsList all flights
GET/v1/flights/:idGet a specific flight
{
"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
Terminal window
curl https://api.phantomjson.app/v1/flights
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
{
"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
}
}
Terminal window
curl https://api.phantomjson.app/v1/flights/1
{
"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"
}
}
Terminal window
curl "https://api.phantomjson.app/v1/flights?q=SWA101"
Terminal window
curl "https://api.phantomjson.app/v1/flights?airlineId=1"
Terminal window
curl "https://api.phantomjson.app/v1/flights?departureAirportId=1"
Terminal window
curl "https://api.phantomjson.app/v1/flights?arrivalAirportId=2"
Terminal window
curl "https://api.phantomjson.app/v1/flights?status=scheduled"
Terminal window
curl "https://api.phantomjson.app/v1/flights?minPrice=100&maxPrice=500"
Terminal window
curl "https://api.phantomjson.app/v1/flights?departureDate=2026-03-15"
Terminal window
# Cheapest first
curl "https://api.phantomjson.app/v1/flights?sort=price:asc"
# Most expensive first
curl "https://api.phantomjson.app/v1/flights?sort=price:desc"
Terminal window
# Earliest first
curl "https://api.phantomjson.app/v1/flights?sort=departureTime:asc"
Terminal window
curl "https://api.phantomjson.app/v1/flights?fields=id,flightNumber,price,status"
Terminal window
# Cheap scheduled flights from airport 1
curl "https://api.phantomjson.app/v1/flights?departureAirportId=1&status=scheduled&maxPrice=300&sort=price:asc"
  • 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)