Bulk Delete Vehicle Consumptions
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({consumption_ids: {}})
};
fetch('https://api.dcycle.io/v1/vehicles/{vehicle_id}/consumptions/bulk-delete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/vehicles/{vehicle_id}/consumptions/bulk-delete"
payload = { "consumption_ids": {} }
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/vehicles/{vehicle_id}/consumptions/bulk-delete \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"consumption_ids": {}
}
'{
"success_count": 123,
"success_ids": {},
"failed_count": 123,
"failed_ids": {},
"message": "<string>"
}Bulk Delete Vehicle Consumptions
Delete multiple consumption records for a specific vehicle in a single operation
POST
/
v1
/
vehicles
/
{vehicle_id}
/
consumptions
/
bulk-delete
Bulk Delete Vehicle Consumptions
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({consumption_ids: {}})
};
fetch('https://api.dcycle.io/v1/vehicles/{vehicle_id}/consumptions/bulk-delete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/vehicles/{vehicle_id}/consumptions/bulk-delete"
payload = { "consumption_ids": {} }
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/vehicles/{vehicle_id}/consumptions/bulk-delete \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"consumption_ids": {}
}
'{
"success_count": 123,
"success_ids": {},
"failed_count": 123,
"failed_ids": {},
"message": "<string>"
}Bulk Delete Vehicle Consumptions
Delete multiple consumption records for a vehicle in a single API call.Permanent Action: Deleting consumption records is permanent and cannot be undone. All associated emissions data will be removed from your organization’s totals.
Request
Path Parameters
uuid
required
The UUID of the vehicle whose consumptions you want to deleteExample:
550e8400-e29b-41d4-a716-446655440000Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faBody Parameters
array[string]
required
Array of consumption record UUIDs to delete. Minimum 1, maximum 100,000 IDs per request.Example:
["660e8400-e29b-41d4-a716-446655440000", "770e8400-e29b-41d4-a716-446655440001"]Response
Returns200 OK with a JSON summary of the operation.
integer
Number of consumption records successfully deleted
array[string]
UUIDs of successfully deleted consumption records
integer
Number of records that failed to delete
array[string]
UUIDs of records that failed to delete (not found or deletion error)
string
Human-readable summary of the operation
Example
curl -X POST "https://api.dcycle.io/v1/vehicles/550e8400-e29b-41d4-a716-446655440000/consumptions/bulk-delete" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"consumption_ids": [
"660e8400-e29b-41d4-a716-446655440000",
"770e8400-e29b-41d4-a716-446655440001"
]
}'
import requests
import os
api_key = os.getenv("DCYCLE_API_KEY")
org_id = os.getenv("DCYCLE_ORG_ID")
vehicle_id = "550e8400-e29b-41d4-a716-446655440000"
headers = {
"x-api-key": api_key,
"x-organization-id": org_id,
"Content-Type": "application/json"
}
payload = {
"consumption_ids": [
"660e8400-e29b-41d4-a716-446655440000",
"770e8400-e29b-41d4-a716-446655440001"
]
}
response = requests.post(
f"https://api.dcycle.io/v1/vehicles/{vehicle_id}/consumptions/bulk-delete",
headers=headers,
json=payload
)
result = response.json()
print(f"Deleted: {result['success_count']}, Failed: {result['failed_count']}")
print(result["message"])
const axios = require('axios');
const apiKey = process.env.DCYCLE_API_KEY;
const orgId = process.env.DCYCLE_ORG_ID;
const vehicleId = '550e8400-e29b-41d4-a716-446655440000';
const headers = {
'x-api-key': apiKey,
'x-organization-id': orgId,
'Content-Type': 'application/json'
};
const payload = {
consumption_ids: [
'660e8400-e29b-41d4-a716-446655440000',
'770e8400-e29b-41d4-a716-446655440001'
]
};
axios.post(
`https://api.dcycle.io/v1/vehicles/${vehicleId}/consumptions/bulk-delete`,
payload,
{ headers }
)
.then(response => {
const result = response.data;
console.log(`Deleted: ${result.success_count}, Failed: ${result.failed_count}`);
console.log(result.message);
})
.catch(error => console.error(error));
Successful Response
{
"success_count": 2,
"success_ids": [
"660e8400-e29b-41d4-a716-446655440000",
"770e8400-e29b-41d4-a716-446655440001"
],
"failed_count": 0,
"failed_ids": [],
"message": "Successfully deleted 2 vehicle consumptions"
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{
"detail": "Invalid API key",
"code": "INVALID_API_KEY"
}
404 Not Found
Cause: Vehicle not found in organization{
"code": "VEHICLE_NOT_FOUND",
"detail": "Vehicle with id=UUID('...') not found"
}
422 Validation Error
Cause: Invalid request body (e.g. emptyconsumption_ids array or exceeding 100,000 IDs)
{
"detail": [
{
"loc": ["body", "consumption_ids"],
"msg": "ensure this value has at least 1 items",
"type": "value_error.list.min_items"
}
]
}
Related Endpoints
Vehicle Consumptions
List all consumption records for a vehicle
Bulk Delete Consumptions by Filters
Delete consumptions matching filter criteria
Bulk Delete Vehicles
Delete multiple vehicles at once
Delete Vehicle
Delete a single vehicle
Was this page helpful?