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

> Retrieve a paginated list of fuel recharges (consumptions) for your organization

# Get Logistics Recharges

Retrieve all logistics recharges (fuel consumptions) for your organization with pagination and filtering support.

<Note>
  **New API**: This endpoint is part of the new API architecture with improved design and maintainability.
</Note>

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

### Query Parameters

<ParamField query="page" type="integer" default="1">
  Page number to retrieve

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

<ParamField query="size" type="integer" default="10">
  Number of items per page (1-100)

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

<ParamField query="search" type="string">
  Search by vehicle license plate

  **Example:** `1234-ABC`
</ParamField>

<ParamField query="vehicle_type" type="array[string]">
  Filter by vehicle type(s)

  **Example:** `vehicle_type=van_diesel&vehicle_type=rigid_truck`
</ParamField>

<ParamField query="fuel_id" type="array[string]">
  Filter by fuel UUID(s)

  **Example:** `fuel_id=550e8400-e29b-41d4-a716-446655440000`
</ParamField>

<ParamField query="vehicle_license_plate" type="array[string]">
  Filter by vehicle license plate(s)

  **Example:** `vehicle_license_plate=1234-ABC`
</ParamField>

<ParamField query="file_id" type="array[string]">
  Filter by source file UUID(s)

  **Example:** `file_id=550e8400-e29b-41d4-a716-446655440000`
</ParamField>

<ParamField query="date_from" type="string">
  Filter by recharge date >= (YYYY-MM-DD)

  **Example:** `2024-01-01`
</ParamField>

<ParamField query="date_until" type="string">
  Filter by recharge date \<= (YYYY-MM-DD)

  **Example:** `2024-12-31`
</ParamField>

<ParamField query="created_at_from" type="string">
  Filter by creation date >= (YYYY-MM-DD)

  **Example:** `2024-01-01`
</ParamField>

<ParamField query="created_at_to" type="string">
  Filter by creation date \<= (YYYY-MM-DD)

  **Example:** `2024-12-31`
</ParamField>

<ParamField query="status" type="string">
  Filter by recharge status

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

<ParamField query="project_id" type="string">
  Filter by project UUID (only recharges linked to this project)

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

## Response

<ResponseField name="page" type="integer">
  Current page number
</ResponseField>

<ResponseField name="size" type="integer">
  Number of items per page
</ResponseField>

<ResponseField name="total" type="integer">
  Total number of logistics recharges matching the filters
</ResponseField>

<ResponseField name="items" type="array">
  Array of logistics recharge objects

  <Expandable title="Logistics Recharge Object">
    <ResponseField name="id" type="string">
      Unique identifier for the recharge
    </ResponseField>

    <ResponseField name="vehicle_license_plate" type="string">
      License plate of the vehicle
    </ResponseField>

    <ResponseField name="vehicle_type" type="string">
      Type of vehicle (e.g., "van\_diesel")
    </ResponseField>

    <ResponseField name="fuel_name" type="string">
      Name of the fuel used
    </ResponseField>

    <ResponseField name="quantity" type="number">
      Amount of fuel consumed
    </ResponseField>

    <ResponseField name="unit" type="string">
      Unit of measurement for the fuel quantity
    </ResponseField>

    <ResponseField name="date" type="date">
      Date of the recharge
    </ResponseField>

    <ResponseField name="co2e" type="number">
      CO2 equivalent emissions in kilograms
    </ResponseField>

    <ResponseField name="created_at" type="datetime">
      Timestamp when the recharge was created
    </ResponseField>

    <ResponseField name="updated_at" type="datetime | null">
      Timestamp when the recharge was last updated
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/v1/logistics/recharges?page=1&size=10&date_from=2024-01-01&date_until=2024-12-31" \
    -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")

  headers = {
      "x-api-key": api_key,
      "x-organization-id": org_id
  }

  params = {
      "page": 1,
      "size": 10,
      "date_from": "2024-01-01",
      "date_until": "2024-12-31"
  }

  response = requests.get(
      "https://api.dcycle.io/v1/logistics/recharges",
      headers=headers,
      params=params
  )

  result = response.json()
  print(f"Total recharges: {result['total']}")
  for item in result['items']:
      print(f"  - {item['vehicle_license_plate']}: {item['quantity']} {item['unit']} ({item['co2e']} kg CO2e)")
  ```

  ```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 headers = {
    'x-api-key': apiKey,
    'x-organization-id': orgId
  };

  const params = {
    page: 1,
    size: 10,
    date_from: '2024-01-01',
    date_until: '2024-12-31'
  };

  axios.get(
    'https://api.dcycle.io/v1/logistics/recharges',
    { headers, params }
  )
  .then(response => {
    console.log(`Total recharges: ${response.data.total}`);
    response.data.items.forEach(item => {
      console.log(`  - ${item.vehicle_license_plate}: ${item.quantity} ${item.unit} (${item.co2e} kg CO2e)`);
    });
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "page": 1,
  "size": 10,
  "total": 156,
  "items": [
    {
      "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "vehicle_license_plate": "1234-ABC",
      "vehicle_type": "van_diesel",
      "fuel_name": "Diesel B7",
      "quantity": 45.5,
      "unit": "liters",
      "date": "2024-11-20",
      "co2e": 120.35,
      "created_at": "2024-11-21T08:30:00Z",
      "updated_at": "2024-11-21T08:30:00Z"
    },
    {
      "id": "a12bc34d-56ef-7890-ghij-klmnopqrstuv",
      "vehicle_license_plate": "5678-XYZ",
      "vehicle_type": "rigid_truck_7.5_12_t_gvw_average_diesel",
      "fuel_name": "Diesel B7",
      "quantity": 120.0,
      "unit": "liters",
      "date": "2024-11-19",
      "co2e": 317.52,
      "created_at": "2024-11-20T14:15:00Z",
      "updated_at": "2024-11-20T14:15:00Z"
    }
  ]
}
```

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

### 422 Validation Error

**Cause:** Invalid filter parameters

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": [
    {
      "loc": ["query", "size"],
      "msg": "ensure this value is less than or equal to 100",
      "type": "value_error"
    }
  ]
}
```

**Solution:** Ensure `page` is a positive integer and `size` is between 1 and 100. Date parameters must use `YYYY-MM-DD` format.

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get Logistics Requests" icon="list" href="/api-reference/logistics/get-requests">
    Retrieve logistics shipment requests
  </Card>

  <Card title="Delete Recharge" icon="trash" href="/api-reference/logistics/delete-recharge">
    Delete a single recharge record
  </Card>

  <Card title="Batch Delete Recharges" icon="trash-can" href="/api-reference/logistics/batch-delete-recharges">
    Delete multiple recharges at once
  </Card>

  <Card title="Generate Report" icon="chart-bar" href="/api-reference/logistics/get-report">
    Generate ISO 14083 emissions report
  </Card>
</CardGroup>
