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

# List Logistic Hubs

> Retrieve all logistic hubs with filtering and pagination support

# List Logistic Hubs

Retrieve a paginated list of logistic hubs in your organization with support for filtering by name, category, type, and status.

## 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="name" type="string">
  Filter hubs by name (partial match, case-insensitive)

  **Example:** `"Madrid"`
</ParamField>

<ParamField query="category" type="string">
  Filter by hub category

  **Example:** `"warehouse_ambient"`
</ParamField>

<ParamField query="type" type="string">
  Filter by hub type

  **Available values:** `owned`, `subcontracted`
</ParamField>

<ParamField query="status[]" type="array[string]">
  Filter by hub status

  **Available values:** `active`, `archived`

  **Example:** `status[]=active`
</ParamField>

<ParamField query="page" type="integer" default="1">
  Page number for pagination
</ParamField>

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

## Response

<ResponseField name="items" type="array[object]">
  Array of logistic hub objects

  <Expandable title="Logistic Hub Object">
    <ResponseField name="id" type="string">Unique identifier (UUID)</ResponseField>
    <ResponseField name="name" type="string">Hub name</ResponseField>
    <ResponseField name="address" type="string | null">Physical address</ResponseField>
    <ResponseField name="country" type="string | null">ISO country code</ResponseField>
    <ResponseField name="type" type="string">Hub type: `owned` or `subcontracted`</ResponseField>
    <ResponseField name="category" type="string | null">Hub category</ResponseField>
    <ResponseField name="status" type="string">Status: `active` or `archived`</ResponseField>
    <ResponseField name="supercharger" type="boolean">Whether hub is a supercharger</ResponseField>
    <ResponseField name="facility_id" type="string | null">Linked facility UUID</ResponseField>
    <ResponseField name="co2e" type="number | null">CO2e emissions from linked facility</ResponseField>
    <ResponseField name="created_at" type="datetime">Creation timestamp</ResponseField>
    <ResponseField name="updated_at" type="datetime | null">Last update timestamp</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="integer">Total number of hubs matching the filter</ResponseField>
<ResponseField name="page" type="integer">Current page number</ResponseField>
<ResponseField name="size" type="integer">Number of items per page</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/v1/logistic-hubs?page=1&size=50&status[]=active" \
    -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

  headers = {
      "x-api-key": os.getenv("DCYCLE_API_KEY"),
      "x-organization-id": os.getenv("DCYCLE_ORG_ID")
  }

  response = requests.get(
      "https://api.dcycle.io/v1/logistic-hubs",
      headers=headers,
      params={"page": 1, "size": 50, "status[]": ["active"]}
  )

  for hub in response.json()["items"]:
      print(f"{hub['name']}: {hub['co2e'] or 0} kg CO2e")
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const axios = require('axios');

  const headers = {
    'x-api-key': process.env.DCYCLE_API_KEY,
    'x-organization-id': process.env.DCYCLE_ORG_ID
  };

  axios.get('https://api.dcycle.io/v1/logistic-hubs', {
    headers,
    params: { page: 1, size: 50, 'status[]': ['active'] }
  })
  .then(response => {
    response.data.items.forEach(h => {
      console.log(`${h.name}: ${h.co2e || 0} kg CO2e`);
    });
  });
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Madrid Warehouse",
      "type": "owned",
      "category": "warehouse_ambient",
      "address": "Calle Industrial 5, Madrid",
      "country": "ES",
      "status": "active",
      "supercharger": false,
      "facility_id": "660e8400-e29b-41d4-a716-446655440000",
      "co2e": 1250.5,
      "created_at": "2024-11-24T10:30:00Z",
      "updated_at": "2024-11-24T10:30:00Z"
    }
  ],
  "total": 8,
  "page": 1,
  "size": 50
}
```

## 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="Create Logistic Hub" icon="plus" href="/api-reference/logistic-hubs/create">
    Add a new logistic hub
  </Card>

  <Card title="Get Logistic Hub" icon="warehouse" href="/api-reference/logistic-hubs/get">
    Retrieve a single logistic hub
  </Card>
</CardGroup>
