✈️

flights

Flight information with airline, route (origin/destination), departure/arrival times, duration, aircraft, pricing, available seats, class, and status. Used for flight booking platforms, airline systems, and travel management applications.

🎯 Request Builder

https://api.mockly.codes/flights?page=1&limit=10&count=10
📡

Configure your request and click Send Request to see the response here.

Endpoints

GET/flights

Get a collection of flights

Alternative: /travel/flights
GET/flights/:id

Get a single flight by ID

Alternative: /travel/flights/:id
GET/flights/meta

Get resource metadata and schema

Alternative: /travel/flights/meta
🔍

How to Use Search

The search feature allows you to filter results by searching for text across all or specific fields. Choose between ?q= or ?search= parameter names.

1. Basic Search

Search across all text fields:

Basic Search
GET https://api.mockly.codes/flights?q=laptop

2. Search Specific Fields

Field-Specific Search
GET https://api.mockly.codes/flights?q=laptop&search_fields=name,description

💡 Pro Tips

  • Search is case-insensitive and performs partial matching
  • Without search_fields, all text fields are searched
  • Combine with pagination to handle large result sets efficiently

Code Examples

JavaScript

Fetch Collection
// Get 10 flights
fetch('https://api.mockly.codes/flights?count=10')
  .then(res => res.json())
  .then(data => console.log(data));

Python

Fetch with Requests
import requests

response = requests.get(
    'https://api.mockly.codes/flights?count=10'
)
data = response.json()

cURL

Command Line
curl "https://api.mockly.codes/flights?count=10"

Bypass Cache

Get Fresh Data
fetch('https://api.mockly.codes/flights?nocache=true')

Schema Properties

idinteger

Unique identifier for the flight

Gen:random_int
flight_numberstring

Flight number or code (e.g., AA123, DL456)

Gen:flight_number
airlinestring

Airline company operating the flight

Gen:airline
originstring

City or airport name of departure location

Gen:city
origin_codestring

IATA airport code for the origin airport (e.g., JFK, LAX, LHR)

Gen:airport_code
destinationstring

City or airport name of arrival location

Gen:city
destination_codestring

IATA airport code for the destination airport

Gen:airport_code
departure_timestring

Scheduled departure date and time

Gen:future_datedate-time
arrival_timestring

Scheduled arrival date and time

Gen:future_datedate-time
durationinteger

Flight duration in minutes

Gen:flight_duration
aircraftstring

Aircraft model or type (e.g., Boeing 737, Airbus A320)

Gen:aircraft
pricenumber

Flight ticket price

Gen:flight_price
currencystring

ISO currency code for the price (e.g., USD, EUR, GBP)

Gen:currency
available_seatsinteger

Number of seats currently available for booking

Gen:random_int
classstring

Cabin class (e.g., Economy, Business, First)

Gen:flight_class
statusstring

Flight status (e.g., scheduled, boarding, departed, arrived, delayed, cancelled)

Gen:flight_status

Query Parameters

countinteger

Number of items to return (default: 10, max: 100)

seedinteger

Seed for reproducible data generation

nocacheboolean

Bypass cache and generate fresh data on every request