Skip to main content

FlightSearchFilters

Complete set of filters for flight search on specific dates.
trip_type
TripType
default:"TripType.ONE_WAY"
Type of flight journey (round trip or one-way)
passenger_info
PassengerInfo
required
Passenger configuration for the search
flight_segments
list[FlightSegment]
required
List of flight segments (typically 1 for one-way, 2 for round trip)
stops
MaxStops
default:"MaxStops.ANY"
Maximum number of stops allowed in the flight
seat_type
SeatType
default:"SeatType.ECONOMY"
Cabin class preference
price_limit
PriceLimit | None
default:"None"
Maximum price constraint for the search
airlines
list[Airline] | None
default:"None"
Filter by specific airlines
max_duration
int | None
default:"None"
Maximum flight duration in minutes
layover_restrictions
LayoverRestrictions | None
default:"None"
Constraints for layovers in multi-leg flights
sort_by
SortBy
default:"SortBy.NONE"
Sorting option for flight results

Methods

format()
list
Formats filters into Google Flights API structure
encode()
str
URL encodes the formatted filters for API request

DateSearchFilters

Filters for searching flights across a date range to find cheapest travel dates.
trip_type
TripType
default:"TripType.ONE_WAY"
Type of flight journey (round trip or one-way)
passenger_info
PassengerInfo
required
Passenger configuration for the search
flight_segments
list[FlightSegment]
required
List of flight segments for the search
stops
MaxStops
default:"MaxStops.ANY"
Maximum number of stops allowed in the flight
seat_type
SeatType
default:"SeatType.ECONOMY"
Cabin class preference
price_limit
PriceLimit | None
default:"None"
Maximum price constraint for the search
airlines
list[Airline] | None
default:"None"
Filter by specific airlines
max_duration
int | None
default:"None"
Maximum flight duration in minutes
layover_restrictions
LayoverRestrictions | None
default:"None"
Constraints for layovers in multi-leg flights
from_date
str
required
Start date for the search range in YYYY-MM-DD format
to_date
str
required
End date for the search range in YYYY-MM-DD format
duration
int | None
default:"None"
Trip duration in days (required for round trips)

Properties

parsed_from_date
datetime
Parses the from_date string into a datetime object
parsed_to_date
datetime
Parses the to_date string into a datetime object

Methods

format()
list
Formats filters into Google Flights API structure
encode()
str
URL encodes the formatted filters for API request

FlightSegment

A segment represents a single portion of a flight journey between two airports.
departure_airport
list[list[Airport | int]]
required
Nested list structure for departure airports (matches Google Flights API format)
arrival_airport
list[list[Airport | int]]
required
Nested list structure for arrival airports (matches Google Flights API format)
travel_date
str
required
Travel date in YYYY-MM-DD format (must not be in the past)
time_restrictions
TimeRestrictions | None
default:"None"
Time constraints for departure and arrival
selected_flight
FlightResult | None
default:"None"
Previously selected flight for fetching return flights

Properties

parsed_travel_date
datetime
Parses the travel_date string into a datetime object

PassengerInfo

Passenger configuration for flight search.
adults
int
default:"1"
Number of adult passengers (non-negative)
children
int
default:"0"
Number of child passengers (non-negative)
infants_in_seat
int
default:"0"
Number of infants occupying a seat (non-negative)
infants_on_lap
int
default:"0"
Number of infants sitting on an adult’s lap (non-negative)

TimeRestrictions

Time constraints for flight departure and arrival in local time. All times are in hours from midnight (e.g., 20 = 8:00 PM).
earliest_departure
int | None
default:"None"
Earliest departure time in hours (0-23)
latest_departure
int | None
default:"None"
Latest departure time in hours (1-24)
earliest_arrival
int | None
default:"None"
Earliest arrival time in hours (0-23)
latest_arrival
int | None
default:"None"
Latest arrival time in hours (1-24)

PriceLimit

Maximum price constraint for flight search.
max_price
int
required
Maximum price (positive integer)
currency
Currency | None
default:"Currency.USD"
Currency for the price limit (currently only USD is supported)

LayoverRestrictions

Constraints for layovers in multi-leg flights.
airports
list[Airport] | None
default:"None"
Specific airports to allow for layovers
max_duration
int | None
default:"None"
Maximum layover duration in minutes (positive integer)

Build docs developers (and LLMs) love