Analytics
Track call volume, platform-minute usage, carrier spend, sentiment distribution, and agent performance metrics.
Spend Overview
GET/v1/analytics/spend
Returns aggregated metrics across calls for the authenticated tenant. Filter by date range, agent, or call status.
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
from | string | No | None | Inclusive start date in YYYY-MM-DD format. When omitted, no start bound is applied and all calls are aggregated (the time_series window still defaults to 30 days ago). |
to | string | No | None | Inclusive end date in YYYY-MM-DD format. When omitted, no end bound is applied and all calls are aggregated (the time_series window still defaults to today). |
agent_id | uuid | No | All agents | Restrict metrics to a specific agent |
status | string | No | All statuses | Filter by call status: completed, failed, in_progress |
Example Request
bash
curl "https://api.rymi.live/v1/analytics/spend?from=2026-03-01&to=2026-03-31&agent_id=550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer YOUR_API_KEY"Response 200
json
{
"total_calls": 140,
"completed_calls": 120,
"in_progress_calls": 2,
"average_duration_seconds": 187,
"success_rate": 0.72,
"total_minutes": 1450,
"customer_revenue": 58.0,
"provider_cost": 46.5,
"gross_margin": 11.5,
"gross_margin_pct": 19.83,
"time_series": [
{
"date": "2026-03-01",
"calls": 8,
"minutes": 34,
"customer_revenue": 2.4,
"provider_cost": 1.9,
"gross_margin": 0.5
}
],
"status_distribution": {
"completed": 120,
"failed": 18,
"in_progress": 2
},
"sentiment_distribution": {
"positive": 40,
"neutral": 61,
"negative": 8,
"unknown": 31
},
"end_reason_distribution": {
"caller_hangup": 72,
"agent_ended": 40,
"error": 8
},
"agent_performance": [
{
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"calls": 90,
"minutes": 740.5,
"customer_revenue": 31.2,
"provider_cost": 25.1,
"gross_margin": 6.1,
"evaluated_calls": 64,
"passed_calls": 46,
"success_rate": 0.719,
"sentiment": { "positive": 30, "neutral": 48, "negative": 6, "unknown": 6 },
"sentiment_score": 0.286
}
],
"drop_off_points": [
{ "bucket": "<30s", "count": 3 },
{ "bucket": "30-60s", "count": 7 },
{ "bucket": "60-120s", "count": 25 },
{ "bucket": ">120s", "count": 45 }
],
"filters": {
"from": "2026-03-01",
"to": "2026-03-31",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"status": null
}
}Response Fields
| Field | Type | Description |
|---|---|---|
total_calls | integer | Total call count matching the filters |
completed_calls | integer | Calls that completed successfully |
in_progress_calls | integer | Calls currently active |
average_duration_seconds | integer | Average call duration in seconds |
success_rate | number | Ratio of evaluated calls that passed their evaluation (0.0–1.0) |
total_minutes | number | Total billed minutes across completed calls |
customer_revenue | number | Total customer-billed revenue in USD across completed calls |
provider_cost | number | Total underlying provider cost in USD across completed calls |
gross_margin | number | customer_revenue − provider_cost in USD |
gross_margin_pct | number | null | Gross margin as a percentage of revenue; null when revenue is 0 |
time_series | array | Daily breakdown: { date, calls, minutes, customer_revenue, provider_cost, gross_margin } |
status_distribution | object | Call count grouped by final status |
sentiment_distribution | object | Call count grouped by post-call sentiment (positive, neutral, negative, unknown) |
end_reason_distribution | object | Call count grouped by why the call ended (e.g. caller_hangup, agent_ended) |
agent_performance | array | Per-agent breakdown: { agent_id, calls, minutes, customer_revenue, provider_cost, gross_margin, evaluated_calls, passed_calls, success_rate, sentiment, sentiment_score } |
drop_off_points | array | Duration histogram of non-passing calls, bucketed <30s, 30-60s, 60-120s, >120s |
filters | object | Echo of applied filters |
Errors
| Status | Meaning |
|---|---|
401 | Missing or invalid API key |
500 | Server error while querying analytics |
INFO
Analytics data is aggregated from call records plus post-call intelligence. Real-time minute counts may be supplemented from live usage tracking when available.
Cost Scope
provider_cost (and the derived gross_margin/gross_margin_pct) are aggregated from each completed call's recorded provider_cost. For self-serve BYOC, this reflects carrier spend only when the connected provider reports costs and the gateway persists them. LLM/STT/TTS provider token-level cost metering is on the roadmap.

