BrightshoalDocsOpen console
MenuCall analytics

API reference

Call analytics

Call volume and latency over a time range, per project or assistant.

Get call latency

GET/api/analytics/latency

End-to-end response latency (p50 and p95, in milliseconds) and per-stage percentiles over the window, with the slowest calls. Percentiles are null when there are no measured calls. The body is not wrapped in data.

Secret API key. How it works

Query parameters

  • project_idstring

    Only this project's calls (an org-wide key covers every project by default).

  • assistant_idarray of string

    Only these assistants' calls. Repeat the parameter or comma-separate the values; a row matching any of them is kept.

  • fromstringISO 8601 timestamp

    Start of the window, ISO 8601 with an offset. Default: 30 days before to.

  • tostringISO 8601 timestamp

    End of the window. Default: now.

Returns

200 OK

Response attributes
  • e2eAnalyticsPercentilesrequired

    2 attributes
    • p50number | nullrequired

    • p95number | nullrequired

  • stagesarray of objectrequired

    3 attributes
    • p50number | nullrequired

    • p95number | nullrequired

    • stagestringrequired

  • slowestarray of objectrequiredup to 10 items

    4 attributes
    • call_idstringrequired

    • e2e_p95numberrequired

    • assistant_idstringrequired

    • started_atstring | nullrequiredISO 8601 timestamp

  • 400 invalid_range: from or to is not a valid timestamp, or from is not before to
  • 401 Missing, malformed, unknown or revoked API key (unauthorized)
  • 403 Refused, for example a read-only key on a write (read_only_key), a role too low for the route (insufficient_role), or a route that needs a console session
  • 429 Rate limit exceeded (rate_limited). Wait Retry-After seconds. Budgets are per 60-second window: developer API 120 per key and 600 per organization; public chat 30 per IP address, except polling for updates (60 per conversation and IP address) and analytics events (120 per IP address).
GET /api/analytics/latency
curl "https://api.myleadsfactory.tech/api/analytics/latency" \
  -H "Authorization: Bearer $MLF_API_KEY"
Response 200
{
  "e2e": {
    "p50": 1,
    "p95": 1
  },
  "stages": [
    {
      "p50": 1,
      "p95": 1,
      "stage": "string"
    }
  ],
  "slowest": [
    {
      "call_id": "call_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
      "e2e_p95": 1,
      "assistant_id": "asst_5f0c2a9e7b1d4c3e8a6f0b2d4c6e8a1f",
      "started_at": "2026-10-28T09:30:00.000Z"
    }
  ]
}

Get call volume

GET/api/analytics/volume

Call counts and minutes over the window: totals, by status, by call type, by why calls ended, and per day. The window defaults to the last 30 days. The body is not wrapped in data.

Secret API key. How it works

Query parameters

  • project_idstring

    Only this project's calls (an org-wide key covers every project by default).

  • assistant_idarray of string

    Only these assistants' calls. Repeat the parameter or comma-separate the values; a row matching any of them is kept.

  • fromstringISO 8601 timestamp

    Start of the window, ISO 8601 with an offset. Default: 30 days before to.

  • tostringISO 8601 timestamp

    End of the window. Default: now.

Returns

200 OK

Response attributes
  • total_callsintegerrequired

  • total_minutesnumberrequired

  • completedintegerrequired

  • failedintegerrequired

  • by_statusarray of objectrequired

    2 attributes
    • countintegerrequired

    • statusstringrequired

  • by_call_typearray of objectrequired

    2 attributes
    • countintegerrequired

    • call_typestringrequired

  • by_canonical_ended_reasonarray of objectrequired

    2 attributes
    • countintegerrequired

    • ended_reasonstringrequired

  • dailyarray of objectrequired

    3 attributes
    • datestringrequireddate

    • callsintegerrequired

    • minutesnumberrequired

  • 400 invalid_range: from or to is not a valid timestamp, or from is not before to
  • 401 Missing, malformed, unknown or revoked API key (unauthorized)
  • 403 Refused, for example a read-only key on a write (read_only_key), a role too low for the route (insufficient_role), or a route that needs a console session
  • 429 Rate limit exceeded (rate_limited). Wait Retry-After seconds. Budgets are per 60-second window: developer API 120 per key and 600 per organization; public chat 30 per IP address, except polling for updates (60 per conversation and IP address) and analytics events (120 per IP address).
GET /api/analytics/volume
curl "https://api.myleadsfactory.tech/api/analytics/volume" \
  -H "Authorization: Bearer $MLF_API_KEY"
Response 200
{
  "total_calls": 1,
  "total_minutes": 1,
  "completed": 1,
  "failed": 1,
  "by_status": [
    {
      "count": 1,
      "status": "string"
    }
  ],
  "by_call_type": [
    {
      "count": 1,
      "call_type": "string"
    }
  ],
  "by_canonical_ended_reason": [
    {
      "count": 1,
      "ended_reason": "string"
    }
  ],
  "daily": [
    {
      "date": "2026-10-28",
      "calls": 1,
      "minutes": 1
    }
  ]
}