# Calculate loan repayment schedule | Submit a new Loan Application

`POST /lokta-lms/api/v1/loans`

It calculates the loan repayment Schedule
Submits a new loan application
Mandatory Fields: clientId, productId, principal, loanTermFrequency, loanTermFrequencyType, loanType, numberOfRepayments, repaymentEvery, repaymentFrequencyType, interestRatePerPeriod, amortizationType, interestType, interestCalculationPeriodType, transactionProcessingStrategyCode, expectedDisbursementDate, submittedOnDate, loanType
Optional Fields: graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, linkAccountId, allowPartialPeriodInterestCalculation, fixedEmiAmount, maxOutstandingLoanBalance, disbursementData, graceOnArrearsAgeing, createStandingInstructionAtDisbursement (requires linkedAccountId if set to true)
Additional Mandatory Fields if interest recalculation is enabled for product and Rest frequency not same as repayment period: recalculationRestFrequencyDate
Additional Mandatory Fields if interest recalculation with interest/fee compounding is enabled for product and compounding frequency not same as repayment period: recalculationCompoundingFrequencyDate
Additional Mandatory Field if Entity-Datatable Check is enabled for the entity of type loan: datatables

## Parameters
- `command` (query, string): command

## Request body (application/json)
- `allowFullTermForTranche` (boolean): Allow full term length for each tranche disbursement
- `amortizationType` (integer)
- `buyDownFeeCalculationType` (string)
- `buyDownFeeIncomeType` (string)
- `buyDownFeeStrategy` (string)
- `capitalizedIncomeCalculationType` (string)
- `capitalizedIncomeStrategy` (string)
- `capitalizedIncomeType` (StringEnumOptionData)
- `charges` (array of PostLoansRequestChargeData)
- `clientId` (integer)
- `datatables` (array of PostLoansDataTable)
- `dateFormat` (string)
- `daysInYearCustomStrategy` (string)
- `daysInYearType` (integer)
- `disbursedAmountPercentageForDownPayment` (number)
- `disbursementData` (array of PostLoansDisbursementData): List of PostLoansDisbursementData
- `enableAutoRepaymentForDownPayment` (boolean)
- `enableBuyDownFee` (boolean)
- `enableDownPayment` (boolean)
- `enableIncomeCapitalization` (boolean)
- `enableInstallmentLevelDelinquency` (boolean)
- `expectedDisbursementDate` (string)
- `externalId` (string)
- `fixedEmiAmount` (number)
- `fixedLength` (integer)
- `fixedPrincipalPercentagePerInstallment` (number)
- `graceOnArrearsAgeing` (integer)
- `graceOnInterestCharged` (integer)
- `graceOnInterestPayment` (integer)
- `graceOnPrincipalPayment` (integer)
- `inArrearsTolerance` (number)
- `interestCalculationPeriodType` (integer)
- `interestRateFrequencyType` (integer)
- `interestRatePerPeriod` (number)
- `interestRecognitionOnDisbursementDate` (boolean)
- `interestType` (integer)
- `linkAccountId` (integer)
- `loanScheduleProcessingType` (string)
- `loanTermFrequency` (integer)
- `loanTermFrequencyType` (integer)
- `loanType` (string)
- `locale` (string)
- `maxOutstandingLoanBalance` (number): Maximum allowed outstanding balance
- `numberOfRepayments` (integer)
- `originators` (array of PostLoansOriginatorData): Optional array of originators to associate with this loan. Each entry can reference an existing originator by 'id' or 'externalId'. If the global config 'enable_originator_creation_during_loan_application' is enabled, non-existing originators will be auto-created using the provided details (name, typeId, channelTypeId).
- `principal` (number)
- `productId` (integer)
- `repaymentEvery` (integer)
- `repaymentFrequencyType` (integer)
- `repaymentStartDateType` (integer)
- `repaymentsStartingFromDate` (string)
- `submittedOnDate` (string)
- `transactionProcessingStrategyCode` (string)

## Responses
- `200`: OK

## Response fields
- `clientId` (integer)
- `currency` (GetLoansLoanIdCurrency): currency
- `loanId` (integer)
- `loanTermInDays` (integer)
- `officeId` (integer)
- `periods` (array of PostLoansRepaymentSchedulePeriods)
- `resourceExternalId` (string)
- `resourceId` (integer)
- `totalFeeChargesCharged` (integer)
- `totalInterestCharged` (number)
- `totalOutstanding` (integer)
- `totalPenaltyChargesCharged` (integer)
- `totalPrincipalDisbursed` (integer)
- `totalPrincipalExpected` (integer)
- `totalPrincipalPaid` (integer)
- `totalRepayment` (integer)
- `totalRepaymentExpected` (number)
- `totalWaived` (integer)
- `totalWrittenOff` (integer)

## Example request (cURL)
```bash
curl -X POST \
  'http://localhost:8080/lokta-lms/api/v1/loans' \
  -u '{username}:{password}' \
  -H 'Tenant-Identifier: default' \
  -H 'Content-Type: application/json' \
  -d '{
  "allowFullTermForTranche": false,
  "amortizationType": 1,
  "buyDownFeeCalculationType": "FLAT",
  "buyDownFeeIncomeType": "FEE",
  "buyDownFeeStrategy": "EQUAL_AMORTIZATION",
  "capitalizedIncomeCalculationType": "FLAT",
  "capitalizedIncomeStrategy": "EQUAL_AMORTIZATION",
  "capitalizedIncomeType": {
    "code": "string",
    "id": "string",
    "value": "string"
  },
  "charges": [
    {
      "amount": 1,
      "chargeId": 1
    }
  ],
  "clientId": 1
}'
```

## Example response
```json
{
  "clientId": 1,
  "currency": {
    "code": "UGX",
    "decimalPlaces": 2,
    "displayLabel": "Uganda Shilling (USh)",
    "displaySymbol": "USh"
  },
  "loanId": 1,
  "loanTermInDays": 366
}
```

Interactive: https://developer.lokta.ai/reference.html#operation/calculateOrSubmitLoanApplication
