Reporting API
Two endpoints powering the Pipeline → Reporting dashboard. Both require auth + workspace context. Both degrade gracefully. Summary returns zero values on error, and recent-reasoning returns synthetic entries when Supabase isn’t configured or the real log is empty.
Summary
GET /api/v1/reporting/summary
Authorization: Bearer <token>Returns the workspace’s current KPI snapshot. Cached per-workspace for 30 seconds. Cache invalidates automatically on Customer / Opportunity / Touchpoint mutations.
{
"activeSignals": 14,
"pipelineArr": 420000,
"openTasks": 12,
"avgConfidence": 78,
"signalsLast24h": 204,
"signalsPrev24h": 187,
"signalsHourly": [3, 5, 8, 12, 9, 7, 11, 14, 18, 22, 19, 15, 21, 24, 20, 17, 19, 16, 13, 10, 8, 6, 4, 2],
"arrTargetCents": 5000000,
"criticalCount": 3,
"criticalCapacity": 8,
"agentsTotal": 4,
"agentsHealthy": 4,
"uptimePct": 99.94,
"confidencePptDelta": 1.2
}Field reference
| Field | Units | Source |
|---|---|---|
activeSignals | count | Customer nodes with signal_type in last 7 days |
pipelineArr | integer (your base currency, no cents) | Sum of amount / arr / estimatedValue on open Opportunities |
openTasks | count | Open Opportunity nodes (stage not won/lost/closed) |
avgConfidence | 0–100 | Mean of waypath_confidence / icp_match_score; falls back to relationship confidence |
signalsLast24h · signalsPrev24h | count | Touchpoint events in [now-24h, now) and [now-48h, now-24h) |
signalsHourly | 24 × count | Oldest → newest; hourly buckets of the last 24h |
arrTargetCents | cents | Default $50,000 until a workspace-configurable setting ships |
criticalCount · criticalCapacity | count / capacity | hyper_signal or signal_strength >= 0.75; capacity = 8 |
agentsHealthy / agentsTotal | count | Buddy registry (4 specialists). All healthy in v1 |
uptimePct | 0–100 | Workspace-level proxy until real ingest telemetry feeds this |
confidencePptDelta | ppt | Synthesized delta from current avgConfidence |
On error the endpoint returns a zero-filled response rather than 500.
Recent reasoning
GET /api/v1/reporting/recent-reasoning?limit=25
Authorization: Bearer <token>Returns the most recent assistant turns across all buddies in the
workspace. limit is clamped to 1–100 (default 25).
{
"entries": [
{
"id": "msg_abc",
"sessionId": "sess_xyz",
"ts": 1729612340000,
"buddyId": "insights",
"text": "Detected hyper-signal on Acme Corp. New VP Marketing hired + Series B closed + competitor tool adopted"
}
]
}Entries are ordered oldest-first (newest at the bottom, so the UI can give the last entry a blinking cursor).
Synthetic fallback
When Supabase isn’t configured or the real agent_messages table is
empty for this workspace, the endpoint builds synthetic entries from:
Recommendationnodes (tagged Insights or Campaign based on type)Customernodes withhyper_signal_text(tagged Prospect)- Recent
Touchpointnodes within the last 6 hours (tagged Insights)
This keeps a fresh demo workspace’s Reporting surface populated without manual seeding. When real chat history lands, it takes over automatically.
Content truncation
Each entry’s text is truncated server-side to 240 chars with an
ellipsis. Unknown buddy_id values default to insights.