curl --request POST \
--url https://api.terratwin.com/api/v1/transportation/emissions/calculate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"id": "123456789",
"options": {
"fallbackTransportModes": [
"ROAD",
"AIR"
],
"storeResult": true
},
"cargo": {
"category": "GENERAL",
"densityCharacteristics": "LIGHT",
"weight": {
"unit": "KILOGRAM",
"value": 100
}
},
"origin": {
"type": "PLACE",
"street": "10 Downing St",
"postCode": "SW1A 2AB",
"city": "London",
"countryCode": "GB"
},
"destination": {
"type": "PLACE",
"street": "Wetstraat 175",
"postCode": "1048",
"city": "Brussel",
"countryCode": "BE"
},
"transportChain": [
{
"id": "123456789-01",
"type": "WATER",
"departureDateTime": "2025-12-25T00:00:00+00:00",
"arrivalDateTime": "2026-01-01T18:12:30Z",
"vehicle": "CONTAINER",
"containerTypeCode": "22G1",
"navigationConstraints": [
"AVOID_KIEL_CANAL",
"AVOID_NORTHEAST_PASSAGE",
"AVOID_NORTHWEST_PASSAGE"
],
"firstMile": {
"structure": "ARTICULATED",
"grossWeight": {
"unit": "METRIC_TONNE",
"value": 40.234
},
"energyType": "DIESEL"
},
"context": {
"additionalInformation": "customWaterLegValue"
}
},
{
"type": "HUB",
"hubType": "MARITIME_TERMINAL",
"location": {
"type": "HARBOR",
"unLoCode": "BEANR"
}
},
{
"id": "123456789-02",
"type": "RAIL",
"departureDateTime": "2026-01-02T10:00:00+01:00",
"arrivalDateTime": "2026-01-02T22:00:00+01:00",
"trainType": "MANIFEST",
"energyType": "ELECTRICITY",
"context": {
"customProperty": "customRailLegValue"
}
}
],
"context": {
"reportingParty": {
"name": "Acme Corp",
"organisationNumber": "12345",
"Custom value": "Custom reporting party value"
},
"reportingTo": {
"name": "Shipping Inc",
"address": "100 Example Street, Demo City, DC 10001 Exampleland",
"Extra information": "Custom reporting to value"
},
"consignor": {
"name": "Apex Distribution",
"Further details": "Custom consignor value"
},
"consignee": {
"name": "Globex Group",
"organisationNumber": "54321"
},
"transportProvider": {
"name": "Atlas Logistics"
},
"transaction": {
"project": "",
"agreement": "",
"incoterms": "DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020"
},
"cargo": {
"shipmentId": "ABCD-123456789",
"Supplementary Information": "Additional ccargo details"
},
"customStringProperty": "customPropertyValue",
"customNumericProperty": 42
}
}
'import requests
url = "https://api.terratwin.com/api/v1/transportation/emissions/calculate"
payload = {
"id": "123456789",
"options": {
"fallbackTransportModes": ["ROAD", "AIR"],
"storeResult": True
},
"cargo": {
"category": "GENERAL",
"densityCharacteristics": "LIGHT",
"weight": {
"unit": "KILOGRAM",
"value": 100
}
},
"origin": {
"type": "PLACE",
"street": "10 Downing St",
"postCode": "SW1A 2AB",
"city": "London",
"countryCode": "GB"
},
"destination": {
"type": "PLACE",
"street": "Wetstraat 175",
"postCode": "1048",
"city": "Brussel",
"countryCode": "BE"
},
"transportChain": [
{
"id": "123456789-01",
"type": "WATER",
"departureDateTime": "2025-12-25T00:00:00+00:00",
"arrivalDateTime": "2026-01-01T18:12:30Z",
"vehicle": "CONTAINER",
"containerTypeCode": "22G1",
"navigationConstraints": ["AVOID_KIEL_CANAL", "AVOID_NORTHEAST_PASSAGE", "AVOID_NORTHWEST_PASSAGE"],
"firstMile": {
"structure": "ARTICULATED",
"grossWeight": {
"unit": "METRIC_TONNE",
"value": 40.234
},
"energyType": "DIESEL"
},
"context": { "additionalInformation": "customWaterLegValue" }
},
{
"type": "HUB",
"hubType": "MARITIME_TERMINAL",
"location": {
"type": "HARBOR",
"unLoCode": "BEANR"
}
},
{
"id": "123456789-02",
"type": "RAIL",
"departureDateTime": "2026-01-02T10:00:00+01:00",
"arrivalDateTime": "2026-01-02T22:00:00+01:00",
"trainType": "MANIFEST",
"energyType": "ELECTRICITY",
"context": { "customProperty": "customRailLegValue" }
}
],
"context": {
"reportingParty": {
"name": "Acme Corp",
"organisationNumber": "12345",
"Custom value": "Custom reporting party value"
},
"reportingTo": {
"name": "Shipping Inc",
"address": "100 Example Street, Demo City, DC 10001 Exampleland",
"Extra information": "Custom reporting to value"
},
"consignor": {
"name": "Apex Distribution",
"Further details": "Custom consignor value"
},
"consignee": {
"name": "Globex Group",
"organisationNumber": "54321"
},
"transportProvider": { "name": "Atlas Logistics" },
"transaction": {
"project": "",
"agreement": "",
"incoterms": "DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020"
},
"cargo": {
"shipmentId": "ABCD-123456789",
"Supplementary Information": "Additional ccargo details"
},
"customStringProperty": "customPropertyValue",
"customNumericProperty": 42
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '123456789',
options: {fallbackTransportModes: ['ROAD', 'AIR'], storeResult: true},
cargo: {
category: 'GENERAL',
densityCharacteristics: 'LIGHT',
weight: {unit: 'KILOGRAM', value: 100}
},
origin: {
type: 'PLACE',
street: '10 Downing St',
postCode: 'SW1A 2AB',
city: 'London',
countryCode: 'GB'
},
destination: {
type: 'PLACE',
street: 'Wetstraat 175',
postCode: '1048',
city: 'Brussel',
countryCode: 'BE'
},
transportChain: [
{
id: '123456789-01',
type: 'WATER',
departureDateTime: '2025-12-25T00:00:00+00:00',
arrivalDateTime: '2026-01-01T18:12:30Z',
vehicle: 'CONTAINER',
containerTypeCode: '22G1',
navigationConstraints: ['AVOID_KIEL_CANAL', 'AVOID_NORTHEAST_PASSAGE', 'AVOID_NORTHWEST_PASSAGE'],
firstMile: {
structure: 'ARTICULATED',
grossWeight: {unit: 'METRIC_TONNE', value: 40.234},
energyType: 'DIESEL'
},
context: {additionalInformation: 'customWaterLegValue'}
},
{
type: 'HUB',
hubType: 'MARITIME_TERMINAL',
location: {type: 'HARBOR', unLoCode: 'BEANR'}
},
{
id: '123456789-02',
type: 'RAIL',
departureDateTime: '2026-01-02T10:00:00+01:00',
arrivalDateTime: '2026-01-02T22:00:00+01:00',
trainType: 'MANIFEST',
energyType: 'ELECTRICITY',
context: {customProperty: 'customRailLegValue'}
}
],
context: {
reportingParty: {
name: 'Acme Corp',
organisationNumber: '12345',
'Custom value': 'Custom reporting party value'
},
reportingTo: {
name: 'Shipping Inc',
address: '100 Example Street, Demo City, DC 10001 Exampleland',
'Extra information': 'Custom reporting to value'
},
consignor: {name: 'Apex Distribution', 'Further details': 'Custom consignor value'},
consignee: {name: 'Globex Group', organisationNumber: '54321'},
transportProvider: {name: 'Atlas Logistics'},
transaction: {
project: '',
agreement: '',
incoterms: 'DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020'
},
cargo: {
shipmentId: 'ABCD-123456789',
'Supplementary Information': 'Additional ccargo details'
},
customStringProperty: 'customPropertyValue',
customNumericProperty: 42
}
})
};
fetch('https://api.terratwin.com/api/v1/transportation/emissions/calculate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.terratwin.com/api/v1/transportation/emissions/calculate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '123456789',
'options' => [
'fallbackTransportModes' => [
'ROAD',
'AIR'
],
'storeResult' => true
],
'cargo' => [
'category' => 'GENERAL',
'densityCharacteristics' => 'LIGHT',
'weight' => [
'unit' => 'KILOGRAM',
'value' => 100
]
],
'origin' => [
'type' => 'PLACE',
'street' => '10 Downing St',
'postCode' => 'SW1A 2AB',
'city' => 'London',
'countryCode' => 'GB'
],
'destination' => [
'type' => 'PLACE',
'street' => 'Wetstraat 175',
'postCode' => '1048',
'city' => 'Brussel',
'countryCode' => 'BE'
],
'transportChain' => [
[
'id' => '123456789-01',
'type' => 'WATER',
'departureDateTime' => '2025-12-25T00:00:00+00:00',
'arrivalDateTime' => '2026-01-01T18:12:30Z',
'vehicle' => 'CONTAINER',
'containerTypeCode' => '22G1',
'navigationConstraints' => [
'AVOID_KIEL_CANAL',
'AVOID_NORTHEAST_PASSAGE',
'AVOID_NORTHWEST_PASSAGE'
],
'firstMile' => [
'structure' => 'ARTICULATED',
'grossWeight' => [
'unit' => 'METRIC_TONNE',
'value' => 40.234
],
'energyType' => 'DIESEL'
],
'context' => [
'additionalInformation' => 'customWaterLegValue'
]
],
[
'type' => 'HUB',
'hubType' => 'MARITIME_TERMINAL',
'location' => [
'type' => 'HARBOR',
'unLoCode' => 'BEANR'
]
],
[
'id' => '123456789-02',
'type' => 'RAIL',
'departureDateTime' => '2026-01-02T10:00:00+01:00',
'arrivalDateTime' => '2026-01-02T22:00:00+01:00',
'trainType' => 'MANIFEST',
'energyType' => 'ELECTRICITY',
'context' => [
'customProperty' => 'customRailLegValue'
]
]
],
'context' => [
'reportingParty' => [
'name' => 'Acme Corp',
'organisationNumber' => '12345',
'Custom value' => 'Custom reporting party value'
],
'reportingTo' => [
'name' => 'Shipping Inc',
'address' => '100 Example Street, Demo City, DC 10001 Exampleland',
'Extra information' => 'Custom reporting to value'
],
'consignor' => [
'name' => 'Apex Distribution',
'Further details' => 'Custom consignor value'
],
'consignee' => [
'name' => 'Globex Group',
'organisationNumber' => '54321'
],
'transportProvider' => [
'name' => 'Atlas Logistics'
],
'transaction' => [
'project' => '',
'agreement' => '',
'incoterms' => 'DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020'
],
'cargo' => [
'shipmentId' => 'ABCD-123456789',
'Supplementary Information' => 'Additional ccargo details'
],
'customStringProperty' => 'customPropertyValue',
'customNumericProperty' => 42
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.terratwin.com/api/v1/transportation/emissions/calculate"
payload := strings.NewReader("{\n \"id\": \"123456789\",\n \"options\": {\n \"fallbackTransportModes\": [\n \"ROAD\",\n \"AIR\"\n ],\n \"storeResult\": true\n },\n \"cargo\": {\n \"category\": \"GENERAL\",\n \"densityCharacteristics\": \"LIGHT\",\n \"weight\": {\n \"unit\": \"KILOGRAM\",\n \"value\": 100\n }\n },\n \"origin\": {\n \"type\": \"PLACE\",\n \"street\": \"10 Downing St\",\n \"postCode\": \"SW1A 2AB\",\n \"city\": \"London\",\n \"countryCode\": \"GB\"\n },\n \"destination\": {\n \"type\": \"PLACE\",\n \"street\": \"Wetstraat 175\",\n \"postCode\": \"1048\",\n \"city\": \"Brussel\",\n \"countryCode\": \"BE\"\n },\n \"transportChain\": [\n {\n \"id\": \"123456789-01\",\n \"type\": \"WATER\",\n \"departureDateTime\": \"2025-12-25T00:00:00+00:00\",\n \"arrivalDateTime\": \"2026-01-01T18:12:30Z\",\n \"vehicle\": \"CONTAINER\",\n \"containerTypeCode\": \"22G1\",\n \"navigationConstraints\": [\n \"AVOID_KIEL_CANAL\",\n \"AVOID_NORTHEAST_PASSAGE\",\n \"AVOID_NORTHWEST_PASSAGE\"\n ],\n \"firstMile\": {\n \"structure\": \"ARTICULATED\",\n \"grossWeight\": {\n \"unit\": \"METRIC_TONNE\",\n \"value\": 40.234\n },\n \"energyType\": \"DIESEL\"\n },\n \"context\": {\n \"additionalInformation\": \"customWaterLegValue\"\n }\n },\n {\n \"type\": \"HUB\",\n \"hubType\": \"MARITIME_TERMINAL\",\n \"location\": {\n \"type\": \"HARBOR\",\n \"unLoCode\": \"BEANR\"\n }\n },\n {\n \"id\": \"123456789-02\",\n \"type\": \"RAIL\",\n \"departureDateTime\": \"2026-01-02T10:00:00+01:00\",\n \"arrivalDateTime\": \"2026-01-02T22:00:00+01:00\",\n \"trainType\": \"MANIFEST\",\n \"energyType\": \"ELECTRICITY\",\n \"context\": {\n \"customProperty\": \"customRailLegValue\"\n }\n }\n ],\n \"context\": {\n \"reportingParty\": {\n \"name\": \"Acme Corp\",\n \"organisationNumber\": \"12345\",\n \"Custom value\": \"Custom reporting party value\"\n },\n \"reportingTo\": {\n \"name\": \"Shipping Inc\",\n \"address\": \"100 Example Street, Demo City, DC 10001 Exampleland\",\n \"Extra information\": \"Custom reporting to value\"\n },\n \"consignor\": {\n \"name\": \"Apex Distribution\",\n \"Further details\": \"Custom consignor value\"\n },\n \"consignee\": {\n \"name\": \"Globex Group\",\n \"organisationNumber\": \"54321\"\n },\n \"transportProvider\": {\n \"name\": \"Atlas Logistics\"\n },\n \"transaction\": {\n \"project\": \"\",\n \"agreement\": \"\",\n \"incoterms\": \"DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020\"\n },\n \"cargo\": {\n \"shipmentId\": \"ABCD-123456789\",\n \"Supplementary Information\": \"Additional ccargo details\"\n },\n \"customStringProperty\": \"customPropertyValue\",\n \"customNumericProperty\": 42\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.terratwin.com/api/v1/transportation/emissions/calculate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"123456789\",\n \"options\": {\n \"fallbackTransportModes\": [\n \"ROAD\",\n \"AIR\"\n ],\n \"storeResult\": true\n },\n \"cargo\": {\n \"category\": \"GENERAL\",\n \"densityCharacteristics\": \"LIGHT\",\n \"weight\": {\n \"unit\": \"KILOGRAM\",\n \"value\": 100\n }\n },\n \"origin\": {\n \"type\": \"PLACE\",\n \"street\": \"10 Downing St\",\n \"postCode\": \"SW1A 2AB\",\n \"city\": \"London\",\n \"countryCode\": \"GB\"\n },\n \"destination\": {\n \"type\": \"PLACE\",\n \"street\": \"Wetstraat 175\",\n \"postCode\": \"1048\",\n \"city\": \"Brussel\",\n \"countryCode\": \"BE\"\n },\n \"transportChain\": [\n {\n \"id\": \"123456789-01\",\n \"type\": \"WATER\",\n \"departureDateTime\": \"2025-12-25T00:00:00+00:00\",\n \"arrivalDateTime\": \"2026-01-01T18:12:30Z\",\n \"vehicle\": \"CONTAINER\",\n \"containerTypeCode\": \"22G1\",\n \"navigationConstraints\": [\n \"AVOID_KIEL_CANAL\",\n \"AVOID_NORTHEAST_PASSAGE\",\n \"AVOID_NORTHWEST_PASSAGE\"\n ],\n \"firstMile\": {\n \"structure\": \"ARTICULATED\",\n \"grossWeight\": {\n \"unit\": \"METRIC_TONNE\",\n \"value\": 40.234\n },\n \"energyType\": \"DIESEL\"\n },\n \"context\": {\n \"additionalInformation\": \"customWaterLegValue\"\n }\n },\n {\n \"type\": \"HUB\",\n \"hubType\": \"MARITIME_TERMINAL\",\n \"location\": {\n \"type\": \"HARBOR\",\n \"unLoCode\": \"BEANR\"\n }\n },\n {\n \"id\": \"123456789-02\",\n \"type\": \"RAIL\",\n \"departureDateTime\": \"2026-01-02T10:00:00+01:00\",\n \"arrivalDateTime\": \"2026-01-02T22:00:00+01:00\",\n \"trainType\": \"MANIFEST\",\n \"energyType\": \"ELECTRICITY\",\n \"context\": {\n \"customProperty\": \"customRailLegValue\"\n }\n }\n ],\n \"context\": {\n \"reportingParty\": {\n \"name\": \"Acme Corp\",\n \"organisationNumber\": \"12345\",\n \"Custom value\": \"Custom reporting party value\"\n },\n \"reportingTo\": {\n \"name\": \"Shipping Inc\",\n \"address\": \"100 Example Street, Demo City, DC 10001 Exampleland\",\n \"Extra information\": \"Custom reporting to value\"\n },\n \"consignor\": {\n \"name\": \"Apex Distribution\",\n \"Further details\": \"Custom consignor value\"\n },\n \"consignee\": {\n \"name\": \"Globex Group\",\n \"organisationNumber\": \"54321\"\n },\n \"transportProvider\": {\n \"name\": \"Atlas Logistics\"\n },\n \"transaction\": {\n \"project\": \"\",\n \"agreement\": \"\",\n \"incoterms\": \"DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020\"\n },\n \"cargo\": {\n \"shipmentId\": \"ABCD-123456789\",\n \"Supplementary Information\": \"Additional ccargo details\"\n },\n \"customStringProperty\": \"customPropertyValue\",\n \"customNumericProperty\": 42\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.terratwin.com/api/v1/transportation/emissions/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"123456789\",\n \"options\": {\n \"fallbackTransportModes\": [\n \"ROAD\",\n \"AIR\"\n ],\n \"storeResult\": true\n },\n \"cargo\": {\n \"category\": \"GENERAL\",\n \"densityCharacteristics\": \"LIGHT\",\n \"weight\": {\n \"unit\": \"KILOGRAM\",\n \"value\": 100\n }\n },\n \"origin\": {\n \"type\": \"PLACE\",\n \"street\": \"10 Downing St\",\n \"postCode\": \"SW1A 2AB\",\n \"city\": \"London\",\n \"countryCode\": \"GB\"\n },\n \"destination\": {\n \"type\": \"PLACE\",\n \"street\": \"Wetstraat 175\",\n \"postCode\": \"1048\",\n \"city\": \"Brussel\",\n \"countryCode\": \"BE\"\n },\n \"transportChain\": [\n {\n \"id\": \"123456789-01\",\n \"type\": \"WATER\",\n \"departureDateTime\": \"2025-12-25T00:00:00+00:00\",\n \"arrivalDateTime\": \"2026-01-01T18:12:30Z\",\n \"vehicle\": \"CONTAINER\",\n \"containerTypeCode\": \"22G1\",\n \"navigationConstraints\": [\n \"AVOID_KIEL_CANAL\",\n \"AVOID_NORTHEAST_PASSAGE\",\n \"AVOID_NORTHWEST_PASSAGE\"\n ],\n \"firstMile\": {\n \"structure\": \"ARTICULATED\",\n \"grossWeight\": {\n \"unit\": \"METRIC_TONNE\",\n \"value\": 40.234\n },\n \"energyType\": \"DIESEL\"\n },\n \"context\": {\n \"additionalInformation\": \"customWaterLegValue\"\n }\n },\n {\n \"type\": \"HUB\",\n \"hubType\": \"MARITIME_TERMINAL\",\n \"location\": {\n \"type\": \"HARBOR\",\n \"unLoCode\": \"BEANR\"\n }\n },\n {\n \"id\": \"123456789-02\",\n \"type\": \"RAIL\",\n \"departureDateTime\": \"2026-01-02T10:00:00+01:00\",\n \"arrivalDateTime\": \"2026-01-02T22:00:00+01:00\",\n \"trainType\": \"MANIFEST\",\n \"energyType\": \"ELECTRICITY\",\n \"context\": {\n \"customProperty\": \"customRailLegValue\"\n }\n }\n ],\n \"context\": {\n \"reportingParty\": {\n \"name\": \"Acme Corp\",\n \"organisationNumber\": \"12345\",\n \"Custom value\": \"Custom reporting party value\"\n },\n \"reportingTo\": {\n \"name\": \"Shipping Inc\",\n \"address\": \"100 Example Street, Demo City, DC 10001 Exampleland\",\n \"Extra information\": \"Custom reporting to value\"\n },\n \"consignor\": {\n \"name\": \"Apex Distribution\",\n \"Further details\": \"Custom consignor value\"\n },\n \"consignee\": {\n \"name\": \"Globex Group\",\n \"organisationNumber\": \"54321\"\n },\n \"transportProvider\": {\n \"name\": \"Atlas Logistics\"\n },\n \"transaction\": {\n \"project\": \"\",\n \"agreement\": \"\",\n \"incoterms\": \"DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020\"\n },\n \"cargo\": {\n \"shipmentId\": \"ABCD-123456789\",\n \"Supplementary Information\": \"Additional ccargo details\"\n },\n \"customStringProperty\": \"customPropertyValue\",\n \"customNumericProperty\": 42\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "123456789",
"origin": {
"type": "PLACE",
"latitude": 51.503314,
"longitude": -0.127697
},
"destination": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 50.842691,
"longitude": 4.380654,
"address": "L161A"
},
"activityDistanceKm": 432.81564963432754,
"activityTonneKm": 43.281564963432764,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 7.06480567200353,
"ttwCo2eGramsPerTonneKm": 23.037518111707207,
"wtwCo2eGramsPerTonneKm": 30.10232378371073
},
"transportEmissions": {
"wttCo2eGrams": 305.77584564684906,
"ttwCo2eGrams": 997.0998367481144,
"wtwCo2eGrams": 1302.8756823949632
},
"hubIntensities": {
"co2eGramsPerTonne": 3.8
},
"hubEmissions": {
"co2eGrams": 0.38
},
"totalIntensities": {
"co2eGramsPerTonneKm": 30.111103503213045
},
"totalEmissions": {
"co2eGrams": 1303.2556823949633
},
"certificateUrl": "https://www.terratwin.com/certificate/3f34c409-284f-4cc2-baa5-124a08bde490",
"context": {
"reportingParty": {
"name": "Acme Corp",
"organisationNumber": "12345",
"Custom value": "Custom reporting party value"
},
"reportingTo": {
"name": "Shipping Inc",
"address": "100 Example Street, Demo City, DC 10001 Exampleland",
"Extra information": "Custom reporting to value"
},
"consignor": {
"name": "Apex Distribution",
"Further details": "Custom consignor value"
},
"consignee": {
"name": "Globex Group",
"organisationNumber": "54321"
},
"transportProvider": {
"name": "Atlas Logistics"
},
"transaction": {
"project": "",
"agreement": "",
"incoterms": "DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020"
},
"cargo": {
"shipmentId": "ABCD-123456789",
"Supplementary Information": "Additional ccargo details"
},
"customStringProperty": "customPropertyValue",
"customNumericProperty": 42
},
"transportChain": [
{
"type": "WATER",
"id": "123456789-01",
"start": {
"type": "PLACE",
"latitude": 51.503314,
"longitude": -0.127697
},
"end": {
"type": "HARBOR",
"countryCode": "BE",
"unLoCode": "BEANR",
"latitude": 51.27936713324465,
"longitude": 4.3567657470703125,
"address": "Antwerp"
},
"activityDistanceKm": 358.24702719735023,
"activityTonneKm": 35.82470271973503,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 6.966414868380875,
"ttwCo2eGramsPerTonneKm": 27.524003700923917,
"wtwCo2eGramsPerTonneKm": 34.490418569304786
},
"transportEmissions": {
"wttCo2eGrams": 249.56974168208689,
"ttwCo2eGrams": 986.0392502424861,
"wtwCo2eGrams": 1235.6089919245728
},
"hubIntensities": {
"co2eGramsPerTonne": 1.9
},
"hubEmissions": {
"co2eGrams": 0.19
},
"totalIntensities": {
"co2eGramsPerTonneKm": 34.495722172281944
},
"totalEmissions": {
"co2eGrams": 1235.7989919245729
},
"context": {
"additionalInformation": "customWaterLegValue"
},
"elements": [
{
"vehicle": "ARTICULATED_TRUCK_40000_TO_50000_KG",
"emissionsStandard": "EURO_6AC",
"loadFactor": 72,
"emptyRunning": 30,
"loadDistribution": "LTL",
"methodology": "INFRAS_HBEFA_5_1",
"distanceMeasurementMethod": "SHORTEST_FEASIBLE_DISTANCE",
"calculationBasis": "MODEL",
"distanceAdjustmentFactor": "1.05",
"start": {
"type": "PLACE",
"latitude": 51.503314,
"longitude": -0.127697
},
"end": {
"type": "PLACE",
"latitude": 51.459472,
"longitude": 0.340663
},
"activityDistanceKm": 44.69842583939949,
"activityTonneKm": 4.46984258393995,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 18.188259972604925,
"ttwCo2eGramsPerTonneKm": 55.634499734404805,
"wtwCo2eGramsPerTonneKm": 73.82275970700972
},
"transportEmissions": {
"wttCo2eGrams": 81.29865895331996,
"ttwCo2eGrams": 248.67745604903843,
"wtwCo2eGrams": 329.97611500235837
},
"resultsByEnergyType": [
{
"energyType": "DIESEL",
"activityDistanceKm": 44.69842583939949,
"activityTonneKm": 4.46984258393995,
"intensities": {
"wttCo2eGramsPerTonneKm": 18.188259972604925,
"ttwCo2eGramsPerTonneKm": 55.634499734404805,
"wtwCo2eGramsPerTonneKm": 73.82275970700974
},
"emissions": {
"wttCo2eGrams": 81.29865895331996,
"ttwCo2eGrams": 248.67745604903843,
"wtwCo2eGrams": 329.97611500235837
},
"resultsByEnergySource": [
{
"energySource": "BIODIESEL_FROM_RAPESEED",
"factorReference": "ECOTRANSIT_4_0_EUROPE_BIOGENIC_FUEL_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 4.729108573738301,
"ttwCo2eGrams": 0.11573345876659132,
"wtwCo2eGrams": 4.844842032504893
}
},
{
"energySource": "BIODIESEL_FROM_UCO",
"factorReference": "ECOTRANSIT_4_0_EUROPE_BIOGENIC_FUEL_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 1.2690772375095185,
"ttwCo2eGrams": 0.09258676701327305,
"wtwCo2eGrams": 1.3616640045227915
}
},
{
"energySource": "BIODIESEL_FROM_SOYBEAN",
"factorReference": "ECOTRANSIT_4_0_EUROPE_BIOGENIC_FUEL_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 0.8260974470580831,
"ttwCo2eGrams": 0.023146691753318262,
"wtwCo2eGrams": 0.8492441388114014
}
},
{
"energySource": "FOSSIL_DIESEL",
"factorReference": "SFC_GLEC_3_2_EUROPE_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 74.47437569501406,
"ttwCo2eGrams": 248.44598913150526,
"wtwCo2eGrams": 322.9203648265193
}
}
]
}
],
"type": "ROAD"
},
{
"hubType": "MARITIME_TERMINAL",
"activityTonnes": 0.1,
"intensities": {
"co2eGramsPerTonne": 1.9000000000000001
},
"emissions": {
"co2eGrams": 0.19
},
"methodology": "SFC_GLEC_FRAMEWORK_3_2",
"calculationBasis": "DEFAULT_FACTORS",
"type": "HUB"
},
{
"vehicle": "CONTAINER",
"capacityBand": "POST_PANAMAX",
"containerType": "TWENTY_FOOT_CONTAINER",
"methodology": "SFC_GLEC_FRAMEWORK_3_2",
"distanceMeasurementMethod": "SHORTEST_FEASIBLE_DISTANCE",
"distanceAdjustmentFactor": "1.15",
"calculationBasis": "DEFAULT_FACTORS",
"start": {
"type": "HARBOR",
"countryCode": "GB",
"unLoCode": "GBTIL",
"latitude": 51.459502138725945,
"longitude": 0.3407907485961914,
"address": "Tilbury"
},
"end": {
"type": "HARBOR",
"countryCode": "BE",
"unLoCode": "BEANR",
"latitude": 51.27936713324465,
"longitude": 4.3567657470703125,
"address": "Antwerp"
},
"activityDistanceKm": 313.54860135795076,
"activityTonneKm": 31.35486013579508,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 5.366666666666667,
"ttwCo2eGramsPerTonneKm": 23.516666666666666,
"wtwCo2eGramsPerTonneKm": 28.883333333333336
},
"transportEmissions": {
"wttCo2eGrams": 168.27108272876694,
"ttwCo2eGrams": 737.3617941934476,
"wtwCo2eGrams": 905.6328769222146
},
"resultsByEnergyType": [
{
"energyType": "VLSFO",
"activityDistanceKm": 313.54860135795076,
"activityTonneKm": 31.35486013579508,
"intensities": {
"wttCo2eGramsPerTonneKm": 5.366666666666667,
"ttwCo2eGramsPerTonneKm": 23.516666666666666,
"wtwCo2eGramsPerTonneKm": 28.883333333333333
},
"emissions": {
"wttCo2eGrams": 168.27108272876694,
"ttwCo2eGrams": 737.3617941934476,
"wtwCo2eGrams": 905.6328769222146
},
"resultsByEnergySource": [
{
"energySource": "FOSSIL_VLSFO",
"factorReference": "SFC_GLEC_3_2_MARINE_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 168.27108272876694,
"ttwCo2eGrams": 737.3617941934476,
"wtwCo2eGrams": 905.6328769222146
}
}
]
}
],
"type": "WATER"
}
]
},
{
"hubType": "MARITIME_TERMINAL",
"activityTonnes": 0.1,
"intensities": {
"co2eGramsPerTonne": 1.9000000000000001
},
"emissions": {
"co2eGrams": 0.19
},
"methodology": "SFC_GLEC_FRAMEWORK_3_2",
"calculationBasis": "DEFAULT_FACTORS",
"type": "HUB"
},
{
"type": "RAIL",
"id": "123456789-02",
"start": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 51.279002,
"longitude": 4.356769,
"address": ""
},
"end": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 50.842691,
"longitude": 4.380654,
"address": "L161A"
},
"activityDistanceKm": 74.56862243697734,
"activityTonneKm": 7.456862243697734,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 7.537500644090015,
"ttwCo2eGramsPerTonneKm": 1.4832762285472343,
"wtwCo2eGramsPerTonneKm": 9.02077687263725
},
"transportEmissions": {
"wttCo2eGrams": 56.206103964762185,
"ttwCo2eGrams": 11.060586505628242,
"wtwCo2eGrams": 67.26669047039043
},
"hubIntensities": {
"co2eGramsPerTonne": 0
},
"hubEmissions": {
"co2eGrams": 0
},
"totalIntensities": {
"co2eGramsPerTonneKm": 9.02077687263725
},
"totalEmissions": {
"co2eGrams": 67.26669047039043
},
"context": {
"customProperty": "customRailLegValue"
},
"elements": [
{
"vehicle": "AVERAGE_TRAIN",
"methodology": "ECOTRANSIT_RAIL_4_0",
"distanceMeasurementMethod": "SHORTEST_FEASIBLE_DISTANCE",
"calculationBasis": "MODEL",
"distanceAdjustmentFactor": "1.0",
"start": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 51.279002,
"longitude": 4.356769,
"address": ""
},
"end": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 50.842691,
"longitude": 4.380654,
"address": "L161A"
},
"activityDistanceKm": 74.56862243697734,
"activityTonneKm": 7.456862243697734,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 7.537500644090015,
"ttwCo2eGramsPerTonneKm": 1.4832762285472343,
"wtwCo2eGramsPerTonneKm": 9.02077687263725
},
"transportEmissions": {
"wttCo2eGrams": 56.206103964762185,
"ttwCo2eGrams": 11.060586505628242,
"wtwCo2eGrams": 67.26669047039043
},
"resultsByEnergyType": [
{
"energyType": "ELECTRICITY",
"activityDistanceKm": 70.71537321805414,
"activityTonneKm": 7.0715373218054145,
"intensities": {
"wttCo2eGramsPerTonneKm": 7.479360000000002,
"ttwCo2eGramsPerTonneKm": 0,
"wtwCo2eGramsPerTonneKm": 7.479360000000002
},
"emissions": {
"wttCo2eGrams": 52.89057338321856,
"ttwCo2eGrams": 0,
"wtwCo2eGrams": 52.89057338321856
},
"resultsByEnergySource": [
{
"energySource": "ELECTRICAL_GRID",
"factorReference": "ECOTRANSIT_4_0_MEDIUM_VOLTAGE_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 52.89057338321856,
"ttwCo2eGrams": 0,
"wtwCo2eGrams": 52.89057338321856
}
}
]
},
{
"energyType": "DIESEL",
"activityDistanceKm": 3.8532492189231973,
"activityTonneKm": 0.38532492189231976,
"intensities": {
"wttCo2eGramsPerTonneKm": 8.604505945945949,
"ttwCo2eGramsPerTonneKm": 28.704570810810825,
"wtwCo2eGramsPerTonneKm": 37.309076756756774
},
"emissions": {
"wttCo2eGrams": 3.3155305815436233,
"ttwCo2eGrams": 11.060586505628242,
"wtwCo2eGrams": 14.376117087171865
},
"resultsByEnergySource": [
{
"energySource": "FOSSIL_DIESEL",
"factorReference": "SFC_GLEC_3_2_EUROPE_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 3.3155305815436233,
"ttwCo2eGrams": 11.060586505628242,
"wtwCo2eGrams": 14.376117087171865
}
}
]
}
],
"type": "RAIL"
}
]
}
],
"creditCost": 3
}{
"title": "Invalid JSON",
"status": 400,
"code": 2,
"details": [
"Invalid JSON at 'cargo' (line 7, byte 26)"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Provide well formed JSON"
}{
"title": "API key invalid",
"status": 401,
"code": 41,
"details": [
"'...' is not a valid API key"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Provide a valid API key. If you don’t have one, then apply to TerraTwin"
}{
"title": "Insufficient credits",
"status": 403,
"code": 42,
"details": [
"Your account has no remaining credits"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Purchase additional credits from TerraTwin"
}{
"title": "Not routable by rail",
"status": 422,
"code": 33,
"details": [
"Operation 'transportChain[0]' could not be routed by rail between '50.68689,7.16285' and '-36.85209,174.76318'"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Review the mode of transport selected and the locations"
}{
"title": "Rate limit exceeded",
"status": 429,
"code": 45,
"details": [
"Too many requests. The limit is 5 requests per second"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Reduce your request rate to ≤ 5 requests/second"
}{
"title": "<string>",
"status": 123,
"details": [
"<string>"
],
"instance": "<string>",
"recommendation": "<string>"
}{
"title": "<string>",
"status": 123,
"details": [
"<string>"
],
"instance": "<string>",
"recommendation": "<string>"
}Calculate transport emissions
Calculates greenhouse gas emissions for one or more transport operations. The endpoint supports the four core transport modes - AIR, RAIL, ROAD, and WATER - as well as a combination mode, WEIGHTED_MODES, which allows multiple underlying modes to be prorated into a single combined operation. Each transport operation in the request represents one leg of the cargo movement, and you may submit a single operation or a sequence of operations within the same request.
curl --request POST \
--url https://api.terratwin.com/api/v1/transportation/emissions/calculate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"id": "123456789",
"options": {
"fallbackTransportModes": [
"ROAD",
"AIR"
],
"storeResult": true
},
"cargo": {
"category": "GENERAL",
"densityCharacteristics": "LIGHT",
"weight": {
"unit": "KILOGRAM",
"value": 100
}
},
"origin": {
"type": "PLACE",
"street": "10 Downing St",
"postCode": "SW1A 2AB",
"city": "London",
"countryCode": "GB"
},
"destination": {
"type": "PLACE",
"street": "Wetstraat 175",
"postCode": "1048",
"city": "Brussel",
"countryCode": "BE"
},
"transportChain": [
{
"id": "123456789-01",
"type": "WATER",
"departureDateTime": "2025-12-25T00:00:00+00:00",
"arrivalDateTime": "2026-01-01T18:12:30Z",
"vehicle": "CONTAINER",
"containerTypeCode": "22G1",
"navigationConstraints": [
"AVOID_KIEL_CANAL",
"AVOID_NORTHEAST_PASSAGE",
"AVOID_NORTHWEST_PASSAGE"
],
"firstMile": {
"structure": "ARTICULATED",
"grossWeight": {
"unit": "METRIC_TONNE",
"value": 40.234
},
"energyType": "DIESEL"
},
"context": {
"additionalInformation": "customWaterLegValue"
}
},
{
"type": "HUB",
"hubType": "MARITIME_TERMINAL",
"location": {
"type": "HARBOR",
"unLoCode": "BEANR"
}
},
{
"id": "123456789-02",
"type": "RAIL",
"departureDateTime": "2026-01-02T10:00:00+01:00",
"arrivalDateTime": "2026-01-02T22:00:00+01:00",
"trainType": "MANIFEST",
"energyType": "ELECTRICITY",
"context": {
"customProperty": "customRailLegValue"
}
}
],
"context": {
"reportingParty": {
"name": "Acme Corp",
"organisationNumber": "12345",
"Custom value": "Custom reporting party value"
},
"reportingTo": {
"name": "Shipping Inc",
"address": "100 Example Street, Demo City, DC 10001 Exampleland",
"Extra information": "Custom reporting to value"
},
"consignor": {
"name": "Apex Distribution",
"Further details": "Custom consignor value"
},
"consignee": {
"name": "Globex Group",
"organisationNumber": "54321"
},
"transportProvider": {
"name": "Atlas Logistics"
},
"transaction": {
"project": "",
"agreement": "",
"incoterms": "DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020"
},
"cargo": {
"shipmentId": "ABCD-123456789",
"Supplementary Information": "Additional ccargo details"
},
"customStringProperty": "customPropertyValue",
"customNumericProperty": 42
}
}
'import requests
url = "https://api.terratwin.com/api/v1/transportation/emissions/calculate"
payload = {
"id": "123456789",
"options": {
"fallbackTransportModes": ["ROAD", "AIR"],
"storeResult": True
},
"cargo": {
"category": "GENERAL",
"densityCharacteristics": "LIGHT",
"weight": {
"unit": "KILOGRAM",
"value": 100
}
},
"origin": {
"type": "PLACE",
"street": "10 Downing St",
"postCode": "SW1A 2AB",
"city": "London",
"countryCode": "GB"
},
"destination": {
"type": "PLACE",
"street": "Wetstraat 175",
"postCode": "1048",
"city": "Brussel",
"countryCode": "BE"
},
"transportChain": [
{
"id": "123456789-01",
"type": "WATER",
"departureDateTime": "2025-12-25T00:00:00+00:00",
"arrivalDateTime": "2026-01-01T18:12:30Z",
"vehicle": "CONTAINER",
"containerTypeCode": "22G1",
"navigationConstraints": ["AVOID_KIEL_CANAL", "AVOID_NORTHEAST_PASSAGE", "AVOID_NORTHWEST_PASSAGE"],
"firstMile": {
"structure": "ARTICULATED",
"grossWeight": {
"unit": "METRIC_TONNE",
"value": 40.234
},
"energyType": "DIESEL"
},
"context": { "additionalInformation": "customWaterLegValue" }
},
{
"type": "HUB",
"hubType": "MARITIME_TERMINAL",
"location": {
"type": "HARBOR",
"unLoCode": "BEANR"
}
},
{
"id": "123456789-02",
"type": "RAIL",
"departureDateTime": "2026-01-02T10:00:00+01:00",
"arrivalDateTime": "2026-01-02T22:00:00+01:00",
"trainType": "MANIFEST",
"energyType": "ELECTRICITY",
"context": { "customProperty": "customRailLegValue" }
}
],
"context": {
"reportingParty": {
"name": "Acme Corp",
"organisationNumber": "12345",
"Custom value": "Custom reporting party value"
},
"reportingTo": {
"name": "Shipping Inc",
"address": "100 Example Street, Demo City, DC 10001 Exampleland",
"Extra information": "Custom reporting to value"
},
"consignor": {
"name": "Apex Distribution",
"Further details": "Custom consignor value"
},
"consignee": {
"name": "Globex Group",
"organisationNumber": "54321"
},
"transportProvider": { "name": "Atlas Logistics" },
"transaction": {
"project": "",
"agreement": "",
"incoterms": "DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020"
},
"cargo": {
"shipmentId": "ABCD-123456789",
"Supplementary Information": "Additional ccargo details"
},
"customStringProperty": "customPropertyValue",
"customNumericProperty": 42
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '123456789',
options: {fallbackTransportModes: ['ROAD', 'AIR'], storeResult: true},
cargo: {
category: 'GENERAL',
densityCharacteristics: 'LIGHT',
weight: {unit: 'KILOGRAM', value: 100}
},
origin: {
type: 'PLACE',
street: '10 Downing St',
postCode: 'SW1A 2AB',
city: 'London',
countryCode: 'GB'
},
destination: {
type: 'PLACE',
street: 'Wetstraat 175',
postCode: '1048',
city: 'Brussel',
countryCode: 'BE'
},
transportChain: [
{
id: '123456789-01',
type: 'WATER',
departureDateTime: '2025-12-25T00:00:00+00:00',
arrivalDateTime: '2026-01-01T18:12:30Z',
vehicle: 'CONTAINER',
containerTypeCode: '22G1',
navigationConstraints: ['AVOID_KIEL_CANAL', 'AVOID_NORTHEAST_PASSAGE', 'AVOID_NORTHWEST_PASSAGE'],
firstMile: {
structure: 'ARTICULATED',
grossWeight: {unit: 'METRIC_TONNE', value: 40.234},
energyType: 'DIESEL'
},
context: {additionalInformation: 'customWaterLegValue'}
},
{
type: 'HUB',
hubType: 'MARITIME_TERMINAL',
location: {type: 'HARBOR', unLoCode: 'BEANR'}
},
{
id: '123456789-02',
type: 'RAIL',
departureDateTime: '2026-01-02T10:00:00+01:00',
arrivalDateTime: '2026-01-02T22:00:00+01:00',
trainType: 'MANIFEST',
energyType: 'ELECTRICITY',
context: {customProperty: 'customRailLegValue'}
}
],
context: {
reportingParty: {
name: 'Acme Corp',
organisationNumber: '12345',
'Custom value': 'Custom reporting party value'
},
reportingTo: {
name: 'Shipping Inc',
address: '100 Example Street, Demo City, DC 10001 Exampleland',
'Extra information': 'Custom reporting to value'
},
consignor: {name: 'Apex Distribution', 'Further details': 'Custom consignor value'},
consignee: {name: 'Globex Group', organisationNumber: '54321'},
transportProvider: {name: 'Atlas Logistics'},
transaction: {
project: '',
agreement: '',
incoterms: 'DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020'
},
cargo: {
shipmentId: 'ABCD-123456789',
'Supplementary Information': 'Additional ccargo details'
},
customStringProperty: 'customPropertyValue',
customNumericProperty: 42
}
})
};
fetch('https://api.terratwin.com/api/v1/transportation/emissions/calculate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.terratwin.com/api/v1/transportation/emissions/calculate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '123456789',
'options' => [
'fallbackTransportModes' => [
'ROAD',
'AIR'
],
'storeResult' => true
],
'cargo' => [
'category' => 'GENERAL',
'densityCharacteristics' => 'LIGHT',
'weight' => [
'unit' => 'KILOGRAM',
'value' => 100
]
],
'origin' => [
'type' => 'PLACE',
'street' => '10 Downing St',
'postCode' => 'SW1A 2AB',
'city' => 'London',
'countryCode' => 'GB'
],
'destination' => [
'type' => 'PLACE',
'street' => 'Wetstraat 175',
'postCode' => '1048',
'city' => 'Brussel',
'countryCode' => 'BE'
],
'transportChain' => [
[
'id' => '123456789-01',
'type' => 'WATER',
'departureDateTime' => '2025-12-25T00:00:00+00:00',
'arrivalDateTime' => '2026-01-01T18:12:30Z',
'vehicle' => 'CONTAINER',
'containerTypeCode' => '22G1',
'navigationConstraints' => [
'AVOID_KIEL_CANAL',
'AVOID_NORTHEAST_PASSAGE',
'AVOID_NORTHWEST_PASSAGE'
],
'firstMile' => [
'structure' => 'ARTICULATED',
'grossWeight' => [
'unit' => 'METRIC_TONNE',
'value' => 40.234
],
'energyType' => 'DIESEL'
],
'context' => [
'additionalInformation' => 'customWaterLegValue'
]
],
[
'type' => 'HUB',
'hubType' => 'MARITIME_TERMINAL',
'location' => [
'type' => 'HARBOR',
'unLoCode' => 'BEANR'
]
],
[
'id' => '123456789-02',
'type' => 'RAIL',
'departureDateTime' => '2026-01-02T10:00:00+01:00',
'arrivalDateTime' => '2026-01-02T22:00:00+01:00',
'trainType' => 'MANIFEST',
'energyType' => 'ELECTRICITY',
'context' => [
'customProperty' => 'customRailLegValue'
]
]
],
'context' => [
'reportingParty' => [
'name' => 'Acme Corp',
'organisationNumber' => '12345',
'Custom value' => 'Custom reporting party value'
],
'reportingTo' => [
'name' => 'Shipping Inc',
'address' => '100 Example Street, Demo City, DC 10001 Exampleland',
'Extra information' => 'Custom reporting to value'
],
'consignor' => [
'name' => 'Apex Distribution',
'Further details' => 'Custom consignor value'
],
'consignee' => [
'name' => 'Globex Group',
'organisationNumber' => '54321'
],
'transportProvider' => [
'name' => 'Atlas Logistics'
],
'transaction' => [
'project' => '',
'agreement' => '',
'incoterms' => 'DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020'
],
'cargo' => [
'shipmentId' => 'ABCD-123456789',
'Supplementary Information' => 'Additional ccargo details'
],
'customStringProperty' => 'customPropertyValue',
'customNumericProperty' => 42
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.terratwin.com/api/v1/transportation/emissions/calculate"
payload := strings.NewReader("{\n \"id\": \"123456789\",\n \"options\": {\n \"fallbackTransportModes\": [\n \"ROAD\",\n \"AIR\"\n ],\n \"storeResult\": true\n },\n \"cargo\": {\n \"category\": \"GENERAL\",\n \"densityCharacteristics\": \"LIGHT\",\n \"weight\": {\n \"unit\": \"KILOGRAM\",\n \"value\": 100\n }\n },\n \"origin\": {\n \"type\": \"PLACE\",\n \"street\": \"10 Downing St\",\n \"postCode\": \"SW1A 2AB\",\n \"city\": \"London\",\n \"countryCode\": \"GB\"\n },\n \"destination\": {\n \"type\": \"PLACE\",\n \"street\": \"Wetstraat 175\",\n \"postCode\": \"1048\",\n \"city\": \"Brussel\",\n \"countryCode\": \"BE\"\n },\n \"transportChain\": [\n {\n \"id\": \"123456789-01\",\n \"type\": \"WATER\",\n \"departureDateTime\": \"2025-12-25T00:00:00+00:00\",\n \"arrivalDateTime\": \"2026-01-01T18:12:30Z\",\n \"vehicle\": \"CONTAINER\",\n \"containerTypeCode\": \"22G1\",\n \"navigationConstraints\": [\n \"AVOID_KIEL_CANAL\",\n \"AVOID_NORTHEAST_PASSAGE\",\n \"AVOID_NORTHWEST_PASSAGE\"\n ],\n \"firstMile\": {\n \"structure\": \"ARTICULATED\",\n \"grossWeight\": {\n \"unit\": \"METRIC_TONNE\",\n \"value\": 40.234\n },\n \"energyType\": \"DIESEL\"\n },\n \"context\": {\n \"additionalInformation\": \"customWaterLegValue\"\n }\n },\n {\n \"type\": \"HUB\",\n \"hubType\": \"MARITIME_TERMINAL\",\n \"location\": {\n \"type\": \"HARBOR\",\n \"unLoCode\": \"BEANR\"\n }\n },\n {\n \"id\": \"123456789-02\",\n \"type\": \"RAIL\",\n \"departureDateTime\": \"2026-01-02T10:00:00+01:00\",\n \"arrivalDateTime\": \"2026-01-02T22:00:00+01:00\",\n \"trainType\": \"MANIFEST\",\n \"energyType\": \"ELECTRICITY\",\n \"context\": {\n \"customProperty\": \"customRailLegValue\"\n }\n }\n ],\n \"context\": {\n \"reportingParty\": {\n \"name\": \"Acme Corp\",\n \"organisationNumber\": \"12345\",\n \"Custom value\": \"Custom reporting party value\"\n },\n \"reportingTo\": {\n \"name\": \"Shipping Inc\",\n \"address\": \"100 Example Street, Demo City, DC 10001 Exampleland\",\n \"Extra information\": \"Custom reporting to value\"\n },\n \"consignor\": {\n \"name\": \"Apex Distribution\",\n \"Further details\": \"Custom consignor value\"\n },\n \"consignee\": {\n \"name\": \"Globex Group\",\n \"organisationNumber\": \"54321\"\n },\n \"transportProvider\": {\n \"name\": \"Atlas Logistics\"\n },\n \"transaction\": {\n \"project\": \"\",\n \"agreement\": \"\",\n \"incoterms\": \"DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020\"\n },\n \"cargo\": {\n \"shipmentId\": \"ABCD-123456789\",\n \"Supplementary Information\": \"Additional ccargo details\"\n },\n \"customStringProperty\": \"customPropertyValue\",\n \"customNumericProperty\": 42\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.terratwin.com/api/v1/transportation/emissions/calculate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"123456789\",\n \"options\": {\n \"fallbackTransportModes\": [\n \"ROAD\",\n \"AIR\"\n ],\n \"storeResult\": true\n },\n \"cargo\": {\n \"category\": \"GENERAL\",\n \"densityCharacteristics\": \"LIGHT\",\n \"weight\": {\n \"unit\": \"KILOGRAM\",\n \"value\": 100\n }\n },\n \"origin\": {\n \"type\": \"PLACE\",\n \"street\": \"10 Downing St\",\n \"postCode\": \"SW1A 2AB\",\n \"city\": \"London\",\n \"countryCode\": \"GB\"\n },\n \"destination\": {\n \"type\": \"PLACE\",\n \"street\": \"Wetstraat 175\",\n \"postCode\": \"1048\",\n \"city\": \"Brussel\",\n \"countryCode\": \"BE\"\n },\n \"transportChain\": [\n {\n \"id\": \"123456789-01\",\n \"type\": \"WATER\",\n \"departureDateTime\": \"2025-12-25T00:00:00+00:00\",\n \"arrivalDateTime\": \"2026-01-01T18:12:30Z\",\n \"vehicle\": \"CONTAINER\",\n \"containerTypeCode\": \"22G1\",\n \"navigationConstraints\": [\n \"AVOID_KIEL_CANAL\",\n \"AVOID_NORTHEAST_PASSAGE\",\n \"AVOID_NORTHWEST_PASSAGE\"\n ],\n \"firstMile\": {\n \"structure\": \"ARTICULATED\",\n \"grossWeight\": {\n \"unit\": \"METRIC_TONNE\",\n \"value\": 40.234\n },\n \"energyType\": \"DIESEL\"\n },\n \"context\": {\n \"additionalInformation\": \"customWaterLegValue\"\n }\n },\n {\n \"type\": \"HUB\",\n \"hubType\": \"MARITIME_TERMINAL\",\n \"location\": {\n \"type\": \"HARBOR\",\n \"unLoCode\": \"BEANR\"\n }\n },\n {\n \"id\": \"123456789-02\",\n \"type\": \"RAIL\",\n \"departureDateTime\": \"2026-01-02T10:00:00+01:00\",\n \"arrivalDateTime\": \"2026-01-02T22:00:00+01:00\",\n \"trainType\": \"MANIFEST\",\n \"energyType\": \"ELECTRICITY\",\n \"context\": {\n \"customProperty\": \"customRailLegValue\"\n }\n }\n ],\n \"context\": {\n \"reportingParty\": {\n \"name\": \"Acme Corp\",\n \"organisationNumber\": \"12345\",\n \"Custom value\": \"Custom reporting party value\"\n },\n \"reportingTo\": {\n \"name\": \"Shipping Inc\",\n \"address\": \"100 Example Street, Demo City, DC 10001 Exampleland\",\n \"Extra information\": \"Custom reporting to value\"\n },\n \"consignor\": {\n \"name\": \"Apex Distribution\",\n \"Further details\": \"Custom consignor value\"\n },\n \"consignee\": {\n \"name\": \"Globex Group\",\n \"organisationNumber\": \"54321\"\n },\n \"transportProvider\": {\n \"name\": \"Atlas Logistics\"\n },\n \"transaction\": {\n \"project\": \"\",\n \"agreement\": \"\",\n \"incoterms\": \"DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020\"\n },\n \"cargo\": {\n \"shipmentId\": \"ABCD-123456789\",\n \"Supplementary Information\": \"Additional ccargo details\"\n },\n \"customStringProperty\": \"customPropertyValue\",\n \"customNumericProperty\": 42\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.terratwin.com/api/v1/transportation/emissions/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"123456789\",\n \"options\": {\n \"fallbackTransportModes\": [\n \"ROAD\",\n \"AIR\"\n ],\n \"storeResult\": true\n },\n \"cargo\": {\n \"category\": \"GENERAL\",\n \"densityCharacteristics\": \"LIGHT\",\n \"weight\": {\n \"unit\": \"KILOGRAM\",\n \"value\": 100\n }\n },\n \"origin\": {\n \"type\": \"PLACE\",\n \"street\": \"10 Downing St\",\n \"postCode\": \"SW1A 2AB\",\n \"city\": \"London\",\n \"countryCode\": \"GB\"\n },\n \"destination\": {\n \"type\": \"PLACE\",\n \"street\": \"Wetstraat 175\",\n \"postCode\": \"1048\",\n \"city\": \"Brussel\",\n \"countryCode\": \"BE\"\n },\n \"transportChain\": [\n {\n \"id\": \"123456789-01\",\n \"type\": \"WATER\",\n \"departureDateTime\": \"2025-12-25T00:00:00+00:00\",\n \"arrivalDateTime\": \"2026-01-01T18:12:30Z\",\n \"vehicle\": \"CONTAINER\",\n \"containerTypeCode\": \"22G1\",\n \"navigationConstraints\": [\n \"AVOID_KIEL_CANAL\",\n \"AVOID_NORTHEAST_PASSAGE\",\n \"AVOID_NORTHWEST_PASSAGE\"\n ],\n \"firstMile\": {\n \"structure\": \"ARTICULATED\",\n \"grossWeight\": {\n \"unit\": \"METRIC_TONNE\",\n \"value\": 40.234\n },\n \"energyType\": \"DIESEL\"\n },\n \"context\": {\n \"additionalInformation\": \"customWaterLegValue\"\n }\n },\n {\n \"type\": \"HUB\",\n \"hubType\": \"MARITIME_TERMINAL\",\n \"location\": {\n \"type\": \"HARBOR\",\n \"unLoCode\": \"BEANR\"\n }\n },\n {\n \"id\": \"123456789-02\",\n \"type\": \"RAIL\",\n \"departureDateTime\": \"2026-01-02T10:00:00+01:00\",\n \"arrivalDateTime\": \"2026-01-02T22:00:00+01:00\",\n \"trainType\": \"MANIFEST\",\n \"energyType\": \"ELECTRICITY\",\n \"context\": {\n \"customProperty\": \"customRailLegValue\"\n }\n }\n ],\n \"context\": {\n \"reportingParty\": {\n \"name\": \"Acme Corp\",\n \"organisationNumber\": \"12345\",\n \"Custom value\": \"Custom reporting party value\"\n },\n \"reportingTo\": {\n \"name\": \"Shipping Inc\",\n \"address\": \"100 Example Street, Demo City, DC 10001 Exampleland\",\n \"Extra information\": \"Custom reporting to value\"\n },\n \"consignor\": {\n \"name\": \"Apex Distribution\",\n \"Further details\": \"Custom consignor value\"\n },\n \"consignee\": {\n \"name\": \"Globex Group\",\n \"organisationNumber\": \"54321\"\n },\n \"transportProvider\": {\n \"name\": \"Atlas Logistics\"\n },\n \"transaction\": {\n \"project\": \"\",\n \"agreement\": \"\",\n \"incoterms\": \"DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020\"\n },\n \"cargo\": {\n \"shipmentId\": \"ABCD-123456789\",\n \"Supplementary Information\": \"Additional ccargo details\"\n },\n \"customStringProperty\": \"customPropertyValue\",\n \"customNumericProperty\": 42\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "123456789",
"origin": {
"type": "PLACE",
"latitude": 51.503314,
"longitude": -0.127697
},
"destination": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 50.842691,
"longitude": 4.380654,
"address": "L161A"
},
"activityDistanceKm": 432.81564963432754,
"activityTonneKm": 43.281564963432764,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 7.06480567200353,
"ttwCo2eGramsPerTonneKm": 23.037518111707207,
"wtwCo2eGramsPerTonneKm": 30.10232378371073
},
"transportEmissions": {
"wttCo2eGrams": 305.77584564684906,
"ttwCo2eGrams": 997.0998367481144,
"wtwCo2eGrams": 1302.8756823949632
},
"hubIntensities": {
"co2eGramsPerTonne": 3.8
},
"hubEmissions": {
"co2eGrams": 0.38
},
"totalIntensities": {
"co2eGramsPerTonneKm": 30.111103503213045
},
"totalEmissions": {
"co2eGrams": 1303.2556823949633
},
"certificateUrl": "https://www.terratwin.com/certificate/3f34c409-284f-4cc2-baa5-124a08bde490",
"context": {
"reportingParty": {
"name": "Acme Corp",
"organisationNumber": "12345",
"Custom value": "Custom reporting party value"
},
"reportingTo": {
"name": "Shipping Inc",
"address": "100 Example Street, Demo City, DC 10001 Exampleland",
"Extra information": "Custom reporting to value"
},
"consignor": {
"name": "Apex Distribution",
"Further details": "Custom consignor value"
},
"consignee": {
"name": "Globex Group",
"organisationNumber": "54321"
},
"transportProvider": {
"name": "Atlas Logistics"
},
"transaction": {
"project": "",
"agreement": "",
"incoterms": "DAP Customer Warehouse, Brussels, Belgium — Incoterms® 2020"
},
"cargo": {
"shipmentId": "ABCD-123456789",
"Supplementary Information": "Additional ccargo details"
},
"customStringProperty": "customPropertyValue",
"customNumericProperty": 42
},
"transportChain": [
{
"type": "WATER",
"id": "123456789-01",
"start": {
"type": "PLACE",
"latitude": 51.503314,
"longitude": -0.127697
},
"end": {
"type": "HARBOR",
"countryCode": "BE",
"unLoCode": "BEANR",
"latitude": 51.27936713324465,
"longitude": 4.3567657470703125,
"address": "Antwerp"
},
"activityDistanceKm": 358.24702719735023,
"activityTonneKm": 35.82470271973503,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 6.966414868380875,
"ttwCo2eGramsPerTonneKm": 27.524003700923917,
"wtwCo2eGramsPerTonneKm": 34.490418569304786
},
"transportEmissions": {
"wttCo2eGrams": 249.56974168208689,
"ttwCo2eGrams": 986.0392502424861,
"wtwCo2eGrams": 1235.6089919245728
},
"hubIntensities": {
"co2eGramsPerTonne": 1.9
},
"hubEmissions": {
"co2eGrams": 0.19
},
"totalIntensities": {
"co2eGramsPerTonneKm": 34.495722172281944
},
"totalEmissions": {
"co2eGrams": 1235.7989919245729
},
"context": {
"additionalInformation": "customWaterLegValue"
},
"elements": [
{
"vehicle": "ARTICULATED_TRUCK_40000_TO_50000_KG",
"emissionsStandard": "EURO_6AC",
"loadFactor": 72,
"emptyRunning": 30,
"loadDistribution": "LTL",
"methodology": "INFRAS_HBEFA_5_1",
"distanceMeasurementMethod": "SHORTEST_FEASIBLE_DISTANCE",
"calculationBasis": "MODEL",
"distanceAdjustmentFactor": "1.05",
"start": {
"type": "PLACE",
"latitude": 51.503314,
"longitude": -0.127697
},
"end": {
"type": "PLACE",
"latitude": 51.459472,
"longitude": 0.340663
},
"activityDistanceKm": 44.69842583939949,
"activityTonneKm": 4.46984258393995,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 18.188259972604925,
"ttwCo2eGramsPerTonneKm": 55.634499734404805,
"wtwCo2eGramsPerTonneKm": 73.82275970700972
},
"transportEmissions": {
"wttCo2eGrams": 81.29865895331996,
"ttwCo2eGrams": 248.67745604903843,
"wtwCo2eGrams": 329.97611500235837
},
"resultsByEnergyType": [
{
"energyType": "DIESEL",
"activityDistanceKm": 44.69842583939949,
"activityTonneKm": 4.46984258393995,
"intensities": {
"wttCo2eGramsPerTonneKm": 18.188259972604925,
"ttwCo2eGramsPerTonneKm": 55.634499734404805,
"wtwCo2eGramsPerTonneKm": 73.82275970700974
},
"emissions": {
"wttCo2eGrams": 81.29865895331996,
"ttwCo2eGrams": 248.67745604903843,
"wtwCo2eGrams": 329.97611500235837
},
"resultsByEnergySource": [
{
"energySource": "BIODIESEL_FROM_RAPESEED",
"factorReference": "ECOTRANSIT_4_0_EUROPE_BIOGENIC_FUEL_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 4.729108573738301,
"ttwCo2eGrams": 0.11573345876659132,
"wtwCo2eGrams": 4.844842032504893
}
},
{
"energySource": "BIODIESEL_FROM_UCO",
"factorReference": "ECOTRANSIT_4_0_EUROPE_BIOGENIC_FUEL_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 1.2690772375095185,
"ttwCo2eGrams": 0.09258676701327305,
"wtwCo2eGrams": 1.3616640045227915
}
},
{
"energySource": "BIODIESEL_FROM_SOYBEAN",
"factorReference": "ECOTRANSIT_4_0_EUROPE_BIOGENIC_FUEL_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 0.8260974470580831,
"ttwCo2eGrams": 0.023146691753318262,
"wtwCo2eGrams": 0.8492441388114014
}
},
{
"energySource": "FOSSIL_DIESEL",
"factorReference": "SFC_GLEC_3_2_EUROPE_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 74.47437569501406,
"ttwCo2eGrams": 248.44598913150526,
"wtwCo2eGrams": 322.9203648265193
}
}
]
}
],
"type": "ROAD"
},
{
"hubType": "MARITIME_TERMINAL",
"activityTonnes": 0.1,
"intensities": {
"co2eGramsPerTonne": 1.9000000000000001
},
"emissions": {
"co2eGrams": 0.19
},
"methodology": "SFC_GLEC_FRAMEWORK_3_2",
"calculationBasis": "DEFAULT_FACTORS",
"type": "HUB"
},
{
"vehicle": "CONTAINER",
"capacityBand": "POST_PANAMAX",
"containerType": "TWENTY_FOOT_CONTAINER",
"methodology": "SFC_GLEC_FRAMEWORK_3_2",
"distanceMeasurementMethod": "SHORTEST_FEASIBLE_DISTANCE",
"distanceAdjustmentFactor": "1.15",
"calculationBasis": "DEFAULT_FACTORS",
"start": {
"type": "HARBOR",
"countryCode": "GB",
"unLoCode": "GBTIL",
"latitude": 51.459502138725945,
"longitude": 0.3407907485961914,
"address": "Tilbury"
},
"end": {
"type": "HARBOR",
"countryCode": "BE",
"unLoCode": "BEANR",
"latitude": 51.27936713324465,
"longitude": 4.3567657470703125,
"address": "Antwerp"
},
"activityDistanceKm": 313.54860135795076,
"activityTonneKm": 31.35486013579508,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 5.366666666666667,
"ttwCo2eGramsPerTonneKm": 23.516666666666666,
"wtwCo2eGramsPerTonneKm": 28.883333333333336
},
"transportEmissions": {
"wttCo2eGrams": 168.27108272876694,
"ttwCo2eGrams": 737.3617941934476,
"wtwCo2eGrams": 905.6328769222146
},
"resultsByEnergyType": [
{
"energyType": "VLSFO",
"activityDistanceKm": 313.54860135795076,
"activityTonneKm": 31.35486013579508,
"intensities": {
"wttCo2eGramsPerTonneKm": 5.366666666666667,
"ttwCo2eGramsPerTonneKm": 23.516666666666666,
"wtwCo2eGramsPerTonneKm": 28.883333333333333
},
"emissions": {
"wttCo2eGrams": 168.27108272876694,
"ttwCo2eGrams": 737.3617941934476,
"wtwCo2eGrams": 905.6328769222146
},
"resultsByEnergySource": [
{
"energySource": "FOSSIL_VLSFO",
"factorReference": "SFC_GLEC_3_2_MARINE_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 168.27108272876694,
"ttwCo2eGrams": 737.3617941934476,
"wtwCo2eGrams": 905.6328769222146
}
}
]
}
],
"type": "WATER"
}
]
},
{
"hubType": "MARITIME_TERMINAL",
"activityTonnes": 0.1,
"intensities": {
"co2eGramsPerTonne": 1.9000000000000001
},
"emissions": {
"co2eGrams": 0.19
},
"methodology": "SFC_GLEC_FRAMEWORK_3_2",
"calculationBasis": "DEFAULT_FACTORS",
"type": "HUB"
},
{
"type": "RAIL",
"id": "123456789-02",
"start": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 51.279002,
"longitude": 4.356769,
"address": ""
},
"end": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 50.842691,
"longitude": 4.380654,
"address": "L161A"
},
"activityDistanceKm": 74.56862243697734,
"activityTonneKm": 7.456862243697734,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 7.537500644090015,
"ttwCo2eGramsPerTonneKm": 1.4832762285472343,
"wtwCo2eGramsPerTonneKm": 9.02077687263725
},
"transportEmissions": {
"wttCo2eGrams": 56.206103964762185,
"ttwCo2eGrams": 11.060586505628242,
"wtwCo2eGrams": 67.26669047039043
},
"hubIntensities": {
"co2eGramsPerTonne": 0
},
"hubEmissions": {
"co2eGrams": 0
},
"totalIntensities": {
"co2eGramsPerTonneKm": 9.02077687263725
},
"totalEmissions": {
"co2eGrams": 67.26669047039043
},
"context": {
"customProperty": "customRailLegValue"
},
"elements": [
{
"vehicle": "AVERAGE_TRAIN",
"methodology": "ECOTRANSIT_RAIL_4_0",
"distanceMeasurementMethod": "SHORTEST_FEASIBLE_DISTANCE",
"calculationBasis": "MODEL",
"distanceAdjustmentFactor": "1.0",
"start": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 51.279002,
"longitude": 4.356769,
"address": ""
},
"end": {
"type": "RAIL_YARD",
"countryCode": "BE",
"latitude": 50.842691,
"longitude": 4.380654,
"address": "L161A"
},
"activityDistanceKm": 74.56862243697734,
"activityTonneKm": 7.456862243697734,
"transportIntensities": {
"wttCo2eGramsPerTonneKm": 7.537500644090015,
"ttwCo2eGramsPerTonneKm": 1.4832762285472343,
"wtwCo2eGramsPerTonneKm": 9.02077687263725
},
"transportEmissions": {
"wttCo2eGrams": 56.206103964762185,
"ttwCo2eGrams": 11.060586505628242,
"wtwCo2eGrams": 67.26669047039043
},
"resultsByEnergyType": [
{
"energyType": "ELECTRICITY",
"activityDistanceKm": 70.71537321805414,
"activityTonneKm": 7.0715373218054145,
"intensities": {
"wttCo2eGramsPerTonneKm": 7.479360000000002,
"ttwCo2eGramsPerTonneKm": 0,
"wtwCo2eGramsPerTonneKm": 7.479360000000002
},
"emissions": {
"wttCo2eGrams": 52.89057338321856,
"ttwCo2eGrams": 0,
"wtwCo2eGrams": 52.89057338321856
},
"resultsByEnergySource": [
{
"energySource": "ELECTRICAL_GRID",
"factorReference": "ECOTRANSIT_4_0_MEDIUM_VOLTAGE_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 52.89057338321856,
"ttwCo2eGrams": 0,
"wtwCo2eGrams": 52.89057338321856
}
}
]
},
{
"energyType": "DIESEL",
"activityDistanceKm": 3.8532492189231973,
"activityTonneKm": 0.38532492189231976,
"intensities": {
"wttCo2eGramsPerTonneKm": 8.604505945945949,
"ttwCo2eGramsPerTonneKm": 28.704570810810825,
"wtwCo2eGramsPerTonneKm": 37.309076756756774
},
"emissions": {
"wttCo2eGrams": 3.3155305815436233,
"ttwCo2eGrams": 11.060586505628242,
"wtwCo2eGrams": 14.376117087171865
},
"resultsByEnergySource": [
{
"energySource": "FOSSIL_DIESEL",
"factorReference": "SFC_GLEC_3_2_EUROPE_EMISSION_FACTORS",
"emissions": {
"wttCo2eGrams": 3.3155305815436233,
"ttwCo2eGrams": 11.060586505628242,
"wtwCo2eGrams": 14.376117087171865
}
}
]
}
],
"type": "RAIL"
}
]
}
],
"creditCost": 3
}{
"title": "Invalid JSON",
"status": 400,
"code": 2,
"details": [
"Invalid JSON at 'cargo' (line 7, byte 26)"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Provide well formed JSON"
}{
"title": "API key invalid",
"status": 401,
"code": 41,
"details": [
"'...' is not a valid API key"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Provide a valid API key. If you don’t have one, then apply to TerraTwin"
}{
"title": "Insufficient credits",
"status": 403,
"code": 42,
"details": [
"Your account has no remaining credits"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Purchase additional credits from TerraTwin"
}{
"title": "Not routable by rail",
"status": 422,
"code": 33,
"details": [
"Operation 'transportChain[0]' could not be routed by rail between '50.68689,7.16285' and '-36.85209,174.76318'"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Review the mode of transport selected and the locations"
}{
"title": "Rate limit exceeded",
"status": 429,
"code": 45,
"details": [
"Too many requests. The limit is 5 requests per second"
],
"instance": "/api/v1/transportation/emissions/calculate",
"recommendation": "Reduce your request rate to ≤ 5 requests/second"
}{
"title": "<string>",
"status": 123,
"details": [
"<string>"
],
"instance": "<string>",
"recommendation": "<string>"
}{
"title": "<string>",
"status": 123,
"details": [
"<string>"
],
"instance": "<string>",
"recommendation": "<string>"
}Authorizations
API key for authenticating requests. Include this header in all calls.
Body
Defines the transported goods for which emissions are calculated. Cargo parameters affect vehicle choice, load factors, and resulting emission estimates throughout the transport chain. Only the weight property is mandatory. Other properties will be defaulted if they are not provided. However, the more detail provided, the more accurate the results will be.
Show child attributes
Show child attributes
A unique identifier for the emissions calculation, such as a shipment ID. The ID is returned in the response. When options.storeResult is true, the calculation result is stored against this ID and can later be retrieved using GET /emissions/{id}.
Requests that provide an already stored ID will apply replace semantics where the new result replaces the previously stored result for that ID.
Used to customize emissions calculations and to control which details are included in the response.
Show child attributes
Show child attributes
Locations resolve either to a transport facility (airport, harbor, or rail yard) or to a general geographic area such as a building, street, postcode, or city. For larger areas, centroids are used to represent the approximate position.
Identification and geocoding
- Airports and harbors can be identified directly by code (
iataCodefor airports,unLoCodefor harbors). - Otherwise, the location is geocoded based on the available address components,
and if the
typeis notPLACE, the closest transport facility of the indicated type is selected.
Geocoding priority
When multiple data sources are provided, they are evaluated in the following order of preference:
- Geographic coordinates (latitude and longitude)
- IATA code (for non-airport locations)
- Structured address components
- UN/LOCODE (for non-harbor locations)
- Unstructured address text
Geocoding accuracy depends on the quality and completeness of the input. Structured addresses almost always yield better results and are tolerant of minor data-entry errors, such as postcodes appearing in street fields. For both structured and unstructured inputs, the most probable match is selected based on lexicographical similarity to known locations.
Operational behavior
When a transport facility is specified directly, it will be used regardless of any transport vehicle specified. The system does not enforce suitability constraints. For example, a large aircraft such as a Boeing 747-8F may be routed to Gibraltar International (LXGB) despite its short runways. If the airport were not explicitly chosen, the system would instead select a nearby suitable airport such as Málaga-Costa del Sol (AGP).
Similarly, a container vessel may be routed to Plymouth (GBPLY) even though the port lacks container handling facilities. If the port were not specified explicitly, a capable alternative such as Southampton (GBSOU) would be selected automatically.
- Coordinates
- IATA code
- UN/LOCODE
- Unstructured address
- Structured address
- Street & city
- Street & postcode
- Postcode
- City
Show child attributes
Show child attributes
Locations resolve either to a transport facility (airport, harbor, or rail yard) or to a general geographic area such as a building, street, postcode, or city. For larger areas, centroids are used to represent the approximate position.
Identification and geocoding
- Airports and harbors can be identified directly by code (
iataCodefor airports,unLoCodefor harbors). - Otherwise, the location is geocoded based on the available address components,
and if the
typeis notPLACE, the closest transport facility of the indicated type is selected.
Geocoding priority
When multiple data sources are provided, they are evaluated in the following order of preference:
- Geographic coordinates (latitude and longitude)
- IATA code (for non-airport locations)
- Structured address components
- UN/LOCODE (for non-harbor locations)
- Unstructured address text
Geocoding accuracy depends on the quality and completeness of the input. Structured addresses almost always yield better results and are tolerant of minor data-entry errors, such as postcodes appearing in street fields. For both structured and unstructured inputs, the most probable match is selected based on lexicographical similarity to known locations.
Operational behavior
When a transport facility is specified directly, it will be used regardless of any transport vehicle specified. The system does not enforce suitability constraints. For example, a large aircraft such as a Boeing 747-8F may be routed to Gibraltar International (LXGB) despite its short runways. If the airport were not explicitly chosen, the system would instead select a nearby suitable airport such as Málaga-Costa del Sol (AGP).
Similarly, a container vessel may be routed to Plymouth (GBPLY) even though the port lacks container handling facilities. If the port were not specified explicitly, a capable alternative such as Southampton (GBSOU) would be selected automatically.
- Coordinates
- IATA code
- UN/LOCODE
- Unstructured address
- Structured address
- Street & city
- Street & postcode
- Postcode
- City
Show child attributes
Show child attributes
Represents the sequence of transport and hub operations that define a complete multimodal logistics chain.
Structure
The transportChain is an ordered array of elements describing how cargo moves between points.
- Each transport element represents a specific operation and has a
typevalue ofAIR,RAIL,ROAD,WATER, orWEIGHTED_MODES. - Each hub element has a
typeofHUBand represents the connecting location between consecutive transport segments.
Behavior
- If this array is not provided or is empty, fallback transport modes are attempted instead. The system will cycle through the fallback modes in order, applying default parameters for each until one succeeds or all fail.
- Hubs must appear between each pair of transport operations to define the connecting locations between them.
- Hubs may also appear as the first and/or last elements in the array. This allows a logistics hub to act as the origin or destination
in place of the top-level
originanddestinationproperties, enabling emissions to be attributed to those locations.
- Unknown transport
- Air transport
- Rail transport
- Road transport
- Water transport
- Weighted modes transport
- Hub operation
Show child attributes
Show child attributes
Additional information related to the emissions calculation. The object may contain any properties. The following recognized properties, when provided, will be displayed as sections in the emissions certificate generated for the calculation:
- reportingParty
- reportingTo
- consignor
- consignee
- transportProvider
- transaction
- cargo
Any additional custom properties included within these recognized objects will also be displayed in the corresponding section of the emissions certificate.
Show child attributes
Show child attributes
Response
Emissions calculation successfully performed
The origin location for the transport chain.
Show child attributes
Show child attributes
The destination location for the transport chain.
Show child attributes
Show child attributes
The total distance in kilometers across all transport operations in the request.
The total transport activity for all transport operations in the request. Measured in tonne kilometers.
The combined emission intensity rates across all the transport operations.
Show child attributes
Show child attributes
The total emissions for all the transport operations.
Show child attributes
Show child attributes
The combined emission intensity rates across all the logistics hubs.
Show child attributes
Show child attributes
The total emissions for all the logistics hubs.
Show child attributes
Show child attributes
The combined emission intensity rates across the entire transport chain.
Show child attributes
Show child attributes
The total emissions for the entire transport chain.
Show child attributes
Show child attributes
Array of emissions calculation results for the transport operations defined in the request’s transport chain, along with any automatically inserted logistics hub operation results. The results appear in the same order as in the request, with any inserted hub operations results placed where they occurred in the transport chain.
- Transport chain result
- Hub operation result
Show child attributes
Show child attributes
Number of credits consumed to generate the emissions calculation results, deducted from the user’s account as part of processing the request.
Returns the unique identifier supplied for the emissions calculation request. This is the same value provided in the request's id field.
The top-level context object supplied in the request's context. Any properties provided by the caller are preserved and returned in this object.
URL for the PDF certificate associated with the emissions calculation. This field is included when the calculation result is stored by setting options.storeResult to true and providing an id.