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

> Get the list of logistics clients with registered shipments

# List Logistics Clients

Get the list of all unique clients that have registered shipments in the system. Useful for populating selectors or verifying that your uploads were processed correctly.

## 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:** `ff4adcc7-8172-45fe-9cf1-e90a6de53aa9`
</ParamField>

<ParamField header="x-user-id" type="string" required>
  Your user UUID

  **Example:** `a1b2c3d4-e5f6-7890-abcd-ef1234567890`
</ParamField>

This endpoint requires no query parameters. It returns all unique clients for your organization.

## Response

<ResponseField name="clients" type="array">
  Array of unique client names

  Example: `["Correos Express", "DHL", "SEUR"]`
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/api/v1/logistics/clients" \
    -H "Authorization: Bearer ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}" \
    -H "x-user-id: ${DCYCLE_USER_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 = {
      "Authorization": f"Bearer {api_key}",
      "x-organization-id": org_id,
      "x-user-id": user_id
  }

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

  clients = response.json()
  print(f"Clients: {', '.join(clients)}")
  ```

  ```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 = {
    'Authorization': `Bearer ${apiKey}`,
    'x-organization-id': orgId,
    'x-user-id': userId
  };

  axios.get(
    'https://api.dcycle.io/api/v1/logistics/clients',
    { headers }
  )
  .then(response => {
    console.log('Clients:', response.data.join(', '));
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
[
  "Correos Express",
  "DHL",
  "SEUR",
  "MRW"
]
```

## Use Cases

### Verify Upload

After uploading a CSV, verify that the client appears in the list:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Upload CSV
upload_csv("correos_shipments.csv")

# Wait for processing
time.sleep(30)

# Verify
clients = get_clients()
if "Correos Express" in clients:
    print("✅ Upload processed successfully")
else:
    print("⚠️ Client not available yet, wait longer")
```

### Populate UI Selector

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
// Get clients for a dropdown
const clients = await getClients();

const selectElement = document.getElementById('client-selector');
clients.forEach(client => {
  const option = document.createElement('option');
  option.value = client;
  option.text = client;
  selectElement.add(option);
});
```

### Validate Client Name

Before generating a report, verify that the client exists:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
def generate_report(client_name, start_date, end_date):
    # Validate that the client exists
    available_clients = get_clients()

    if client_name not in available_clients:
        raise ValueError(
            f"Client '{client_name}' not found. "
            f"Available: {', '.join(available_clients)}"
        )

    # Generate report
    return get_report(client_name, start_date, end_date)
```

## Notes

<Info>
  The client list is dynamically generated based on the shipments you've uploaded. If you just completed an upload, wait a few seconds for processing to finish.
</Info>

<Warning>
  Client names are **case-sensitive**. `"Correos Express"` and `"correos express"` are considered different.
</Warning>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get Report" icon="chart-line" href="/api-docs/logistics/get-report">
    Generate report for a client
  </Card>

  <Card title="Upload CSV" icon="upload" href="/api-docs/logistics/upload-csv">
    Upload bulk shipments
  </Card>
</CardGroup>
