# Airfare Price Drop Monitor (Your Fare Data) (`felixgoldwin/airfare-price-drop-monitor`) Actor

Compare your authorized fare snapshots by route, travel dates, currency, cabin and party size. Emit price-drop and target-crossing alerts. No embedded fare feed.

- **URL**: https://apify.com/felixgoldwin/airfare-price-drop-monitor.md
- **Developed by:** [Felix GoldWin](https://apify.com/felixgoldwin) (community)
- **Categories:** Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

## Airfare Price Drop Monitor (Your Fare Data)

Compare two price observations for one exact flight search. Get a dataset row when the lowest observed total drops by a meaningful amount, crosses your target, or both. This is a **bring-your-own-data comparator, not a live flight-search scraper, fare feed, or booking service**. It does not access Google Flights, airline websites, any provider API, or booking systems.

### Quick start

- **Demo (default):** no input or network needed. See the synthetic example in `DEMO_RESULT`. Demo writes no dataset rows and does not provide a reusable baseline.
- **Snapshot:** provide `currentSnapshot` and, to compare against an earlier run, pass that run's `SNAPSHOT` unchanged as `previousSnapshot`. Confirm that you have authorization to transmit, store and process the data on Apify. Send only the documented fields. Do not send raw provider responses, booking references, traveler information or API credentials.
- The dataset defaults to alerts only. For a baseline row or clean no-change result, set `outputPolicy` to `all`; diagnostic and stale statuses go to `SUMMARY` only. No booking, messaging, schedules, automatic storage lookups, or provider enrollment is configured.

Use `node examples/make-input.js` to generate a current **simulated** comparison with USD 780.00 to 650.00 and a USD 700.00 target. Its output demonstrates `PRICE_DROP` and `TARGET_REACHED`; it is not a real fare.

#### Snapshot format

```json
{
  "version": 1,
  "scope": {
    "sourceId": "my-licensed-feed",
    "origin": "SFO",
    "destination": "NRT",
    "departureDate": "2027-04-15",
    "returnDate": "2027-04-29",
    "currency": "USD",
    "market": "US",
    "cabin": "economy",
    "adults": 1,
    "maxStops": 0,
    "baggage": "any"
  },
  "observedAt": "2027-02-01T18:00:00Z",
  "expiresAt": null,
  "coverage": "complete",
  "lowestTotalMinor": 65000
}
```

| Field | Meaning |
| --- | --- |
| `scope.sourceId` | Stable caller-defined lowercase identifier. Use separate identifiers for different sources or upstream search rules. Never put a token or account ID here. |
| `origin`, `destination` | Distinct three-letter IATA airport codes. Scope requires exact values; the Actor validates format, not airport existence. |
| `departureDate`, `returnDate` | Local calendar dates for the respective flights. Use `null` or omit return date for one way. No open-jaw or multi-city queries. |
| `currency`, `market` | Three uppercase currency letters and two uppercase market letters. Pass the same pricing currency and point of sale in both observations. No FX. |
| `cabin`, `adults` | `economy`, `premium_economy`, `business`, or `first`, and 1–9 adults. No children, infants or mixed cabin. |
| `maxStops`, `baggage` | Stops per direction: `0`–`3` or explicit `null` for any. Baggage: `any`, `carry_on_included`, or `checked_bag_included`. |
| `observedAt`, `expiresAt` | UTC timestamps ending in `Z`; optional expiry may be `null`. An expired current quote will never alert. The Actor cannot know real quote expiry if none is supplied. |
| `coverage` | `complete` means your provider finished the identical filtered query; not a claim to cover all airlines. `partial` means incomplete (e.g. unfinished polling), `unavailable` means provider error. |
| `lowestTotalMinor` | Lowest **total for every traveler and both outbound/return legs if applicable**, including taxes and agreed required fees. Integer currency minor units: USD 650.00 → 65000; JPY 650 → 650. Use `null` when no matching fare was observed. Never treat an API failure as zero or a complete no-offer search. |

#### Alert rules

- A price drop has to meet both `minDropMinor` (default 1) and `minDropBasisPoints` (default 500 = 5%). Comparisons are exact integer arithmetic, not rounded percent.
- The optional `targetTotalMinor` threshold fires when a price moves from above to at or below the target. It also fires if a matching fare reappears after a complete comparable no-offer observation. A first-run target alert is opt-in.
- Every search scope field must agree; timestamps must be distinct and increasing. Historical data may be compared for up to 30 days by default. A stale (over 60 minutes by default), expired, partial or unavailable **current** observation will not alert or replace the older baseline.
- One dataset row at most per run, including when both alert reasons fire. Retry with the exact inputs and your receiver gets the same `alertId`; deduplicate on that ID in your webhook/job. Runs do not share automatic state. For polling, your workflow must pass the previous `SNAPSHOT` to the next run and store the successful replacement. Do not advance it when the run fails.
- Price and availability are only observations as of `observedAt`. Re-check with the provider before acting. The Actor evaluates no booking links and contacts no passengers or providers.

#### Commercial-source boundary

An API key or partner affiliation does not establish rights to store or redistribute data. [Travelpayouts Search API usage rules](https://support.travelpayouts.com/hc/en-us/articles/34788165535250-Search-API-usage-rules) prohibit automatic collection or scraping of results. [Skyscanner usage guidelines](https://developers.skyscanner.net/docs/getting-started/usage-guidelines) describe partner product and attribution/deeplink rules; its [Indicative API](https://developers.skyscanner.net/docs/flights-indicative-prices/overview) is cached, not a realtime bookable quote. [Duffel flight offers](https://duffel.com/docs/api/offers) can change before booking and its endpoint docs do not establish rights for a commercial price-history feed. No live connector is included. Only send data your own provider agreement permits you to upload, store and use for monitoring.

#### Development

`npm ci --omit=dev --omit=optional` · `npm test` · `npm start`. Source processing is bounded to two JSON observations per invocation, with no network integration except Apify's own run storage.

# Actor input Schema

## `mode` (type: `string`):

Demo uses synthetic data. Snapshot compares fare data you provide. Neither mode retrieves live fares.

## `authorized` (type: `boolean`):

Required for snapshot mode. Only use data you have permission to upload, store and process on Apify, and do not send credentials or personal information.

## `currentSnapshot` (type: `object`):

Required in snapshot mode. Supply version, scope, observedAt, coverage, lowestTotalMinor, and optional expiresAt as documented. Do not paste raw provider payloads.

## `previousSnapshot` (type: `object`):

An earlier compatible SNAPSHOT from this monitor or a normalized authorized observation. All scope fields must match currentSnapshot exactly.

## `targetTotalMinor` (type: `integer`):

Optional inclusive target, for example 70000 for USD 700.00 for the entire traveling party. Alerts only when crossing from above or after a complete search with no offers.

## `minDropMinor` (type: `integer`):

A price-drop alert requires both the absolute and percentage thresholds.

## `minDropBasisPoints` (type: `integer`):

500 basis points is a 5 percent drop. Enter 0 to use only the absolute threshold.

## `maxObservationAgeMinutes` (type: `integer`):

No alerts from a current snapshot older than this.

## `maxBaselineAgeDays` (type: `integer`):

A baseline older than this is not compared. This does not override current quote expiry.

## `alertOnFirstMatch` (type: `boolean`):

Normally the first observation sets a baseline without an alert. This setting allows a target alert without a previous snapshot.

## `outputPolicy` (type: `string`):

Only confirmed alert rows by default. All also emits valid baseline, no-change and no-offer rows. Invalid, stale, partial and unavailable runs produce no dataset rows.

## Actor input object example

```json
{
  "mode": "demo",
  "authorized": false,
  "minDropMinor": 1,
  "minDropBasisPoints": 500,
  "maxObservationAgeMinutes": 60,
  "maxBaselineAgeDays": 30,
  "alertOnFirstMatch": false,
  "outputPolicy": "alerts_only"
}
```

# Actor output Schema

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

No description

## `snapshot` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `demoResult` (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 = {
    "mode": "demo"
};

// Run the Actor and wait for it to finish
const run = await client.actor("felixgoldwin/airfare-price-drop-monitor").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 = { "mode": "demo" }

# Run the Actor and wait for it to finish
run = client.actor("felixgoldwin/airfare-price-drop-monitor").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 '{
  "mode": "demo"
}' |
apify call felixgoldwin/airfare-price-drop-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,felixgoldwin/airfare-price-drop-monitor"
        }
    }
}
```

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/B0tGElcq8rsUNhITy/builds/wZVOvIyQVucTgAU0c/openapi.json
