Delete Vehicle Consumption
const options = {
method: 'DELETE',
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.delete(url, headers=headers)
print(response.text)curl --request DELETE \
--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>'Delete Vehicle Consumption
Permanently delete a single vehicle consumption record by its ID
DELETE
/
v1
/
vehicle_consumptions
/
{vehicle_consumption_id}
Delete Vehicle Consumption
const options = {
method: 'DELETE',
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.delete(url, headers=headers)
print(response.text)curl --request DELETE \
--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>'← Vehicles API
Permanently delete a single vehicle consumption record. This action cannot be undone and will remove all associated emissions data from your organization’s totals.
No response body is returned for successful deletions.
Solution: Verify your API key is valid and active. Get a new one in Company settings → API Keys.
Solution: Verify the consumption ID is correct and belongs to your organization. Use the List Vehicle Consumptions endpoint to retrieve valid IDs.
Deprecated. Use
POST /v2/vehicle-consumptions/delete: many vehicle consumptions per request by id, idempotent, deleted asynchronously as an ingest job, with webhooks. To also move to the trash the uploaded files that no record uses after the delete (delete_source_files), use this endpoint: the v2 delete does not. This endpoint keeps working; its responses carry Deprecation and Link: </v2/vehicle-consumptions/delete>; rel="successor-version" headers. Its responses also carry Sunset: Fri, 30 Apr 2027 00:00:00 GMT: the endpoint is retired on April 30, 2027 (see the changelog).Irreversible Action: Deleting a consumption record is permanent. All associated CO₂e impact data will be removed.
Request
Path Parameters
The UUID of the vehicle consumption record to deleteExample:
660e8400-e29b-41d4-a716-446655440000Headers
Query Parameters
Also move to the trash the files uploaded for these records that no record uses after the delete.
Response
Returns204 No Content on successful deletion. No response body.
Example
curl -X DELETE "https://api.dcycle.io/v1/vehicle_consumptions/660e8400-e29b-41d4-a716-446655440000" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
import requests
import os
api_key = os.getenv("DCYCLE_API_KEY")
org_id = os.getenv("DCYCLE_ORG_ID")
consumption_id = "660e8400-e29b-41d4-a716-446655440000"
headers = {
"x-api-key": api_key,
"x-organization-id": org_id
}
response = requests.delete(
f"https://api.dcycle.io/v1/vehicle_consumptions/{consumption_id}",
headers=headers
)
if response.status_code == 204:
print("Vehicle consumption deleted successfully")
else:
print(f"Error: {response.status_code}")
const axios = require('axios');
const apiKey = process.env.DCYCLE_API_KEY;
const orgId = process.env.DCYCLE_ORG_ID;
const consumptionId = '660e8400-e29b-41d4-a716-446655440000';
const headers = {
'x-api-key': apiKey,
'x-organization-id': orgId
};
axios.delete(
`https://api.dcycle.io/v1/vehicle_consumptions/${consumptionId}`,
{ headers }
)
.then(response => {
if (response.status === 204) {
console.log('Vehicle consumption deleted successfully');
}
})
.catch(error => console.error(error));
Successful Response
HTTP/1.1 204 No Content
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{
"detail": "Invalid API key",
"code": "INVALID_API_KEY"
}
404 Not Found
Cause: Vehicle consumption record not found in organization{
"code": "VEHICLE_CONSUMPTION_NOT_FOUND",
"detail": "VehicleConsumption with id=UUID('...') not found"
}
422 Validation Error
Cause: Malformed UUID in path parameter{
"detail": [
{
"loc": ["path", "vehicle_consumption_id"],
"msg": "value is not a valid uuid",
"type": "type_error.uuid"
}
]
}
Related Endpoints
Vehicle Consumptions
List all consumption records for a vehicle
Delete Consumptions by File
Delete all consumptions from a CSV upload by file ID
Bulk Delete Consumptions
Delete multiple consumption records at once
Bulk Delete by Filters
Delete consumptions matching filter criteria
Was this page helpful?