API Reference
Programmatic access to all Calculator Cult calculators
Base URL
/apiAll responses are JSON. CORS is enabled for all origins.
Endpoints
GET/api/categories
List all categories and subcategories with calculator counts.
GET/api/calculators
List all calculators with title, category, and availability info.
GET/api/calculators/:slug
Get a calculator's spec: inputs, outputs, content, and metadata.
POST/api/calculate/:slug
Execute a calculation. Send input values as JSON body, get results back.
Example
Calculate simple interest:
POST /api/calculate/simple-interest
Content-Type: application/json
{
"principal": 10000,
"rate": 5,
"time": 3
}
// Response:
{
"slug": "simple-interest",
"inputs": { "principal": 10000, "rate": 5, "time": 3 },
"results": { "interest": 1500, "total": 11500 }
}Error Handling
Errors return appropriate HTTP status codes with a JSON body:
- 400 — Invalid JSON body or validation errors
- 404 — Calculator not found