Loan / Installment Calculation
Finance Math & Calculations Credits / request: 1Calculates equal installments, total interest and an optional schedule.
GET
https://api.apikodu.com/api/v1/math/loan
Documentation
Overview
Equal-installment (annuity) loan.
Authentication
Every request requires the x-api-key header. Credits used and remaining quota are returned in response headers (x-api-credits-used, x-api-remaining-credits, x-rate-limit-*).
Request
GET
https://api.apikodu.com/api/v1/math/loan?amount=100000&rate=24&termMonths=12&includeSchedule=true
GET query or POST JSON.
Parameters
| Name | Type | Required | Default | Options | Description |
|---|---|---|---|---|---|
amount |
number | * Required | — | — | Principal. |
rate |
number | * Required | — | — | Annual interest %. |
termMonths |
integer | * Required | — | — | Term 1–360 months. |
currency |
string | Optional | — | — | ISO code. |
includeSchedule |
boolean | Optional | true |
true false |
Installment schedule. |
Response
| Name | Type | Description |
|---|---|---|
amount |
number | Principal. 2 decimals. |
rate |
number | Annual interest rate (%). |
termMonths |
integer | Term in months. |
amountPayment |
number | Fixed monthly installment (annuity). 2 decimals. |
amountInterest |
number | Total interest paid over the term. |
amountTotal |
number | Principal + total interest. amountPayment * termMonths. |
currency |
string | ISO currency code. Null if omitted. |
schedule |
array | Installment rows when includeSchedule=true. Empty array when false. |
schedule[].index |
integer | Installment number (1 to termMonths). |
schedule[].amountPayment |
number | Payment this month (principal + interest). |
schedule[].amountPrincipal |
number | Principal portion of this installment. |
schedule[].amountInterest |
number | Interest portion of this installment. |
schedule[].amountRemaining |
number | Remaining principal after this installment. |
Errors
| HTTP | code | Description |
|---|---|---|
400 |
-241 |
POST body missing, or amount/rate missing or out of range. |
400 |
-248 |
termMonths is outside 1–360. |
401 |
-100 |
x-api-key is missing, empty, malformed, inactive, banned, expired, IP-restricted, or not allowed for this API. |
429 |
-221 |
Per-minute request limit exceeded. Response headers: x-rate-limit-limit, x-rate-limit-remaining, x-rate-limit-reset. |
429 |
— | Package credit quota cannot cover this request. Body may be { error, limit, currentUsage, requestCost } (no code field). |
500 |
-1 |
Unexpected server error. message is a generic error text without technical details. |
Notes
- Success body is { data: { ... } }. Error body is { code, message }. code is an ApiResponseCode enum value (negative integer).
Sample response
{
"data": {
"amount": 100000.00,
"rate": 24.0,
"termMonths": 12,
"amountPayment": 9455.96,
"amountInterest": 13471.52,
"amountTotal": 113471.52,
"currency": "EUR",
"schedule": [
{
"index": 1,
"amountPayment": 9455.96,
"amountPrincipal": 7455.96,
"amountInterest": 2000.00,
"amountRemaining": 92544.04
}
]
}
}
Code samples
const response = await fetch('https://api.apikodu.com/api/v1/math/loan', {
method: 'GET',
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
import requests
headers = {
'x-api-key': 'YOUR_API_KEY'
}
response = requests.get('https://api.apikodu.com/api/v1/math/loan', headers=headers)
print(response.json())
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");
var response = await client.GetStringAsync("https://api.apikodu.com/api/v1/math/loan");
Console.WriteLine(response);
$response = file_get_contents('https://api.apikodu.com/api/v1/math/loan', false, stream_context_create([
'http' => [
'header' => "x-api-key: YOUR_API_KEY"
]
]));
print_r(json_decode($response, true));
curl -X GET 'https://api.apikodu.com/api/v1/math/loan' \
-H 'x-api-key: YOUR_API_KEY'
Start building in minutes
Create a free account, get your API key and send your first request in minutes.