Skip to content

Unit Economics: Track Cost Per Business Metric

Unit economics lets you answer questions like “How much does it cost to serve one customer?” or “What’s our cost per API call this month?” Instead of looking at raw cloud spend, you track cost relative to business output.

Raw cloud cost going up isn’t necessarily bad — it might mean your business is growing. What matters is whether your cost per unit is stable, improving, or degrading.

ScenarioRaw CostCustomersCost/CustomerVerdict
January$8,000200$40Baseline
February$12,000350$34Improving
March$15,000360$42Degrading

In this example, March’s cost increase is a real problem — you’re spending more per customer. February’s increase was healthy growth.

TypeDescriptionExample
api_callsAPI request volume2.4M calls/day
transactionsBusiness transactions50K orders/day
customersActive customer count1,200 active
requestsHTTP requests served10M requests/day
customAny numeric metricDeployments, builds, etc.
  1. You send unit data — Push your business metrics to Xplorr via API (daily values).
  2. Xplorr matches with cost — Each day’s unit count is joined with that day’s total cloud cost.
  3. Cost per unit is calculateddaily_cost / unit_count = cost_per_unit.
  4. Trends are tracked — Xplorr compares the first half vs. second half of any period to detect whether cost-per-unit is increasing, decreasing, or stable.

Push unit data via the REST API. You’ll typically run this from a cron job, CI pipeline, or data pipeline.

Terminal window
# Push today's customer count
curl -X POST "https://api.xplorr.io/api/v1/unit-economics/metrics" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Active Customers",
"metric_type": "customers",
"value": 1247,
"date": "2026-03-21"
}'
// Node.js example — push daily from a scheduled job
const response = await fetch('https://api.xplorr.io/api/v1/unit-economics/metrics', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.XPLORR_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'API Calls',
metric_type: 'api_calls',
value: 2_400_000,
date: new Date().toISOString().split('T')[0],
}),
});
# Python example
import requests
from datetime import date
requests.post(
"https://api.xplorr.io/api/v1/unit-economics/metrics",
headers={"Authorization": f"Bearer {token}"},
json={
"name": "Transactions",
"metric_type": "transactions",
"value": 48500,
"date": str(date.today()),
},
)

Upsert behavior: If you push the same (name, date) combination twice, the second value replaces the first. This makes retries safe.

Rate limit: 30 requests per minute.

Terminal window
# Get cost per unit for the last 30 days
curl -H "Authorization: Bearer $TOKEN" \
"https://api.xplorr.io/api/v1/unit-economics?metricName=Active%20Customers"
# Custom date range
curl -H "Authorization: Bearer $TOKEN" \
"https://api.xplorr.io/api/v1/unit-economics?metricName=API%20Calls&startDate=2026-02-01&endDate=2026-03-01"

Response:

[
{
"date": "2026-03-20",
"metric_name": "Active Customers",
"metric_type": "customers",
"unit_count": 1247,
"daily_cost": 412.50,
"cost_per_unit": 0.33,
"currency": "USD"
}
]

Check whether cost-per-unit is improving or degrading:

Terminal window
curl -H "Authorization: Bearer $TOKEN" \
"https://api.xplorr.io/api/v1/unit-economics/trend?metricName=Active%20Customers&period=30"

Response:

{
"trend": {
"direction": "decreasing",
"percentChange": -8.2,
"avgCostPerUnit": 0.31
}
}
DirectionMeaning
decreasingCost per unit is improving (good)
increasingCost per unit is degrading (investigate)
insufficient_dataNot enough data points to determine trend

The trend compares the average cost-per-unit in the first half of the period against the second half.

Unit economics data is also accessible via:

  • MCP Server — Use the get_cost_summary tool and correlate with your own metrics.
  • Slack Bot — Ask questions like “What’s my cost per customer this month?” (if you’ve ingested customer metrics).
  • Push daily — Unit economics works best with daily granularity. A daily cron job is the simplest approach.
  • Pick 2-3 metrics — Don’t track everything. Pick the metrics that matter most to your business: customers, API calls, or transactions.
  • Automate ingestion — Pull from your application database, analytics platform, or Stripe/billing system. Don’t rely on manual entry.
  • Review weekly — Check the trend endpoint weekly. A gradual increase in cost-per-unit is easy to miss if you only look at raw spend.
  • Correlate with anomalies — If cost-per-unit spikes, check the anomaly detection page to see if a specific service is the cause.