Rail shipments
Calculate the CO₂e emissions for a shipment by rail. Lune supports both electric and diesel train transport.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.

Review how to calculate emissions for multi-leg shipments using the API.
1. Gather shipment details
When setting the route for rail transport, the source and destination should be locations of existing rail stations. If the stations can’t be identified, consider using the distance property for route, or enabling Lune’s Road transfer inference feature.
method
property of the leg
object. There are many values you can choose from for train transport, the simplest being diesel_freight_train
and electric_freight_train
. For electric trains, we take the electricity generation patterns of the countries the train travels in to more accurately determine the emission estimate calculation.Values can also include us
or eu
to request a region specific emission factor, for example diesel_freight_train_us_average
where average
refers to the size of the load.Values can include several suffixes indicating load characteristics, like size or what is being carried by the shipment, for example electric_freight_train_eu_coal_steel
.For values such as diesel_freight_train_eu_truck_and_trailer
and diesel_freight_train_eu_truck_trailer_only
the load characteristic suffix refers to the net load within the truck.For a list of all available enum values, refer to the API reference.To specify a leg travelling from London St. Pancras station to Paris Gare du Nord station, on an electric freight train, the object would look like this:
2. Make the API request
To calculate emissions for rail shipments, use the /estimates/shipping/multi-leg/ endpoint. Send aPOST
request to this endpoint to create an emissions estimate.Include the Authorization header with your API Key as a Bearer Token. To associate the emission calculation with a specific client account, add either a Lune-Account header or a client account object to your request.
Sample request
The sample request below generates an estimate for a shipment with one leg transported by train from London St. Pancras station to Paris Gare du Nord station.