# Historical Flight Prices: Build Your Own Fare History

Searches Google Flights for one-way fares from Los Angeles (LAX) to Tokyo Narita (NRT) and returns each itinerary's price, airlines, stops and duration. Run it on a schedule and every dataset is a dated snapshot, so the runs together form a fare history you own and can chart.

- Actor: openclawai/google-flights-scraper (Google Flights Scraper), https://datapika.com/actors/google-flights-scraper
- Run on Apify: https://apify.com/openclawai/google-flights-scraper
- Tested: 2026-11-26, 10 rows in 16 seconds, $0.02 at free-plan prices

## Input

```json
{
  "from_airport": "LAX",
  "to_airport": "NRT",
  "date": "2027-03-05",
  "trip": "one-way",
  "max_results": 25
}
```

## Output fields

- `airline_names`: Airline
- `price`: Price
- `currency`: Currency
- `departure`: Departure
- `arrival`: Arrival
- `stops`: Stops
- `duration_min_total`: Duration (min)
- `from_airport`: from_airport
- `to_airport`: to_airport

## Sample rows (personal data masked)

```json
[
  {
    "airline_names": [
      "ZIPAIR Tokyo"
    ],
    "price": 484,
    "currency": "USD",
    "departure": "2027-03-05T09:40:00",
    "arrival": "2027-03-06T14:25:00",
    "stops": 0,
    "duration_min_total": 705,
    "from_airport": "LAX",
    "to_airport": "NRT"
  },
  {
    "airline_names": [
      "Philippine Airlines"
    ],
    "price": 542,
    "currency": "USD",
    "departure": "2027-03-05T11:10:00",
    "arrival": "2027-03-07T12:50:00",
    "stops": 1,
    "duration_min_total": 1185,
    "from_airport": "LAX",
    "to_airport": "NRT"
  },
  {
    "airline_names": [
      "Cathay Pacific"
    ],
    "price": 557,
    "currency": "USD",
    "departure": "2027-03-05T21:20:00",
    "arrival": "2027-03-07T13:10:00",
    "stops": 1,
    "duration_min_total": 1180,
    "from_airport": "LAX",
    "to_airport": "NRT"
  }
]
```

Full sample: https://datapika.com/data/tasks/historical-flight-prices.json

## How to run it

1. **Open the actor on Apify.** Click Copy input, then Run on Apify to open the Google Flights Scraper. Sign in or create a free account, open the JSON tab of the input form and paste the input.
2. **Start the "Historical Flight Prices: Build Your Own Fare History" task.** Press Start. Change any input field first if you need a different topic, account or size; the fields are listed above.
3. **Get the results.** Rows arrive in a dataset while the run works. Our test returned 10 rows in 16 seconds.
4. **Use the data.** Download JSON, CSV or Excel, call the run from the API, schedule it, or let an AI agent run it through MCP.

API (replace the token):

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/openclawai~google-flights-scraper/run-sync-get-dataset-items?maxTotalChargeUsd=1" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"from_airport":"LAX","to_airport":"NRT","date":"2027-03-05","trip":"one-way","max_results":25}'
```

## Change it

- from_airport and to_airport take three-letter airport codes such as JFK, LHR or NRT.
- date and return_date take YYYY-MM-DD; set trip to round-trip when you add a return date.
- trip takes one-way, round-trip or multi-city (one leg per search).
- max_results caps the itineraries returned (1 to 200); you pay only for those returned.

## FAQ

### Can I get prices from before my first run?

No. The task records fares as Google Flights shows them at run time, so your history starts with the first scheduled run. Keep the datasets, or send each run to a spreadsheet or database, to build the series.

### How often should it run?

Once a day is enough for most routes, since fares move with demand and the days left to departure. Add an Apify schedule and use max_results (1 to 200) to set how many itineraries each snapshot keeps.

### Do I need a Google account or API key?

No. It reads public Google Flights results with no login, cookie or API key. Run it from the Apify Console, the API, or an AI agent through MCP.

### How much does it cost?

You pay per itinerary delivered to your dataset. There is no start fee. The current prices are on the Pricing tab.
