Get Consumption
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/vehicle_consumptions/{vehicle_consumption_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/vehicle_consumptions/{vehicle_consumption_id}"
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/vehicle_consumptions/{vehicle_consumption_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"vehicle_id": "<string>",
"quantity": {},
"start_date": "<string>",
"end_date": "<string>",
"status": "<string>",
"unit": {},
"co2e": {},
"co2e_generation": {},
"co2e_consumption": {},
"total_energy_kwh": {},
"license_plate": {},
"vehicle": {},
"user": {},
"error_messages": {}
}Get Consumption
Retrieve a single vehicle consumption record with CO2e data
GET
/
v1
/
vehicle_consumptions
/
{vehicle_consumption_id}
Get Consumption
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/vehicle_consumptions/{vehicle_consumption_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/vehicle_consumptions/{vehicle_consumption_id}"
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/vehicle_consumptions/{vehicle_consumption_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"vehicle_id": "<string>",
"quantity": {},
"start_date": "<string>",
"end_date": "<string>",
"status": "<string>",
"unit": {},
"co2e": {},
"co2e_generation": {},
"co2e_consumption": {},
"total_energy_kwh": {},
"license_plate": {},
"vehicle": {},
"user": {},
"error_messages": {}
}← Vehicles API
Retrieve the full details of a single vehicle consumption record, enriched with CO2e emission calculations.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faPath Parameters
string
required
UUID of the vehicle consumption record
Response
string
Consumption record UUID
string
UUID of the vehicle this consumption belongs to
number | null
Fuel quantity consumed
date
Start date of the consumption period
date
End date of the consumption period
string
Record status:
active, loading, errorobject
Fuel unit (id, name, type)
number | null
Total CO2 equivalent emissions in kg
number | null
Scope 3 (upstream) CO2e from fuel generation
number | null
Scope 1 (direct) CO2e from fuel combustion
number | null
Total energy in kWh
string | null
Vehicle license plate
object | null
Vehicle details (id, name, organization)
object | null
User who uploaded the record
array[string] | null
Error details when status is
errorExample
curl "https://api.dcycle.io/v1/vehicle_consumptions/${CONSUMPTION_ID}" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os
response = requests.get(
f"https://api.dcycle.io/v1/vehicle_consumptions/{os.getenv('CONSUMPTION_ID')}",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
},
)
c = response.json()
print(f"{c['quantity']} {c['unit']['name']} → {c['co2e']} kg CO2e")
const axios = require('axios');
const response = await axios.get(
`https://api.dcycle.io/v1/vehicle_consumptions/${process.env.CONSUMPTION_ID}`,
{
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
},
}
);
const c = response.data;
console.log(`${c.quantity} ${c.unit.name} → ${c.co2e} kg CO2e`);
Successful Response
{
"id": "consumption-uuid",
"vehicle_id": "vehicle-uuid",
"quantity": 450.0,
"start_date": "2025-01-01",
"end_date": "2025-03-31",
"status": "active",
"unit": { "id": "unit-uuid", "name": "litres", "type": "volume" },
"co2e": 1170.0,
"co2e_generation": 117.0,
"co2e_consumption": 1053.0,
"total_energy_kwh": 4500.0,
"license_plate": "1234 ABC",
"vehicle": {
"id": "vehicle-uuid",
"name": "Company Van #12",
"organization": { "id": "org-uuid", "company_name": "Acme Corp" }
},
"user": {
"id": "user-uuid",
"first_name": "Ana",
"last_name": "Garcia"
},
"error_messages": null,
"file_id": null,
"created_at": "2025-01-15T10:00:00Z",
"updated_at": "2025-01-15T10:05:00Z"
}
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"}
404 Not Found
Cause: The vehicle consumption record does not exist or belongs to another organization{"detail": "Not Found"}
Related Endpoints
Calculation Steps
View detailed emission calculation breakdown
List Consumptions
Browse all consumptions for a vehicle
Was this page helpful?