map   Lumo Index TM Map

Search Lumo

Getting started with the Lumo API

This gets your up and running with the Lumo API. It assumes you are a developer who is broadly familiar with REST APIs.

What can the Lumo API be used for?

Broadly, the Lumo APIs are designed to help keep travelers, travel agents, and others informed about their flights. The Lumo API makes it possible to get rich, comprehensive data – including flight delay predictions, real-time data, weather alerts, COVID stats, and more – through a single API call. Data from Lumo's API can be used at the time of booking to help travelers choose better flights, or to monitor flights post-booking to send relevant and timely alerts.

Overview of data returned by the API 

The API contains the following types of data:

  • Real-time flight data from our partner OAG: This includes times on estimated times of arrival and departure, terminal and gate changes, cancellations, delays, and other real-time alerts.
  • Flight delay predictions: Lumo's proprietary machine learning and simulation engine predicts the likelihood of a delay or a missed connection up to 3 months out. Our predictions are constantly updated and account for historical data, seasonal effects, weather forecasts, data from air traffic control, network models of how delays propagate, and more. Our algorithms also compute the predicted likelihood of a missed connection.
  • Event-based alerts: We constantly scan publicly available sources such as social media sites and government-issued alerts to send travel alerts based on severe weather data, strikes and demonstrations, airline waivers, and more.
  • Travel advisories: Sourced from various government agencies, we deliver data on risk ratings by country.
  • COVID-related data: Lumo aggregates COVID stats (cases and deaths) by country (and if available, by state or county) and uses AI to parse quarantine information to summarize COVID-related travel restrictions.

Types of API calls

  • Subscriptions API: This API calls allows you to specify a set of flights to be tracked and register a webhook to which Lumo will push alerts. You can learn more about how to use the Subscription API here.
  • Status API: The status API allows you to get the latest information for a flight, search for flights by airport, airline, etc, retrieve the connection risk of an itinerary, etc. 
  • Manage API: The manage API allows you to manage information in Lumo Navigator.

Production vs Sandbox trial key

Lumo provides two types of keys

  • Production: This requires a contract with Lumo and allows unlimited calls, has SLAs on uptime, and is production-grade. You can request a production key here.
  • Sandbox trial: This is a free trial key that comes with a few restrictions: it allows a maximum of 500 hits per month, and can only be used for evaluation/testing (i.e., this key cannot be used in a production system and the data cannot be shared with third parties or travelers). You can get a free key here.

Code snippets

Python


import requests
import json

API_KEY="YOUR-API-KEY-HERE"
ENV="test" #Use either test or prod

if ENV == 'test':
    headers = {
                'x-api-key': API_KEY,
                "Content-type": "application/json"
            }
    base_url = 'https://sandbox-api.thinklumo.com/flights/v1'
else:
    headers = {
                'Token': API_KEY,
                "Content-type": "application/json"
            }
    base_url = 'https://api.thinklumo.com/flights/v1'

#-------------------------------------------------------------------------------
# Retrieve the status of a flight given a flight id
# Format of the flight id is [IATA carrier code][flight number][departure airport][arrival airport][scheduled departure time as YYMMDDHHMM in UTC time]
#
def status_with_flight_id():
    flght_id = 'AA38MIALHR2010082235'
    r = requests.get(f'{base_url}/status/{flght_id}', headers=headers)
    print(f'{r.status_code}: {r.text}')

#-------------------------------------------------------------------------------
# Retrieve the status of a flight given flight parameters
#
def status_with_params():
    params = {
        'carrier': 'WN',
        'flight_number': 822,
        'origin': 'HOU',
        'date': '2020-10-09'
    }
    r = requests.get(f'{base_url}/status', headers=headers, params=params)
    print(f'{r.status_code}: {r.text}')

#-------------------------------------------------------------------------------
# Retrieve the connection risk for a pair of flights
# flights are comma-separated IDs
# [IATA carrier code][flight number][departure airport][arrival airport][scheduled departure date as YYMMDD in local time]
#
def connection_with_params():
    params = {
        'flights': 'LH2230MUCCDG201011,AF1280CDGLHR201011'
    }
    r = requests.get(f'{base_url}/connection', headers=headers, params=params)
    print(f'{r.status_code}: {r.text}')

#-------------------------------------------------------------------------------
# Retrieve alternative flights with a lower risk of delay
# Format of the flight id is [IATA carrier code][flight number][departure airport][arrival airport][scheduled departure time as YYMMDDHHMM in UTC time]
#
def alternates_with_flight_id():
    flght_id='AA2421MIASFO2010152345'
    r = requests.get(f'{base_url}/alternates/{flght_id}', headers=headers)
    print(f'{r.status_code}: {r.text}')

#-------------------------------------------------------------------------------
# Retrieve the results of flight search based on parameters
#
def search_with_params():
    params = {
        'origin': 'BOS',
        'destination': 'LGA',
        'date': '2020-10-20'
    }
    r = requests.get(f'{base_url}/search', headers=headers, params=params)
    print(f'{r.status_code}: {r.text}')

#-------------------------------------------------------------------------------
# Create a subscription
#
def subscription_with_flight_id():
    data = {
        'flight_ids': ['LH2230MUCCDG201011','AF1280CDGLHR201011'],
        'booking_reference': 'ABCDEF'
    }
    r = requests.post(f'{base_url}/subscriptions', headers=headers, data=json.dumps(data))
    print(f'{r.status_code}: {r.text}')

#-------------------------------------------------------------------------------
# Retrieve all your subscriptions
#
def get_all_subscriptions():
    r = requests.get(f'{base_url}/subscriptions', headers=headers)
    print(f'{r.status_code}: {r.text}')

#-------------------------------------------------------------------------------
# Retrieve a specific subscription based on the itinerary id
#
def get_specific_subscription():
    itinerary_id='c9686e9b-6158-40c5-a8fc-723735c53b8c'
    r = requests.get(f'{base_url}/subscriptions/{itinerary_id}', headers=headers)
    print(f'{r.status_code}: {r.text}')

#-------------------------------------------------------------------------------
# Delete a specific subscription based on the itinerary id
#
def delete_specific_subscription():
    itinerary_id='c9686e9b-6158-40c5-a8fc-723735c53b8c'
    r = requests.delete(f'{base_url}/subscriptions/{itinerary_id}', headers=headers)
    print(f'{r.status_code}: {r.text}')

Documentation

Documentation is at developer.thinklumo.com