Building a Request

Our APIs give access to a collection of 'RESTful' web services. You interact with our resources by sending an HTTP message to a URL. The URL determines the resource and the HTTP method defines the type of action.

URLs

All URLs conform to this pattern:

Code snippet: URL pattern

https://{hostname} /{version} /{area|api} /{root resource name} [/{resource key}] [/{sub-resource name} [/{sub-resource key}]* ][?{option_key}={option_value}]
URL component Explanation
hostname The hostname determines whether you access the test or production environment
Test:  api-test.lufthansa.com
Production: api.lufthansa.com
version New versions of services may be introduced with additional features. The version number allows you to select a particular service version.
area|api The APIs are is separated into 'resource areas' for some general topics
  • Cargo
  • Reference Data
  • Offers
  • Operations

For specific business services, the API is exposed with a contextual name, e.g. Flight-Schedules
root resource name The desired resource, generally a plural-form noun representing a class of object (e.g. ‘airports’)
resource key A particular instance of the root resource, for example the airport 'FRA' (Frankfurt).
sub-resource name Sometimes a root resource is split into smaller components or different views. These are sub-resources. For example, flightstatus has the subresources arrivals, departures, and city pairs.
sub-resource key The key to a particular instance of a sub-resource.
option_key
option_value
Some methods allow further restrictions on the dataset with query parameters. These take the form of a key-value pair, for example lang=en.

HTTP method

The HTTP method (GET, PUT, POST, DELETE) defines what interaction on the resource is requested. The GET method is supported for most public data sets.

Access Token

Access to our resources is controlled by authorization tokens. A valid token needs to be sent in the http authorization header with every request.

Code snippet: Curl

curl -H "Authorization: Bearer b2d5h7n4chvpun2f4pu7jh36" -H "Accept: application/json" https://api.lufthansa.com/v1/mds-references/airports/FRA

Visit our API Playground (io/docs) to try some real examples.