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

# Outcome Breakdown

> Get detailed breakdown of interaction outcomes

# Outcome Breakdown

Returns a detailed breakdown of interaction outcomes, showing how many interactions resulted in each outcome type. Use this to understand your conversion rates and identify opportunities for improvement.

## Request

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

### Headers

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

### Query Parameters

| Parameter   | Type   | Default     | Description                              |
| ----------- | ------ | ----------- | ---------------------------------------- |
| `date_from` | string | 30 days ago | Start date (ISO 8601)                    |
| `date_to`   | string | Today       | End date (ISO 8601)                      |
| `clinic_id` | string | -           | Filter by clinic UUID                    |
| `channel`   | string | -           | Filter by channel: `voice` or `whatsapp` |
| `type`      | string | -           | Filter by interaction type               |

## Response

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

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="outcomes" type="array">
      Array of outcome objects with counts and percentages
    </ResponseField>

    <ResponseField name="total" type="integer">
      Total interactions included in breakdown
    </ResponseField>
  </Expandable>
</ResponseField>

### Outcome Object

| Field        | Type    | Description                              |
| ------------ | ------- | ---------------------------------------- |
| `outcome`    | string  | Outcome identifier                       |
| `label`      | string  | Human-readable outcome name              |
| `count`      | integer | Number of interactions with this outcome |
| `percentage` | number  | Percentage of total (0-100)              |

## Common Outcomes

<Info>
  Outcome values are **UPPERCASE**. Use these exact values when filtering interactions.
</Info>

| Outcome                 | Description                          |
| ----------------------- | ------------------------------------ |
| `APPOINTMENT_BOOKED`    | New appointment was scheduled        |
| `APPOINTMENT_MODIFIED`  | Existing appointment was rescheduled |
| `APPOINTMENT_CANCELLED` | Appointment was cancelled            |
| `NO_ANSWER`             | Call was not answered                |
| `VOICEMAIL_REACHED`     | Call went to voicemail               |
| `CALLBACK_REQUESTED`    | Patient requested a callback         |
| `DECISION_PENDING`      | Patient needs more time to decide    |
| `OPT_OUT`               | Patient opted out of communications  |
| `UNREACHABLE`           | Unable to reach patient              |

## Examples

### Basic Request

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

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.getdoppel.ai/api/v1/metrics/outcomes', {
    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/metrics/outcomes',
      headers={'Authorization': 'Bearer dpl_live_YOUR_API_KEY'}
  )
  data = response.json()
  ```
</CodeGroup>

### Filter by Channel

Get outcome breakdown for voice calls only:

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

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.getdoppel.ai/api/v1/metrics/outcomes?channel=voice',
    {
      headers: {
        'Authorization': 'Bearer dpl_live_YOUR_API_KEY'
      }
    }
  );
  ```

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

  response = requests.get(
      'https://api.getdoppel.ai/api/v1/metrics/outcomes',
      params={'channel': 'voice'},
      headers={'Authorization': 'Bearer dpl_live_YOUR_API_KEY'}
  )
  ```
</CodeGroup>

### Filter by Interaction Type

Get outcomes for campaign outbound calls:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.getdoppel.ai/api/v1/metrics/outcomes?channel=voice&type=CAMPAIGN_OUTBOUND" \
    -H "Authorization: Bearer dpl_live_YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.getdoppel.ai/api/v1/metrics/outcomes?channel=voice&type=CAMPAIGN_OUTBOUND',
    {
      headers: {
        'Authorization': 'Bearer dpl_live_YOUR_API_KEY'
      }
    }
  );
  ```

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

  response = requests.get(
      'https://api.getdoppel.ai/api/v1/metrics/outcomes',
      params={
          'channel': 'voice',
          'type': 'CAMPAIGN_OUTBOUND'
      },
      headers={'Authorization': 'Bearer dpl_live_YOUR_API_KEY'}
  )
  ```
</CodeGroup>

### Response Example

```json theme={null}
{
  "success": true,
  "data": {
    "outcomes": [
      {
        "outcome": "APPOINTMENT_BOOKED",
        "label": "Appointment Booked",
        "count": 320,
        "percentage": 25.6
      },
      {
        "outcome": "NO_ANSWER",
        "label": "No Answer",
        "count": 280,
        "percentage": 22.4
      },
      {
        "outcome": "APPOINTMENT_MODIFIED",
        "label": "Appointment Modified",
        "count": 200,
        "percentage": 16.0
      },
      {
        "outcome": "VOICEMAIL_REACHED",
        "label": "Voicemail Reached",
        "count": 150,
        "percentage": 12.0
      },
      {
        "outcome": "CALLBACK_REQUESTED",
        "label": "Callback Requested",
        "count": 100,
        "percentage": 8.0
      },
      {
        "outcome": "DECISION_PENDING",
        "label": "Decision Pending",
        "count": 80,
        "percentage": 6.4
      },
      {
        "outcome": "OPT_OUT",
        "label": "Opt Out",
        "count": 70,
        "percentage": 5.6
      },
      {
        "outcome": "UNREACHABLE",
        "label": "Unreachable",
        "count": 50,
        "percentage": 4.0
      }
    ],
    "total": 1250
  },
  "request_id": "req_abc123xyz",
  "timestamp": "2024-01-15T10:30:00.000Z"
}
```

## Use Cases

### Conversion Funnel Analysis

Calculate conversion rates from your outcomes:

```javascript theme={null}
async function getConversionMetrics(apiKey, dateFrom, dateTo) {
  const response = await fetch(
    `https://api.getdoppel.ai/api/v1/metrics/outcomes?date_from=${dateFrom}&date_to=${dateTo}`,
    {
      headers: { 'Authorization': `Bearer ${apiKey}` }
    }
  );
  const { data } = await response.json();

  const outcomes = Object.fromEntries(
    data.outcomes.map(o => [o.outcome, o.count])
  );

  const contacted = data.total - (outcomes.NO_ANSWER || 0) - (outcomes.VOICEMAIL_REACHED || 0);
  const converted = outcomes.APPOINTMENT_BOOKED || 0;

  return {
    totalAttempts: data.total,
    contactRate: ((contacted / data.total) * 100).toFixed(1),
    conversionRate: ((converted / data.total) * 100).toFixed(1),
    contactToConversion: ((converted / contacted) * 100).toFixed(1)
  };
}
```

### Compare Channels

Compare outcome performance between voice and WhatsApp:

```python theme={null}
import requests

def compare_channel_outcomes(api_key):
    channels = ['voice', 'whatsapp']
    results = {}

    for channel in channels:
        response = requests.get(
            'https://api.getdoppel.ai/api/v1/metrics/outcomes',
            params={'channel': channel},
            headers={'Authorization': f'Bearer {api_key}'}
        )
        data = response.json()['data']

        # Find APPOINTMENT_BOOKED outcome
        scheduled = next(
            (o for o in data['outcomes'] if o['outcome'] == 'APPOINTMENT_BOOKED'),
            {'percentage': 0}
        )
        results[channel] = {
            'total': data['total'],
            'conversion_rate': scheduled['percentage']
        }

    return results

# Usage
comparison = compare_channel_outcomes('dpl_live_YOUR_API_KEY')
print(f"Voice conversion: {comparison['voice']['conversion_rate']}%")
print(f"WhatsApp conversion: {comparison['whatsapp']['conversion_rate']}%")
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Metrics Summary" icon="chart-line" href="/api-reference/metrics/summary">
    Get high-level KPIs and totals.
  </Card>

  <Card title="Daily Metrics" icon="calendar" href="/api-reference/metrics/daily">
    Track outcomes over time with daily data.
  </Card>
</CardGroup>
