> ## 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.

# Get Consumption

> Retrieve a single vehicle consumption record with CO2e data

# Get Consumption

Retrieve the full details of a single vehicle consumption record, enriched with CO2e emission calculations.

## Request

### 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>

### Path Parameters

<ParamField path="vehicle_consumption_id" type="string" required>
  UUID of the vehicle consumption record
</ParamField>

## Response

<ResponseField name="id" type="string">
  Consumption record UUID
</ResponseField>

<ResponseField name="vehicle_id" type="string">
  UUID of the vehicle this consumption belongs to
</ResponseField>

<ResponseField name="quantity" type="number | null">
  Fuel quantity consumed
</ResponseField>

<ResponseField name="start_date" type="date">
  Start date of the consumption period
</ResponseField>

<ResponseField name="end_date" type="date">
  End date of the consumption period
</ResponseField>

<ResponseField name="status" type="string">
  Record status: `active`, `loading`, `error`
</ResponseField>

<ResponseField name="unit" type="object">
  Fuel unit (id, name, type)
</ResponseField>

<ResponseField name="co2e" type="number | null">
  Total CO2 equivalent emissions in kg
</ResponseField>

<ResponseField name="co2e_generation" type="number | null">
  Scope 3 (upstream) CO2e from fuel generation
</ResponseField>

<ResponseField name="co2e_consumption" type="number | null">
  Scope 1 (direct) CO2e from fuel combustion
</ResponseField>

<ResponseField name="total_energy_kwh" type="number | null">
  Total energy in kWh
</ResponseField>

<ResponseField name="license_plate" type="string | null">
  Vehicle license plate
</ResponseField>

<ResponseField name="vehicle" type="object | null">
  Vehicle details (id, name, organization)
</ResponseField>

<ResponseField name="user" type="object | null">
  User who uploaded the record
</ResponseField>

<ResponseField name="error_messages" type="array[string] | null">
  Error details when status is `error`
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl "https://api.dcycle.io/v1/vehicle_consumptions/${CONSUMPTION_ID}" \
    -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

  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")
  ```

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

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "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,
  "created_at": "2025-01-15T10:00:00Z",
  "updated_at": "2025-01-15T10:05:00Z"
}
```

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

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

### 403 Forbidden

**Cause:** The authenticated user is not a member of the organization

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Not Found"}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Calculation Steps" icon="calculator" href="/api-reference/vehicles/consumptions-steps">
    View detailed emission calculation breakdown
  </Card>

  <Card title="List Consumptions" icon="list" href="/api-reference/vehicles/consumptions">
    Browse all consumptions for a vehicle
  </Card>
</CardGroup>
