MetricTree Public API
Free product-metric calculations as JSON. 22 metrics. No signup, no API key, CORS open. Built for developers.
Quickstart
Calculate LTV via GET:
curl "https://metricstree.vercel.app/api/calc?metric=ltv&aov=2500&freq=4&life=3"
Response:
{
"metric": "ltv",
"inputs": { "aov": 2500, "freq": 4, "life": 3 },
"formula": "AOV × Frequency × Lifetime",
"result": 30000,
"unit": "$",
"insight": "LTV target ≥ 3× CAC for healthy unit economics",
"rating": "high",
"calculator_url": "https://metricstree.vercel.app/ltv",
"docs_url": "https://metricstree.vercel.app/api-docs"
}
Try it now
Edit URL and hit Calculate:
POST with JSON body
curl -X POST "https://metricstree.vercel.app/api/calc" \
-H "Content-Type: application/json" \
-d '{"metric":"nrr","inputs":{"start":1000000,"expansion":200000,"churn":50000,"contraction":10000}}'
Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/calc | GET, POST | Calculate any supported metric |
/api/lead | POST | (Internal — used by MetricTree forms only) |
Supported metrics (22)
| metric | Required inputs | Returns (unit) |
|---|---|---|
ltv | aov, freq, life | Lifetime Value ($) |
cac | spend, customers | CAC ($) |
ltv_cac | ltv, cac | LTV:CAC ratio (x) |
mrr | mrr | MRR ($) |
arr | mrr | ARR = MRR×12 ($) |
nrr | start, expansion, churn, contraction | NRR (%) |
grr | start, churn, contraction | GRR (%) |
churn | lost, total | Churn Rate (%) |
runway | cash, burn | Runway (months) |
burnMultiple | burn, newArr | Burn Multiple (x) |
ruleOf40 | growth, margin | Rule of 40 (%) |
quickRatio | newMrr, expansionMrr, churnMrr, contractionMrr | Quick Ratio (x) |
magicNumber | newArrQuarter, sm | Magic Number (x) |
nps | promoters, detractors, total | NPS (score) |
cacPayback | cac, mrrPerCustomer, grossMargin | CAC Payback (months) |
roas | revenue, spend | ROAS (x) |
stickiness | dau, mau | Stickiness (%) |
salesVelocity | opps, acv, winRate, cycleDays | $/day |
winRate | won, total | Win Rate (%) |
pipelineCoverage | pipeline, quota | Coverage (x) |
aov | revenue, orders | AOV ($) |
mrrGrowthRate | startMrr, endMrr | MoM growth (%) |
JavaScript example
// Calculate LTV:CAC from browser
const r = await fetch('https://metricstree.vercel.app/api/calc?metric=ltv_cac<v=15000&cac=3000');
const data = await r.json();
console.log(data.result); // 5
console.log(data.insight); // "Excellent (or under-investing in growth)"
console.log(data.rating); // "excellent"
Python example
import requests
r = requests.get('https://metricstree.vercel.app/api/calc', params={
'metric': 'runway', 'cash': 5000000, 'burn': 300000
})
print(r.json())
# { "result": 16.67, "unit": "months", "rating": "healthy", ... }
Response format
| Field | Type | Description |
|---|---|---|
metric | string | Echo of the requested metric |
inputs | object | Echo of provided inputs |
formula | string | Plain-English formula |
result | number | "Infinity" | Calculated value (rounded to 2 decimals) |
unit | string | "$" / "%" / "x" / "months" / etc |
insight | string | Plain-English interpretation + benchmark |
rating | string | Categorical: "healthy" / "critical" / "excellent" / etc |
calculator_url | string | Link to interactive calculator on MetricTree |
Errors
| Status | Meaning |
|---|---|
400 | Missing required inputs / invalid JSON body |
404 | Unknown metric |
405 | Method not allowed (use GET, POST, or OPTIONS) |
422 | Inputs valid but calculation undefined (e.g., divide by zero) |
Rate limiting
Soft limit ~60 requests/minute per IP (Edge runtime default). No hard limit, no API key required. Be reasonable.
If you need higher throughput or SLA guarantees — get in touch (rodion.121093@gmail.com). The future Pro tier will include higher limits + sub-50ms guaranteed latency.
CORS
Access-Control-Allow-Origin: * — open to all origins. Use directly from browser apps.
Caching
Cache-Control: public, max-age=300 — responses cacheable 5 minutes (calculations are deterministic by inputs).
Want a metric we don't support?
Open an issue on GitHub or email — we'll add it within 48 hours if it's a standard product metric.
License
MIT — use commercially, modify, redistribute. Attribution appreciated but not required.
Use cases
- Internal dashboards — embed metric calculations in your team's Notion/Confluence
- SaaS-blog automation — auto-update benchmark tables in posts
- Slack/Discord bots — slash-command to compute metric (just like our Telegram bot)
- Zapier/Make automations — feed metric calculations into your CRM / spreadsheet
- Learning — verify your hand-calculation against canonical formula