Pre-requisites
Complete the following setup steps before using this guide:Generate an API key and authenticate your account.
Set up Client Accounts to track emissions for your individual customers.
1. Gather shipment details
Basic requirements
To calculate an emissions estimate with Lune, you need three essential pieces of information: the shipment’s quantity, the distance travelled, and the transport method used. This data is provided within thelegs
and shipment
objects in your API request.The legs
object is an array, with each element detailing the route and method for a specific segment of the shipment's journey. At least one leg is required in this array to generate a calculation.
Route
You can specify a route by providing the distance in either kilometres or miles, as shown below:
Method
You can implement the method property in several ways, depending on how much information you have available. Lune offers multiple calculation methodologies. Some require minimal data, while others use more detailed inputs for greater accuracy. For example, a CO₂e calculation can be generated by specifying simply the type of truck used for the leg:
Calculate emissions for sea shipments using the API.
Calculate emissions for road shipments using the API.
Calculate emissions for air shipments using the API.
Optional properties
To make full use of Lune’s emissions reporting capabilities, we recommend including the following properties in emission calculation requests:2. Make the API request
Use the estimates/shipping/multi-leg/ endpoint to calculate emissions for multi-leg shipments. Send aPOST
request to this endpoint to create the estimate.Remember to add the Authorization header with your generated Bearer Token, as well as a Lune Account header with the client account that this emission is being calculated for.
- First leg: Shipment by cargo plane from Toronto Pearson Airport to London Heathrow Airport.
- Second leg: Shipment by truck from London Heathrow Airport to Cambridge, United Kingdom.
Sample request
3. Interpret the results
After receiving a response, refer to the mass property for the total CO₂e estimate for the entire shipment. In the sample request from Step 2, the total CO₂e estimate of 8.084842 tonnes.
id
in the response for future reference. You can use this property later on for reporting, analytics, and any updates to the calculation.For details on additional properties, go to the full API reference.4. Update the estimate
If the initial estimate was created during the booking phase, you'll need to update it once the final details are confirmed. Any changes after booking confirmation will also require an estimate update.Use the estimate’sid
with the estimates/shipping/multi-leg/{id} endpoint, and send a PUT
request that includes the updated legs. Ensure that is_shipment
is set to true
.Success! You’ve successfully calculated emissions for your shipment. This brings you one step closer to climate compliance!