> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getdoppel.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List Clinics

> Retrieve a list of all clinics accessible with your API key

# List Clinics

Returns a list of all clinics you have access to. If your API key is restricted to specific clinics, only those clinics will be returned.

## Request

```bash theme={null}
GET https://api.getdoppel.ai/api/v1/clinics
```

### Headers

| Header          | Required | Description                    |
| --------------- | -------- | ------------------------------ |
| `Authorization` | Yes      | Bearer token with your API key |

### Query Parameters

| Parameter | Type    | Default | Description               |
| --------- | ------- | ------- | ------------------------- |
| `page`    | integer | 1       | Page number (1-indexed)   |
| `limit`   | integer | 25      | Items per page (max: 500) |

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="clinics" type="array">
      Array of clinic objects
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="meta" type="object">
  Pagination metadata
</ResponseField>

### Clinic Object

| Field        | Type   | Description                             |
| ------------ | ------ | --------------------------------------- |
| `id`         | string | Unique clinic ID (UUID)                 |
| `name`       | string | Clinic name                             |
| `address`    | string | Clinic address                          |
| `phone`      | string | Clinic phone number                     |
| `email`      | string | Clinic email address                    |
| `timezone`   | string | Clinic timezone (e.g., `Europe/Madrid`) |
| `created_at` | string | When the clinic was added (ISO 8601)    |

## Examples

### Basic Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.getdoppel.ai/api/v1/clinics" \
    -H "Authorization: Bearer dpl_live_YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.getdoppel.ai/api/v1/clinics', {
    headers: {
      'Authorization': 'Bearer dpl_live_YOUR_API_KEY'
    }
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.getdoppel.ai/api/v1/clinics',
      headers={'Authorization': 'Bearer dpl_live_YOUR_API_KEY'}
  )
  data = response.json()
  ```
</CodeGroup>

### Response Example

```json theme={null}
{
  "success": true,
  "data": {
    "clinics": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "SmileUp Madrid Centro",
        "address": "Calle Gran Via 123, 28013 Madrid",
        "phone": "+34912345678",
        "email": "madrid@smileup.com",
        "timezone": "Europe/Madrid",
        "created_at": "2024-01-01T00:00:00.000Z"
      },
      {
        "id": "660f9511-f30c-52e5-b827-557766551111",
        "name": "SmileUp Barcelona",
        "address": "Passeig de Gracia 45, 08007 Barcelona",
        "phone": "+34934567890",
        "email": "barcelona@smileup.com",
        "timezone": "Europe/Madrid",
        "created_at": "2024-01-15T00:00:00.000Z"
      },
      {
        "id": "770a0622-g41d-63f6-c938-668877662222",
        "name": "SmileUp Valencia",
        "address": "Calle Colon 78, 46004 Valencia",
        "phone": "+34961234567",
        "email": "valencia@smileup.com",
        "timezone": "Europe/Madrid",
        "created_at": "2024-02-01T00:00:00.000Z"
      }
    ]
  },
  "meta": {
    "page": 1,
    "limit": 25,
    "total": 3,
    "total_pages": 1,
    "has_more": false
  },
  "request_id": "req_abc123xyz",
  "timestamp": "2024-01-15T10:30:00.000Z"
}
```

## Use Cases

### Build a Clinic Selector

Create a dropdown to filter data by clinic:

```javascript theme={null}
async function getClinicOptions(apiKey) {
  const response = await fetch('https://api.getdoppel.ai/api/v1/clinics', {
    headers: { 'Authorization': `Bearer ${apiKey}` }
  });
  const { data } = await response.json();

  return data.clinics.map(clinic => ({
    value: clinic.id,
    label: clinic.name
  }));
}

// Usage in a React component
function ClinicSelector({ apiKey, onSelect }) {
  const [options, setOptions] = useState([]);

  useEffect(() => {
    getClinicOptions(apiKey).then(setOptions);
  }, [apiKey]);

  return (
    <select onChange={(e) => onSelect(e.target.value)}>
      <option value="">All Clinics</option>
      {options.map(opt => (
        <option key={opt.value} value={opt.value}>
          {opt.label}
        </option>
      ))}
    </select>
  );
}
```

### Get Clinic by ID

Find a specific clinic from the list:

```python theme={null}
import requests

def get_clinic_by_id(api_key, clinic_id):
    response = requests.get(
        'https://api.getdoppel.ai/api/v1/clinics',
        headers={'Authorization': f'Bearer {api_key}'}
    )
    clinics = response.json()['data']['clinics']
    return next(
        (c for c in clinics if c['id'] == clinic_id),
        None
    )

# Usage
clinic = get_clinic_by_id(
    'dpl_live_YOUR_API_KEY',
    '550e8400-e29b-41d4-a716-446655440000'
)
if clinic:
    print(f"Found clinic: {clinic['name']}")
```

### Create a Clinic Summary Report

```python theme={null}
import requests

def generate_clinic_summary(api_key):
    # Get all clinics
    clinics_response = requests.get(
        'https://api.getdoppel.ai/api/v1/clinics',
        headers={'Authorization': f'Bearer {api_key}'}
    )
    clinics = clinics_response.json()['data']['clinics']

    summary = []
    for clinic in clinics:
        # Get metrics for each clinic
        metrics_response = requests.get(
            'https://api.getdoppel.ai/api/v1/metrics/summary',
            params={'clinic_id': clinic['id']},
            headers={'Authorization': f'Bearer {api_key}'}
        )
        metrics = metrics_response.json()['data']

        summary.append({
            'clinic_name': clinic['name'],
            'total_interactions': metrics['total_interactions'],
            'appointments_scheduled': metrics['appointments_scheduled'],
            'success_rate': metrics['success_rate']
        })

    return summary

# Usage
report = generate_clinic_summary('dpl_live_YOUR_API_KEY')
for clinic in report:
    print(f"{clinic['clinic_name']}: {clinic['appointments_scheduled']} appointments ({clinic['success_rate']}% success)")
```

## API Key Restrictions

<Info>
  If your API key is restricted to specific clinics, only those clinics will appear in the response. Contact your account manager to modify clinic access.
</Info>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="List Interactions" icon="phone" href="/api-reference/interactions/list-interactions">
    Filter interactions by clinic.
  </Card>

  <Card title="Metrics Summary" icon="chart-line" href="/api-reference/metrics/summary">
    Get metrics for specific clinics.
  </Card>
</CardGroup>
