Search Flights
flights_searchFull Description
Searches for flights between airports or cities. Not for flight status, price tracking, visa information, bookings, or reservation management. Returns results from a Wego metasearch in a single call.
Parameters:
- newSearch: Route (from/to as IATA codes), dates (fromDate, toDate in YYYY-MM-DD), passengers, and cabin class. Omit toDate for one-way trips.
- Defaults when not specified: 1 adult, 0 children, 0 infants, economy cabin.
- filters: Include only when the user mentions specific preferences (airlines, stops, times, price range, etc.).
- sorting: A single string value. Options: score_desc (recommended, default), price_asc (cheapest), duration_asc (fastest), leg1_departure_time_asc/desc (outbound departure), leg2_departure_time_asc/desc (return departure, round-trip only).
Time filtering (time ranges in minutes from midnight, 0-1440):
- Format: {min: minutesFromMidnight, max: minutesFromMidnight}
- Example: "flights after 10pm" → outboundDepartureTimeRange: {min: 1320, max: 1440}
- Example: "depart 8am-1pm" → outboundDepartureTimeRange: {min: 480, max: 780}
- Supports wraparound: {min: 1380, max: 60} = 11pm-1am (crosses midnight)
Refinement: Provide the searchId from a previous response with updated filters or sorting. Refinement replaces all previous filters and sorting entirely — include existing values alongside new ones to preserve them.
Example — changing return to after 10pm while keeping existing airlines ["SQ", "KE"], outbound 6am-8am, and price_asc sorting: { "searchId": "abc", "filters": { "airlines": ["SQ", "KE"], "outboundDepartureTimeRange": { "min": 360, "max": 480 }, "inboundArrivalTimeRange": { "min": 1320, "max": 1440 } }, "sorting": "price_asc" }
Default behavior:
- One date provided → one-way trip
- Return date mentioned → round-trip
- No preferences stated → omit filters
- City name without specific airport → use the city IATA code (e.g., "London" → LON, "New York" → NYC, "Tokyo" → TYO). City codes automatically search all airports in that city.
The widget handles flight result display. Format URLs as markdown links: [text](url).
Parameters (0 required, 4 optional)
filtersobjectFlight filters. On refinement, filters replace all previous filters — re-include existing ones to preserve them.
newSearchobjectNew flight search parameters. Include route, dates, and passengers. Omit when refining via searchId.
searchIdstringReuse the searchId from a previous search when refining, filtering, or sorting.
sortingstringSort order for results. Pass a single string value. Options: score_desc (recommended, default), price_asc (cheapest), duration_asc (fastest), leg1_departure_time_asc/desc (outbound departure), leg2_departure_time_asc/desc (return departure, round-trip only).
score_descprice_ascduration_ascleg1_departure_time_ascleg1_departure_time_descleg2_departure_time_ascleg2_departure_time_descscore_desc