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

# Logistic Hubs

> Manage distribution centers and logistic nodes for transport calculations

<Note>
  **Early Access** - The Dcycle CLI is currently available for enterprise customers.
  [Contact us](/docs/support) to learn more about access.
</Note>

## Overview

The `hub` command manages logistic hubs — distribution centers and logistic nodes used in transport emission calculations.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub <subcommand> [flags]
```

### Available Commands

| Command  | Description           |
| -------- | --------------------- |
| `list`   | List logistic hubs    |
| `show`   | Show hub details      |
| `create` | Create a logistic hub |
| `edit`   | Edit a logistic hub   |
| `delete` | Delete a logistic hub |

***

## List Hubs

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub list [flags]

# Aliases
dcy hub ls
```

### Examples

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
# List all hubs
dcy hub list

# Filter by name and type
dcy hub list --name "Madrid" --type owned

# Filter by category
dcy hub list --category warehouse_ambient

# Filter by facility
dcy hub list --facility <facility-id>

# Filter by status
dcy hub list --status active

# Pagination
dcy hub list --page 2 --size 100

# JSON output
dcy hub list --format json | jq '.[] | {id, name, type, category}'
```

### Flags

| Flag         | Short | Default | Description                               |
| ------------ | ----- | ------- | ----------------------------------------- |
| `--name`     | `-n`  | —       | Filter by name                            |
| `--type`     | `-t`  | —       | Filter by type (`owned`, `subcontracted`) |
| `--category` | `-c`  | —       | Filter by category (see table below)      |
| `--facility` | `-f`  | —       | Filter by facility ID                     |
| `--status`   | —     | —       | Filter by status                          |
| `--page`     | —     | `1`     | Page number                               |
| `--size`     | —     | `50`    | Items per page                            |
| `--org`      | —     | —       | Organization ID override                  |

#### Hub Categories

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

### Output

```
Showing 3 of 3 hubs in Acme Corp
h1-abc123-... | Madrid DC     | owned          | warehouse_ambient | ES | supercharger=false | active
h2-def456-... | Barcelona Hub | subcontracted  | transshipment_ambient | ES | supercharger=true  | active
h3-ghi789-... | Valencia Port | owned          | maritime_container_terminals_ambient | ES | supercharger=false | active
```

Columns: ID, name, type, category, country, supercharger status, status.

***

## Show Hub Details

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub show <hub-id>
```

### Examples

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub show 00000000-0000-0000-0000-000000000000

# JSON output
dcy hub show <hub-id> --format json
```

### Flags

| Flag    | Description              |
| ------- | ------------------------ |
| `--org` | Organization ID override |

### Output

```
ID: h1-abc123-...
Name: Madrid DC
Address: Pol. Ind. Las Mercedes, Madrid
Type: owned
Category: warehouse_ambient
Country: ES
Facility ID: abc123-def456-...
Status: active
Supercharger: false
CO2e: 0.00000 tCO2e
```

***

## Create Hub

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub create [flags]
```

### Examples

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub create \
  --name "Madrid Distribution Center" \
  --address "Pol. Ind. Las Mercedes, Madrid" \
  --type owned \
  --category warehouse_ambient

dcy hub create \
  --name "Port Terminal" \
  --address "Valencia Port" \
  --type subcontracted \
  --category maritime_container_terminals_ambient \
  --country ES \
  --facility <facility-id>
```

### Flags

| Flag             | Short | Required | Default | Description                          |
| ---------------- | ----- | -------- | ------- | ------------------------------------ |
| `--name`         | `-n`  | Yes      | —       | Hub name                             |
| `--address`      | `-a`  | Yes      | —       | Physical address                     |
| `--type`         | `-t`  | Yes      | —       | Hub type (`owned`, `subcontracted`)  |
| `--category`     | `-c`  | Yes      | —       | Hub category (see categories above)  |
| `--country`      | —     | No       | —       | Country code                         |
| `--facility`     | —     | No       | —       | Associated facility ID               |
| `--supercharger` | —     | No       | `false` | Has supercharger (electric charging) |
| `--org`          | —     | No       | —       | Organization ID override             |

***

## Edit Hub

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub edit <hub-id> [flags]
```

### Examples

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub edit <hub-id> --name "New Name"
dcy hub edit <hub-id> --address "New Address" --supercharger
dcy hub edit <hub-id> --no-supercharger
dcy hub edit <hub-id> --type subcontracted --category transshipment_ambient
```

### Flags

Accepts the same flags as `create` (all optional). Additionally:

| Flag                | Description               |
| ------------------- | ------------------------- |
| `--no-supercharger` | Set supercharger to false |

***

## Delete Hub

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dcy hub delete <hub-id> [flags]

# Aliases
dcy hub rm <hub-id>
```

### Examples

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Interactive confirmation
dcy hub delete <hub-id>

# Skip confirmation
dcy hub delete <hub-id> --yes
```

### Flags

| Flag    | Short | Default | Description              |
| ------- | ----- | ------- | ------------------------ |
| `--yes` | `-y`  | `false` | Skip confirmation prompt |
| `--org` | —     | —       | Organization ID override |

### Output

Confirmation prompt:

```
Delete hub Madrid DC (h1-abc123-...)? [y/N]
```

```
hub deleted successfully: Madrid DC
```

***

## Common Options

All hub commands support:

| Flag            | Description                        |
| --------------- | ---------------------------------- |
| `--format json` | JSON output (default: `text`)      |
| `--verbose`     | Show HTTP request/response details |
| `--timeout`     | Request timeout in seconds         |

***

## Workflows

### Export Hubs for Reporting

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Export all hubs as JSON
dcy hub list --format json --size 100 > hubs.json

# Group hubs by type
dcy hub list --format json | jq 'group_by(.type) | map({type: .[0].type, count: length})'

# Find hubs with supercharger
dcy hub list --format json | jq '[.[] | select(.supercharger == true)]'
```

### Piping with jq

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
# List hub IDs for scripting
dcy hub list --format json | jq -r '.[].id'

# Get hub names and categories
dcy hub list --format json | jq '.[] | {name, type, category}'
```
