# Loans The **Loan** resource (`ln_`) represents a loan originated from a CreditOffer and its Simulation. After creation, the loan goes through several automated steps until disbursement. ## Simulate a loan - [POST /credit-offers/{credit_offer_id}/simulations](https://dinie.redocly.app/apis/openapi/loans/createsimulation.md): Simulates a loan scenario for a specific credit offer. The customer can simulate multiple times with different amounts and terms before committing. The simulation is synchronous and returns installment amounts, fees, and total cost. The result is persisted and can be referenced when creating the loan via simulation_id. Only the latest simulation is valid for contracting (Last Write Record). ## Create a loan - [POST /loans](https://dinie.redocly.app/apis/openapi/loans/createloan.md): Creates a loan from a credit offer and a simulation accepted by the customer. The partner must include the simulation_id to link the agreed terms. The loan starts with status processing and automatically progresses through the cycle: contract_generated → awaiting_signatures → signed → disbursing → active. The signing_url for signing the CCB contract will be made available via webhook loan.contract_generated. Track the lifecycle via loan.* webhooks. ## Retrieve a loan - [GET /loans/{loan_id}](https://dinie.redocly.app/apis/openapi/loans/getloan.md): Returns the complete loan object with all lifecycle details. Important fields vary by status: signing_url is populated when awaiting_signatures, ccb_number when contract_generated, and net_amount after disbursement. Use together with loan.* webhooks to keep your system synchronized. ## List loan transactions - [GET /loans/{loan_id}/transactions](https://dinie.redocly.app/apis/openapi/loans/listtransactions.md): Lists the transactions (installments) of a loan. Each transaction represents an installment with due date (due_date), original amount, paid amount, and payment status (pending, paid, overdue). This is a read-only endpoint — payments are processed outside the API. Track payments in real time via webhook loan.payment_received. ## Loan created - [POST loan.created](https://dinie.redocly.app/apis/openapi/loans/onloancreated.md): Fires when the loan is created via POST /loans from an accepted offer. Includes the loan, offer, and customer IDs, as well as the requested amount and number of installments. The loan starts with processing status. Use it to register the loan in your system. ## Loan contract generated - [POST loan.contract_generated](https://dinie.redocly.app/apis/openapi/loans/onloancontractgenerated.md): Fires when the CCB (Cedula de Credito Bancario) contract is generated by Dinie. Includes the ClickSign signing_url for digital contract signing. Use it to present the signing link to the customer in your flow. ## Loan awaiting signatures - [POST loan.awaiting_signatures](https://dinie.redocly.app/apis/openapi/loans/onloanawaitingsignatures.md): Fires when the CCB contract is sent to ClickSign and awaits the customer's signature. Includes the updated signing_url. Use it to resend the signing link to the customer or display a reminder if the signature has not yet been completed. ## Loan signed - [POST loan.signed](https://dinie.redocly.app/apis/openapi/loans/onloansigned.md): Fires when the CCB contract is fully signed by all signatories on ClickSign. Includes the registered contract ccb_number. The next step is automatic disbursement. Use it to confirm to the customer that the contract has been successfully signed. ## Loan disbursing - [POST loan.disbursing](https://dinie.redocly.app/apis/openapi/loans/onloandisbursing.md): Fires when Dinie initiates the fund transfer to the customer's account. Includes the disbursement method used (e.g., pix). The transfer may take a few minutes. Use it to inform the customer that the amount is being transferred. ## Loan active - [POST loan.active](https://dinie.redocly.app/apis/openapi/loans/onloanactive.md): Fires when the disbursement is confirmed and the loan enters the repayment phase. Includes the requested amount (requested_amount) and the net amount received (net_amount). Use it to confirm to the customer that the funds have been credited and present the installment schedule. ## Loan payment received - [POST loan.payment_received](https://dinie.redocly.app/apis/openapi/loans/onloanpaymentreceived.md): Fires when an installment payment is recorded for the loan. Includes the amount paid, payment date, and corresponding installment number. Use it to update the outstanding balance in your system and notify the customer about the payment confirmation. ## Loan finished - [POST loan.finished](https://dinie.redocly.app/apis/openapi/loans/onloanfinished.md): Fires when all loan installments are paid off and the contract is closed. Includes the loan ID and finished status. Use it to mark the loan as completed in your system and check if new credit offers are available. ## Loan cancelled - [POST loan.cancelled](https://dinie.redocly.app/apis/openapi/loans/onloancancelled.md): Fires when the loan is cancelled before disbursement is completed. Includes the loan ID and cancelled status. Use it to update the status in your system and inform the customer. The original credit offer may still be available for a new request. ## Loan error - [POST loan.error](https://dinie.redocly.app/apis/openapi/loans/onloanerror.md): Fires when an unrecoverable error occurs in the loan, such as a disbursement failure or contract generation error. Includes the error code and message in the error field. Use it to alert your team, log the issue, and inform the customer about the situation.