# Thailand Flight Prices Scraper | Inbound & Domestic Flights (`mai_amm/thailand-flight-prices-scraper`) Actor

Search international and domestic flights to Thailand. Compare dates, exact airports and connections. Export THB fares to JSON or CSV. $4/1,000 returned itineraries.

- **URL**: https://apify.com/mai_amm/thailand-flight-prices-scraper.md
- **Developed by:** [wiseld_squid](https://apify.com/mai_amm) (community)
- **Categories:** Other, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 returned fresh flight itineraries

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/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

## Thailand Flight Prices Scraper

Search one-way economy flights **to and within Thailand** and export prices, airlines, flight numbers, departure and arrival times, airports, aircraft, and connecting segments from Trip.com. Use it for fare monitoring, travel research, dashboards, and AI travel assistants.

Search from international origin cities such as Singapore (`SIN`), Hong Kong (`HKG`), Tokyo (`TYO`), and London (`LON`) to Bangkok, Chiang Mai, Phuket, Krabi, Hat Yai, Koh Samui, and other Thai destinations. Domestic Thailand routes are also supported. **The final destination must be in Thailand.** Prices are returned in **Thai baht (THB)** for the requested number of adults.

### Quick start

1. Enter origin and destination city codes.
2. Choose your departure date and number of adults.
3. Optionally select exact airports, nonstop flights, or a maximum total price.
4. Run the Actor and download JSON, CSV, or Excel from its Dataset.

```json
{
  "origin": "BKK",
  "destination": "CNX",
  "originAirport": "DMK",
  "departureDate": "2026-11-18",
  "adults": 1,
  "nonStopOnly": true,
  "maxItems": 100
}
```

Replace the example date with your travel date. Dates must be today through 330 days ahead.

**Bangkok city versus airport:** `BKK` as a city includes both Suvarnabhumi and Don Mueang. Set `originAirport: "BKK"` for Suvarnabhumi or `originAirport: "DMK"` for Don Mueang. Leaving the airport filter empty searches the city. The same distinction applies to `destinationAirport` when flying into Bangkok. Entering `DMK` as a city is also accepted and selects Don Mueang.

### Input

| Field | Default | Description |
| --- | --- | --- |
| `origin` | `BKK` | Origin city IATA code worldwide, such as SIN, HKG, TYO or LON. |
| `destination` | `CNX` | Destination city IATA code in Thailand, such as BKK, CNX or HKT. |
| `originAirport` | Empty | Restrict the actual first departure airport. |
| `destinationAirport` | Empty | Restrict the actual final arrival airport. |
| `departureDate` | Required | Local departure date, `YYYY-MM-DD`. |
| `additionalDates` | `[]` | Up to 30 additional dates on the same route. Duplicate dates are removed. |
| `adults` | `1` | 1–9 adults. Child and infant fares are not supported. |
| `nonStopOnly` | `false` | Keep flights with no connections or reported intermediate stops. |
| `maxPrice` | `0` | Maximum total THB price for all adults. `0` disables this filter. |
| `sortBy` | `price` | Sort each date's results by `price`, `departure`, or `duration`. |
| `maxItems` | `100` | Total output limit across dates. Paying accounts can use `0` for all eligible returned results. |
| `maxSearches` | `5` | Maximum date searches per run, up to 31. |
| `maxRunSeconds` | `180` | Collection time budget, 30–600 seconds. Increase the Actor timeout accordingly for longer runs. |

Dates run in input order. Sorting applies within each date, rather than ranking all dates together. `maxItems: 0` remains subject to the number of source results, date/search limits, time budget, and your maximum service charge. It does not create results beyond those returned by the source.

Example: compare three departure dates from Suvarnabhumi to Phuket:

```json
{
  "origin": "BKK",
  "destination": "HKT",
  "originAirport": "BKK",
  "departureDate": "2026-11-18",
  "additionalDates": ["2026-11-19", "2026-11-20"],
  "adults": 2,
  "maxPrice": 10000,
  "maxItems": 0,
  "maxSearches": 3
}
```

### International origins

Use a city code for `origin` and an optional airport code for `originAirport`. For example, Tokyo is `TYO`; `NRT` and `HND` are airports within that city. London is `LON`; choose `LHR` as the exact airport if needed. Do not substitute an airport code for a different city code.

Example: Singapore to Suvarnabhumi, with prices in THB:

```json
{
  "origin": "SIN",
  "destination": "BKK",
  "destinationAirport": "BKK",
  "departureDate": "2026-11-18",
  "adults": 1,
  "maxItems": 50
}
```

Flight departure and arrival times remain local to their respective airports. An international itinerary can cross time zones and arrive on a different calendar day. `totalPrice` remains the total THB quote for the requested adults.

### Pricing and free trial

**$4 per 1,000 fresh itineraries returned** ($0.004 each). An itinerary can contain one or more flight segments. The Actor returns the lowest-priced returned fare option for each distinct itinerary and passenger count.

- Paying Apify accounts can run fresh searches repeatedly. Only itineraries actually exported incur the itinerary service fee; filtered results and failed searches have no itinerary fee.
- A free Apify account gets **one live date search**, with up to **10 returned itineraries**. Subsequent runs return that first saved result, even if the input or Actor build changes. Look for `reusedResult: true` and the original `observedAt` timestamp.
- The first free attempt is consumed even if no matching flights are returned or the search is interrupted. Saved trial results depend on retaining the account's trial storage.
- **Apify platform usage is paid by the runner**, including trial runs and saved-result replays. It is separate from the itinerary service fee.
- Your maximum service charge limits fresh paid output. If the remaining allowance cannot cover another itinerary, collection stops. Replaying saved trial data has no itinerary fee.

For example, 50 fresh returned itineraries cost **$0.20 in service fees**, plus Apify platform usage.

### Output

Each Dataset row represents an itinerary with the cheapest fare option returned for the requested adults. Key fields:

| Field | Meaning |
| --- | --- |
| `itineraryId` | Stable identifier based on flight segments and adult count; useful when comparing scheduled runs. |
| `totalPrice` | Total THB price for **all requested adults**, not a per-person quote. |
| `averagePrice`, `totalTax` | Average fare and tax amounts as supplied by the source. |
| `adults`, `priceBasis` | Passenger count and `total_for_all_adults`. |
| `flightNumbers`, `airlines` | Convenient text columns for CSV and table views. |
| `originAirport`, `destinationAirport` | Actual first departure and final arrival airports. |
| `departureLocal`, `arrivalLocal` | Source-local date and time strings; these are not UTC timestamps. |
| `direct`, `connectionCount`, `durationMinutes` | Nonstop flag, number of flight connections, and source-reported journey duration. |
| `legs` | Full segment details, including airline, airports, times, aircraft, and reported technical stops. |
| `passengerPrices` | Source-provided price breakdown by passenger type. |
| `originCountry`, `destinationCountry` | Source-reported origin and destination country codes. The destination country is TH. |
| `observedAt` | UTC time the result was collected. It is not a timestamp of the airline's last price update. |
| `checkedBaggageKg`, `cabinBaggageKg` | `null` where weight allowances are not available. |
| `fareRevalidated` | `false`; the Actor does not complete a checkout price confirmation. |
| `reusedResult` | Whether this is a saved free-trial result. |

A stable ID does not guarantee a flight will remain on sale. Codeshares and different itineraries can refer to the same operating flight. Missing baggage weights do not mean zero allowance or included baggage.

The **SUMMARY** output reports searched dates, returned and charged counts, request count, errors, stop reason, and whether output is partial. A blocked or failed search is reported as an error rather than being presented as a sold-out route. If a later date fails, earlier saved results are retained.

### Repeated monitoring and API access

Paying accounts can schedule this Actor to run repeatedly, then compare `itineraryId`, `totalPrice`, and `observedAt` in successive Datasets. Historical price comparisons and notifications are handled by your downstream workflow; this Actor does not maintain a price-history database or send alerts itself.

Start a run using the Apify API:

```bash
curl -X POST \
  'https://api.apify.com/v2/acts/mai_amm~thailand-flight-prices-scraper/runs' \
  -H 'Authorization: Bearer YOUR_APIFY_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"origin":"BKK","destination":"CNX","originAirport":"DMK","departureDate":"2026-11-18","adults":1,"maxItems":50}'
```

Wait for the run to finish, then use its `defaultDatasetId` to retrieve results from `GET https://api.apify.com/v2/datasets/DATASET_ID/items?format=json`. CSV exports contain convenient flat columns; use JSON for complete segment and passenger-price structures.

### Scope and limitations

This release supports **one-way economy searches with adults, from international or Thai origins to a destination in Thailand**. Routes ending outside Thailand are rejected. Return tickets, multi-city trips, booking transactions, exact remaining-seat counts, verified baggage allowances, and checkout-confirmed fares are not included.

Prices and availability can change between collection and booking. Discounts, payment fees, membership offers, and optional services can affect the final payable amount. Verify the fare and conditions before purchase. Results reflect the source's available offers and do not guarantee coverage of every airline or fare. Access can change, and a successful test does not guarantee uninterrupted availability.

This is an independent Actor and is not affiliated with Trip.com or any airline. Use the data in accordance with applicable terms and laws.

# Actor input Schema

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

Origin IATA city code worldwide, such as SIN, HKG, TYO or LON. BKK includes Bangkok airports; DMK selects Don Mueang.

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

Destination IATA city code in Thailand, such as BKK, CNX or HKT. International origins are supported; the destination must be in Thailand.

## `originAirport` (type: `string`):

Optional exact departure airport, for example NRT with city TYO, LHR with city LON, or DMK with city BKK.

## `destinationAirport` (type: `string`):

Optional actual arrival airport code.

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

Local departure date in YYYY-MM-DD format, today through 330 days ahead.

## `additionalDates` (type: `array`):

Additional dates for the same route. Dates are searched in input order; duplicates are removed.

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

Number of adult passengers. totalPrice covers all requested adults.

## `nonStopOnly` (type: `boolean`):

Exclude flight connections and reported intermediate stops.

## `maxPrice` (type: `number`):

Maximum fare for the entire adult party. Zero disables the filter.

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

Choose the output order within each departure date.

## `maxItems` (type: `integer`):

Total output across dates. Paying accounts may use 0 for all eligible source results within the run and service-charge limits.

## `maxSearches` (type: `integer`):

Maximum searches per run. The free trial performs one date search.

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

Maximum collection time. Also increase the Actor timeout if setting a longer budget.

## Actor input object example

```json
{
  "origin": "BKK",
  "destination": "CNX",
  "departureDate": "2026-11-18",
  "adults": 1,
  "nonStopOnly": false,
  "maxPrice": 0,
  "sortBy": "price",
  "maxItems": 100,
  "maxSearches": 5,
  "maxRunSeconds": 180
}
```

# Actor output Schema

## `flights` (type: `string`):

No description

## `summary` (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 = {
    "departureDate": "2026-11-18"
};

// Run the Actor and wait for it to finish
const run = await client.actor("mai_amm/thailand-flight-prices-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 = { "departureDate": "2026-11-18" }

# Run the Actor and wait for it to finish
run = client.actor("mai_amm/thailand-flight-prices-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 '{
  "departureDate": "2026-11-18"
}' |
apify call mai_amm/thailand-flight-prices-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mai_amm/thailand-flight-prices-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/z4c6csYw1ENCkDpHD/builds/dbMdb3usSvqRhZtQ0/openapi.json
