Skip to main content
GET
https://api.getdoppel.ai/api/v1
/
api
/
v1
/
metrics
/
daily
Daily Metrics
curl --request GET \
  --url https://api.getdoppel.ai/api/v1/api/v1/metrics/daily \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "data": {
    "daily": [
      {}
    ]
  }
}

Daily Metrics

Returns daily time series data for your interactions. Use this endpoint to build trend charts, identify patterns, and track performance over time.

Request

GET https://api.getdoppel.ai/api/v1/metrics/daily

Headers

HeaderRequiredDescription
AuthorizationYesBearer token with your API key

Query Parameters

ParameterTypeDefaultDescription
date_fromstring30 days agoStart date (ISO 8601)
date_tostringTodayEnd date (ISO 8601)
clinic_idstring-Filter by clinic UUID
channelstring-Filter by channel: voice or whatsapp
typestring-Filter by interaction type

Response

success
boolean
Whether the request was successful
data
object

Daily Object

FieldTypeDescription
datestringDate (YYYY-MM-DD)
totalintegerTotal interactions
callsintegerVoice calls
conversationsintegerWhatsApp conversations
inboundintegerInbound interactions
outboundintegerOutbound interactions
appointments_scheduledintegerAppointments booked
success_ratenumberSuccess rate percentage
avg_duration_secondsnumberAverage call duration

Examples

Basic Request

curl -X GET "https://api.getdoppel.ai/api/v1/metrics/daily" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Get Last 7 Days

curl -X GET "https://api.getdoppel.ai/api/v1/metrics/daily?date_from=2024-12-29&date_to=2025-01-05" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Filter by Channel

Get daily metrics for voice calls only:
curl -X GET "https://api.getdoppel.ai/api/v1/metrics/daily?channel=voice" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Response Example

{
  "success": true,
  "data": {
    "daily": [
      {
        "date": "2024-12-29",
        "total": 45,
        "calls": 30,
        "conversations": 15,
        "inbound": 20,
        "outbound": 25,
        "appointments_scheduled": 12,
        "success_rate": 71.1,
        "avg_duration_seconds": 175
      },
      {
        "date": "2024-12-30",
        "total": 52,
        "calls": 35,
        "conversations": 17,
        "inbound": 22,
        "outbound": 30,
        "appointments_scheduled": 15,
        "success_rate": 73.5,
        "avg_duration_seconds": 182
      },
      {
        "date": "2024-12-31",
        "total": 28,
        "calls": 18,
        "conversations": 10,
        "inbound": 12,
        "outbound": 16,
        "appointments_scheduled": 8,
        "success_rate": 68.2,
        "avg_duration_seconds": 165
      },
      {
        "date": "2025-01-01",
        "total": 15,
        "calls": 10,
        "conversations": 5,
        "inbound": 8,
        "outbound": 7,
        "appointments_scheduled": 4,
        "success_rate": 66.7,
        "avg_duration_seconds": 155
      },
      {
        "date": "2025-01-02",
        "total": 58,
        "calls": 40,
        "conversations": 18,
        "inbound": 25,
        "outbound": 33,
        "appointments_scheduled": 18,
        "success_rate": 75.2,
        "avg_duration_seconds": 190
      }
    ]
  },
  "request_id": "req_abc123xyz",
  "timestamp": "2025-01-05T10:30:00.000Z"
}

Use Cases

Build a Trend Chart

Use the daily data to create visualizations:
async function getChartData(apiKey, days = 30) {
  const today = new Date();
  const startDate = new Date(today);
  startDate.setDate(startDate.getDate() - days);

  const response = await fetch(
    `https://api.getdoppel.ai/api/v1/metrics/daily?date_from=${startDate.toISOString().split('T')[0]}&date_to=${today.toISOString().split('T')[0]}`,
    {
      headers: { 'Authorization': `Bearer ${apiKey}` }
    }
  );
  const { data } = await response.json();

  // Format for charting libraries (Chart.js, Recharts, etc.)
  return {
    labels: data.daily.map(d => d.date),
    datasets: [
      {
        label: 'Total Interactions',
        data: data.daily.map(d => d.total)
      },
      {
        label: 'Appointments Scheduled',
        data: data.daily.map(d => d.appointments_scheduled)
      }
    ]
  };
}

Calculate Week-over-Week Growth

import requests
from datetime import datetime, timedelta

def calculate_wow_growth(api_key):
    today = datetime.now()

    # This week
    this_week_end = today
    this_week_start = today - timedelta(days=7)

    # Last week
    last_week_end = this_week_start
    last_week_start = last_week_end - timedelta(days=7)

    def get_week_total(start, end):
        response = requests.get(
            'https://api.getdoppel.ai/api/v1/metrics/daily',
            params={
                'date_from': start.strftime('%Y-%m-%d'),
                'date_to': end.strftime('%Y-%m-%d')
            },
            headers={'Authorization': f'Bearer {api_key}'}
        )
        daily = response.json()['data']['daily']
        return sum(d['total'] for d in daily)

    this_week = get_week_total(this_week_start, this_week_end)
    last_week = get_week_total(last_week_start, last_week_end)

    if last_week > 0:
        growth = ((this_week - last_week) / last_week) * 100
    else:
        growth = 0

    return {
        'this_week': this_week,
        'last_week': last_week,
        'growth_percentage': round(growth, 1)
    }

# Usage
growth = calculate_wow_growth('dpl_live_YOUR_API_KEY')
print(f"Week-over-week growth: {growth['growth_percentage']}%")

Identify Busy Days

Find your busiest days of the week:
async function analyzeDayPatterns(apiKey) {
  const today = new Date();
  const startDate = new Date(today);
  startDate.setDate(startDate.getDate() - 90); // Last 90 days

  const response = await fetch(
    `https://api.getdoppel.ai/api/v1/metrics/daily?date_from=${startDate.toISOString().split('T')[0]}&date_to=${today.toISOString().split('T')[0]}`,
    {
      headers: { 'Authorization': `Bearer ${apiKey}` }
    }
  );
  const { data } = await response.json();

  const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
  const dayTotals = new Array(7).fill(0);
  const dayCounts = new Array(7).fill(0);

  data.daily.forEach(d => {
    const dayOfWeek = new Date(d.date).getDay();
    dayTotals[dayOfWeek] += d.total;
    dayCounts[dayOfWeek]++;
  });

  const dayAverages = dayNames.map((name, i) => ({
    day: name,
    average: dayCounts[i] > 0 ? Math.round(dayTotals[i] / dayCounts[i]) : 0
  }));

  return dayAverages.sort((a, b) => b.average - a.average);
}

// Usage
const patterns = await analyzeDayPatterns('dpl_live_YOUR_API_KEY');
console.log('Busiest days:', patterns.slice(0, 3));