POST /available-offers v2

POST /available-offers v2

The AvailableOffers endpoint provides the available flights with the lowest price based on certain (set of) date(s). 

HOW TO USE

The POST method should be used to start a search for available offers.

Use case flow can also be followed by the consumer by requesting the GET method supplied as HATEOAS link in the POST response body of LowestFareOffers.

The GET method returns the same response data structure as the POST method.

HEADERS TO USE FOR REQUESTS

Parameter

Value

Authorization 

Bearer {{token}}

Content-Type 

application/json

Accept 

application/hal+json;profile=com.afklm.flightoffers.available-offers.v2;charset=utf8

Accept-Language 

{{language}}-{{country}}

AFKL-TRAVEL-Host 

KL or AF

AFKL-TRAVEL-Country 

Country (overrides Accept-Language country)

POST

POST https://api.klm.com/opendata/flightoffers/available-offers

QUERY PARAMETERS

n/a

POST PARAMETERS

Name

Type

Multiplicity

Description

cabinClass

String

1

Code for requested cabin class.

ECONOMY or BUSINESS

currency

String

0-1

Indicates the currency to be used for prices in response.

Three letter currency code according to ISO 4217.

This can be used to override the setting for the default currency of the country of the origin airport (also known as Point of Sale).

discountCode

String

0-1

code for IDC discount.

displayPriceContent

Enumeration

0-1

Content of displayPrice in response.

- If empty : displayPrice is the price for 1adt regarding point of sell

- ALL_PAX_ROUNDED : displayPrice is the price for all pax regarding point of sell rounded up

includeCarriers

Array of Strings

0-n

List of marketing carriers to include in the request. When shortest=true, includeCarriers cannot be supplied

reservationId

String

0-1

Identification of the reservation for which a rebooking is requested. Only supplied for Rebooking a ticket. reservationId is the conversation state identifier.

fallbackMode

Enumeration

0-1

Fallback mode to find matching flights:

- NONE (default): No fallback applied

- FAREFAMILY: If fareFamilyCode supplied does not give any results, result with different FareFamily will be returned.

- ANY: If fareBasis/sellingClasses supplied does not give any results, result with different fareBasis/sellingClasses will be returned. If that does not give any results, result with different FareFamily will be returned.

shortest

Boolean

0-1

Indicates whether shortest route should be found. Otherwise lowest fare is found. When shortest=true, includeCarriers cannot be supplied.

passengerCount

Object

1

The specification of the passengers for which the offer is requested.

..ADULT

Integer

0-1

Number of adults. 16 years and older.

..CHILD

Integer

0-1

Number of children. 2-11 years.

..INFANT

Integer 

0-1

Number of infants. Under 2 years.

..YOUNG_ADULT

Integer

0-1

Number of young adults. 12-15 years.

requestedConnections Array of Objects 1-6 A chronologically ordered list of connections for which the lowest fare offers is requested.

..departureDate

String

0-1

String representing the departure date requested for the Connection

..fareBasis String 0-1

The fare basis of the connection.

Conditional: Must not be supplied when origin & destination are supplied. Can be supplied when segments are supplied. In case it is supplied, the selling class must also be supplied in segments.

..fareFamilyCode String 0-1

The fare family of the connection.

Conditional: Must not be supplied when origin & destination are supplied. Can be supplied when segments are supplied. In case it is supplied, the fare basis must also be supplied.
..minDaysOfStay Integer 0-1

Minimum days of stay between this and next connection.

Conditional: Either both or none of min/maxStayOfDays must be supplied.

..maxDaysOfStay Integer 0-1

Maximum days of stay between this and next connection.

Conditional: Either both or none of min/maxStayOfDays must be supplied.

..origin Object 0-1

The origin station of the connection.

Conditional: Either origin & destination are supplied or segments are supplied.

....city Object 0-1

The city of origin.

Conditional: Either city or airport must be supplied.

…...code String 1 IATA location code of the city.
....airport Object 0-1

The airport of origin.

Conditional: Either city or airport must be supplied.

…...code String 1
IATA location code of the airport.
..destination Object 0-1

The destination station of the connection.

Conditional: Either origin & destination are supplied or segments are supplied.

....city Object 0-1

The city of destination.

Conditional: Either city or airport must be supplied.

…...code String 1 IATA location code of the city.
....airport Object 0-1

The airport of destination.

Conditional: Either city or airport must be supplied.

…...code String 1 IATA location code of the airport.
..segments Array of Objects 1-6

A chronologically ordered list of segments that describe the Connection requested.

Conditional: Either origin & destination are supplied or segments are supplied.

….origin Object 0-1 The origin airport of the connection.
…...code String 1 IATA location code of the airport.
….destination Object 0-1 The destination airport of the connection.
…...code String 1 IATA location code of the airport.
….departureDateTime DateTime 1 DateTime of departure of the segment flight. It is specified as local time at origin of the segment.
….marketingFlightNumber String 1

The marketing flight number for the segment.

Max of four digits, when less than 3 then prefix with zeroes up till 3 digits. For example: 006, 022, 1001.

….marketingCarrier Object 1 IATA airline code for the marketing carrier of the flight.
….sellingClass Object 0-1 Selling Class of the selected flight


ERROR CODES

HTTP status

Type

500

INTERNAL_SERVER_ERROR

400

FOA/DISCOUNT_CODE_INELIGIBLE

500

FOA/INTERNAL_SERVER_ERROR/UNSUPPORTED_CAPABILITY

SAMPLE POST REQUEST

{
    "currency": "USD", 
    "cabinClass": "ECONOMY", 
    "passengerCount": {
        "ADULT": 3, 
        "CHILD": 2, 
        "INFANT": 1
    }, 
    "requestedConnections": [
        {
            "segments": [
                {
                    "departureDateTime": "2015-11-01T11:30:00", 
                    "origin": {
                        "code": "AMS"
                    }, 
                    "farebase": {
                        "code": "NKXRDNL"
                    }, 
                    "destination": {
                        "code": "JFK"
                    }, 
                    "marketingFlight": {
                        "number": "6149", 
                        "carrier": {
                            "code": "KL"
                        },
			"sellingClass": {
                            "code": "N"
                        }
                    }
                }
            ]
        }, 
        {
            "departureDate": "2015-11-15", 
            "origin": {
                "city": {
                    "code": "NYC"
                }
            }, 
            "destination": {
                "airport": {
                    "code": "AMS"
                }
            }
        }
    ]
}

 

SAMPLE RESPONSE

 

{
    "flightProducts": [
        {
            "locationSpecificRemarks": [
                 {
                    "remarkText": "<b>Important:</b><br />For travel from the United States, all travellers need to provide various personal details (such as date of birth) to the authorities of the United States. After booking your flight, please make sure to enter these so-called ‘<b>API</b>’ details in My Trip. 

<p><a href=\"https://www.klm.com/travel/nl_en/prepare_for_travel/travel_planning/usa/index.htm\" target=\"_blank\">Read all about API and ESTA</a><br/>
<a href=\"https://www.klm.com/travel/nl_en/customer_support/privacy_policy/privacy_policy.htm#p14\" target=\"_blank\">Read the KLM Privacy Policy</a></p>"
                }
            ], 
            "price": {
                "displayPrice": 938.91, 
                "totalPrice": 4539.05, 
                "surcharges": [
                    {
                        "code": "BookingFee", 
                        "amount": 10
                    }
                ], 
                "accuracy": 100, 
                "pricePerPassengerTypes": [
                    {
                        "passengerType": "CHD", 
                        "fare": 423, 
                        "taxes": 375.91
                    }, 
                    {
                        "passengerType": "INF", 
                        "fare": 56, 
                        "taxes": 58.5
                    }, 
                    {
                        "passengerType": "ADT", 
                        "fare": 563, 
                        "taxes": 375.91
                    }
                ], 
                "currency": "USD", 
                "displayType": "TAX"
            }, 
            "passengers": [ 
                {
                    "id": 1, 
                    "type": "ADT"
                }, 
                {
                    "id": 2, 
                    "type": "ADT"
                }, 
                {
                    "id": 3, 
                    "type": "ADT"
                }, 
                {
                    "id": 4, 
                    "type": "CHD"
                }, 
                {
                    "id": 5, 
                    "type": "CHD"
                }, 
                {
                    "id": 6, 
                    "type": "INF"
                }
            ], 
            "sameConditions": false, 
            "connections": [
                {
                    "segments": [
                        {
                            "marketingFlight": {
                                "carrier": {
                                    "name": "KLM", 
                                    "code": "KL"
                                }, 
                                "numberOfStops": 0, 
                                "operatingFlight": {
                                    "equipmentType": {
                                        "code": "333", 
                                        "name": "Airbus A330-300", 
                                        "_links": {
                                            "information": {
                                                "href": "http://www.delta.com/planning_reservations/plan_flight/aircraft_types_layout/a330_300/index.jsp", 
                                                "templated": false
                                            }
                                        }
                                    }, 
                                    "cabin": {
                                        "class": "M"
                                    }, 
                                    "carrier": {
                                        "name": "Delta Air Lines", 
                                        "code": "DL"
                                    }
                                }, 
                                "sellingClass": {
                                    "code": "L"
                                }, 
                                "number": "6149"
                            }, 
                            "departureDateTime": "2015-11-01T10:05:00", 
                            "origin": {
                                "name": "Schiphol", 
                                "city": {
                                    "name": "Amsterdam", 
                                    "code": "AMS"
                                }, 
                                "code": "AMS"
                            }, 
                            "destination": {
                                "name": "John F. Kennedy International", 
                                "city": {
                                    "name": "New York", 
                                    "code": "NYC"
                                }, 
                                "code": "JFK"
                            }, 
                            "farebase": {
                                "code": "LLWSRNL"
                            }, 
                            "arrivalDateTime": "2015-11-01T12:45:00"
                        }
                    ], 
                    "duration": 520, 
                    "numberOfSeatsAvailable": 7, 
                    "_links": {
                        "lowestFareOffers": {
                            "href": "https://api.klm.com/travel/flightoffers/lowest-fare-offers?d=q0ZOjDCDMcIHrNfKWAfsNCsjHYiFVoa1OMKmGhE01ejRXg1L8NWQZO7tA3RUHjRJmRmaWAK5WNKxkYGhqa6hoa6BYYihgZWBqZWBATxuq8EZB2qeo28w0ARkNnIGQFHqF-kMV-rl5q1UWxsLDB-0XAWz2NAUu31gQ9AsgeV6ZCcBDUekCnDYw_O3lVJosAssWYBiuBYA&dateInterval={dateInterval}", 
                            "templated": true
                        }
                    }
                }, 
                {
                    "segments": [
                        {
                            "marketingFlight": {
                                "carrier": {
                                    "name": "Air France", 
                                    "code": "AF"
                                }, 
                                "numberOfStops": 0, 
                                "operatingFlight": {
                                    "equipmentType": {
                                        "code": "388", 
                                        "name": "Airbus A380-800", 
					  "ACVcode": "38F",
                                        "_links": {
                                            "information": {
                                                "href": "http://www.airfrance.fr/common/image/PlansCabine/en/A380_538pax_maxi_en.gif", 
                                                "templated": false
                                            }
                                        }
                                    }, 
                                    "cabin": {
                                        "class": "M"
                                    }, 
                                    "carrier": {
                                        "name": "Air France", 
                                        "code": "AF"
                                    }
                                }, 
                                "sellingClass": {
                                    "code": "N"
                                }, 
                                "number": "0007"
                            }, 
                            "departureDateTime": "2015-11-15T19:10:00", 
                            "origin": {
                                "name": "John F. Kennedy International", 
                                "city": {
                                    "name": "New York", 
                                    "code": "NYC"
                                }, 
                                "code": "JFK"
                            }, 
                            "destination": {
                                "name": "Charles De Gaulle Airport", 
                                "city": {
                                    "name": "Parijs", 
                                    "code": "PAR"
                                }, 
                                "code": "CDG"
                            }, 
                            "farebase": {
                                "code": "NLWRDNL"
                            }, 
                            "arrivalDateTime": "2015-11-16T08:30:00"
                        }, 
                        {
                            "marketingFlight": {
                                "carrier": {
                                    "name": "Air France", 
                                    "code": "AF"
                                }, 
                                "numberOfStops": 0, 
                                "operatingFlight": {
                                    "equipmentType": {
                                        "code": "73H", 
                                        "name": "Boeing 737-800",
					  "AVCcode": "",  
                                        "_links": {
                                            "information": {
                                                "href": "http://www.klm.com/travel/nl_nl/flights/ebt/737-800.htm", 
                                                "templated": false
                                            }
                                        }
                                    }, 
                                    "cabin": {
                                        "class": "M"
                                    }, 
                                    "carrier": {
                                        "name": "KLM", 
                                        "code": "KL"
                                    }
                                }, 
                                "sellingClass": {
                                    "code": "L"
                                }, 
                                "number": "8228"
                            }, 
                            "departureDateTime": "2015-11-16T09:45:00", 
                            "origin": {
                                "name": "Charles De Gaulle Airport", 
                                "city": {
                                    "name": "Parijs", 
                                    "code": "PAR"
                                }, 
                                "code": "CDG"
                            }, 
                            "destination": {
                                "name": "Schiphol", 
                                "city": {
                                    "name": "Amsterdam", 
                                    "code": "AMS"
                                }, 
                                "code": "AMS"
                            }, 
                            "farebase": {
                                "code": "NLWRDNL"
                            }, 
                            "arrivalDateTime": "2015-11-16T11:05:00"
                        }
                    ], 
                    "duration": 595, 
                    "numberOfSeatsAvailable": 9, 
                    "_links": {
                        "lowestFareOffers": {
                            "href": "https://api.klm.com/travel/flightoffers/lowest-fare-offers?d=lVRRDoIwDL2L35C0gyH0j0AwESUGMNEPruAFFu5uGRtMEIl_27q17_W9TrlmtIlX_dFvKfA0NBLeWJCw3-iNmlujlrIra3g12ry8MKiXsVSEYcLbLz4WgNJH9AFbRAqAACZtTab02ui3s91N4FyUHJiMbE6r8lHnFVfvO-7KYpZsOZSuzrtk0sIhAwDH32RQtpgQLsgMv4DF-Mw4g8vik55z9ZbW09UsPzEt7z-4sRDxDtyohYRCuQl3hWEb7iiWs2YVunlstDmnD5AO9ya3czOMQP8G&dateInterval={dateInterval}", 
                            "templated": true
                        }
                    }
                }
            ], 
            "_links": {
                "ticketConditions": {
                    "href": "https://api.klm.com/travel/flightoffers/flight-products/YqDp7bPdgr4gFcjqsfh_iX1UXQuDMAz8L_ccwbg5WN6GMHDuC-eLDH-J9L_bVLS1dnvNNWlyyd2I7VSQEQnZQL4j5nXAtlK371fbyeXxASG49AC7XRuHBSqxaJFzmTFnObtO1opV3fXy7Kuf5Zav0uW41KEQHYbO4i0DciB4m4AUhEAgECZEpENyQ0gt2dG0GpDtZNkAIWknjr_9Vbiwl7tWjRU5L0QxNHdLGkI_sMETH88a_sf0oOTEvmHfbC6Ddl9re4MxPjWwlzjbTA==/ticket-conditions", 
                    "templated": false
                }, 
                "relatedProducts": {
                    "href": "https://api.klm.com/travel/flightoffers/flight-products/YqDp7bPdgr4gFcjqsfh_iX1UXQuDMAz8L_ccwbg5WN6GMHDuC-eLDH-J9L_bVLS1dnvNNWlyyd2I7VSQEQnZQL4j5nXAtlK371fbyeXxASG49AC7XRuHBSqxaJFzmTFnObtO1opV3fXy7Kuf5Zav0uW41KEQHYbO4i0DciB4m4AUhEAgECZEpENyQ0gt2dG0GpDtZNkAIWknjr_9Vbiwl7tWjRU5L0QxNHdLGkI_sMETH88a_sf0oOTEvmHfbC6Ddl9re4MxPjWwlzjbTA==/related-products", 
                    "templated": false
                }, 
                "shoppingCart": {
                    "href": "https://api.klm.com/travel/flightoffers/flight-products/YqDp7bPdgr4gFcjqsfh_iX1UXQuDMAz8L_ccwbg5WN6GMHDuC-eLDH-J9L_bVLS1dnvNNWlyyd2I7VSQEQnZQL4j5nXAtlK371fbyeXxASG49AC7XRuHBSqxaJFzmTFnObtO1opV3fXy7Kuf5Zav0uW41KEQHYbO4i0DciB4m4AUhEAgECZEpENyQ0gt2dG0GpDtZNkAIWknjr_9Vbiwl7tWjRU5L0QxNHdLGkI_sMETH88a_sf0oOTEvmHfbC6Ddl9re4MxPjWwlzjbTA==/shopping-carts", 
                    "templated": false
                }, 
                "taxBreakdown": {
                    "href": "https://api.klm.com/travel/flightoffers/flight-products/YqDp7bPdgr4gFcjqsfh_iX1UXQuDMAz8L_ccwbg5WN6GMHDuC-eLDH-J9L_bVLS1dnvNNWlyyd2I7VSQEQnZQL4j5nXAtlK371fbyeXxASG49AC7XRuHBSqxaJFzmTFnObtO1opV3fXy7Kuf5Zav0uW41KEQHYbO4i0DciB4m4AUhEAgECZEpENyQ0gt2dG0GpDtZNkAIWknjr_9Vbiwl7tWjRU5L0QxNHdLGkI_sMETH88a_sf0oOTEvmHfbC6Ddl9re4MxPjWwlzjbTA==/tax-breakdown", 
                    "templated": false
                }, 
                "upsellOffers": {
                    "href": "https://api.klm.com/travel/flightoffers/flight-products/YqDp7bPdgr4gFcjqsfh_iX1UXQuDMAz8L_ccwbg5WN6GMHDuC-eLDH-J9L_bVLS1dnvNNWlyyd2I7VSQEQnZQL4j5nXAtlK371fbyeXxASG49AC7XRuHBSqxaJFzmTFnObtO1opV3fXy7Kuf5Zav0uW41KEQHYbO4i0DciB4m4AUhEAgECZEpENyQ0gt2dG0GpDtZNkAIWknjr_9Vbiwl7tWjRU5L0QxNHdLGkI_sMETH88a_sf0oOTEvmHfbC6Ddl9re4MxPjWwlzjbTA==/upsell-offers", 
                    "templated": false
                }
            }
        }
    ]
}

Docs Navigation