> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Vehicle Consumption

> Permanently delete a single vehicle consumption record by its ID

# Delete Vehicle Consumption

Permanently delete a single vehicle consumption record. This action cannot be undone and will remove all associated emissions data from your organization's totals.

<Warning>
  **Irreversible Action**: Deleting a consumption record is permanent. All associated CO₂e impact data will be removed.
</Warning>

## Request

### Path Parameters

<ParamField path="vehicle_consumption_id" type="uuid" required>
  The UUID of the vehicle consumption record to delete

  **Example:** `660e8400-e29b-41d4-a716-446655440000`
</ParamField>

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

## Response

Returns `204 No Content` on successful deletion. No response body.

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  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}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  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}")
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  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));
  ```
</CodeGroup>

### Successful Response

```
HTTP/1.1 204 No Content
```

No response body is returned for successful deletions.

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Invalid API key",
  "code": "INVALID_API_KEY"
}
```

**Solution:** Verify your API key is valid and active. Get a new one from [Settings → API](https://app.dcycle.io/settings/api).

### 404 Not Found

**Cause:** Vehicle consumption record not found in organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "code": "VEHICLE_CONSUMPTION_NOT_FOUND",
  "detail": "VehicleConsumption with id=UUID('...') not found"
}
```

**Solution:** Verify the consumption ID is correct and belongs to your organization. Use the [List Vehicle Consumptions](/api-reference/vehicles/consumptions) endpoint to retrieve valid IDs.

### 422 Validation Error

**Cause:** Malformed UUID in path parameter

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": [
    {
      "loc": ["path", "vehicle_consumption_id"],
      "msg": "value is not a valid uuid",
      "type": "type_error.uuid"
    }
  ]
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Vehicle Consumptions" icon="list" href="/api-reference/vehicles/consumptions">
    List all consumption records for a vehicle
  </Card>

  <Card title="Delete Consumptions by File" icon="trash" href="/api-reference/vehicles/consumptions-delete-by-file">
    Delete all consumptions from a CSV upload by file ID
  </Card>

  <Card title="Bulk Delete Consumptions" icon="trash-can" href="/api-reference/vehicles/consumptions-bulk-delete">
    Delete multiple consumption records at once
  </Card>

  <Card title="Bulk Delete by Filters" icon="filter" href="/api-reference/vehicles/consumptions-bulk-delete-by-filters">
    Delete consumptions matching filter criteria
  </Card>
</CardGroup>
