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

> Get summary statistics for logistics entities in your organization

# Get Logistics Summary

Retrieve summary statistics including counts and last updated timestamps for each logistics entity type (requests, recharges, hubs).

<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="project_id" type="string">
  Filter by project UUID to get project-scoped summary

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

## Response

<ResponseField name="requests" type="object">
  Summary for logistics requests (shipments)

  <Expandable title="Summary Object">
    <ResponseField name="count" type="integer">
      Total number of logistics requests
    </ResponseField>

    <ResponseField name="last_updated" type="datetime">
      Timestamp of the most recently updated request
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="recharges" type="object">
  Summary for logistics recharges (fuel consumptions)

  <Expandable title="Summary Object">
    <ResponseField name="count" type="integer">
      Total number of logistics recharges
    </ResponseField>

    <ResponseField name="last_updated" type="datetime">
      Timestamp of the most recently updated recharge
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="hubs" type="object">
  Summary for logistics hubs

  <Expandable title="Summary Object">
    <ResponseField name="count" type="integer">
      Total number of logistics hubs
    </ResponseField>

    <ResponseField name="last_updated" type="datetime">
      Timestamp of the most recently updated hub
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

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

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

  result = response.json()
  print(f"Requests: {result['requests']['count']}")
  print(f"Recharges: {result['recharges']['count']}")
  print(f"Hubs: {result['hubs']['count']}")
  ```

  ```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
  };

  axios.get(
    'https://api.dcycle.io/v1/logistics/summary',
    { headers }
  )
  .then(response => {
    const { requests, recharges, hubs } = response.data;
    console.log(`Requests: ${requests.count}`);
    console.log(`Recharges: ${recharges.count}`);
    console.log(`Hubs: ${hubs.count}`);
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "requests": {
    "count": 1250,
    "last_updated": "2024-11-24T15:30:00Z"
  },
  "recharges": {
    "count": 456,
    "last_updated": "2024-11-23T10:15:00Z"
  },
  "hubs": {
    "count": 12,
    "last_updated": "2024-11-20T09:00: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"}
```

## 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="Get Logistics Recharges" icon="gas-pump" href="/api-reference/logistics/get-recharges">
    Retrieve fuel consumption records
  </Card>

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