> For the complete documentation index, see [llms.txt](https://docs.myshell.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.myshell.ai/create/pro-config-mode/api-reference/widgets/17-google-flight-search.md).

# Google Flight Search

## Try it in the Widget Center

Click this [url](https://app.myshell.ai/robot-workshop/widget/1781994185011990528) to try this widget and copy the Pro Config template.

## Usage

Search the flights using google flight search. The `return_date` must be later than `outbound_date` and both the two dates must be later than today.

**Input Parameters**

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Default</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>num_results</td><td><code>integer</code></td><td>The number of search results to return.</td><td>10</td><td>false</td></tr><tr><td>departure_id</td><td><code>string</code></td><td>defines the departure airport code or location kgmid.</td><td>CDG</td><td>true</td></tr><tr><td>arrival_id</td><td><code>string</code></td><td>defines the arrival airport code or location kgmid.</td><td>AUS</td><td>true</td></tr><tr><td>outbound_date</td><td><code>string</code></td><td>The outbound date, should be YYYY-MM-DD. e.g. 2024-04-20</td><td></td><td>true</td></tr><tr><td>return_date</td><td><code>string</code></td><td>The return date, should be YYYY-MM-DD. e.g. 2024-04-27</td><td></td><td>true</td></tr><tr><td>currency</td><td><code>string</code></td><td>Defines the currency of the returned prices. Default is USD</td><td>USD</td><td>false</td></tr></tbody></table>

**Output Parameters**

| Name            | Type    | Description                        | File Type |
| --------------- | ------- | ---------------------------------- | --------- |
| search\_results | `array` | The result of google flight search |           |

**Output Example**

{% tabs %}
{% tab title="success" %}
{% code fullWidth="false" %}

```json
{
  "search_results": [
    {
      "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/multi.png",
      "carbon_emissions": {
        "difference_percent": 8,
        "this_flight": 746000,
        "typical_for_this_route": 688000
      },
      "departure_token": "WyJDalJJUzI5clYwbE5ZMEp0Y2pSQlJGSldha0ZDUnkwdExTMHRMUzB0TFhWcWNISXhNVUZCUVVGQlIxbHVXbDluUVZSeGRXMUJFZ3BVVGpkOFFVRXlNREUzR2dzSXc5OElFQUlhQTFWVFJEZ2NjTVBmQ0E9PSIsW1siQ0RHIiwiMjAyNC0wNC0yNCIsIkxBWCIsbnVsbCwiVE4iLCI3Il0sWyJMQVgiLCIyMDI0LTA0LTI0IiwiQVVTIixudWxsLCJBQSIsIjIwMTciXV1d",
      "extensions": [
        "Checked baggage for a fee",
        "Fare non-refundable, taxes may be refundable",
        "No ticket changes",
        "Bag and fare conditions depend on the return flight"
      ],
      "flights": [
        {
          "airline": "Air Tahiti Nui",
          "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/TN.png",
          "airplane": "Boeing 787",
          "arrival_airport": {
            "id": "LAX",
            "name": "Los Angeles International Airport",
            "time": "2024-04-24 14:15"
          },
          "departure_airport": {
            "id": "CDG",
            "name": "Paris Charles de Gaulle Airport",
            "time": "2024-04-24 12:05"
          },
          "duration": 670,
          "extensions": [
            "Average legroom (31 in)",
            "Wi-Fi for a fee",
            "In-seat USB outlet",
            "On-demand video",
            "Carbon emissions estimate: 573 kg"
          ],
          "flight_number": "TN 7",
          "legroom": "31 in",
          "travel_class": "Economy"
        },
        {
          "airline": "American",
          "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AA.png",
          "airplane": "Boeing 737",
          "arrival_airport": {
            "id": "AUS",
            "name": "Austin-Bergstrom International Airport",
            "time": "2024-04-24 23:37"
          },
          "departure_airport": {
            "id": "LAX",
            "name": "Los Angeles International Airport",
            "time": "2024-04-24 18:36"
          },
          "duration": 181,
          "extensions": [
            "Average legroom (30 in)",
            "Wi-Fi for a fee",
            "In-seat power \u0026 USB outlets",
            "Stream media to your device",
            "Carbon emissions estimate: 172 kg"
          ],
          "flight_number": "AA 2017",
          "legroom": "30 in",
          "ticket_also_sold_by": [
            "Air Tahiti Nui"
          ],
          "travel_class": "Economy"
        }
      ],
      "layovers": [
        {
          "duration": 261,
          "id": "LAX",
          "name": "Los Angeles International Airport"
        }
      ],
      "price": 1433,
      "total_duration": 1112,
      "type": "Round trip"
    },
    {
      "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/BA.png",
      "carbon_emissions": {
        "difference_percent": -20,
        "this_flight": 547000,
        "typical_for_this_route": 688000
      },
      "departure_token": "WyJDalJJUzI5clYwbE5ZMEp0Y2pSQlJGSldha0ZDUnkwdExTMHRMUzB0TFhWcWNISXhNVUZCUVVGQlIxbHVXbDluUVZSeGRXMUJFZ3RDUVRNd05YeENRVEU1TVJvTENLaVVDUkFDR2dOVlUwUTRISENvbEFrPSIsW1siQ0RHIiwiMjAyNC0wNC0yNCIsIkxIUiIsbnVsbCwiQkEiLCIzMDUiXSxbIkxIUiIsIjIwMjQtMDQtMjQiLCJBVVMiLG51bGwsIkJBIiwiMTkxIl1dXQ==",
      "extensions": [
        "Checked baggage for a fee",
        "Fare non-refundable, taxes may be refundable",
        "Ticket changes for a fee",
        "Bag and fare conditions depend on the return flight"
      ],
      "flights": [
        {
          "airline": "British Airways",
          "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/BA.png",
          "airplane": "Airbus A320",
          "arrival_airport": {
            "id": "LHR",
            "name": "Heathrow Airport",
            "time": "2024-04-24 08:20"
          },
          "departure_airport": {
            "id": "CDG",
            "name": "Paris Charles de Gaulle Airport",
            "time": "2024-04-24 08:00"
          },
          "duration": 80,
          "extensions": [
            "Below average legroom (29 in)",
            "Wi-Fi for a fee",
            "In-seat USB outlet",
            "Carbon emissions estimate: 54 kg"
          ],
          "flight_number": "BA 305",
          "legroom": "29 in",
          "often_delayed_by_over_30_min": true,
          "ticket_also_sold_by": [
            "American"
          ],
          "travel_class": "Economy"
        },
        {
          "airline": "British Airways",
          "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/BA.png",
          "airplane": "Airbus A350",
          "arrival_airport": {
            "id": "AUS",
            "name": "Austin-Bergstrom International Airport",
            "time": "2024-04-24 15:55"
          },
          "departure_airport": {
            "id": "LHR",
            "name": "Heathrow Airport",
            "time": "2024-04-24 11:50"
          },
          "duration": 605,
          "extensions": [
            "Average legroom (31 in)",
            "Wi-Fi for a fee",
            "In-seat power \u0026 USB outlets",
            "On-demand video",
            "Carbon emissions estimate: 491 kg"
          ],
          "flight_number": "BA 191",
          "legroom": "31 in",
          "ticket_also_sold_by": [
            "American",
            "Finnair",
            "Iberia"
          ],
          "travel_class": "Economy"
        }
      ],
      "layovers": [
        {
          "duration": 210,
          "id": "LHR",
          "name": "Heathrow Airport"
        }
      ],
      "price": 1501,
      "total_duration": 895,
      "type": "Round trip"
    },
    {
      "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AA.png",
      "carbon_emissions": {
        "difference_percent": 9,
        "this_flight": 753000,
        "typical_for_this_route": 688000
      },
      "departure_token": "WyJDalJJUzI5clYwbE5ZMEp0Y2pSQlJGSldha0ZDUnkwdExTMHRMUzB0TFhWcWNISXhNVUZCUVVGQlIxbHVXbDluUVZSeGRXMUJFZ3BCUVRRNWZFRkJPRFF6R2dzSTJwMEpFQUlhQTFWVFJEZ2NjTnFkQ1E9PSIsW1siQ0RHIiwiMjAyNC0wNC0yNCIsIkRGVyIsbnVsbCwiQUEiLCI0OSJdLFsiREZXIiwiMjAyNC0wNC0yNCIsIkFVUyIsbnVsbCwiQUEiLCI4NDMiXV1d",
      "extensions": [
        "Checked baggage for a fee",
        "Fare non-refundable, taxes may be refundable",
        "Ticket changes for a fee",
        "Bag and fare conditions depend on the return flight"
      ],
      "flights": [
        {
          "airline": "American",
          "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AA.png",
          "airplane": "Boeing 777",
          "arrival_airport": {
            "id": "DFW",
            "name": "Dallas Fort Worth International Airport",
            "time": "2024-04-24 14:55"
          },
          "departure_airport": {
            "id": "CDG",
            "name": "Paris Charles de Gaulle Airport",
            "time": "2024-04-24 11:25"
          },
          "duration": 630,
          "extensions": [
            "Average legroom (31 in)",
            "Wi-Fi for a fee",
            "In-seat power \u0026 USB outlets",
            "On-demand video",
            "Carbon emissions estimate: 695 kg"
          ],
          "flight_number": "AA 49",
          "legroom": "31 in",
          "ticket_also_sold_by": [
            "British Airways"
          ],
          "travel_class": "Economy"
        },
        {
          "airline": "American",
          "airline_logo": "https://www.gstatic.com/flights/airline_logos/70px/AA.png",
          "airplane": "Boeing 737",
          "arrival_airport": {
            "id": "AUS",
            "name": "Austin-Bergstrom International Airport",
            "time": "2024-04-24 17:40"
          },
          "departure_airport": {
            "id": "DFW",
            "name": "Dallas Fort Worth International Airport",
            "time": "2024-04-24 16:35"
          },
          "duration": 65,
          "extensions": [
            "Average legroom (30 in)",
            "Wi-Fi for a fee",
            "In-seat power \u0026 USB outlets",
            "Stream media to your device",
            "Carbon emissions estimate: 56 kg"
          ],
          "flight_number": "AA 843",
          "legroom": "30 in",
          "ticket_also_sold_by": [
            "British Airways"
          ],
          "travel_class": "Economy"
        }
      ],
      "layovers": [
        {
          "duration": 100,
          "id": "DFW",
          "name": "Dallas Fort Worth International Airport"
        }
      ],
      "price": 1513,
      "total_duration": 795,
      "type": "Round trip"
    }
  ]
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
