> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lms.bsa.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Undo disbursal

> Reverse a disbursement and return the loan to approved state.

Reverses a disbursement. The loan returns to **approved** state — the
first step back from the `Active` state that [`POST /v1/loans`](/loans/create)
lands at.

<Warning>
  This is only safe if **no repayment transactions have been recorded
  against the loan yet.** Once a borrower has made any repayment, you
  must first reverse those transactions (see
  [Reverse a repayment](/repayments/reverse)) before undoing the
  disbursal.
</Warning>

Two equivalent forms. **Prefer the externalId form** when you can —
it lets you drive the rollback flow off your own loan reference.

```bash theme={null}
# By loan externalId (recommended)
curl -X POST "$BASE/v1/loans/external/loan-ext-12345/undo-disbursal" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"note":"Wallet credit failed"}'

# Same effect, by LMS id
curl -X POST "$BASE/v1/loans/501/undo-disbursal" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"note":"Wallet credit failed"}'
```

## Path parameters

<ParamField path="loan_id" type="string" required />

## Request body

<ParamField body="note" type="string">
  Optional. Reason for the reversal.
</ParamField>

## Example

```bash theme={null}
curl -sf -X POST "$BASE/v1/loans/501/undo-disbursal" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"note": "Disbursed to wrong account"}'
```

## Response

`200 OK` returns the [loan object](/loans/overview) with `status="Approved"`.

## Errors

| Code        | When                                                    |
| ----------- | ------------------------------------------------------- |
| `not_found` | No loan with that ID                                    |
| `aborted`   | Loan has repayments recorded, or is not in active state |
