API da calculadora libre
Todas as calculadoras deste sitio son tamén API JSON libres. Non hai que rexistrarse, non hai chave API, está habilitada para CORS, chámeo desde o servidor ou directamente desde o navegador.
Resumo
A API executa exactamente as mesmas matemáticas que usa o sitio web. Envíe os valores dos campos dunha calculadora como parámetros de consulta ou JSON e obteña os resultados calculados como JSON, incluíndo calquera plan de amortización ou datos de gráficos que produza a calculadora.
- 198+ calculadoras, cada unha co seu propio punto final
- Sen chave API — acceso anónimo, velocidade limitada polo IP
- CORS —
Access-Control-Allow-Origin: *(utilizábel do lado do cliente) - Límite de taxa: 60 peticións/ hora por IP (HTTP 429 cando se exceda)
- Errors are free — only a successful (2xx) response uses one call from your monthly quota. Every 400, 401, 404, 429 and 500 costs you nothing.
URL base
https://calculator.free/api/v1/
Índice — lista todas as calculadoras
GET https://calculator.free/api/v1/
Devolve unha listaxe de todas as calculadoras lexíbel por máquina cos campos de cada unha (chave, etiqueta, tipo, predeterminado, unidade) e as chaves de resultado, o suficiente para construír un cliente dinamicamente. Each field also carries a required flag — true for the few fields that have no default (dates, mostly). Send those: a couple of calculators can infer one, the rest answer 400 without it.
Calcular — executar unha calculadora
GET https://calculator.free/api/v1/<slug>/?field=value&field=value
POST https://calculator.free/api/v1/<slug>/ (JSON or form body)
Forma da resposta:
{
"ok": true,
"slug": "mortgage",
"country": "us",
"inputs": { ... the values actually computed with ... },
"results": { ... computed result keys ... },
"schedule": { "columns": [...], "rows": [...] } | null,
"chart": { "type": "pie", "slices": [...] } | null,
"defaults_applied": ["tax", "insurance"]
}
Acepta calculadoras que coñecen o país (hipoteca, préstamo, impostos sobre a renda, impostos sobre as vendas...) ?country=us|uk|ca|au|in|ie|nz|za. O slug descoñecido devolve 404; o país non soportado ou a entrada incorrecta devolve 400 cunha mensaxe útil e a especificación do campo.
Parameters, defaults and errors
Send only the fields you care about. Anything you leave out is filled with that field's published default — the same value the calculator page pre-fills, so the API and the website always return the same numbers for the same inputs. Each response lists what it filled in under defaults_applied.
Anything the API cannot resolve honestly is an error, never a zero: a misspelled parameter, a value of the wrong type, an unknown dropdown option, or a missing field that has no default (the date fields — a birth date cannot be guessed). Every 400 names the offending parameter and echoes the full field spec so a client can correct itself.
$ curl "https://calculator.free/api/v1/mortgage/?price=350000&rate=6.5&term=30"
{
"ok": false,
"error": "unknown_parameter",
"message": "Unknown parameter 'term' for calculator 'mortgage'. Did you mean 'years'? ...",
"unknown_parameters": ["term"],
"did_you_mean": { "term": "years" },
"valid_parameters": ["down", "extra", "extra_onetime", "extra_yearly", "hoa",
"insurance", "other", "pmi", "price", "rate", "tax", "years"],
"fields": [ ... ]
}
| error | HTTP | When |
|---|---|---|
unknown_parameter | 400 | a parameter that is not a field of this calculator (with a did-you-mean suggestion) |
invalid_value | 400 | a number field that is not a number, a dropdown value outside its options, an unparseable date, or an unknown _mode |
missing_parameter | 400 | the calculator produced no result because a field with no default was left empty |
unsupported_country | 400 | ?country= is not one this calculator has data for |
bad_json | 400 | the POST body is not valid JSON |
unknown_calculator | 404 | no calculator with that slug |
invalid_key | 401 | an API key was sent but is unknown or inactive |
rate_limited / quota_exceeded | 429 | the anonymous hourly IP limit, or a key's monthly quota, is used up |
too_many_invalid_requests | 429 | too many rejected requests in one hour for this key — rejected calls are free, so they are rate-limited instead. Resets hourly; successful calls never count towards it. |
The /api/v1/ index publishes every field's key, type, unit, default and whether it is required — enough to build a client that never guesses.
Autenticación e plans
Pode chamar á API sen ningunha chave; as peticións anónimas están limitadas pola velocidade do IP. Para unha cota mensual maior e predicible (e uso comercial), cree unha chave na páxina da súa conta e envíea dun dos tres xeitos:
GET https://calculator.free/api/v1/mortgage/?price=350000&key=YOUR_KEY
curl -H "Authorization: Bearer YOUR_KEY" "https://calculator.free/api/v1/bmi/?units=metric&height=180&weight=80"
curl -H "X-Api-Key: YOUR_KEY" "https://calculator.free/api/v1/bmi/?units=metric&height=180&weight=80"
- Libre — anónimo (IP limitado pola velocidade) ou unha chave libre cunha pequena cota mensual. Non comercial.
- Desenvolvedor & mdash; $9/ mes — 10.000 chamadas/mes, uso comercial.
- Empresarial — $49/mo — 100.000 chamadas/mes, prioridade de transmisión.
What counts against your quota
Only a successful response does. One 2xx = one call. Every error is free: a 400 for a misspelled parameter, a bad value or a missing required field, a 404 for an unknown slug, a 401 for a bad key, a 429, and anything that goes wrong on our side. Explore the contract and fix your request as many times as you need — you are billed for answers, not for corrections.
Because errors are free they are rate-limited instead: if one key provokes more than 200 rejected responses in an hour, it gets HTTP 429 "too_many_invalid_requests" until the hour rolls over. Successful calls never count towards that, so a working integration will never see it — it only catches a client stuck in a retry loop.
Cando se esgota a cota mensual dunha chave, a API devolve HTTP 429 co erro « quota_ exceeded »; unha chave descoñecida ou inactiva devolve HTTP 401. Vexa os plans completos e inscríbase no Prezos páxina.
Exemplos
curl
curl "https://calculator.free/api/v1/mortgage/?price=350000&down=70000&rate=6.9&years=30"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/bmi/?" + new URLSearchParams({
units: "metric", height: "180", weight: "80"
}));
const { results } = await r.json();
console.log(results.bmi, results.category);
Python
import requests
r = requests.get("https://calculator.free/api/v1/mortgage/",
params={"price": 350000, "down": 70000,
"rate": 6.9, "years": 30},
headers={"Authorization": "Bearer YOUR_KEY"})
print(r.json()["results"])
POST JSON
curl -X POST "https://calculator.free/api/v1/income-tax/?country=uk" \
-H "Content-Type: application/json" \
-d '{"income": 60000}'
Todos os puntos finais
Un punto final por calculadora. As chaves de campo e de resultado para cada unha están no /api/v1/ índice.
Finanzas (41)
Impostos e salarios (2)
| Calculadora | Punto final |
|---|---|
| Calculadora de impostos | /api/v1/income-tax/ |
| Calculadora de impostos sobre vendas e IVA | /api/v1/sales-tax/ |
Saúde e fitness (28)
Tipo de ficheiro (26)
Estatísticas (15)
Conversores de unidades (17)
Ciencia e enxeñaríaName (27)
Data e hora (15)
Todos os días (27)
Os resultados son estimacións só para orientación xeral, non para consellos financeiros, médicos ou fiscais.