Lune Docs Logo
Log inContact us

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:
/illustrations/stamp-key.png
Generate an API key and authenticate your account.
/illustrations/stamp-accounts.png
Set up Client Accounts to track emissions for your individual customers.
/illustrations/stamp-route.png
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.
  • To calculate an estimate, you must choose an appropriate value for the 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:
  • Sample rail leg object
  • 2. Make the API request

    To calculate emissions for rail shipments, use the /estimates/shipping/multi-leg/ endpoint. Send a POST 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.
  • CURL request for a rail shipment
  • To interpret the results, go to the Multi-leg shipment guide. If your shipment has multiple legs involving different transport methods, refer to the relevant guides for constructing your multi-leg object.Success! You’ve successfully calculated emissions for the rail transport legs of your shipment. You’re on the path to a greener supply chain!

    What to do next...