# Google Flights Scraper (`fetch_cat/google-flights-scraper`) Actor

Extract public Google Flights prices, schedules, airlines, stops, and booking links for route/date fare monitoring.

- **URL**: https://apify.com/fetch_cat/google-flights-scraper.md
- **Developed by:** [Fetch Cat](https://apify.com/fetch_cat) (community)
- **Categories:** Travel, SEO tools
- **Features:** Limited permissions
- **Stats:** 7 total users, 1 monthly users, 92.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.03 / 1,000 flight result scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

Extract public **Google Flights** fare options for one route and travel date into a dataset with prices, airlines, schedules, duration, stops and available segment details. Use Google Flights Scraper for fare snapshots, route comparisons and travel research. Export results to CSV, Excel or JSON.

Searches depend on Google's available response, and prices are snapshots—not booking guarantees. `bookingLink` reopens the route search, not an airline checkout or a selected-ticket booking page.

### Quick start

1. Enter origin and destination airport codes, such as `JFK` and `LAX`.
2. Set a future departure date or use `30 days` for a rolling date.
3. Start with `maxResults: 5`, then download the dataset or retrieve it through the API.

```json
{
  "origin": "JFK",
  "destination": "LAX",
  "departureDate": "30 days",
  "tripType": "one-way",
  "currency": "USD",
  "maxResults": 5
}
```

For round-trip searches, explicitly select `tripType: "round-trip"` and supply `returnDate`, for example `37 days`. Airport codes are recommended. City-name precision is not guaranteed.

Prefer a video guide? This short Apify walkthrough shows you how to set up and run an Actor. It uses a different Actor, but the setup steps are the same.

https://youtu.be/1OW8gOqlZbY?t=25

### Ready-to-run examples

Choose a public example to see its settings before starting a run:

- [Compare premium-economy international fares](https://apify.com/fetch_cat/google-flights-scraper/examples/premium-economy-international)
- [Find nonstop one-way flight options](https://apify.com/fetch_cat/google-flights-scraper/examples/one-way-nonstop-search)
- [Monitor round-trip fares for a business route](https://apify.com/fetch_cat/google-flights-scraper/examples/round-trip-price-monitoring)

### What you get

Saved fare-option rows for one requested route and date, with numeric prices and available carrier, timing, stops and segment fields. Optional values can be null, and empty segment lists or round-trip labels do not guarantee a complete outbound/return pairing. Search links reopen Google Flights rather than a selected-ticket checkout.

### Who is it for?

- **Travel researchers** comparing available fare observations for a fixed route.
- **Editorial teams** preparing source-qualified travel content for later verification.
- **Route analysts** organizing separate dated snapshots in their own reporting.
- **Data teams** processing returned fare options and available segment details.

### How you can use the data

- **Prepare a JFK–LAX fare sample.** Use the existing one-way route with the rolling 30-day departure and a small result cap. Keep price, currency, requested dates, passenger counts and scrapedAt together before comparing options.
- **Compare snapshots on consistent terms.** For the same travel date, save a fixed date rather than a rolling value that resolves differently on later runs. Compare fares only with the same route, cabin, passengers and currency in your own system.
- **Inspect the returned itinerary before use.** Review segments, carriers, dates, local times and stops. Round-trip output uses itinerary rows rather than separate outward and return rows, and the label alone does not establish complete pairing.
- **Verify a candidate at the provider.** Use available carrier information and the link that reopens the route search as research context. Recheck fares, passenger totals and baggage before using an observation as a travel quote or publishing it.

### Input settings

| Setting / API key | What it controls |
| --- | --- |
| Origin / `origin` | Required origin airport code or city. |
| Destination / `destination` | Required destination airport code or city. |
| Departure / `departureDate` | Required `YYYY-MM-DD` date or relative value such as `30 days` or `4 weeks`. |
| Return / `returnDate` | Optional date, resolved from the run date when relative. |
| Trip type / `tripType` | `one-way` (form default) or `round-trip`. Use round-trip plus a return date for return searches. |
| Passengers / `adults`, `children`, `infantsInSeat`, `infantsOnLap` | Adults default to 1. Other counts default to 0. |
| Cabin / `cabinClass` | `economy`, `premium_economy`, `business` or `first`. |
| Currency / `currency` | Three-letter currency code. Default `USD`. |
| Result limit / `maxResults` | Maximum selected fare rows, 1–100. Default 10. |
| Ordering / `sortBy` | `best`, `price`, `duration`, `departure` or `arrival`. Applies to available offers, not the entire flight market. |
| Stops / `maxStops` | `any`, `nonstop`, `1` or `2`. |
| Fare filter / `excludeBasicEconomy` | Best-effort exclusion of likely basic-economy offers. Default false. |
| Run limit / `maxRunSeconds` | Advanced deadline and checkpoint setting. See field help. |
| Checkpoint / `resumeItems` | Advanced continuation using only `PENDING_ITEMS` created by this Actor. |
| Connection / `proxyConfiguration` | Existing Apify Proxy configuration, custom proxies or explicit opt-out. See field help for defaults and limitations. |

#### Example inputs

Use the Quick start input as a small first run. Adjust the fields described above for your own data.

### Output data

Illustrative shape-only subset, not a live fare quote:

```json
{
  "queryOrigin": "JFK",
  "queryDestination": "LAX",
  "queryDepartureDate": "2026-11-23",
  "tripType": "one-way",
  "currency": "USD",
  "resultRank": 1,
  "legType": "outbound",
  "airline": null,
  "price": 286,
  "priceText": "USD 286",
  "departureTime": "06:00",
  "arrivalTime": "08:59",
  "durationMinutes": 359,
  "stopsCount": 0,
  "scrapedAt": "2026-10-24T12:00:00.000Z"
}
```

| Fields | Meaning |
| --- | --- |
| `queryOrigin`, `queryDestination` | Uppercase route input. |
| `queryDepartureDate`, `queryReturnDate` | Resolved departure date and optional return date. |
| `tripType`, `cabinClass` | Effective trip type and selected cabin. |
| `adults`, `children`, `infantsInSeat`, `infantsOnLap` | Passenger counts requested. |
| `currency`, `price`, `priceText` | Requested currency, numeric fare and formatted fare text. Only offers with a numeric price are saved. |
| `resultRank`, `isBest` | Saved order and Google's best-offer marker. |
| `legType` | `outbound` for one-way searches.  `itinerary` for round-trip mode. Not separate outbound/return rows. |
| `airline`, `airlineCode`, `fareBrand` | Available carrier and best-effort fare tier. |
| `departureTime`, `arrivalTime`, `departureDate`, `arrivalDate` | Available local times and dates for the returned option. |
| `duration`, `durationMinutes`, `stops`, `stopsCount` | Human-readable and numeric duration and stops. |
| `carryOnIncluded`, `checkedBagsIncluded` | Carry-on flag and checked-bag count. Missing bag information may appear as zero, so confirm baggage with the provider. |
| `segments` | Available segment flight numbers, carriers, airports, local times, aircraft and durations. |
| `flightSummary` | Readable summary of the available carrier, times, duration, stops and price. |
| `bookingToken`, `bookingLink` | Available Google token and a link to reopen the search. Seller-specific booking details are not resolved. |
| `scrapedAt` | Observation timestamp. |

Many optional fields can be `null`, and `segments` can be empty. A round-trip label does not guarantee a complete outbound/return flight pairing or separate return-flight details. Inspect the returned segments before using a fare as a full itinerary.

#### Download your results

Open your run's dataset, choose **Export** and select JSON, CSV or Excel. JSON keeps nested fields together. CSV and Excel are useful when you want to review the records in a spreadsheet.

See [Apify's download and export guide](https://docs.apify.com/storage/dataset#apify-console) for the available formats and field options.

### Pricing

Pay-per-event pricing uses a one-time `start` event and a `result` event for each saved flight-option row. A failed search can incur the start event even if no fare rows are saved. There are no separate error or status dataset rows.

Start with a small cap and a common airport-code route. See the [live Pricing tab](https://apify.com/fetch_cat/google-flights-scraper/pricing) for current rates and discounts.

### Tips for best results

- **Prefer airport codes for a precise route.** City-name resolution is not guaranteed to be exact.
- **Choose fixed or rolling dates deliberately.** Relative dates resolve at run time and change the date sampled by recurring runs.
- **Set round-trip mode and a return date together.** Inspect returned segments rather than assuming complete return-flight detail.
- **Verify unknown baggage before making comparisons.** Missing bag information can appear as zero rather than confirmed no allowance.
- **Keep prices as dated observations.** A booking link reopens search rather than selecting or purchasing a particular ticket.

### Limits and caveats

The Actor searches one route per run rather than combining multiple routes. It does not book tickets, search flexible-date calendars or resolve seller-specific offers. Only options with numeric prices are saved, and filters can reduce the result count.

Google can block requests, require consent or change responses. Blocked, unsupported or empty searches can currently fail rather than return a successful empty dataset. A failed or empty search does not prove that no flights exist.

Prices and availability vary with time, market and currency. Verify fares, passenger totals and baggage directly before purchase or publication. Missing bag information can appear as zero, optional fields can be null and segments can be empty.

Round-trip labels do not guarantee a complete outbound/return pairing. The booking link reopens a route search, not an airline checkout or selected-ticket page. Available-offer sorting is not an ordering of the entire flight market.

Advanced continuation accepts only PENDING_ITEMS created by this Actor, as described in the input help. Cross-run comparisons and alerts require your own workflow. This is not an official or affiliated Google Flights API.

### Automation and integrations

#### Save your settings for next time

Once you have an input that works for you, [save it as an Apify task](https://docs.apify.com/actors/running/tasks). This keeps your settings together so you can use them again without filling in the form from scratch.

#### Run on a schedule

Need fresh results regularly? You can [schedule the Actor or a saved task](https://docs.apify.com/actors/running/schedules) to run at a time that suits you.

Each scheduled run collects the data again. If you want to compare results or highlight changes, add that step in your own workflow.

#### Send results to your other tools

Use **n8n, Make or Zapier** to connect this scraper to the rest of your workflow. For example, you could pass its results to an AI assistant or add records to a spreadsheet. Follow the [Apify integration guides](https://docs.apify.com/integrations) for your chosen tool.

For a custom connection, an [Apify webhook](https://docs.apify.com/integrations/webhooks) can notify your app when a run finishes or fails. Your app can then fetch the results or handle the failure.

### API usage

Want to collect this data from your own app or automation? The examples below send input to the scraper and show how to collect its results.

The Node.js and Python examples wait for the run to finish before reading its results. The cURL example starts the run and returns its details. Wait for that run to finish, then use its `defaultDatasetId` to fetch the results.

For setup instructions, see Apify's [JavaScript client guide](https://docs.apify.com/api/client/js), [Python client guide](https://docs.apify.com/api/client/python) and [Actor runs API reference](https://docs.apify.com/api/v2/acts-runs-post).

#### cURL

```bash
curl -X POST 'https://api.apify.com/v2/acts/fetch_cat~google-flights-scraper/runs' \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  --data @- <<'JSON'
{
  "origin": "JFK",
  "destination": "LAX",
  "departureDate": "30 days",
  "tripType": "one-way",
  "currency": "USD",
  "maxResults": 5
}
JSON
```

#### Node.js

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('fetch_cat/google-flights-scraper').call({
  "origin": "JFK",
  "destination": "LAX",
  "departureDate": "30 days",
  "tripType": "one-way",
  "currency": "USD",
  "maxResults": 5
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ['APIFY_TOKEN'])
run = client.actor('fetch_cat/google-flights-scraper').call(run_input={'origin': 'JFK', 'destination': 'LAX', 'departureDate': '30 days', 'tripType': 'one-way', 'currency': 'USD', 'maxResults': 5})
print(client.dataset(run['defaultDatasetId']).list_items().items)
```

#### API and AI-agent usage notes

The cURL call returns run metadata. Use `defaultDatasetId` to retrieve results when the run finishes.

### MCP and AI agents

You can ask your AI assistant to collect data with **Google Flights Scraper** and help you work with the results. The scraper returns the data, and your assistant can then summarize it, compare records or prepare notes.

Connect your assistant through the [Apify MCP server](https://mcp.apify.com/). MCP gives your assistant a way to find this scraper, run it and read the results. Follow the [official setup and sign-in guide](https://docs.apify.com/mcp) for your app.

#### Easier setup with an Apify plugin

If you use a supported coding assistant, the [official Apify plugin](https://docs.apify.com/agents/plugins) can set up the connection for you. It connects your assistant to Apify and includes instructions for common tasks. Follow the guide for your particular app.

#### Use Apify AI in Console

Prefer to keep everything in Apify? Open [Apify AI in Console](https://docs.apify.com/account/apify-ai) and ask it to find Fetch Cat's **Google Flights Scraper**. You can describe the data you want and ask questions about the results.

Apify AI is currently in beta. It asks for confirmation before starting an Actor, and normal run charges apply.

#### Choose your assistant

- **Claude and Claude Code (Anthropic):** [Apify setup guide](https://docs.apify.com/integrations/claude).
- **ChatGPT and Codex (OpenAI):** [Apify setup guides](https://docs.apify.com/integrations/openai).
- **Grok Bot (xAI):** [Apify plugin guide](https://docs.apify.com/integrations/grok-bot).
- **Gemini CLI (Google):** [MCP server setup guide](https://geminicli.com/docs/tools/mcp-server/). Use the server URL below with the HTTP configuration supported by Gemini CLI.

#### Connect just this scraper

To keep your setup focused on this scraper, add this server configuration to a compatible MCP client:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=fetch_cat/google-flights-scraper"
    }
  }
}
```

Sign in to Apify when your client asks. If your client uses a Bearer token instead, follow its setup guide and keep the token in its secure configuration. Configuration formats vary by app, so use the linked guide if your client needs a different format.

#### Use Apify's general server

Already connected to the general Apify MCP server at `https://mcp.apify.com`? You can use it to find this scraper without adding another server. Ask your assistant to use **Google Flights Scraper** by Fetch Cat, or give it the identifier `fetch_cat/google-flights-scraper`.

Your assistant can check the available settings and retrieve the results from the returned run. If the run is still working, it should follow that run rather than start it again. Both connection options use Apify's hosted service.

#### Example requests

- “Use Fetch Cat’s Google Flights Scraper to collect up to 5 one-way JFK to LAX fare options departing in 30 days, in USD. Show available airlines, times, stops and dated prices without claiming a booking guarantee.”
- “Collect at most 3 nonstop one-way options for the airport codes and future fixed date I provide. Keep passenger counts, currency and collection time so I can compare them with my own earlier snapshot.”
- “Retrieve up to 3 premium-economy round-trip options for my supplied route, departure and return dates. Show available segments and flag incomplete pairing or unknown baggage without treating the search link as checkout.”

Normal Apify charges apply. Check the [live Pricing tab](https://apify.com/fetch_cat/google-flights-scraper/pricing) before asking your assistant to run a larger batch.

### Pay with x402

If your AI agent has a funded wallet, it can pay for Apify usage through [x402](https://docs.apify.com/integrations/x402). This experimental option lets an agent use Apify without a conventional account.

[Apify AGI](https://agi.apify.com/) provides a prepaid API token with a spending cap after payment. Your agent can use that token to run this scraper through the Apify API or an authenticated MCP connection.

Some MCP setups also support paying for each request directly. That is a different payment option, so check the official guide for its availability.

Follow the official guide for wallet setup, supported payment options and current terms. Apify handles the payments. Keep wallet keys and payment tokens in your agent's secure configuration.

#### Other ways for agents to pay

Apify also supports **MPP** for prepaid access through AGI and **Skyfire** for eligible Actors. If your agent already uses one of these, see the [agentic payment guide](https://docs.apify.com/agents/payments) to choose the right setup.

### FAQ

#### Is this a Google Flights API alternative?

It provides structured public fare observations through Apify's API, not an official Google API. It does not perform checkout or guarantee live bookable fares.

#### Can I export Google Flights data to CSV or JSON?

Yes. Download the dataset from Apify as CSV, Excel or JSON, or retrieve it through the dataset API. Nested segments are most convenient in JSON.

#### Can I search round trips or business class?

Choose `tripType: "round-trip"` with `returnDate`, and select `cabinClass: "business"` if wanted. Round-trip rows use `legType: "itinerary"`, but return-flight combinations are not separately resolved. Confirm the actual segments returned.

#### Why did the search fail or return fewer rows?

A restrictive filter, unavailable fare data, Google blocking or a response change can prevent useful output. Review the run log, confirm the route/date and try a smaller common route search. Optional fields are only as complete as Google's response.

#### Can I compare fares over time?

Yes. Store timestamped exports and compare equivalent routes, dates, passenger counts and currencies from separate runs. The Actor itself does not send fare-drop alerts or maintain a price history.

### Related Actors

- [Google Hotels Scraper](https://apify.com/fetch_cat/google-hotels-scraper) — Accommodation price research alongside fares.
- [Google Autocomplete Scraper](https://apify.com/fetch_cat/google-autocomplete-scraper) — Search suggestion research.
- [Google Play Apps Scraper](https://apify.com/fetch_cat/google-play-apps-scraper) — Collect public Android app metadata for travel-app market research.
- [Google Play Reviews Scraper](https://apify.com/fetch_cat/google-play-reviews-scraper) — Public app feedback.
- [Airbnb Listings Scraper](https://apify.com/fetch_cat/airbnb-listings-scraper) — Collect public Airbnb listing data for rental-market research.

### Support and feedback

For custom additions or integrations, email <hello@fetchcat.dev>.

Found an error or have a feature request? [Open an issue](https://apify.com/fetch_cat/google-flights-scraper/issues) with the run URL, a non-sensitive input example and what you expected.

Need help sharing it? See [Apify’s guide to sharing a run when reporting an issue](https://docs.apify.com/account/collaboration/general-resource-access#automatically-sharing-runs-via-actor-issues). Sharing a run can give the developer access to its input, logs and results, so use a run that contains no sensitive data. Please leave out API tokens, passwords, cookies, private documents and personal data. Use a public sample URL or a redacted example instead.

Tried this scraper? We'd love to hear how it worked for you. [Leave a review](https://apify.com/fetch_cat/google-flights-scraper/reviews) to help others choose the right tool and help us improve it. Your feedback means a lot to us.

Made with care for curious people, AI agents and the possibilities in data. ♥

# Changelog

This Actor's version history is a separate document: https://apify.com/fetch_cat/google-flights-scraper/changelog.md

# Actor input Schema

## `origin` (type: `string`):

Airport code or city to fly from. Airport codes are the most reliable, for example JFK, LAX, SFO, or London.

## `destination` (type: `string`):

Airport code or city to fly to. Airport codes are recommended for precise results.

## `departureDate` (type: `string`):

Departure date in YYYY-MM-DD format, or a relative date such as 30 days. The relative date moves forward for scheduled runs.

## `returnDate` (type: `string`):

Optional return date in YYYY-MM-DD format or relative to the run date, such as 37 days. Leave empty for one-way searches.

## `tripType` (type: `string`):

Choose one-way or round-trip. For a round trip, select round-trip and provide returnDate. Explicit one-way takes precedence even when a return date is supplied; when tripType is omitted, a supplied return date selects round-trip.

## `maxResults` (type: `integer`):

Maximum number of flight option rows to save. Keep low for first tests.

## `adults` (type: `integer`):

Number of adult passengers.

## `children` (type: `integer`):

Number of child passengers.

## `infantsInSeat` (type: `integer`):

Number of infant passengers with their own seat.

## `infantsOnLap` (type: `integer`):

Number of infant passengers on lap.

## `cabinClass` (type: `string`):

Preferred seating class.

## `currency` (type: `string`):

Currency code to request in Google Flights, for example USD, EUR, or GBP.

## `maxRunSeconds` (type: `integer`):

Advanced safety limit (20–270 seconds). The Actor saves each fare as it goes and stores remaining rows in PENDING_ITEMS when the deadline is reached.

## `resumeItems` (type: `array`):

Advanced: paste the PENDING_ITEMS value from a deadline-limited run to save only its remaining fare rows.

## `sortBy` (type: `string`):

Order the available offers before applying maxResults: best puts Google-marked best offers first, then lowest price; price and duration sort numerically; departure and arrival sort the displayed local clock times. This does not search additional flights.

## `maxStops` (type: `string`):

Keep offers with a known stop count at or below the selected maximum. Any keeps all available offers. The limit filters the returned offers before maxResults; it does not expand the search.

## `excludeBasicEconomy` (type: `boolean`):

Exclude lowest-tier fares only when Google's payload also indicates no included checked bag. This avoids dropping normal economy on international routes.

## `proxyConfiguration` (type: `object`):

Uses Apify Proxy from the first request when omitted (useApifyProxy: true, no named group). Explicit settings are passed to Apify unchanged: choose available managed groups/country, supply your own proxy URLs, or set useApifyProxy: false with no proxyUrls for direct access. There is no automatic direct-to-proxy or provider fallback. Proxy availability and charges depend on your account; invalid settings may fail rather than selecting another route. Do not share proxy credentials in issue reports.

## Actor input object example

```json
{
  "origin": "JFK",
  "destination": "LAX",
  "departureDate": "30 days",
  "returnDate": "",
  "tripType": "one-way",
  "maxResults": 10,
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "cabinClass": "economy",
  "currency": "USD",
  "maxRunSeconds": 60,
  "resumeItems": [],
  "sortBy": "best",
  "maxStops": "any",
  "excludeBasicEconomy": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "origin": "JFK",
    "destination": "LAX",
    "departureDate": "30 days",
    "returnDate": "",
    "tripType": "one-way",
    "cabinClass": "economy",
    "currency": "USD",
    "sortBy": "best",
    "maxStops": "any"
};

// Run the Actor and wait for it to finish
const run = await client.actor("fetch_cat/google-flights-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "origin": "JFK",
    "destination": "LAX",
    "departureDate": "30 days",
    "returnDate": "",
    "tripType": "one-way",
    "cabinClass": "economy",
    "currency": "USD",
    "sortBy": "best",
    "maxStops": "any",
}

# Run the Actor and wait for it to finish
run = client.actor("fetch_cat/google-flights-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "origin": "JFK",
  "destination": "LAX",
  "departureDate": "30 days",
  "returnDate": "",
  "tripType": "one-way",
  "cabinClass": "economy",
  "currency": "USD",
  "sortBy": "best",
  "maxStops": "any"
}' |
apify call fetch_cat/google-flights-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fetch_cat/google-flights-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/okIzc2YlKxBvJcj4L/builds/eVQU9OWkEGUfdVQJD/openapi.json
