Objectives
- Understand what the Lufthansa Open API can and cannot do for schedules and trip planning.
- Set up developer access and generate a working OAuth2 access token.
- Successfully call the Flight Schedules endpoint and read its response.
- Use schedule data as a building block for trip planning logic.
- Establish a clear, low-effort path to sync or look up this data inside Odoo.
Key Highlights
- Flight Schedules API covers seven Lufthansa Group airlines: LH, EN, LX, OS, WK, SN, 4Y.
- Access uses OAuth2 client_credentials - you need a Client ID and Client Secret from the developer portal.
- Access tokens expire (commonly every 6 hours) and must be refreshed, not requested per call.
- A known quirk: the API returns "bearer" lowercase but expects "Bearer" uppercase in the request header.
- The API returns schedules only - no pricing, seat availability, or booking. Those need a separate Partner Plan agreement.
- Flight times in responses are minutes-from-midnight, not HH:MM - conversion is required on your end.
- Odoo integration is done as a custom module; there is no ready-made connector.
- Two integration patterns fit most use cases: a scheduled daily sync, or an on-demand lookup triggered from a form/button.
1. What This API Offers
The Lufthansa Open API is a REST API published by Lufthansa Group. For flight schedules and trip planning, the relevant service is the Flight Schedules API.
It returns schedule data for the following Lufthansa Group airlines:
LH (Lufthansa), EN (Air Dolomiti), LX (Swiss), OS (Austrian), WK (Edelweiss), SN (Brussels Airlines), 4Y (Eurowings Discover)
You can search schedules by:
- Airline
- Flight number
- Start and end date
- Days of operation
- Origin and destination
- Aircraft type
Passenger flight schedule access is open on the Public Plan. Full/bulk schedule listing and cargo schedules are restricted and need a Partner Plan (contact Lufthansa directly).
2. Getting Access
Step 1 - Create a developer account at https://developer.lufthansa.com and register an application. You will receive a Client ID and Client Secret.
Step 2 - Subscribe your application to the "Flight Schedules" API product (Public Plan is enough to start).
Step 3 - Request an OAuth2 access token before calling any endpoint.
Token endpoint
POST https://api.lufthansa.com/v1/oauth/token
Content-Type: application/x-www-form-urlencoded
Parameters sent as form data:
- client_id = your client key
- client_secret = your client secret
- grant_type = client_credentials
Example request
curl "https://api.lufthansa.com/v1/oauth/token" -X POST -d "client_id=YOUR_CLIENT_ID" -d "client_secret=YOUR_CLIENT_SECRET" -d "grant_type=client_credentials"
Example response
{ "access_token": "d8bmzggu72dy69tzkffe6vaa", "token_type": "bearer", "expires_in": 21600 }
Notes
- The token is valid for a limited time (expires_in is in seconds, typically 6 hours).
- When sending the token on later requests, the header must use "Bearer" with a capital B, even though the response says "bearer" lowercase. This is a known quirk in Lufthansa's API.
- Store the token and refresh it before it expires. Do not request a new token on every single call.
3. Calling the Flight Schedules Endpoint
Once you have a valid token, call:
GET https://api.lufthansa.com/v1/flight-schedules/flightschedules/passenger
Send the token as a header:
Authorization: Bearer YOUR_ACCESS_TOKEN
Example request with query parameters
GET /flight-schedules/flightschedules/passenger?airlines=LH&flightNumberRanges=400-405&startDate=05DEC19&endDate=10DEC19&daysOfOperation=1234567&timeMode=UTC
Common query parameters
- airlines - airline code, e.g. LH
- flightNumberRanges - single number or range, e.g. 400-405
- startDate / endDate - format DDMMMYY, e.g. 05DEC19
- daysOfOperation - digits 1–7 representing Mon–Sun
- origin / destination - IATA airport codes
- timeMode - UTC or LT (local time)
The response is a JSON array. Each entry contains:
- airline and flightNumber
- periodOfOperationUTC / periodOfOperationLT - validity dates and days of operation
- legs - one entry per flight leg, with origin, destination, aircraft type, and departure/arrival times
- dataElements - extra IATA SSIM-standard fields (codeshares, meal service, etc.)
Times in the response are given as minutes from midnight, not as HH:MM strings. You will need to convert them in your own code (e.g. 590 minutes = 09:50).
4. Using It to Plan Trips
The Flight Schedules API only returns schedules - it does not do fare pricing, seat availability, or booking. A typical "trip planning" flow looks like this:
Step 1 - Use the Reference Data endpoints (Airports, Cities, Countries, Nearest Airport) to resolve city names to IATA airport codes.
Step 2 - Call Flight Schedules with origin, destination, and travel dates to get candidate flights.
Step 3 - If you need live delays/gate info instead of the base timetable, use the separate Flight Status API instead of Flight Schedules.
Step 4 - Assemble multi-leg trips yourself in your application logic by matching arrival airports to onward departure airports, since the API does not build itineraries for you.
Step 5 - If you need actual fares, you need the Partner API (Offers section) which requires a commercial partner agreement - it is not open to Public Plan developers.
5. Overview: Connecting This to Odoo
Odoo does not have a native Lufthansa connector, so integration is done as a custom module. There are two common approaches.
Option A - Scheduled Sync (recommended for schedules)
- Build a small Odoo module with a scheduled action (ir.cron).
- The cron job calls the OAuth token endpoint, then the Flight Schedules endpoint, on a timer (e.g. once a day).
- Store results in a custom Odoo model, for example x_flight_schedule, with fields for airline, flight number, origin, destination, departure time, arrival time, and days of operation.
- Use Odoo's requests library (already available in Odoo's Python environment) to make the HTTP calls.
- Cache the access token in a system parameter (ir.config_parameter) along with its expiry time, so you are not requesting a new token on every cron run.
Option B - On-Demand Lookup
- Add a button or wizard on a relevant Odoo view (e.g. a Travel Request or Booking form in HR/Project modules).
- When clicked, the module calls the Flight Schedules API live with the dates and route entered by the user, and displays matching flights in a list for the user to pick from.
- This suits ad-hoc trip planning better than a nightly sync.