API Documentation
Integrate The Calculators into your applications. Access calculators, perform calculations, and embed widgets programmatically.
https://thecalculators.net/api/v1
JSON
Authentication
All API requests require an API key. Include your key in the request header:
X-API-Key: your_api_key_here
Alternatively, pass the key as a query parameter: ?api_key=your_api_key_here
Keep your API keys secure
Never expose API keys in client-side code or public repositories. Use environment variables or server-side code to make API calls.
Rate Limits
Rate limits vary by plan. When you exceed your limit, the API returns a 429 status code.
| Plan | Monthly Requests | Rate |
|---|---|---|
| Free | 1,000 | 10 req/min |
| Starter | 10,000 | 60 req/min |
| Pro | 100,000 | 120 req/min |
| Enterprise | 1,000,000 | Unlimited |
Custom rate limits can be configured by your administrator per API key.
Error Handling
The API returns standard HTTP status codes. Errors include a JSON body with details.
{
"error": "Invalid API key",
"status": 401
}
| Code | Description |
|---|---|
200 | Success |
400 | Bad request - Invalid parameters |
401 | Unauthorized - Missing or invalid API key |
404 | Not found - Resource doesn't exist |
429 | Rate limit exceeded |
500 | Internal server error |
List Calculators
Retrieve a paginated list of all public calculators.
GET https://thecalculators.net/api/v1/calculators
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number |
per_page | integer | 20 | Results per page (max 100) |
category | string | - | Filter by category slug |
search | string | - | Search by name |
Example Response
{
"calculators": [
{
"id": 1,
"name": "Compound Interest",
"slug": "compound-interest",
"description": "Calculate compound interest...",
"category": "Finance",
"icon": "calculator",
"color": "#7c3aed"
}
],
"total": 15,
"page": 1,
"per_page": 20,
"pages": 1
}
Get Calculator
Retrieve details about a specific calculator by its slug.
GET https://thecalculators.net/api/v1/calculators/{slug}
Path Parameters
| Parameter | Description |
|---|---|
slug | The URL-friendly identifier of the calculator |
List Categories
Retrieve all calculator categories.
GET https://thecalculators.net/api/v1/categories
Example Response
{
"categories": [
{
"id": 1,
"name": "Finance",
"slug": "finance",
"description": "Financial calculators",
"calculator_count": 5
}
]
}
Calculate
Perform a calculation using a specific calculator.
POST https://thecalculators.net/api/v1/calculate/{slug}
Request Body
{
"inputs": {
"principal": 10000,
"rate": 5,
"years": 10,
"compound_frequency": "monthly"
}
}
Example Response
{
"result": 16470.09,
"formatted": "$16,470.09",
"details": {
"total_interest": 6470.09,
"effective_rate": "5.12%"
}
}
Code Examples
curl -X POST https://thecalculators.net/api/v1/calculate/compound-interest \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"inputs": {"principal": 10000, "rate": 5, "years": 10}}'
const response = await fetch('https://thecalculators.net/api/v1/calculate/compound-interest', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
inputs: { principal: 10000, rate: 5, years: 10 }
})
});
const data = await response.json();
import requests
response = requests.post(
'https://thecalculators.net/api/v1/calculate/compound-interest',
headers={'X-API-Key': 'your_api_key'},
json={'inputs': {'principal': 10000, 'rate': 5, 'years': 10}}
)
data = response.json()
Embed Widget
Embed any calculator directly into your website using an iframe. No API key required for embeds.
<iframe src="https://thecalculators.net/embed/compound-interest?theme=dark" width="100%" height="500px" frameborder="0" loading="lazy" style="border: none; border-radius: 8px;" ></iframe>
Embed Parameters
| Parameter | Values | Description |
|---|---|---|
theme | dark, light, auto | Widget color theme |
Use the Embed Code Generator in the admin panel to generate embed codes for any calculator with your preferred settings.
SDKs & Libraries
Official SDK libraries are coming soon. In the meantime, use any HTTP client to interact with the API.
JavaScript / Node.js
Coming soon
Python
Coming soon
PHP
Coming soon
Changelog
- Initial API release
- Calculator listing and details endpoints
- Calculation endpoint with formula support
- Category listing endpoint
- Embed widget support