> ## 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 User Loans

> List a borrower active loans in a market

Returns every open loan held by one address in one market, read from the contract. Closed, repaid, and fully liquidated loans are excluded.

A borrower can hold several loans in the same market at once. Each is independent, with its own collateral, debt, and health factor, and each is liquidated separately.

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>
<ParamField path="userAddress" type="string" required>Borrower address, 0x-prefixed with 40 hex characters.</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="userAddress" type="string">The address queried, echoed back.</ResponseField>

    <ResponseField name="loans" type="array">
      Active loans. Each entry has the same shape as [Get Loan](/endpoints/external-securities-lending/get-loan): `loanId`, `borrower`, `collateralAmount`, `principal`, `accruedInterest`, `healthFactor`, `active`.
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  An empty `loans` array means the borrower has no open loans here. It does not distinguish that from a failed chain read, which also returns an empty array. Confirm the market is reachable through [Get Market Metrics](/endpoints/external-securities-lending/get-metrics) if an empty result is unexpected.
</Note>

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

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/lending-external-securities/api/positions/${marketId}/user-loans/${address}`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  const totalDebt = data.loans.reduce(
    (sum, l) => sum + Number(l.principal) + Number(l.accruedInterest),
    0
  );
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "userAddress": "0xabc...def",
      "loans": [
        {
          "loanId": "5",
          "borrower": "0xabc...def",
          "collateralAmount": "1000.000000000000000000",
          "principal": "50000.000000",
          "accruedInterest": "128.750000",
          "healthFactor": "1.842000000000000000",
          "active": true
        },
        {
          "loanId": "9",
          "borrower": "0xabc...def",
          "collateralAmount": "250.000000000000000000",
          "principal": "12000.000000",
          "accruedInterest": "14.200000",
          "healthFactor": "1.204000000000000000",
          "active": true
        }
      ]
    }
  }
  ```
</ResponseExample>
