
Compound Interest Calculator API
Finance
See how savings grow with compound interest: a starting amount, regular contributions, any compounding frequency, with a growth chart and a year-by-year table.
Authentication
Send your API key as a Bearer token in the Authorization header (Authorization: Bearer YOUR_API_KEY), or in an X-API-Key header.
Rate Limit
120 requests per minute
Endpoints
1 endpoint available
Overview
Grows a starting amount with optional regular contributions at a fixed annual rate. Returns the final balance, total contributions, total interest, the effective annual rate, the years it takes money to double, and a year-by-year table.
Notes
annualRateis a percentage (6 means 6%), from 0 to 100.yearsis a whole number from 1 to 100.- Interest compounds
compoundingtimes a year (dailyis 365,continuouslyuses e^rt). Contributions can be on a different schedule. The balance is stepped one contribution period at a time using the exact equivalent rate for that period. contributionTimingstartputs each contribution in at the start of its period, so it earns one more period of interest.endis the default.- Money in the response is rounded to the cent, so the rounded totals can differ from the exact ones by a cent.
yearsToDoubleis for the starting amount alone, with no contributions. It isnullat a 0% rate.
Endpoints
POST
https://opentools.ca/api/v1/tools/compound-interest-calculatorCalculate compound interest with regular contributions
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| initialAmount | number | Optional | Starting amount.Default: 0 |
| contribution | number | Optional | Amount added each contribution period.Default: 0 |
| contributionFrequency | string Enum: weekly, bi-weekly, monthly, quarterly, annually | Optional | How often contributions are made.Default: monthly |
| contributionTiming | string Enum: end, start | Optional | Whether contributions go in at the start or the end of each period.Default: end |
| annualRate | number | Required | Nominal annual interest rate as a percentage, 0 to 100. |
| compounding | string Enum: daily, monthly, quarterly, semi-annually, annually, continuously | Optional | How often interest compounds.Default: monthly |
| years | number | Required | Number of whole years, 1 to 100. |
Response Example
{
"success": true,
"finalBalance": 21800.83,
"totalContributions": 19000,
"totalInterest": 2800.83,
"effectiveAnnualRate": 6.167781,
"yearsToDouble": 11.5813,
"yearly": [
{
"year": 1,
"contributions": 3000,
"interest": 700.67,
"totalContributions": 13000,
"totalInterest": 700.67,
"balance": 13700.67
},
{
"year": 2,
"contributions": 3000,
"interest": 928.92,
"totalContributions": 16000,
"totalInterest": 1629.59,
"balance": 17629.59
},
{
"year": 3,
"contributions": 3000,
"interest": 1171.24,
"totalContributions": 19000,
"totalInterest": 2800.83,
"balance": 21800.83
}
]
}Error Codes
400
Bad Request - A field is missing or invalid. The response lists each problem.401
Unauthorized - Missing or invalid API key403
Forbidden - The API key is inactive or expired, or the request IP is not allowed405
Method Not Allowed - This endpoint accepts POST only429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)500
Internal Server ErrorCode Examples
# Savings over three years
curl -X POST https://opentools.ca/api/v1/tools/compound-interest-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"initialAmount": 10000,
"contribution": 250,
"contributionFrequency": "monthly",
"annualRate": 6,
"compounding": "monthly",
"years": 3
}'Rather use it in your browser? Open the Compound Interest Calculator