API & MCP
Everything a person can do on Bill Detective, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://billdetective.usefulweb.site/api/v1/calculate– run Bill DetectiveGET https://billdetective.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Bill Detective
Enter several billing periods of an electricity, gas, water or data bill. Bill Detective normalises consumption per day, flags unusual periods (outliers), unit-price and standing-charge changes, and totals that do not add up, each with a plain-English explanation.
| Field | Type | Default | Description |
|---|---|---|---|
unit | select (kWh, m3, liters, GB) | "kWh" | Consumption unit |
currency | text | "EUR" | Currency |
changeThresholdPercent | number | 25 | Flag per-day change vs. previous period above |
outlierPercent | number | 30 | Flag periods above median by more than |
tolerancePercent | number | 1 | Arithmetic tolerance. Billed total may differ from consumption × unit price + charges by this much (rounding, taxes included in prices) before it is flagged. |
periods (required) | table | — | Billing periods. Start and end dates are both counted as billing days. Fixed charge = total standing/base charge for the period. Leave Total billed empty to skip the arithmetic check for a row. |
Example request
Monthly electricity with a May spike and a spring price rise
curl -X POST https://billdetective.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"unit":"kWh","currency":"EUR","periods":[{"label":"Jan","startDate":"2026-01-01","endDate":"2026-01-31","consumption":310,"unitPrice":0.32,"fixedCharge":12,"totalBilled":111.2},{"label":"Feb","startDate":"2026-02-01","endDate":"2026-02-28","consumption":280,"unitPrice":0.32,"fixedCharge":12,"totalBilled":101.6},{"label":"Mar","startDate":"2026-03-01","endDate":"2026-03-31","consumption":300,"unitPrice":0.32,"fixedCharge":12,"totalBilled":108},{"label":"Apr","startDate":"2026-04-01","endDate":"2026-04-30","consumption":290,"unitPrice":0.35,"fixedCharge":12,"totalBilled":113.5},{"label":"May","startDate":"2026-05-01","endDate":"2026-05-31","consumption":520,"unitPrice":0.35,"fixedCharge":14,"totalBilled":198},{"label":"Jun","startDate":"2026-06-01","endDate":"2026-06-30","consumption":295,"unitPrice":0.35,"fixedCharge":14,"totalBilled":117.25}]}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://billdetective.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
bill_detective - Local stdio connector:
node src/mcp-stdio.ts --tool=bill-detective
{
"mcpServers": {
"bill-detective": { "type": "http", "url": "https://billdetective.usefulweb.site/mcp" }
}
}