How to Use Flight Search Filters, Sorting, and Pagination
The Flights API search endpoint supports filtering, sorting, and pagination to help you narrow down results and build efficient user interfaces. All three are optional parameters on the search request body.
Filters
Add a filters object to your search request to narrow results. All filter fields are optional — include only the ones you need.
Filter Options
| Filter | Type | Values | Description |
|---|---|---|---|
departuretime | array of strings | "earlymorning", "morning", "afternoon", "evening" | Filter by departure time window. |
arrivaltime | array of strings | "earlymorning", "morning", "afternoon", "evening" | Filter by arrival time window. |
baggage | array of strings | "cabin", "checked" | Only return flights that include the specified baggage type. |
stops | array of strings | "nonstop", "onestop", "two_plus", "any" | Filter by number of stops. |
airlines | array of strings | Airline names | Filter by specific airlines (e.g., "Alaska Airlines", "United Airlines"). |
Time Window Definitions
| Value | Approximate Time Range |
|---|---|
early_morning | 12:00 AM - 6:00 AM |
morning | 6:00 AM - 12:00 PM |
afternoon | 12:00 PM - 6:00 PM |
evening | 6:00 PM - 12:00 AM |
Example: Filtered Search
{
"flight_info": [
{
"departure_date": "2026-04-15",
"origin": "SFO",
"destination": "BLR"
}
],
"route_type": "Oneway",
"cabin_type": "economy",
"adults": 1,
"filters": {
"departure_time": [
"morning",
"afternoon"
],
"stops": [
"non_stop",
"one_stop"
],
"airlines": [
"United Airlines",
"Air India"
],
"baggage": [
"checked"
]
}
}This request returns economy flights departing in the morning or afternoon, with at most one stop, operated by United Airlines or Air India, and including checked baggage.
Discovering Available Airlines
The search response includes an available_airlines field containing all airlines present in the unfiltered result set. Use this list to populate airline filter options in your UI.
{
"available_airlines": [
"United Airlines",
"Lufthansa",
"Air India",
"Emirates",
"Alaska Airlines"
]
}Sorting
Add a sorting object to control the order of results.
| Field | Type | Values | Description |
|---|---|---|---|
sortby | string | "price", "duration", "recommended" | The field to sort by. |
sortorder | string | "asc", "desc" | Sort direction. |
Example: Sort by Price (Lowest First)
{
"sorting": {
"sort_by": "price",
"sort_order": "asc"
}
}Example: Sort by Duration (Shortest First)
{
"sorting": {
"sort_by": "duration",
"sort_order": "asc"
}
}Example: Recommended
{
"sorting": {
"sort_by": "recommended",
"sort_order": "desc"
}
}The recommended sort uses a combination of price, duration, and number of stops to surface the best overall options.
Pagination
Add a pagination object to control the number of results per page and navigate through pages.
| Field | Type | Description |
|---|---|---|
page | integer | The page number to retrieve (1-based). |
limit | integer | Number of results per page. |
Example: Paginated Request
{
"pagination": {
"page": 2,
"limit": 10
}
}Pagination Response Fields
The search response includes pagination metadata:
| Field | Type | Description |
|---|---|---|
total | integer | Total number of matching flights. |
page | integer | Current page number. |
limit | integer | Results per page. |
totalpages | integer | Total number of pages. |
hasnext | boolean | Whether a next page exists. |
has_prev | boolean | Whether a previous page exists. |
Example Pagination Response
{
"pagination": {
"total": 45,
"page": 2,
"limit": 10,
"total_pages": 5,
"has_next": true,
"has_prev": true
}
}Complete Example
Here is a full search request combining filters, sorting, and pagination:
{
"flight_info": [
{
"departure_date": "2026-04-15",
"origin": "SFO",
"destination": "BLR"
}
],
"route_type": "Oneway",
"cabin_type": "economy",
"adults": 2,
"children": 1,
"infants": 0,
"filters": {
"departure_time": [
"morning"
],
"stops": [
"non_stop"
],
"baggage": [
"cabin",
"checked"
]
},
"sorting": {
"sort_by": "price",
"sort_order": "asc"
},
"pagination": {
"page": 1,
"limit": 20
}
}Tips
- Omit the
filtersobject entirely to return all results without filtering. - Use the
available_airlinesfield from the response to build dynamic airline filter lists. - Start with
page: 1and usehas_nextto determine whether to offer a "next page" control. - Combining multiple filter values within a field uses OR logic (e.g.,
["morning", "afternoon"]returns flights departing in either window). - Combining different filter fields uses AND logic (e.g.,
stops: ["non_stop"]ANDairlines: ["United Airlines"]returns only non-stop United flights).
Related Articles
- How to Search for Flights — Core search endpoint documentation.
- How to Check Flight Availability and Pricing — Next step after finding a flight.