Developers

Developer API

Access Fanalyx financial calculation engines through a deterministic, tested, edge-deployed API built for low-latency analysis workflows.

New during Agents Week

Try the new Project Think-powered Fanalyx Agent

We now expose a first-class Cloudflare agent runtime in the app with persistent sessions and deterministic finance tools.

Open the agent

Quick Start

1. Get Your API Key

Sign up for a free developer account to get your API key:

Get Free API Key

2. Make Your First Request

curl -X POST https://fanalyx.com/v1/api/analysis/amortization \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "principal": 300000,
    "annualRate": 0.045,
    "years": 30,
    "startDate": "2025-01-01"
  }'

3. Try the Interactive Playground

Test endpoints directly in your browser without an API key:

Open API Playground

4. Explore the API

View interactive documentation and try all endpoints:

View OpenAPI Documentation →

API Tiers

Free

$0/month
  • 1,000 requests/month
  • All calculation endpoints
  • Basic support
  • OpenAPI documentation

Perfect for testing and small projects

Enterprise

Custom
  • Unlimited requests
  • Custom endpoints
  • Dedicated support
  • SLA guarantee
  • White-label options

For large-scale deployments

Available Endpoints

Loan Amortization

POST /v1/api/analysis/amortization

Calculate loan amortization schedules with principal, interest, and balance breakdowns.

View Example
{
  "principal": 300000,
  "annualRate": 0.045,
  "years": 30,
  "startDate": "2025-01-01"
}

Lease Analysis

POST /v1/api/analysis/lease

Analyze lease vs buy decisions with NPV, IRR, and cashflow projections.

View Example
{
  "assetCost": 50000,
  "monthlyLease": 1200,
  "leaseTerm": 36,
  "residualValue": 20000,
  "discountRate": 0.05
}

EBITDA Forecasting

POST /v1/api/analysis/ebitda

Generate financial forecasts with revenue, expenses, and EBITDA projections.

Plus 6 More Models

  • • Savings Goal Calculator
  • • Auto Loan Analysis
  • • Retirement Planning
  • • Budget Optimization
  • • Debt Payoff Strategy
  • • Student Loan Analysis
View all endpoints in API docs →

Why Use Our API?

Edge Deployed

Running on Cloudflare's global network for ultra-low latency from anywhere in the world.

🔒

Secure & Tested

All calculations are deterministic, unit tested, and validated against golden test cases.

📊

Fully Documented

Complete OpenAPI specification with interactive examples and TypeScript types.

🎯

Type-Safe

Strict input validation with Zod schemas and detailed error messages.

Authentication

All API requests require authentication using your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Security Note: Never expose your API key in client-side code. Always make API requests from your backend server.

Rate Limits

All requests include rate limit headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1735689600
Tier Requests/Month Requests/Second
Free 1,000 1
Pro 50,000 10
Enterprise Unlimited Custom

Error Reference

All errors follow a consistent format with actionable error codes:

{ "error": "INVALID_INPUT", "message": "Principal must be a positive number", "code": 400, "field": "principal", "docs": "https://fanalyx.com/docs/errors/INVALID_INPUT" }
400 - INVALID_INPUT

Cause: Request body doesn't match schema (missing fields, wrong types, invalid values)

Solution: Check the `field` property and ensure your input matches the endpoint requirements

Common examples: negative principal, invalid date format, missing required field

401 - UNAUTHORIZED

Cause: Missing or invalid API key

Solution: Include `Authorization: Bearer YOUR_API_KEY` header with valid key

Check your API key at /dashboard or generate a new one

429 - RATE_LIMIT_EXCEEDED

Cause: Too many requests in time window

Solution: Check `X-RateLimit-Reset` header and retry after that timestamp

Consider upgrading to Pro tier for higher limits

500 - INTERNAL_ERROR

Cause: Unexpected server error

Solution: Retry with exponential backoff. If persists, contact support

Include the `X-Request-ID` header value when reporting issues

SDKs & Client Libraries

Official SDKs provide type-safe wrappers and handle authentication automatically:

TypeScript/JavaScript

npm install @fanalyx/sdk
import Fanalyx from '@fanalyx/sdk';

const client = new Fanalyx({
  apiKey: process.env.FANALYX_API_KEY
});

const result = await client.amortization({
  principal: 300000,
  annualRate: 0.045,
  years: 30
});
View on GitHub →

Python

pip install fanalyx
from fanalyx import Fanalyx

client = Fanalyx(
    api_key=os.environ['FANALYX_API_KEY']
)

result = client.amortization(
    principal=300000,
    annual_rate=0.045,
    years=30
)
View on GitHub →

Generate your own: Download our OpenAPI spec and use OpenAPI Generator to create clients in Go, Ruby, PHP, and more.

Webhooks

Receive real-time notifications for events like calculations completing or quota warnings:

Available Events

  • calculation.completed Fired when an async calculation finishes
  • quota.warning Fired at 80% quota usage
  • quota.exceeded Fired when quota limit is reached

Webhook Signature Verification

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const hash = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  
  return hash === signature;
}

// In your webhook handler
const isValid = verifyWebhook(
  req.body,
  req.headers['x-fanalyx-signature'],
  process.env.WEBHOOK_SECRET
);

if (!isValid) {
  return res.status(401).send('Invalid signature');
}

Performance Optimization

🚀 Use HTTP/2

All endpoints support HTTP/2 multiplexing. Make parallel requests over a single connection for better performance.

💾 Cache Responses

Calculation results are deterministic. Cache them by input hash to avoid redundant requests.

ETag: "abc123"
Cache-Control: public, max-age=31536000

🔄 Batch Requests

For multiple calculations, use batch endpoints (coming soon) or make concurrent requests.

🗜️ Enable Compression

Include `Accept-Encoding: gzip` header to reduce response size by ~70%.

Use Cases & Tutorials

🏠 Build a Mortgage Calculator

Create a full-featured mortgage calculator with amortization schedules, payment breakdowns, and affordability analysis.

Read tutorial →

Financial Planning Dashboard

Build a comprehensive financial planning app with retirement projections, savings goals, and debt payoff strategies.

Read tutorial →

Auto Loan Comparison Tool

Help users compare financing options with side-by-side loan analysis and total cost calculations.

Read tutorial →

Testing Sandbox

Use test API keys for development and CI/CD without consuming your quota:

Test API Key

test_sk_1234567890abcdef

Test keys return mock data and don't count toward rate limits. Perfect for unit tests and CI/CD pipelines.

Example Test Response

{
  "test": true,
  "payment": 1520.06,
  "totalInterest": 247221.60,
  "schedule": [/* mock data */]
}

API Changelog

v1.2.0 2025-10-22
  • ✨ Added webhook support for async calculations
  • ✨ New `/v1/api/analysis/budget` endpoint
  • 🐛 Fixed rounding issues in amortization schedule
v1.1.0 2025-10-01
  • ✨ Added EBITDA forecasting endpoint
  • ⚡ Improved response times by 40%
  • 📚 Enhanced OpenAPI documentation
v1.0.0 2025-09-15
  • Initial API release
  • 9 financial calculation endpoints
  • OpenAPI specification
View full changelog →

Pricing Calculator

Estimate your monthly costs based on expected usage:

$0/month

Community & Support

Security & Compliance

🔒 Data Security

  • • All data encrypted in transit (TLS 1.3)
  • • No calculation data stored after response
  • • API keys hashed with bcrypt
  • • Regular security audits

✅ Compliance

  • • GDPR compliant
  • • CCPA compliant
  • • SOC 2 Type II (in progress)
  • • PCI DSS compliant infrastructure

📜 Data Retention

We retain metadata (timestamps, request counts) for 90 days. Calculation inputs and results are not logged or stored.

🛡️ Best Practices

  • • Rotate API keys quarterly
  • • Use environment variables
  • • Implement request signing
  • • Monitor for anomalies

Support & Resources

Ready to Get Started?

Sign up for a free API key and start building today

Get Your Free API Key