# Kayak Flights Scraper (`khadinakbar/kayak-flights-scraper`) Actor

Scrape Kayak flight search results with prices, booking providers, direct-airline flags, baggage, segments, aircraft, and cabin details. MCP-ready.

- **URL**: https://apify.com/khadinakbar/kayak-flights-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Travel, Automation, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 flight founds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Kayak Flights Scraper

Scrape Kayak flight result pages into clean itinerary records with prices, booking providers, airline-direct flags, baggage signals, fare options, legs, segments, aircraft, and cabin details.

The actor drives Kayak's own flight results page in Playwright and captures the signed dynamic flight poll responses that the page emits. It can also paginate through the same endpoint after the first page is captured.

### What You Get

- Flight itinerary price, currency, provider, booking link, rank, and Kayak share URL
- Airline names and codes across all legs
- Per-leg and per-segment times, airports, duration, aircraft, and flight numbers
- Booking options with direct-airline flags, free-cancellation flags, carry-on and checked-bag information
- Fare buckets where Kayak returns them, such as basic economy, main cabin, or business fare variants
- `RUN_SUMMARY` and `OUTPUT` records in the key-value store for automation-friendly status checks

### Input

Use either structured route fields or full Kayak URLs.

Structured example:

```json
{
  "origin": "LAX",
  "destination": "NYC",
  "departureDate": "2026-09-15",
  "returnDate": "2026-09-22",
  "adults": 2,
  "cabinClass": "business",
  "sortMode": "price_a",
  "maxResults": 25
}
```

URL example:

```json
{
  "startUrls": [
    "https://www.kayak.com/flights/LAX-NYC/2026-09-15/2026-09-22/business/2adults?sort=price_a"
  ],
  "maxResults": 50
}
```

Structured searches accept airport or metro codes such as `LAX`, `NYC`, `LON`, and `SFO`. For custom Kayak searches, paste a full Kayak `/flights/...` result URL into `startUrls`.

### Pricing

This actor uses pay per event:

- `apify-actor-start`: `$0.00005` per GB of run memory, minimum one event
- `flight-found`: `$0.006` per validated flight itinerary stored in the dataset

Filtered-out, invalid, blocked, or empty results are not charged as `flight-found` events.

### Notes

Flight prices and availability change frequently. The dataset reflects what Kayak returned during the actor run. Residential proxy is recommended for cloud runs; direct local runs may work for probing, but datacenter IPs can be blocked.

# Actor input Schema

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

Origin airport or metro code for a structured Kayak search, e.g. LAX, JFK, NYC, LON. Ignored when startUrls are provided.

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

Destination airport or metro code for a structured Kayak search, e.g. NYC, SFO, LHR. Ignored when startUrls are provided.

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

Departure date in YYYY-MM-DD format. Must be today or later. Ignored when startUrls are provided.

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

Optional return date in YYYY-MM-DD format. Leave empty for one-way searches. Must be after departureDate. Ignored when startUrls are provided.

## `startUrls` (type: `array`):

Full Kayak flight result URLs to scrape directly, e.g. https://www.kayak.com/flights/LAX-NYC/2026-09-15/2026-09-22/business/2adults?sort=price\_a. Use this for prebuilt Kayak searches.

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

Number of adult passengers for structured searches. Range 1-9. Kayak encodes this in the generated URL, so it affects returned prices.

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

Cabin class for structured searches. Kayak currently applies economy, premium economy, and business in the URL grammar used by this actor.

## `sortMode` (type: `string`):

Kayak sort mode for structured searches. Ignored when a startUrl already contains sort.

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

Maximum number of flight itineraries to return across all searches. Each stored itinerary is one billed flight-found event.

## `maxStops` (type: `integer`):

Optional post-filter. Set 0 for nonstop only, 1 for one stop or nonstop, etc. Filtered-out flights are not billed.

## `airlineDirectOnly` (type: `boolean`):

When true, keep only itineraries whose cheapest retained booking option is marked by Kayak as direct with the airline. Filtered-out flights are not billed.

## `waitForResultsSecs` (type: `integer`):

Maximum seconds to wait for Kayak's first search page before marking that search as blocked or empty.

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

Proxy settings. Residential proxy is recommended for cloud runs because Kayak may block datacenter IPs. Set useApifyProxy to false for direct local probing.

## `saveRawDebug` (type: `boolean`):

Save the first raw Kayak poll response and blocked-page diagnostics to the key-value store for parser debugging.

## Actor input object example

```json
{
  "origin": "LAX",
  "destination": "NYC",
  "departureDate": "2026-09-15",
  "returnDate": "2026-09-22",
  "startUrls": [
    "https://www.kayak.com/flights/LAX-NYC/2026-09-15/2026-09-22?sort=bestflight_a"
  ],
  "adults": 1,
  "cabinClass": "economy",
  "sortMode": "bestflight_a",
  "maxResults": 50,
  "airlineDirectOnly": false,
  "waitForResultsSecs": 45,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "saveRawDebug": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

Validated flight itinerary records returned by Kayak. Download as JSON, CSV, Excel, HTML, or RSS.

## `runSummary` (type: `string`):

Outcome, counts, billing, filters, and upstream warnings for this run.

## `output` (type: `string`):

Compact outcome and counts for automation and MCP clients.

# 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": "LAX",
    "destination": "NYC",
    "departureDate": "2026-09-15",
    "returnDate": "2026-09-22",
    "adults": 1,
    "maxResults": 50,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/kayak-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": "LAX",
    "destination": "NYC",
    "departureDate": "2026-09-15",
    "returnDate": "2026-09-22",
    "adults": 1,
    "maxResults": 50,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/kayak-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": "LAX",
  "destination": "NYC",
  "departureDate": "2026-09-15",
  "returnDate": "2026-09-22",
  "adults": 1,
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call khadinakbar/kayak-flights-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,khadinakbar/kayak-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/Y6ekiNuQCqR2JQnT7/builds/1ZDE4kMu6M57SdfZM/openapi.json
