SerpApi Official icon

SerpApi Official

Get live Google Search data and more from SerpApi's official node

Overview

This node integrates with SerpApi's Google Flights API to retrieve live flight search data. It allows users to perform detailed flight searches including round trip, one way, and multi-city itineraries by specifying parameters such as departure and arrival airports, dates, travel class, number of passengers, and various filters.

Common scenarios where this node is beneficial include:

  • Travel agencies automating flight search queries.
  • Apps or services that compare flight options dynamically.
  • Users wanting to embed live flight search results into workflows or dashboards.

Practical example: A user wants to find the best round-trip flights from Austin (AUS) to Paris Charles de Gaulle (CDG) departing on March 14, 2025, returning on March 20, 2025, for two adults in economy class, sorted by price.

Properties

Name Meaning
Departure airport code / location kgmid (departure_id) Defines the departure airport code (3-letter IATA) or location kgmid (starts with /m/). Multiple entries can be comma-separated. Default: AUS
Arrival airport code / location kgmid (arrival_id) Defines the arrival airport code (3-letter IATA) or location kgmid (starts with /m/). Multiple entries can be comma-separated. Default: CDG
Outbound Date (outbound_date) The outbound flight date in YYYY-MM-DD format. Example: 2025-03-14
Return Date (return_date) The return flight date in YYYY-MM-DD format. Required if flight type is Round trip. Example: 2025-03-20
Flight Type (type) Type of flight itinerary. Options: Round trip (1), One way (2), Multi-city (3). For Multi-city, use multi_city_json to specify details. Default: Round trip (1)
Additional Fields Collection of optional parameters to refine the search, including:
- Country (gl) Country code to localize the search. Examples: us, fr, gb, etc. Default: us
- Language (hl) Language code for the search results. Examples: en, fr, es, de, etc. Default: en
- Currency (currency) Currency code for prices. Examples: USD, EUR, GBP, JPY, etc. Default: USD
- Travel Class (travel_class) Travel class. Options: Economy (1), Premium economy (2), Business (3), First (4). Default: Economy (1)
- Parameters for Multi-city (multi_city_json) JSON string defining multiple flight legs with required fields: departure_id, arrival_id, date, and optional time ranges
- Show hidden results (show_hidden) Boolean to include hidden flight results. Default: false
- Deep search (deep_search) Boolean to enable deep search for more comprehensive results but longer response time. Default: false
- Number of Adults (adults) Number of adult passengers. Default: 1
- Number of Children (children) Number of child passengers. Default: 0
- Number of Infants in seat (infants_in_seat) Number of infants occupying a seat. Default: 0
- Number of Infants on lap (infants_on_lap) Number of infants on lap. Default: 0
- Sort By (sort_by) Sorting order of results. Options: Top flights (1), Price (2), Departure time (3), Arrival time (4), Duration (5), Emissions (6). Default: Top flights (1)
- Stops (stops) Number of stops filter. Options: Any number (0), Nonstop only (1), 1 stop or fewer (2), 2 stops or fewer (3). Default: Any number (0)
- Exclude airlines (exclude_airlines) Comma-separated airline codes or alliance names to exclude. Cannot be used with include_airlines.
- Include airlines (include_airlines) Comma-separated airline codes or alliance names to include. Cannot be used with exclude_airlines.
- Bags (bags) Number of carry-on bags. Default: 0
- Max price (max_price) Maximum ticket price. Default: unlimited
- Outbound times (outbound_times) Time range filter for outbound flights. See SerpApi docs for format.
- Return times (return_times) Time range filter for return flights. See SerpApi docs for format.
- Emissions (emissions) Filter for emission levels. Option: Less emissions only (1). Default: 1
- Layover duration (layover_duration) Layover duration range in minutes, e.g., "90,330" for 1h30min to 5h30min
- Exclude connecting airports (exclude_conns) Comma-separated airport codes to exclude as connections
- Max duration (max_duration) Maximum flight duration in minutes, e.g., 1500 for 25 hours
- Departure flight token (departure_token) Token to select a specific flight and get related flights (for round trip or multi-city)
- Booking token (booking_token) Token to get booking options for selected flights. Cannot be used with departure_token.
- Disable Caching (no_cache) Boolean to force fresh results ignoring cache. Default: false
- Async (async) Boolean to perform async search submission. Requires separate retrieval of results later. Default: false
- ZeroTrace Mode (zero_trace) Enterprise-only boolean to skip storing search metadata on servers. Default: false
- Output (output) Format of output: JSON (default) or raw HTML
- JSON Restrictor (json_restrictor) Restricts returned JSON fields, e.g., organic_results[0:3].{title,snippet}

Output

The node outputs a JSON object containing structured flight search results as returned by SerpApi's Google Flights API. This includes detailed information about available flights, pricing, airlines, timings, stops, and other relevant metadata.

If the output property is set to html, the node returns the raw HTML content retrieved from the search instead of JSON.

The output does not include binary data.

Dependencies

  • Requires an active SerpApi account with a valid API key credential configured in n8n.
  • Internet access to call SerpApi endpoints.
  • No additional external dependencies beyond the SerpApi service.

Troubleshooting

  • Invalid or missing API key: Ensure the API key credential is correctly set up and has permissions for Google Flights API.
  • Incorrect date formats: Dates must be in YYYY-MM-DD format; otherwise, the API may reject the request.
  • Conflicting parameters: Do not use exclude_airlines and include_airlines simultaneously.
  • Missing required parameters: For round trips, return_date is mandatory.
  • Async mode usage: When using async=true, results are not immediately available; you must retrieve them later via Search Archive API.
  • Cache conflicts: Using both no_cache and async together is disallowed.
  • Multi-city JSON formatting: The multi_city_json must be a valid JSON string with required fields; invalid JSON will cause errors.
  • Rate limits or quota exceeded: Check your SerpApi account limits if requests fail repeatedly.

Links and References

Discussion