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

# Get Liquidatable Loans

> List loans whose health factor has fallen below 1.0

Scans every active loan in the market and returns those eligible for liquidation. A loan qualifies when its health factor is strictly below `1.0`.

This is a full scan of the market's loan book, so response time grows with the number of loans. Poll it on a schedule rather than per page view.

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="totalActiveLoans" type="integer">Active loans scanned.</ResponseField>

    <ResponseField name="liquidatableLoans" type="array">
      <Expandable>
        <ResponseField name="loanId" type="integer">On-chain loan ID. Pass this to [Liquidate Loan](/endpoints/external-securities-lending/liquidate).</ResponseField>
        <ResponseField name="borrower" type="string">Borrower address.</ResponseField>
        <ResponseField name="collateralAmount" type="string">Collateral pledged, in collateral token units.</ResponseField>
        <ResponseField name="principal" type="string">Outstanding principal, in borrow asset units.</ResponseField>
        <ResponseField name="accruedInterest" type="string">Accrued unpaid interest, in borrow asset units.</ResponseField>
        <ResponseField name="healthFactor" type="string">Health factor at 18 decimal places. Always below `1.0` in this list.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="onChainError" type="string">Present when the scan failed. Both counters read zero in that case.</ResponseField>
  </Expandable>
</ResponseField>

<Warning>
  When the chain read fails the endpoint returns `200` with `totalActiveLoans: 0`, an empty `liquidatableLoans`, and an `onChainError` string. An empty list is therefore not proof that no loan is liquidatable. Always check for `onChainError` before concluding the book is healthy.
</Warning>

<Note>
  Health factors are computed against the oracle's stored price. If the price is stale the figures here are stale too. Push a current NAV with [Sync Oracle Price](/endpoints/external-securities-lending/sync-oracle) before acting on this list, or pass a `signedPrice` when liquidating so the contract prices against a fresh value.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/lending-external-securities/api/liquidations/{marketId}/liquidatable-loans" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/lending-external-securities/api/liquidations/${marketId}/liquidatable-loans`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  if (data.onChainError) throw new Error(`Scan failed: ${data.onChainError}`);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "totalActiveLoans": 12,
      "liquidatableLoans": [
        {
          "loanId": 7,
          "borrower": "0xabc...def",
          "collateralAmount": "500.000000000000000000",
          "principal": "42000.000000",
          "accruedInterest": "318.400000",
          "healthFactor": "0.942000000000000000"
        }
      ]
    }
  }
  ```

  ```json Response - Scan Failed theme={null}
  {
    "success": true,
    "data": {
      "totalActiveLoans": 0,
      "liquidatableLoans": [],
      "onChainError": "could not detect network"
    }
  }
  ```
</ResponseExample>
