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": {},
"source": {},
"attachment": {
"file_id": "<string>",
"file_name": "<string>",
"file_url": "<string>"
}
}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": {},
"source": {},
"attachment": {
"file_id": "<string>",
"file_name": "<string>",
"file_url": "<string>"
}
}← Vehicles API
Retrieve the full details of a single vehicle consumption record, enriched with CO2e emission calculations.
Request
Headers
Path Parameters
Response
Where the consumption comes from:
manual (the app’s form), api (sent with an API key), pdf (read from a ticket) or bulk_file (a
spreadsheet import). null on older consumptions created by hand or through the APIThe document attached to the consumption (
attachment_file_id), or null. Not the file the consumption was read
from (file_id). A file deleted or moved to the trash is no longer attached.Show properties
Show properties
The file of your files.
Example
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,
"source": "manual",
"attachment": 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?