Skip to main content
POST
Create a loan
Creates a loan against an existing customer using one of the configured loan products. The returned loan is already Active and ready for repayments. Loan terms (term length, repayment schedule, interest rate, amortization, etc.) are inherited from the chosen productId, so the request body carries only the three fields that vary per loan.

Request body

string
required
The externalId of the customer this loan is for — the identifier you chose when creating the customer, not the numeric LMS id. The service resolves it against the LMS before submitting anything; an unknown externalId fails with not_found and no loan is created.
integer
required
The loan product to use. List available products via GET /v1/loan-products.
number
required
Requested principal amount. Must be greater than 0, within the product’s minPrincipal/maxPrincipal bounds, and no more than the customer’s availableCreditLimit (see Credit limit). The full principal is approved and disbursed in the same call.
string
Partner-supplied identifier for the loan (e.g. your wallet transaction reference). Send it on every create: it is the call’s idempotency key. Creating a loan is several ledger steps (submit, approve, disburse), so if your call times out you cannot know how far it got. Retry with the same externalId, customer, product and principal and the service finishes whatever is left and returns the loan with 200 — or, if the earlier attempt had already completed, returns that loan unchanged. Never retry without the externalId: that creates a second loan.The same externalId with a different customer, product or principal, or one that belongs to a loan already closed, overpaid, rejected or withdrawn, is refused with 409 already_exists (loan_external_id_exists). Once set, you can reference the loan on every route via /v1/loans/external/{externalId}/... instead of the numeric LMS id.

Credit limit

Before anything is submitted to the LMS, the service checks the principal against the customer’s availableCreditLimit: the same figure GET /v1/credit-scorecard returns.
  • A customer with an active loan, or who owes anything on any loan, has an available limit of 0 and cannot take a new loan until it is repaid and closed.
  • A loan that was never disbursed (still submitted or approved) does not count: it lent nothing, so it does not block a new loan.
  • A customer who owes nothing can borrow up to their finalCreditLimit. An unscored customer (halopesaGrade XX) has a limit of 0.
A request above the limit is refused with 400 failed_precondition (credit_limit_exceeded) and no loan is created. The message gives the figures, e.g. principal 5000.00 exceeds the customer's availableCreditLimit of 2000.00. Requests for the same customer are handled one at a time. If you send a second loan request while the first is still being processed (a double tap, or a retry under a new externalId), the second waits for the first to finish and is then checked against the customer’s new position, so it is refused once the first loan exists. If it has to wait more than about 15 seconds it is refused with 409 aborted (loan_create_in_progress) and nothing is created; retry shortly. If the limit cannot be read at that moment (the credit scoring service or the LMS is unavailable), the loan is refused with 503 unavailable rather than granted unchecked. Retry with the same externalId. Keep your own pre-offer check on the scorecard: it lets you show the customer what they can borrow. This check is the backstop, so that a stale or skipped offer can never disburse more than the limit. A retry of a create that already succeeded is not refused, even though the customer now owes that loan: with the same externalId it returns the existing loan with 200 as described below.

Example

Response

200 OK returns the freshly-created and disbursed loan object.
The id (string) is what every downstream call uses (repayments, get, etc.). totalOutstanding is the headline “how much is owed” amount; nextDueDate / nextDueAmount are the maturity date and the amount owed by it. dueDateTime is the exact instant the loan falls due and the overdue penalty fires if it is still unpaid.
disbursedAt and dueDateTime on this response are computed from the instant the disbursal was confirmed. Subsequent reads serve them from the loan’s penalty schedule, which the platform records within about fifteen minutes; a GET in those first minutes may omit the two fields. The values agree to the second once present.
Asymmetry to be aware of: the request customerId carries the customer’s externalId, but the response customerId is the numeric LMS id (as a string) — the same value every read endpoint returns. Your externalId still appears on the customer object itself.

Errors