Skip to main content

Flight Bulk Truecost | Climes API


This endpoint provides the truecost value for flights in bulk (upto 500 flights per request).

This endpoint has 2 parts in its integration.

  1. Sending the flight data in the below endpoint for processing.
  2. Get a processed flights result with calculated truecost values sent to the endpoint given by you in below format.

Here firstly you will send the flights data using the below endpoint. This data will be then processed internally and will be sent back to you via the endpoint that you provide in the below format

Request Parameters

Request Schema

This is the schema for the flights bulk truecost api.

Flight Schema

Each request body is an array which requires individual objects with below parameters.

Name DescriptionTypeOptional
flight_idThis field has to generated and sent from your end. This has to be unique in order to map each flight truecost data to its original request for tally purposes.unique string
required
departureThe destination airport's IATA code where the flight is going.string
required
arrivalThe arrival airport's IATA code where the flight will arrive at.string
required
no_of_ticketsNumber of tickets for which the truecost is being calculated.number
required
aircraft_modelThe aircraft model that is being used for the journey.
Default will be set as 320
stringoptional
flight_classThe class of flight ticket for which the truecost is being calculated.
Enums : ECONOMY , PREMIUM_ECONOMY , FIRST , BUSINESS
string
required
flight_typeThis is an enum denoting the type of the flight.
Enums : ONE_WAY , ROUND_TRIP
string
required

Endpoint

/v3/flight/bulk

Method

POST

Headers

{
'x-api-key': 'API_KEY',
'Content-Type': 'application/json'
}

Payload

[
{
"flight_id": "BWESYZZE6ECOFOMFDH4",
"departure": "BOS",
"arrival": "YYZ",
"aircraft_model": "DH4",
"flight_class": "ECONOMY",
"no_of_tickets": 1,
"flight_type": "ONE_WAY"
},
{
"flight_id": "FWYSYZZE6ECOFOMOME",
"departure": "BOS",
"arrival": "YYZ",
"aircraft_model": "DH4",
"flight_class": "ECONOMY",
"no_of_tickets": 1,
"flight_type": "ONE_WAY"
}
]
tip

If you want to calculate and store the flight's truecost value for future use, send the no_of_tickets as 1 and in future just multiply the value of this flight's truecost by the number of tickets so that you don't have to query this data again

caution

The length of the payload should be less than 500 individual objects per request.

Response Parameters

Response Schema

NameDescriptionType
messageA human readable string describing response for the given request.string
caution

The error message is for your information, not the end users.
Please use the status codes and communicate the error to user accordingly
The API returns the first validation error that is encountered even if there are multiple errors with the request

Status Code

200

Response Data

{
"message": "The flight data has been added successfully!",
}

Sample Request

curl --location --request POST 'BASE_URL/v3/flight/bulk'  
--header 'x-api-key: API_KEY'
--header 'Content-Type: application/json'
--data-raw '[{
"flight_id": "BWESYZZE6ECOFOMFDH4",
"departure": "BOS",
"arrival": "YYZ",
"aircraft_model": "DH4",
"flight_class": "ECONOMY",
"no_of_tickets": 1,
"flight_type": "ONE_WAY"
},
{
"flight_id": "FWYSYZZE6ECOFOMOME",
"departure": "BOS",
"arrival": "YYZ",
"aircraft_model": "DH4",
"flight_class": "ECONOMY",
"no_of_tickets": 1,
"flight_type": "ONE_WAY"
}
]'

Sample Response

Below are sample responses for the above request.

Responses

{
"message": "The flight data has been added successfully!"
}

Calculated Values Response Format

This the format in which the calculated response will be sent to your configured endpoint.

The response will be in the following format as key value pairs where keys are the flight_id sent during the request and the values are the truecost values in tonnes CO2e for that individual flight request object.

{
"BWESYZZE6ECOFOMFDH4": "0.123",
"FWYSYZZE6ECOFOMOME": "0.123"
}