💳Loan Generator API

Calculate loan amount and interest with our Loan Generator API. Also, generate a loan repayment schedule with payment details using a single, easy-to-use endpoint.

You need to provide your API key for every API request you make. Please refer to the Getting Started section for more details.

You can check our Errors section to understand how we handle errors and the responses you will receive in cases when errors occur.

Calculate loan (/loan/generate)

Endpoint used for generating loan details and payment schedule based on the specified parameters.

Request parameters

KeyExplanationTypeRequired

amount

Loan principal amount.

number

true

installments

The total number of installments (number of months during which the loan repayment takes place).

number

true

interest_rate

Loan interest rate, expressed as percentage (if loan interest rate is 10%, this parameter should have value 10).

number

true

diminishing

Indicates whether a diminishing loan (loan that has decreasing monthly installments) is being generated. Defaults to false.

boolean

false

Examples

GET /loan/generate?amount=1000&installments=4&interest_rate=12

RESPONSE:

{
  "amount": {
    "principal": 1000,
    "interest": 25.13,
    "total": 1025.13
  },
  "details": {
    "installments_count": 4,
    "interest_rate": 12,
    "diminishing": false
  },
  "payment_schedule": [
    {
      "principal": 246.28,
      "interest": 10,
      "total": 256.28,
      "remaining": 753.72,
      "total_paid_interest": 10
    },
    {
      "principal": 248.74,
      "interest": 7.54,
      "total": 256.28,
      "remaining": 504.98,
      "total_paid_interest": 17.54
    },
    {
      "principal": 251.23,
      "interest": 5.05,
      "total": 256.28,
      "remaining": 253.75,
      "total_paid_interest": 22.59
    },
    {
      "principal": 253.74,
      "interest": 2.54,
      "total": 256.28,
      "remaining": 0,
      "total_paid_interest": 25.13
    }
  ]
}

Our API generates non-diminishing loans by default.

A diminishing loan is a loan that has decreasing monthly installments. In diminishing loans, all installments don't have the same amount in the monthly payment schedule. The first installment is the largest, and monthly payments gradually decrease from month to month.

If you would like to generate a diminishing loan you can specify it via diminishing parameter:

GET /loan/generate?amount=1000&installments=4&interest_rate=12&diminishing=true

RESPONSE:

{
  "amount": {
    "principal": 1000,
    "interest": 25,
    "total": 1025
  },
  "details": {
    "installments_count": 4,
    "interest_rate": 12,
    "diminishing": true
  },
  "payment_schedule": [
    {
      "principal": 250,
      "interest": 10,
      "total": 260,
      "remaining": 750,
      "total_paid_interest": 10
    },
    {
      "principal": 250,
      "interest": 7.5,
      "total": 257.5,
      "remaining": 500,
      "total_paid_interest": 17.5
    },
    {
      "principal": 250,
      "interest": 5,
      "total": 255,
      "remaining": 250,
      "total_paid_interest": 22.5
    },
    {
      "principal": 250,
      "interest": 2.5,
      "total": 252.5,
      "remaining": 0,
      "total_paid_interest": 25
    }
  ]
}

Response structure

Every successful response will have the structure explained in the table below:

KeyExplanationType

amount.principal

The principal amount of loan.

number

amount.interest

Total loan interest amount.

number

amount.total

Total loan amount (calculated by summing amount.principal and amount.interest).

number

details.installments_count

Total number of months over which is loan paid out.

number

details.interest_rate

Loan interest rate, expressed as percentage (if loan interest rate is 10%, this key will have value 10).

number

details.diminishing

Indicates whether a diminishing loan (loan that has decreasing monthly installments) was generated.

boolean

payment_schedule.principal

Principal repayment amount of loan installment.

number

payment_schedule.interest

Interest repayment amount of loan installment.

number

payment_schedule.total

Total repayment amount of loan installment (calculated by summing payment_schedule.principal + payment_schedule.interest).

number

payment_schedule.remaining

Total amount that is remained to be paid out after the current installment is paid.

number

payment_schedule.total_paid_interest

Total amount of interest that is paid out (including the current installment).

number

Last updated