Skyscanner Flight Price Calendar API in Python: Find Cheaper Travel Dates

Published October 12, 2026 · UpdatedOctober 16, 2026

The shortcut is typing LHR and JFK from memory, hitting the price calendar, and treating the cheapest cell as a fare a traveler can book. That assumption is wrong on both counts. The three-letter code in your head is not the place identifier this API searches with, and a cheap calendar cell is not a booked fare.

London the city comes back as LOND — four letters, not IATA — with entityId 27544008. Heathrow is LHR / 95565050. New York the metro area is NYCA. Guessing JFK skips the city-versus-airport choice, leaves you without the paired entityId the itinerary search needs, and still does not lock a seat. The before is guessed IATA. The after is resolved places, then the calendar, then a recheck of the day you actually pick.

A Skyscanner flight price calendar API in Python compares quoted departure days in one snapshot. The useful result is the lowest usable quote among the dates that came back, not a promise of the globally cheapest flight. Opening this page or copying the script does not send a request.

Sign in, copy an authorized platform key from the dashboard, and read it from OPENDATA_API_KEY on the server. Snippets that show YOUR_API_KEY are placeholders. The key travels in the query string, so those URLs do not belong in tickets, screenshots, or browser JavaScript. HTTP 4xx/5xx means the call did not run (auth, quota, or network). The gateway envelope is {code, message, data}; code 200 means the platform accepted the call. It does not mean a place matched, a day had a quote, or an itinerary is complete.

Do not type the airport code from memory

The naive call looks like this: originSkyId=LHR, destinationSkyId=JFK, a hardcoded fromDate, no autocomplete, no entityId. Sometimes those skyIds happen to be valid airport codes. That is luck, not a contract. iataCode on a real suggestion can be blank. City suggestions are a different scope from a single airport — a London city search can surface itineraries that actually fly Heathrow to JFK. Mixing a remembered airport code on one end with a city code on the other is how you rank days that are not the route you thought you asked for.

flights-search-airport is the correct first hop. Pass query=London (the documented example) with market=US and locale=en-US. Read places. Pick by name, countryName, and placeType (CITY versus AIRPORT). Keep both skyId and entityId from that same row. Repeat for New York. HTTP 200 with places:[] is a clean no-match: change the query, do not invent an id. Do not substitute an IATA code for entityId.

Resolve both ends, then the calendar

Only after both ends are resolved do you call flights-get-price-calendar. Required: originSkyId, destinationSkyId, fromDate. Add toDate for an explicit future range. Optional currency, market, and cabinClass describe the comparison; keep them identical for every date you rank. The calendar does not take entityId. You still resolved it, because the recheck will need the pair.

The documented London–New York window used city skyIds LOND and NYCA over eight days. The script below resolves Heathrow and JFK instead, so the calendar and the itinerary search share the same airport-level choice. Dates are computed at run time so the example does not ship an expired travel day. Install requests and export the key before you run anything.

import math
import os
from datetime import date, timedelta

import requests

BASE = "https://api.opendata-api.com/api/project/skyscanner"
API_KEY = os.environ["OPENDATA_API_KEY"]


def get(operation, **params):
    try:
        response = requests.get(
            f"{BASE}/{operation}",
            params={"key": API_KEY, **params},
            timeout=45,
        )
    except requests.RequestException:
        raise RuntimeError("Transport failure; inspect redacted logs.") from None
    if not response.ok:
        raise RuntimeError(f"HTTP failure: {response.status_code}")
    body = response.json()
    if not isinstance(body, dict) or body.get("code") != 200:
        raise RuntimeError("Business failure; inspect redacted code/message.")
    payload = body.get("data")
    if not isinstance(payload, dict):
        raise RuntimeError("Inspect the endpoint payload before parsing.")
    return payload


def airport(query, sky_id):
    places = get(
        "flights-search-airport",
        query=query,
        market="US",
        locale="en-US",
    ).get("places", [])
    for place in places:
        if (
            isinstance(place, dict)
            and place.get("skyId") == sky_id
            and place.get("placeType") == "AIRPORT"
            and place.get("entityId")
        ):
            return place
    raise RuntimeError("No matching airport; review actual suggestions.")


origin = airport("London", "LHR")
destination = airport("New York", "JFK")
start = date.today() + timedelta(days=45)
end = start + timedelta(days=7)
calendar = get(
    "flights-get-price-calendar",
    originSkyId=origin["skyId"],
    destinationSkyId=destination["skyId"],
    fromDate=start.isoformat(),
    toDate=end.isoformat(),
    currency="USD",
    market="US",
    cabinClass="economy",
)
if calendar.get("currency") != "USD":
    raise RuntimeError("Check returned quote currency before comparison.")

quoted = []
for row in calendar.get("outboundDates") or []:
    if not isinstance(row, dict) or row.get("hasQuote") is not True:
        continue
    try:
        day = date.fromisoformat(row.get("date", ""))
    except (TypeError, ValueError):
        continue
    price = row.get("price")
    if (
        start <= day <= end
        and type(price) in (int, float)
        and math.isfinite(price)
        and price >= 0
    ):
        quoted.append((day, price))

if not quoted:
    raise SystemExit("No usable quoted dates; review the route or range.")
for day, price in sorted(quoted):
    print(day.isoformat(), price, calendar["currency"])
selected_day, selected_price = min(quoted, key=lambda item: item[1])
print("Lowest returned quote:", selected_day, selected_price)

The observed calendar payload has currency and outboundDates records with date, numeric price, group, and hasQuote. A London–New York search included every day of the requested eight-day range, with low/medium group labels. Coverage on other routes can vary. Missing days are unknown, not zero-priced flights. group is a relative hint inside this response, not a global cheapest-fare badge. directPrice and isDirect were not observed, so the calendar does not establish non-stop availability.

A cheap cell is not a booked fare

Sorting quoted and taking min(...) answers one question: which returned, quoted day was cheapest in this snapshot, in this currency, cabin, and market. It does not mean every seller is covered, that the day still has seats, or that the number will match the itinerary search. Skip rows where hasQuote is not true. Skip non-finite or negative prices. Do not fill gaps with 0. Do not mix USD cells with another currency. A blank day is not evidence that no flights exist.

If outboundDates is missing or not a list, stop. That is a schema miss, not an empty bargain month. The monthly one-way operation documents a month in YYYY-MM; its response shape is unverified, so this script does not parse it. Round-trip date pairs are a different operation; gluing two independent one-way minima is not a return fare.

Show the cell as a query-time reference. Keep the retrieval timestamp, route identifiers, currency, cabin, and date window next to the number. Your application owns scheduling and alerts; this API does not supply a historical fare archive or a watchlist subscription.

Recheck the day you actually pick

Hand the selected day to flights-search-flights with both skyId/entityId pairs, date, and the same currency / market / cabinClass. Inspect itineraries: price.amount and price.currency, actual leg airports, times, durationMinutes, stopCount, carriers, and bookingUrl. The rechecked amount can differ from the calendar cell. A booking link is a redirect, not a reservation. This API does not issue tickets.

flights = get(
    "flights-search-flights",
    originSkyId=origin["skyId"],
    originEntityId=origin["entityId"],
    destinationSkyId=destination["skyId"],
    destinationEntityId=destination["entityId"],
    date=selected_day.isoformat(),
    adults=1,
    cabinClass="economy",
    currency="USD",
    market="US",
    countryCode="US",
)
print("Search status:", flights.get("status"))

RESULT_STATUS_INCOMPLETE can sit next to usable itineraries, a total, and a sessionToken. Treat the list as partial. If you choose to ask for more, pass that token as sessionId to flights-search-incomplete with the same currency and countryCode. Polling itself is unverified: inspect the follow-up structure before merging, dedupe by itinerary id where available, and set backoff, a request budget, and a deadline. Stop on evidence of completion or your deadline. No session lifetime or final count is guaranteed. Do not print the token or hard-code a captured session.

This path will not lock a fare, filter non-stops from the calendar, invent identifiers for an empty places list, complete an arbitrary month or return grid without inspecting those payloads, or turn a remembered IATA code into a place you never resolved. Recheck the day. Then send the traveler to the link that search actually returned.