Skip to content

HTTP API

The public HTTP API exposes the library’s safe* operations as JSON over HTTPS. It is read-only (no persistence), unauthenticated in v1, and intended for Excel, Python, curl, and other clients that do not install Node.

Production base URL: https://api.igcp-aforro.primor.me

For bulk precomputed rates, keep using the static rates.json artifact. The API runs live simulations with the same inputs as simulate() and safeSimulate().

This project is not affiliated with IGCP. Results are calculator-quality estimates, not financial or tax advice. Always verify against official statements. Every response includes the X-IGCP-Aforro-Disclaimer header.

All POST routes return JSON shaped as SafeResult:

{ "ok": true, "value": { } }
{ "ok": false, "kind": "validation", "error": { "issues": [ ] } }
{ "ok": false, "kind": "runtime", "message": "" }
OutcomeHTTP
Success200
Validation error (Zod)400
Domain / runtime error422
Unknown route404
Wrong method405

Access-Control-Allow-Origin: * on GET, POST, and OPTIONS. OPTIONS on /v1/* returns 204 for preflight.

MethodPathMaps to
GET/healthVersion, status, Euribor metadata (_meta.json)
POST/v1/simulatesafeSimulate — body = SimulateInput
POST/v1/portfoliosafeSimulatePortfolio
POST/v1/redeemsafeSimulateRedemption
POST/v1/rates/currentsafeGetCurrentRate
POST/v1/rates/cohortsafeGetRateForCohort
POST/v1/rates/tablesafeGetRateTable
POST/v1/tax-year/rollupsafeRollupTaxYears — body = SimulateResult with schedule
POST/v1/tax-year/rollup-portfoliosafeRollupTaxYearsFromPortfolio
POST/v1/tax-year/getsafeGetTaxYearRollup — body { "result": …, "taxYear": 2025 }
Terminal window
curl -sS -X POST 'https://api.igcp-aforro.primor.me/v1/simulate' \
-H 'content-type: application/json' \
-d '{
"series": "F",
"subscriptionDate": "2024-03-15",
"units": 1000,
"includeSchedule": true
}' | jq .

v1 does not require an API key. Configure Cloudflare WAF rate limiting (for example 60 requests/minute per IP on /v1/*). The Worker itself does not enforce quotas in v1.

The same core is available as a stdio MCP server in the monorepo (igcp-aforro-mcp). See CONTRIBUTING for local development and a sample mcp.json.