# Agoda Flight Scraper (`romy/agoda-flight-scraper`) Actor

Search Agoda flight itineraries by route and date: fares, carriers, stops, baggage and cancellation policy. No login needed.

- **URL**: https://apify.com/romy/agoda-flight-scraper.md
- **Developed by:** [Romy](https://apify.com/romy) (community)
- **Categories:** Travel
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## Agoda Flight Scraper

Search Agoda flight itineraries by route and date: fares, carriers, stops,
baggage and cancellation policy. Wraps the same reverse-engineered,
already-verified Agoda Android-app API (`searchapi.agoda.com`) used by the
[Agoda All-in-One API](https://apify.com/RomySaputraSihananda/agoda-all-in-one-api)
actor — this actor is a narrow, run-based spin-off focused only on flight
search. No account, login, app or device needed.

### Why

Agoda's flight-search API needs no login and no request signing to read —
the only quirks are a public per-app client key (not a secret) and a hard
pace limit (bursts trigger empty-bodied HTTP 502s, handled internally by
throttling and retrying every request). Flight search itself is
asynchronous server-side: a search is submitted, then the same request body
is re-polled until the upstream marks it complete. This actor mirrors that
protocol exactly (up to 5 polls per page) and paginates it up to
`maxResults` itineraries.

- **Search filters and sorts are honest.** Server-side flight filters
  (stops, airlines, departure/arrival times, duration, price range) and
  most upstream sort options were live-tested and found unreliable/inert on
  Agoda's own API — they validate but don't change the result. This actor
  does not pretend otherwise: those are **not** exposed as input fields.
  There is no client-side sort either, since a spin-off actor should not
  promise anything beyond what it genuinely does. If you need honest
  filtering, filter or sort the dataset rows yourself after the run.
- **Unresolvable routes don't hang or error.** A bad/nonexistent IATA pair
  never completes upstream polling. After the polling cap, the actor
  surfaces whatever partial data exists with `search_page_is_completed:
  false` on the affected rows (and a run-log warning), rather than hanging
  or throwing.
- **Prices can differ between identical calls** (Agoda's own live pricing
  engine, not a bug here) — expect small variance run to run.

### Input

| Field         | Required | Description                                                                                                                                                                                                 |
| ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `origin`      | yes      | Origin airport/city, 3-letter IATA code (e.g. `CGK`).                                                                                                                                                       |
| `destination` | yes      | Destination airport/city, 3-letter IATA code (e.g. `SIN`).                                                                                                                                                  |
| `departDate`  | no       | Departure date, `YYYY-MM-DD`. Defaults to 30 days after the run date.                                                                                                                                       |
| `returnDate`  | no       | Return date, `YYYY-MM-DD`. Adds a return slice (round trip) when given; omit for one-way.                                                                                                                   |
| `adults`      | no       | Adult passengers, 1-9 (default 1).                                                                                                                                                                          |
| `children`    | no       | Child passengers, 0-8 (default 0).                                                                                                                                                                          |
| `infants`     | no       | Lap-infant passengers, 0-8 (default 0).                                                                                                                                                                     |
| `cabin`       | no       | One of `Economy`, `PremiumEconomy`, `Business`, `First` (default `Economy`).                                                                                                                                |
| `currency`    | no       | 3-letter ISO currency code for prices (default `USD`).                                                                                                                                                      |
| `locale`      | no       | Response language as an Agoda locale, e.g. `th-th`, `ja-jp` (default `en-us`). Not every locale is translated server-side; unsupported ones silently fall back to English.                                  |
| `maxResults`  | no       | Stop after this many itineraries, 1-500 (default 20). Paginates the upstream search (20 itineraries per page) until this many are collected, the route runs out of results, or the search stops completing. |

### Output

One dataset row per flight itinerary: price breakdown, ticketing carrier,
trip duration, cancellation policy, and the full outbound/inbound slice
(segments, layovers, baggage allowance, cabin, booking class). Each row
also carries `search_*` fields (route, dates, cabin, currency, page, and
whether that page's upstream polling completed) so a row is self-describing
without needing the run's input.

### Pricing

Pay-per-event (PPE), tiered by Apify plan (FREE/BRONZE/SILVER/GOLD/PLATINUM/
DIAMOND = 100/92/85/78/72/68% of the FREE price). Same per-itinerary price
as the `flight-itinerary` event on the Agoda All-in-One API, for pricing
consistency across this account's Agoda product line. See the Actor's
Pricing tab for the exact current price.

### Known limitations

- Upstream result filters (stops, airlines, times, duration, price) and
  upstream sort are validated but not applied server-side by Agoda's own
  API — not exposed here, see "Why" above.
- `/flight/searchunbundled` polls up to 5 times per page; a route with no
  real itineraries returns partial/empty results with
  `search_page_is_completed: false` rather than hanging.
- 20 itineraries per upstream page; `maxResults` above 20 means multiple
  upstream requests (and multiple poll cycles), so large values take
  proportionally longer.
- This actor only searches; it does not book or hold fares.

### Getting started

```bash
npm install
npm run start:dev
```

# Actor input Schema

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

Origin airport/city, 3-letter IATA code (e.g. CGK).

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

Destination airport/city, 3-letter IATA code (e.g. SIN).

## `departDate` (type: `string`):

Departure date, format YYYY-MM-DD. Optional: defaults to 30 days after the run date.

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

Return date, format YYYY-MM-DD. Adds a return slice (round trip) when given; leave empty for one-way.

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

Adult passengers (default 1).

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

Child passengers (default 0).

## `infants` (type: `integer`):

Lap-infant passengers (default 0).

## `cabin` (type: `string`):

Cabin class (default Economy).

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

3-letter ISO currency code for prices (default USD).

## `locale` (type: `string`):

Response language as an Agoda locale, e.g. th-th, ja-jp, zh-cn (default en-us). Not every locale is translated server-side; unsupported ones silently fall back to English.

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

Stop after this many itineraries. Paginates the underlying search (20 itineraries per upstream page) until this many are collected, the route runs out of results, or the search stops completing (bad/unresolvable routes never finish upstream).

## Actor input object example

```json
{
  "origin": "CGK",
  "destination": "SIN",
  "adults": 1,
  "children": 0,
  "infants": 0,
  "cabin": "Economy",
  "currency": "USD",
  "locale": "en-us",
  "maxResults": 20
}
```

# Actor output Schema

## `dataset` (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": "CGK",
    "destination": "SIN"
};

// Run the Actor and wait for it to finish
const run = await client.actor("romy/agoda-flight-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": "CGK",
    "destination": "SIN",
}

# Run the Actor and wait for it to finish
run = client.actor("romy/agoda-flight-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": "CGK",
  "destination": "SIN"
}' |
apify call romy/agoda-flight-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,romy/agoda-flight-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/zTzElxfnTx5MUkFVj/builds/FjlmNfPkq2x9aAD2V/openapi.json
