Analytics API
The dashboard answers what is happening right now. This answers what did we do about it — how many users we contacted, how many of those contacts landed, and how many came back saying they were saved.
Every route is scoped to one tenant. The contact history names who was contacted about cancelling, so a user id is unique per tenant and never crosses a boundary.
Authentication
Same as the dashboard: a Bearer JWT.
curl -H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-Id: $TENANT_ID" \
https://api.nochurn.dev/v1/tenants/$TENANT_ID/analytics
The X-Tenant-Id header is not optional. The JWT from Neon Auth carries no
tenant claim, and the API compares the header against the path parameter — the
header is the second half of the authorisation.
GET /v1/tenants/:tenantId/analytics
Everything in one call. The numbers cannot disagree with each other, because they come from the same query window.
curl -H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-Id: $TENANT_ID" \
"https://api.nochurn.dev/v1/tenants/$TENANT_ID/analytics?days=30"
{
"window": { "days": 30 },
"outreach": {
"total": 40,
"sent": 30,
"failed": 10,
"pending": 0,
"successRate": 75,
"uniqueUsers": 25
},
"outreachSeries": [
{ "date": "2026-11-28", "sent": 4, "failed": 1, "pending": 0 }
],
"ratings": {
"rated": 20,
"unrated": 5,
"average": 3.5,
"saved": 12,
"lost": 4,
"neutral": 4
},
"distribution": [
{ "from": 0, "to": 10, "count": 3 },
{ "from": 90, "to": 100, "count": 2 }
],
"saveRate": {
"atRiskNow": 8,
"atRiskBefore": 15,
"saved": 12,
"atRisk": 5,
"saveRate": 80
}
}
window
The window in days. Defaults to 30, clamped to 365. ?days=abc falls back to
the default rather than erroring.
outreach
| Field | What it means |
|---|---|
total | Contacts enqueued in the window |
sent | Delivered |
failed | Attempted and rejected — the integration is broken |
pending | Enqueued and not yet attempted |
successRate | Sent ÷ attempted, as a percentage. null when nothing was attempted |
uniqueUsers | Distinct users contacted |
successRate is null, not 0, when nothing was attempted. Zero percent would
read as "every contact failed", which is a different fact.
outreachSeries
One entry per day: how many were sent, how many failed, how many are still queued. The days with no activity are in the series too — a gap is a fact.
ratings
What the customer said after being contacted. The rating scale is 1 to 5:
saved— rating 4 or 5lost— rating 1 or 2neutral— rating 3
average is null when nobody has rated yet.
distribution
The score histogram: ten fixed buckets of ten points, from 0 to 100. Every bucket is present, including the empty ones.
Use it when the average hides two populations — a mean of 40 could be ten users at zero and ten at 80.
saveRate
| Field | What it means |
|---|---|
atRiskNow | Users at 60 or above today |
atRiskBefore | Users at 60 or above days ago |
saved | Crossed from at-risk to safe |
atRisk | Crossed from safe to at-risk |
saveRate | Saved ÷ at-risk-before, as a percentage. null when nobody was at risk |
:::info The save rate needs history
The current score is overwritten on every recompute, so yesterday's number only
survives in the score history the backend keeps. On a tenant that has not been
running for the whole window, atRiskBefore is 0 and saveRate is null —
there was nothing to compare, which is not the same as saving nobody.
:::
GET /v1/tenants/:tenantId/analytics/outreach
The contacts themselves.
curl -H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-Id: $TENANT_ID" \
"https://api.nochurn.dev/v1/tenants/$TENANT_ID/analytics/outreach?limit=50"
{
"summary": { "total": 40, "sent": 30, "failed": 10, "successRate": 75 },
"recent": [
{
"id": "1c7c731c-...",
"userId": "u_123",
"ruleName": "high score, no login for 14 days",
"topic": "playbook.email",
"status": "failed",
"attempts": 3,
"lastError": "smtp refused",
"createdAt": "2026-11-30T10:00:00.000Z",
"sentAt": null
}
]
}
limit defaults to 50 and is clamped to 200.
lastError is the failure reason — a broken integration shows up here, not as a
silent zero. sentAt is null while the contact is still queued.
GET /v1/tenants/:tenantId/analytics/scores
The score histogram on its own.
{ "distribution": [ { "from": 0, "to": 10, "count": 3 } ] }
The MCP server
The same numbers, for an AI assistant. The NoChurn MCP server runs over stdio and exposes these routes as tools:
| Tool | Answers |
|---|---|
list_tenants | Which tenants the token belongs to |
get_dashboard_summary | The dashboard numbers |
get_analytics | Outreach, ratings, histogram, save rate |
get_outreach | The contacts, with the rule that fired |
get_score_distribution | The histogram |
list_users | The tenant's users |
get_user_detail | One user, opened up |
Configure it with two environment variables:
{
"mcpServers": {
"nochurn": {
"command": "npx",
"args": ["-y", "nochurn-mcp"],
"env": {
"NOCHURN_TOKEN": "eyJhbG...",
"NOCHURN_TENANT_ID": "114af97f-e5fc-4d0c-a075-35c67d0aec93"
}
}
}
}
The MCP server talks to the API over HTTPS, the same way your own code would.