Last updated: 2025-03-31
Retrieve statistical data via API, CO2 emissions in grams
Valid Opter 2024.06.00 and later. Some functional improvements are available if you use Opter 2024.12.00 or later.
In this Price item
Using Opter's statistics API, you can see the estimated climate impact of your transport in terms of carbon emissions.
You can programme a solution where you call Opter's statistics API and then present the statistics as you wish. You can automate the flow so that the information is retrieved from Opter as often as you want. The information returned by the statistics API is "raw data"/basic data from the Opter database. For more information, see Retrieving statistical data via API.
Conditions
-
In order for Opter to calculate CO2 emissions, you must first make the settings described in Settings for CO2 emission calculations.
-
To use the Opter Statistics API to retrieve optional statistics data from Opter, follow the instructions in Retrieving statistical data via API.
Example
Examples of CO2 emissions data that can be retrieved:
The estimated CO2 emissions for the order are based on information available at the time of order placement. After that, the estimated CO2 emissions can be changed manually.
All data about orders will be retrieved if you set includeDeliveries to "true".
The following fields in Deliveries are relevant:
-
The estimated CO2 emissions for the order (automatically calculated) can be found in calculatedEmissionForecast.
-
The estimated CO2 emissions for the order (manually filled in) can be found in emissionForecast.
If the estimated CO2 emissions have been entered manually, the manually entered value overwrites Opter’s calculated value. In the statistics API, this means that if there are values for both emissionForecast and calculatedEmissionForecast, you should use emissionForecast.
For more information, see table below, and in How Opter calculates CO2 emissions.
Calculated CO2 emissions for a shipment are a more accurate calculation than estimated CO2 emissions for an order, as this calculation is also based on information about the actual vehicle and distance of the mission. For more information, see How Opter calculates CO2 emissions.
All shipment data will be retrieved if you set includeShipments to "true".
The following fields in Shipments are relevant:
-
The Calculated CO2 emissions for the shipment can be found in emissionEstimate.
-
The order to which the shipment belongs can be found in deliveryId (Order number) .
-
The vehicle associated with the shipment can be found at vehicleId.
The call number of the Vehicle can be found in vehicleCode and the name of the Vehicle can be found in vehicleName.
For more information, see table below.
To get the calculated CO2 emissions for the order, programme your solution so that the calculated CO2 emissions of the constituent shipments are added together. See Calculated CO2 emissions for the shipment above
If you want to make your own calculations of CO2 emissions, you can use the following data, for example:
-
Weight and pricing weight for the order, they can be found in calculatedWeight and pricingWeight, and retrieved if includeDeliveries is set to "true".
-
Distance and Vehicle on the shipment, they can be found in calculatedDistance and vehicleId, and retrieved if includeShipments is set to "true".
-
CO2 emissions (g/km), fuel consumption, fuel, environmental class and capacity converted to pricing weight (kg), they can be found in emissionInGramPerKilometer, fuelConsumption, fuelName, emissionClass and EmissionPricingWeightCapacity, and retrieved if includeVehicle is set to "true".
For more information, see table below.
Examples of fields that may be of interest:
| Field name in Opter | The field name in the statistics API | Description |
|---|---|---|
|
Estimated CO2 emissions (g) (formerly CO2 emissions (g)) Shown under Data in order reception. |
calculatedEmissionForecast Enter includeDeliveries = "true". |
What is shown in the field is the estimate, i.e. a first calculation of the CO2 emissions of the order in grams. (This value is overwritten if the CO2 emissions are entered manually in the Estimated CO2 emissions (g) field in the Order reception, see line below). |
|
Estimated CO2 emissions (g) (formerly CO2 emissions (g)) Shown under Data in order reception. |
emissionForecast Enter includeDeliveries = "true". |
If the estimated CO2 emissions have been entered manually, the manually entered value overwrites Opter’s calculation of the order’s estimated CO2 emissions. (See the row above). |
|
CO2 emissions, calculated (g) Shown under Details on the shipment in order reception. |
emissionEstimate Enter includeShipments = "true". In deliveryId, the number of the order to which the shipment belongs is displayed. vehicleId shows which Vehicle is linked to the shipment. |
What is shown in the field is a calculation of the shipment’s CO2 emissions. |
|
CO2 emissions (g/km) Shown on the Emissions tab in the vehicle registry. |
emissionInGramPerKilometer
Enter includeVehicle = "true". |
The vehicle’s CO2 emissions in grams per km. |
|
Fuel Shown on the Emissions tab in the vehicle registry. |
fuelName Enter includeVehicle = "true". |
The type of fuel used by the vehicle, e.g. Diesel. |
|
Fuel consumption (per 100 km) Shown on the Emissions tab in the vehicle registry. |
fuelConsumption
Enter includeVehicle = "true". |
The vehicle’s fuel consumption in the selected unit per 100 km. (The unit is configured in the fuel registry). |
|
Capacity converted into pricing weight (kg) Shown on the Emissions tab in the vehicle registry. |
emissionPricingWeightCapacity Enter includeVehicle = "true". |
See Step 1 in Settings for CO2 emission calculations. |
|
Emission class Shown on the General tab in the vehicle registry. |
emissionClass
Enter includeVehicle = "true". |
The environmental class of the vehicle, e.g. “Euro 5”. |
Back
CO2 emissions in grams, overview.