Skip to main content
GET
/
v1
/
transports
/
totals
Get 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));
{
  "total_co2e": 123,
  "total_quantity_kg": 123,
  "count": 123,
  "co2e_pct_change": {},
  "quantity_kg_pct_change": {}
}

Get Totals

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

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Query Parameters

Free-text search (min 1, max 255 characters)
from_date
string
Filter routes with dates on or after this date (ISO 8601)Example: 2025-01-01
to_date
string
Filter routes with dates on or before this date (ISO 8601)Example: 2025-12-31
status
string[]
Filter by calculation status: pending, active, error
transport_direction
string
Filter by direction: downstream or upstream
file_id
string[]
Filter by bulk-upload file UUIDs
created_at_from
string
Filter routes created on or after this datetime (ISO 8601)
created_at_to
string
Filter routes created on or before this datetime (ISO 8601)
co2e_status
string
Filter by CO2e calculation status

Response

total_co2e
number
Sum of CO2e emissions across all matching routes (tCO2e). Default: 0.0
total_quantity_kg
number
Sum of transported quantity across all matching routes (kg). Default: 0.0
count
integer
Number of matching transport routes. Default: 0
co2e_pct_change
number | null
Percentage change in CO2e vs the same period in the previous year. null if no prior-year data exists.
quantity_kg_pct_change
number | null
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}"

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"}

List Transport Routes

Retrieve all transport routes with filtering and pagination

Get Route Counts

Count routes grouped by calculation status