Skip to main content

Create Loan API

Create Loan API in Frappe Lending allows users to create and book loans through external applications. The API supports different repayment methods, including repayment based on a fixed number of periods and repayment based on a fixed amount per period.

Using this API, lenders can create loan records, configure repayment details, add loan charges, and automatically create disbursement entries during loan booking.

Did You Know?

Frappe Lending supports flexible loan booking by allowing repayment schedules to be defined either by tenure or by repayment amount.

API Endpoint

POST /api/resource/Loan

Loan Creation Based on Tenure

When repayment is defined by the number of repayment periods, use the Repay Over Number Of Periods method. The system generates the repayment schedule based on the selected tenure.

Request Body

{
    "applicant_type": "Customer",
    "applicant": "_Test Loan Customer 2",
    "company": "_Test Company",
    "posting_date": "2024-04-01",
    "docstatus": 1,
    "auto_create_disbursement_on_loan_booking": 1,
    "loan_product": "Term Loan Product 4",
    "loan_amount": 500000,
    "penalty_charges_rate": 25,
    "repayment_start_date": "2024-05-05",
    "repayment_frequency": "Monthly",
    "repayment_method": "Repay Fixed Amount per Period",
    "repayment_periods": 12,
    "loan_charges": [
        {
            "charge": "Processing Fee",
            "amount": 100,
            "treatment_of_charge": "Add to first repayment",
            "doctype": "Loan Disbursement Charge"
        }
    ]
}

Key Fields

Field Description
Applicant Type Defines whether the borrower is a Customer or another supported applicant type.
Applicant Specifies the borrower associated with the loan.
Company Defines the company issuing the loan.
Loan Product Specifies the loan product configuration used for the loan.
Loan Amount Defines the principal amount issued to the borrower.
Repayment Frequency Defines the repayment interval, such as Monthly.
Repayment Periods Defines the number of repayment installments.
Loan Charges Defines additional charges applied during loan creation.

Loan Creation Based on Fixed Repayment Amount

When repayment is based on a fixed installment amount, use the Repay Fixed Amount per Period method. The system calculates the repayment tenure based on the configured installment amount.

Request Body

{
    "applicant_type": "Customer",
    "applicant": "_Test Loan Customer 2",
    "company": "_Test Company",
    "posting_date": "2024-04-01",
    "docstatus": 1,
    "auto_create_disbursement_on_loan_booking": 1,
    "loan_product": "Term Loan Product 4",
    "loan_amount": 500000,
    "penalty_charges_rate": 25,
    "repayment_start_date": "2024-05-05",
    "repayment_frequency": "Monthly",
    "repayment_method": "Repay Fixed Amount per Period",
    "monthly_repayment_amount": 30000,
    "loan_charges": [
        {
            "charge": "Processing Fee",
            "amount": 100,
            "treatment_of_charge": "Add to first repayment",
            "doctype": "Loan Disbursement Charge"
        }
    ]
}

Additional Field

Field Description
Monthly Repayment Amount Defines the fixed repayment amount to be collected in each repayment cycle.

Loan Charges

Loan charges can be added during loan creation using the loan_charges child table.

Field Description
Charge Name of the applicable charge.
Amount Amount of the charge.
Treatment Of Charge Defines how the charge is adjusted, such as adding it to the first repayment.
DocType Defines the child document type as Loan Disbursement Charge.

Response

After successful loan creation, the API returns the created loan document details.

{
    "data": {
        "name": "ACC-LOAN-2026-00232",
        "applicant": "_Test Loan Customer 2",
        "company": "_Test Company",
        "loan_product": "Term Loan Product 4",
        "loan_amount": 500000.0,
        "status": "Sanctioned",
        "repayment_frequency": "Monthly",
        "repayment_periods": 12,
        "doctype": "Loan"
    }
}

Response Fields

Field Description
Name Unique identifier generated for the loan account.
Status Shows the current loan status after creation.
Loan Amount Displays the approved loan principal amount.
Disbursed Amount Shows the amount already disbursed against the loan.
Rate Of Interest Displays the applicable loan interest rate.
Total Payment Shows total repayment amount calculated for the loan.
Total Interest Payable Displays total interest expected over the loan lifecycle.
Loan Charges Shows charges added during loan creation.

How It Works

Step Description
1. Validate Loan Details The system validates applicant, company, loan product, and repayment configuration.
2. Create Loan Record A new loan document is created with the provided details.
3. Generate Repayment Schedule The repayment schedule is generated based on tenure or fixed repayment amount.
4. Apply Charges Configured loan charges are added to the loan.
5. Create Disbursement If auto-create disbursement is enabled, the disbursement entry is created automatically.

Use Cases

The Create Loan API can be used for:

  • Creating loans from external lending portals.
  • Integrating loan origination systems with Frappe Lending.
  • Automating loan booking workflows.
  • Creating borrower-specific loan products.
  • Managing loan charges during origination.

Note

Ensure the selected Loan Product is properly configured before creating loans through API.

Best Practices

  • Validate borrower details before creating loans.
  • Use the correct repayment method based on business requirements.
  • Configure loan products before API-based loan creation.
  • Review loan charges before submitting the request.
  • Use proper API authentication and access controls.
Rating: 0 / 5 (0 votes)