Table of contents
Introduction
On Fineract [↗] before a loan officer can issue a loan, a loan product must exist in the system. This guide walks you through the POST /loanproducts endpoint, covering every required field and all available optional parameters.
Assumptions:
- You are running Version 1 of Fineract
- You have Fineract running locally via Docker (see How To Install Apache Fineract With Docker [→])
- You are authenticating with the default
mifos/passwordcredentials - You are hitting the default tenant (
default) - The code snippets suppressed SSL certificate warnings (e.g.: the
--insecureflag in curl)
Authentication
All requests to the Fineract API require two things: a Fineract-Platform-TenantId header identifying which tenant you are operating on, and an Authorization header using HTTP Basic Auth. For the default setup, the credentials mifos:password encode to bWlmb3M6cGFzc3dvcmQ= in Base64.
01: Authorization: Basic bWlmb3M6cGFzc3dvcmQ=
02: Fineract-Platform-TenantId: defaultRequest
URL
01: POST https://localhost:8443/fineract-provider/api/v1/loanproductsRequired Request Body
01: {
02: "name": "Auto Loan",
03: "shortName": "AL-1",
04: "currencyCode": "GHC",
05: "digitsAfterDecimal": 2,
06: "principal": 100,
07: "numberOfRepayments": 1,
08: "locale": "en",
09: "interestRatePerPeriod": 2,
10: "interestRateFrequencyType": 2,
11: "repaymentEvery": 1,
12: "repaymentFrequencyType": 2,
13: "amortizationType": 1,
14: "isInterestRecalculationEnabled": false,
15: "interestType": 0,
16: "interestCalculationPeriodType": 1,
17: "transactionProcessingStrategyCode": "creocore-strategy",
18: "daysInYearType": 1,
19: "daysInMonthType": 1,
20: "loanScheduleType": "CUMULATIVE",
21: "accountingRule": 1
22: }Required Parameters Explained
| Parameter | Type | Example Value | What it does |
|---|---|---|---|
| name | string | "Auto Loan" | The full display name of the loan product. Must be unique across all products. |
| shortName | string | "AL-1" | A short code for the product, used in reports and reference lists. Maximum 4 characters. Must be unique. |
| currencyCode | string | "GHC" | ISO 4217 currency code for the loan. Determines the currency all amounts are expressed in. |
| digitsAfterDecimal | number | 2 | Number of decimal places used when displaying monetary amounts for this product. |
| principal | number | 100 | The default loan amount suggested when creating a new loan under this product. |
| numberOfRepayments | number | 1 | The default number of repayment installments for loans under this product. |
| locale | string | "en" | Locale used to parse any date and number values in the request body. |
| interestRatePerPeriod | number | 2 | The default interest rate applied per repayment period (e.g. 2 means 2% per period). |
| interestRateFrequencyType | number | 2 | The frequency at which interestRatePerPeriod applies. 1 = per day, 2 = per week, 3 = per month, 4 = per year. |
| repaymentEvery | number | 1 | How often a repayment falls due, expressed as a count of repaymentFrequencyType units (e.g. every 1 month). |
| repaymentFrequencyType | number | 2 | The unit of time for repayment frequency. 0 = days, 1 = weeks, 2 = months. |
| amortizationType | number | 1 | How principal is distributed across installments. 0 = equal principal payments, 1 = equal installments (annuity-style). |
| isInterestRecalculationEnabled | boolean | false | Whether interest is recalculated if the borrower makes early or late payments. Must be false when using CUMULATIVE loanScheduleType. |
| interestType | number | 0 | How interest is calculated on the outstanding balance. 0 = declining balance, 1 = flat (applied to original principal throughout the loan life). |
| interestCalculationPeriodType | number | 1 | The period granularity used when calculating interest. 0 = daily, 1 = same as repayment period. |
| transactionProcessingStrategyCode | string | "creocore-strategy" | Determines the order in which incoming payments are applied across fees, interest, and principal. Common values: creocore-strategy, mifos-standard-strategy, interest-principal-penalties-fees-order-strategy. |
| daysInYearType | number | 1 | How many days Fineract assumes a year has when calculating interest. 1 = 360 days, 3 = 365 days, 4 = actual days. |
| daysInMonthType | number | 1 | How many days Fineract assumes a month has. 1 = 30 days, 3 = actual days in the calendar month. |
| loanScheduleType | string | "CUMULATIVE" | The repayment schedule generation model. CUMULATIVE builds an amortization schedule upfront. PROGRESSIVE recalculates the schedule dynamically as payments are made. |
| accountingRule | number | 1 | The accounting method applied to transactions for this product. 1 = none (no journal entries), 2 = cash-basis, 3 = accrual (periodic), 4 = accrual (upfront). |
Optional Parameters
Click to view
| Parameter | Type | Default value | What it does |
|---|---|---|---|
| description | string | empty string | A longer human-readable description of the loan product. |
| externalId | string | empty string | Your own reference ID from an external system (e.g. your CRM or ERP) for linking records. |
| startDate | string | null | The date this product becomes available. Requires dateFormat and locale to parse. |
| closeDate | string | null | The date this product stops being available for new loans. |
| dateFormat | string | "dd MMMM yyyy" | Format pattern used to parse startDate and closeDate. Required only if those dates are provided. |
| inMultiplesOf | number | empty string | Loan amounts must be multiples of this value (e.g. 100 : only GHC100, GHC200, GHC300 allowed). Leave blank for no rounding. |
| installmentAmountInMultiplesOf | number | empty string | Each repayment installment is rounded to a multiple of this value. |
| includeInBorrowerCycle | boolean | false | Whether loans from this product count toward a borrower's loan cycle history (used for progressive lending). |
| useBorrowerCycle | boolean | false | If true, principal/rate/repayments auto-adjust based on how many previous loans the borrower has taken. |
| principalVariationsForBorrowerCycle | array | [] | Rules defining how the default loan amount changes per cycle number (e.g. cycle 1 = GHC500, cycle 2 = GHC1000). |
| numberOfRepaymentVariationsForBorrowerCycle | array | [] | Rules defining how the number of repayments changes per borrower cycle. |
| interestRateVariationsForBorrowerCycle | array | [] | Rules defining how the interest rate changes per borrower cycle. |
| repaymentStartDateType | number | 1 | When the first repayment is due. 1 = from disbursement date, 2 = from submission date. |
| fixedLength | number | null | Forces the loan to always last exactly this many periods, overriding other schedule settings. |
| canDefineInstallmentAmount | boolean | false | Allows the loan officer to manually set a fixed installment amount when creating an individual loan. |
| allowVariableInstallments | boolean | false | Allows each installment to have a different amount rather than a fixed recurring amount. |
| isLinkedToFloatingInterestRates | boolean | false | If true, the rate floats based on a market index (like LIBOR or prime rate) instead of being fixed. |
| interestRecognitionOnDisbursementDate | boolean | false | If true, interest starts accruing on the exact day money is paid out to the borrower. |
| isEqualAmortization | boolean | false | Enforces that every single installment is exactly the same total amount. |
| allowApprovedDisbursedAmountsOverApplied | boolean | false | Allows disbursing more than the approved loan amount. |
| overAppliedCalculationType | string | null | How the over-disbursement limit is calculated e.g. flat amount or percentage. Required if overApplied is enabled. |
| overAppliedNumber | number | null | The actual cap for how much over the approved amount can be disbursed. |
| disallowExpectedDisbursements | boolean | false | Prevents setting expected disbursement dates on individual loans of this product. |
| allowFullTermForTranche | boolean | false | For multi-tranche (split-disbursement) loans, lets each tranche span the full loan term. |
| accountMovesOutOfNPAOnlyOnArrearsCompletion | boolean | false | A loan marked as non-performing only recovers 'good' status once ALL overdue amounts are cleared. |
| delinquencyBucketId | number | null | Links this product to a delinquency classification bucket (groups loans by how many days overdue). |
| enableInstallmentLevelDelinquency | boolean | false | Track delinquency per installment rather than at the overall loan level. |
| dueDaysForRepaymentEvent | number | 1 | Days before the due date to trigger a 'payment coming up' notification or event. |
| overDueDaysForRepaymentEvent | number | 1 | Days after the due date to trigger an 'overdue' notification or event. |
| enableDownPayment | boolean | false | Requires the borrower to pay a portion of the loan upfront before full disbursement. |
| holdGuaranteeFunds | boolean | false | Locks/holds collateral or guarantee funds associated with the loan in the system. |
| canUseForTopup | boolean | false | This product can be used to top up (add extra funds to) an existing active loan. |
| allowAttributeOverrides | object | { } | An object where each key is a loan setting (e.g. amortizationType). Set to true to allow that setting to be changed per individual loan, overriding the product default. Keys: amortizationType, interestType, transactionProcessingStrategyCode, interestCalculationPeriodType, inArrearsTolerance, repaymentEvery, graceOnPrincipalAndInterestPayment, graceOnArrearsAgeing. |
| charges | array | [] | List of charge/fee IDs to attach to this product (e.g. origination fee, late penalty). Empty means no fees. |
Response
01:
02: {
03:
04: "resourceId": 6
05:
06: }
07: The resource ID represents the unique identifier for the loan product.
Code samples
SSL error muted
Default Basic Auth setup mifos/password
Curl
create_loan.sh
01:
02: curl --insecure --location 'https://localhost:8443/fineract-provider/api/v1/loanproducts' \
03:
04: --header 'Accept: application/json, text/plain, */*' \
05:
06: --header 'Authorization: Basic bWlmb3M6cGFzc3dvcmQ=' \
07:
08: --header 'Connection: keep-alive' \
09:
10: --header 'Content-Type: application/json' \
11:
12: --header 'Fineract-Platform-TenantId: default' \
13:
14: --data '{
15:
16: "name": "Auto Loan",
17:
18: "shortName": "AL-1",
19:
20: "currencyCode": "GHC",
21:
22: "digitsAfterDecimal": 2,
23:
24: "principal": 100,
25:
26: "numberOfRepayments": 1,
27:
28: "locale": "en",
29:
30: "interestRatePerPeriod": 2,
31:
32: "interestRateFrequencyType": 2,
33:
34: "repaymentEvery": 1,
35:
36: "repaymentFrequencyType": 2,
37:
38: "amortizationType": 1,
39:
40: "isInterestRecalculationEnabled": false,
41:
42: "interestType": 0,
43:
44: "interestCalculationPeriodType": 1,
45:
46: "transactionProcessingStrategyCode": "creocore-strategy",
47:
48: "daysInYearType": 1,
49:
50: "daysInMonthType": 1,
51:
52: "loanScheduleType": "CUMULATIVE",
53:
54: "accountingRule": 1
55:
56: }'
57: NodeJS
create_loan.js
01:
02: process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
03:
04: const url = 'https://localhost:8443/fineract-provider/api/v1/loanproducts';
05:
06: const postData = JSON.stringify({
07:
08: "name": "Auto Loan",
09:
10: "shortName": "AL-1",
11:
12: "currencyCode": "GHC",
13:
14: "digitsAfterDecimal": 2,
15:
16: "principal": 100,
17:
18: "numberOfRepayments": 1,
19:
20: "locale": "en",
21:
22: "interestRatePerPeriod": 2,
23:
24: "interestRateFrequencyType": 2,
25:
26: "repaymentEvery": 1,
27:
28: "repaymentFrequencyType": 2,
29:
30: "amortizationType": 1,
31:
32: "isInterestRecalculationEnabled": false,
33:
34: "interestType": 0,
35:
36: "interestCalculationPeriodType": 1,
37:
38: "transactionProcessingStrategyCode": "creocore-strategy",
39:
40: "daysInYearType": 1,
41:
42: "daysInMonthType": 1,
43:
44: "loanScheduleType": "CUMULATIVE",
45:
46: "accountingRule": 1
47:
48: });
49:
50: const response = await fetch(url, {
51:
52: method: 'POST',
53:
54: headers: {
55:
56: 'Accept': 'application/json, text/plain, */*',
57:
58: 'Authorization': 'Basic bWlmb3M6cGFzc3dvcmQ=',
59:
60: 'Content-Type': 'application/json',
61:
62: 'Fineract-Platform-TenantId': 'default'
63:
64: },
65:
66: body: postData
67:
68: });
69:
70: const result = await response.text();
71:
72: console.log(result);
73: PHP
create_loan.php
01:
02: <?php
03:
04: $curl = curl_init();
05:
06: curl_setopt_array($curl, array(
07:
08: CURLOPT_URL => 'https://localhost:8443/fineract-provider/api/v1/loanproducts',
09:
10: CURLOPT_RETURNTRANSFER => true,
11:
12: CURLOPT_ENCODING => '',
13:
14: CURLOPT_MAXREDIRS => 10,
15:
16: CURLOPT_TIMEOUT => 0,
17:
18: CURLOPT_FOLLOWLOCATION => true,
19:
20: CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
21:
22: CURLOPT_CUSTOMREQUEST => 'POST',
23:
24: CURLOPT_POSTFIELDS =>'{
25:
26: "name": "Auto Loan",
27:
28: "shortName": "AL-1",
29:
30: "currencyCode": "GHC",
31:
32: "digitsAfterDecimal": 2,
33:
34: "principal": 100,
35:
36: "numberOfRepayments": 1,
37:
38: "locale": "en",
39:
40: "interestRatePerPeriod": 2,
41:
42: "interestRateFrequencyType": 2,
43:
44: "repaymentEvery": 1,
45:
46: "repaymentFrequencyType": 2,
47:
48: "amortizationType": 1,
49:
50: "isInterestRecalculationEnabled": false,
51:
52: "interestType": 0,
53:
54: "interestCalculationPeriodType": 1,
55:
56: "transactionProcessingStrategyCode": "creocore-strategy",
57:
58: "daysInYearType": 1,
59:
60: "daysInMonthType": 1,
61:
62: "loanScheduleType": "CUMULATIVE",
63:
64: "accountingRule": 1
65:
66: }',
67:
68: CURLOPT_HTTPHEADER => array(
69:
70: 'Accept: application/json, text/plain, */*',
71:
72: 'Authorization: Basic bWlmb3M6cGFzc3dvcmQ=',
73:
74: 'Connection: keep-alive',
75:
76: 'Content-Type: application/json',
77:
78: 'Fineract-Platform-TenantId: default',
79:
80: ),
81:
82: ));
83:
84: $response = curl_exec($curl);
85:
86: curl_close($curl);
87:
88: echo $response;