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

> Retrieve all logistics hubs for your organization

# Get Logistics Hubs

Retrieve a paginated list of logistics hubs for your organization. Hubs represent physical locations (warehouses, transshipment points, etc.) used as origins in logistics shipments.

## 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="type" type="string">
  Filter by hub type

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

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

  **Available values:** `transshipment_ambient`, `transshipment_mixed`, `storage_transhipment_ambient`, `storage_transhipment_mixed`, `warehouse_ambient`, `warehouse_mixed`, `liquid_bulk_terminals_ambient`, `liquid_bulk_terminals_mixed`, `maritime_container_terminals_ambient`, `maritime_container_terminals_temperature_controlled`
</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">
  Array of hub objects

  <Expandable title="Hub Object">
    <ResponseField name="id" type="string">
      Unique identifier (UUID)
    </ResponseField>

    <ResponseField name="name" type="string">
      Hub name
    </ResponseField>

    <ResponseField name="address" type="string">
      Physical address of the hub
    </ResponseField>

    <ResponseField name="country" type="string">
      ISO country code (e.g. `ES`, `FR`)
    </ResponseField>

    <ResponseField name="type" type="string">
      Hub type: `owned` (linked to a facility) or `subcontracted`
    </ResponseField>

    <ResponseField name="category" type="string">
      Hub category (e.g. `warehouse_ambient`, `transshipment_mixed`)
    </ResponseField>

    <ResponseField name="status" type="string">
      Status: `active` or `archived`
    </ResponseField>

    <ResponseField name="supercharger" type="boolean">
      Whether the hub is a supercharger location
    </ResponseField>

    <ResponseField name="facility_id" type="string">
      UUID of the linked facility (only for `owned` hubs)
    </ResponseField>

    <ResponseField name="co2e" type="number">
      CO2e emissions from the linked facility, if available
    </ResponseField>

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

    <ResponseField name="updated_at" type="datetime | null">
      Timestamp when the hub was last updated
    </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/logistics/hubs?page=1&size=10" \
    -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/hubs",
      headers=headers,
      params={"page": 1, "size": 10}
  )

  result = response.json()
  for hub in result["items"]:
      print(f"{hub['name']} ({hub['type']}) — {hub['address']}")
  ```

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

  axios.get('https://api.dcycle.io/v1/logistics/hubs', {
    headers: {
      'x-api-key': process.env.DCYCLE_API_KEY,
      'x-organization-id': process.env.DCYCLE_ORG_ID,
    },
    params: { page: 1, size: 10 },
  })
  .then(({ data }) => {
    data.items.forEach(hub => {
      console.log(`${hub.name} (${hub.type}) — ${hub.address}`);
    });
  });
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "items": [
    {
      "id": "b3d2e1f0-1234-5678-abcd-ef0123456789",
      "name": "HUB-MAD-001",
      "address": "Calle Ejemplo 1, Madrid, Spain",
      "country": "ES",
      "type": "owned",
      "category": "warehouse_ambient",
      "status": "active",
      "supercharger": false,
      "facility_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
      "co2e": 1240.5,
      "created_at": "2024-10-01T09:00:00Z",
      "updated_at": "2024-11-15T14:30:00Z"
    },
    {
      "id": "c4e5f6a7-2345-6789-bcde-f01234567890",
      "name": "HUB-BCN-SUB",
      "address": "Av. Diagonal 100, Barcelona, Spain",
      "country": "ES",
      "type": "subcontracted",
      "category": "transshipment_ambient",
      "status": "active",
      "supercharger": false,
      "facility_id": null,
      "co2e": null,
      "created_at": "2024-11-01T11:00:00Z",
      "updated_at": null
    }
  ],
  "total": 2,
  "page": 1,
  "size": 10
}
```

## 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 requests — each includes a `hub_id` reference
  </Card>

  <Card title="Create Logistics Request" icon="plus" href="/api-reference/logistics/create-request">
    Create a shipment leg referencing a hub
  </Card>

  <Card title="Logistic Hubs (full CRUD)" icon="warehouse" href="/api-reference/logistic-hubs/list">
    Full hub management: create, update, delete
  </Card>
</CardGroup>
