Skip to main content
POST
/
v2
/
vehicle_consumptions
/
bulk-delete
Bulk Delete Vehicle Consumptions (Organization)
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/v2/vehicle_consumptions/bulk-delete', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "success_count": 123,
  "success_ids": {},
  "failed_count": 123,
  "failed_ids": {},
  "message": "<string>"
}

Bulk Delete Vehicle Consumptions (Organization)

Delete multiple consumption records by their IDs in a single call — the consumptions don’t need to belong to the same vehicle. Use this from an “all consumptions” table view where a user has selected specific rows across multiple vehicles.
Permanent Action: Deleting consumption records is permanent and cannot be undone. All associated emissions data will be removed from your organization’s totals.
Consumption IDs that don’t exist, or whose vehicle belongs to a different organization, are reported in failed_ids rather than causing the whole request to fail. Always check failed_count after a 200 response.

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

Body Parameters

consumption_ids
array[string]
required
Array of consumption record UUIDs to delete, from any vehicle in the organization. Minimum 1, maximum 100,000 IDs per request.Example: ["660e8400-e29b-41d4-a716-446655440000", "770e8400-e29b-41d4-a716-446655440001"]

Response

Returns 200 OK with a JSON summary of the operation.
success_count
integer
Number of consumption records successfully deleted
success_ids
array[string]
UUIDs of successfully deleted consumption records
failed_count
integer
Number of records that failed to delete
failed_ids
array[string]
UUIDs of records that failed to delete (not found, or owned by a different organization)
message
string
Human-readable summary of the operation

Example

curl -X POST "https://api.dcycle.io/v2/vehicle_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"
    ]
  }'

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 consumption(s)"
}

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{
  "detail": "Invalid API key",
  "code": "INVALID_API_KEY"
}

422 Validation Error

Cause: Invalid request body (e.g. empty consumption_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"
    }
  ]
}

List Vehicle Consumptions (Organization)

List all consumptions across every vehicle, with filters

Bulk Delete by Filters (Organization)

Delete every consumption matching the current filters, e.g. an entire uploaded file

Bulk Delete Consumptions

Delete consumptions scoped to a single vehicle