Get Transport Route Totals
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/transports/totals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/transports/totals"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/transports/totals \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"total_co2e": 123,
"total_quantity_kg": 123,
"count": 123,
"co2e_pct_change": {},
"quantity_kg_pct_change": {}
}Get Transport Route Totals
Get aggregated CO2e emissions and quantity totals for transport routes
GET
/
v1
/
transports
/
totals
Get Transport Route Totals
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/transports/totals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/transports/totals"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/transports/totals \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"total_co2e": 123,
"total_quantity_kg": 123,
"count": 123,
"co2e_pct_change": {},
"quantity_kg_pct_change": {}
}← Transport API
Return aggregated totals for transport routes — total CO2e emissions, total quantity transported (in kg), record count, and percentage change compared to the same period in the previous year. Supports the same filters as the list endpoint.
Request
Headers
Query Parameters
Filter by supplier name (exact match). Pass multiple values to include routes from several suppliers.
Response
Percentage change in CO2e vs the same period in the previous year.
null if no prior-year data exists.Percentage change in quantity (kg) vs the same period in the previous year.
null if no prior-year data exists.Example
curl "https://api.dcycle.io/v1/transports/totals?from_date=2025-01-01&to_date=2025-12-31&transport_direction=downstream" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os
response = requests.get(
"https://api.dcycle.io/v1/transports/totals",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
},
params={
"from_date": "2025-01-01",
"to_date": "2025-12-31",
"transport_direction": "downstream",
},
)
totals = response.json()
print(f"Total CO2e: {totals['total_co2e']:.2f} tCO2e")
print(f"Total quantity: {totals['total_quantity_kg']:.0f} kg")
print(f"Routes: {totals['count']}")
if totals["co2e_pct_change"] is not None:
print(f"YoY change: {totals['co2e_pct_change']:+.1f}%")
const axios = require('axios');
const { data: totals } = await axios.get('https://api.dcycle.io/v1/transports/totals', {
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
},
params: {
from_date: '2025-01-01',
to_date: '2025-12-31',
transport_direction: 'downstream',
},
});
console.log(`Total CO2e: ${totals.total_co2e.toFixed(2)} tCO2e`);
console.log(`Total quantity: ${totals.total_quantity_kg} kg`);
console.log(`Routes: ${totals.count}`);
if (totals.co2e_pct_change !== null) {
console.log(`YoY change: ${totals.co2e_pct_change > 0 ? '+' : ''}${totals.co2e_pct_change.toFixed(1)}%`);
}
Successful Response
{
"total_co2e": 245.78,
"total_quantity_kg": 1500000.0,
"count": 342,
"co2e_pct_change": -12.5,
"quantity_kg_pct_change": 8.3
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
403 Forbidden
Cause: The authenticated user is not a member of the organization{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
Related Endpoints
List Transport Routes
Retrieve all transport routes with filtering and pagination
Get Route Counts
Count routes grouped by calculation status
Was this page helpful?