Simple Interest Calculator API: The Complete Guide

Need to calculate simple interest in your application? This guide covers everything you need to know about simple interest calculations via API, including the formula, use cases, and implementation examples in multiple languages.

What is Simple Interest?

Simple interest is a method of calculating interest where the interest is computed only on the original principal amount. Unlike compound interest, simple interest does not earn interest on accumulated interest, making it easier to calculate and predict.

Simple interest is commonly used for short-term loans, car loans, and some types of bonds. It provides a straightforward way to understand the cost of borrowing or the return on an investment.

The Simple Interest Formula

The simple interest formula is:

I = P × r × t

Where:
I = Interest amount
P = Principal (initial amount)
r = Annual interest rate (decimal)
t = Time in years

Total Amount = P + I

Simple vs Compound Interest

Feature Simple Interest Compound Interest
Interest calculated on Principal only Principal + accumulated interest
Growth pattern Linear Exponential
Common uses Short-term loans Savings accounts, investments
Example: $10,000 at 5% simple interest for 3 years: Interest = $10,000 × 0.05 × 3 = $1,500. Total = $11,500.

Using the Simple Interest API

TinyFn provides a simple endpoint to calculate simple interest:

API Request
GET https://api.tinyfn.io/v1/math/simple-interest
Headers: X-API-Key: your-api-key
Response
{
  "principal": 10000,
  "rate": 0.05,
  "time": 3,
  "interest": 1500,
  "total_amount": 11500
}

Parameters

Parameter Type Description
principal number Initial amount (loan or investment)
rate number Annual interest rate (e.g., 0.05 for 5%)
time number Time period in years

Code Examples

JavaScript / Node.js

const response = await fetch(
  'https://api.tinyfn.io/v1/math/simple-interest?principal=10000&rate=0.05&time=3',
  { headers: { 'X-API-Key': 'your-api-key' } }
);
const data = await response.json();
console.log(data.interest); // 1500
console.log(data.total_amount); // 11500

Python

import requests

response = requests.get(
    'https://api.tinyfn.io/v1/math/simple-interest',
    params={'principal': 10000, 'rate': 0.05, 'time': 3},
    headers={'X-API-Key': 'your-api-key'}
)
data = response.json()
print(data['interest'])  # 1500
print(data['total_amount'])  # 11500

cURL

curl "https://api.tinyfn.io/v1/math/simple-interest?principal=10000&rate=0.05&time=3" \
  -H "X-API-Key: your-api-key"

Common Use Cases

  • Loan Cost Estimation: Calculate total cost of short-term loans
  • Car Loan Calculators: Estimate interest on auto financing
  • Bond Calculations: Compute returns on simple interest bonds
  • Educational Tools: Teach basic interest concepts
  • Quick Estimates: Provide fast interest calculations

Best Practices

  1. Convert time correctly: Ensure time is in years for accurate calculations
  2. Use decimal rates: Convert percentage to decimal (5% = 0.05)
  3. Show both values: Display both interest amount and total
  4. Clarify terms: Make it clear that simple interest is being used

Use via MCP

Your AI agent can call this tool directly via Model Context Protocol — no HTTP code needed. Add TinyFn to Claude Desktop, Cursor, or any MCP client:

{
  "mcpServers": {
    "tinyfn-math": {
      "url": "https://api.tinyfn.io/mcp/math/",
      "headers": {
        "X-API-Key": "your-api-key"
      }
    }
  }
}

See all math tools available via MCP in our Math MCP Tools for AI Agents guide.

Try the Simple Interest Calculator API

Get your free API key and start calculating interest in seconds.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key