> ## 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 Escrowed Collateral

> Read collateral the custody adapter holds in escrow for a holder

Returns the collateral a custody-mode adapter is holding in escrow for a specific address.

Escrow is a fail-safe rather than a failure. When a custody adapter returns collateral and the token's compliance rules block the transfer, the adapter escrows the balance instead of reverting the whole operation. The holder later reclaims it through [Claim Escrowed Collateral](/endpoints/external-securities-lending/claim-escrowed-collateral). Read this endpoint first, because claiming an empty escrow reverts.

<Note>
  Custody-mode markets only. A `FREEZE` market never escrows, because collateral never leaves the borrower's wallet, and the call is refused with `NOT_CUSTODY_MODE`.
</Note>

## Path Parameters

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

<ParamField path="holderAddress" type="string" required>Address to read the escrow for.</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="holderAddress" type="string">The address queried, lowercased.</ResponseField>
    <ResponseField name="adapterAddress" type="string">Custody adapter holding the escrow.</ResponseField>
    <ResponseField name="escrowedCollateral" type="string">Escrowed amount as a decimal string in the collateral token's decimals. `0.0` when nothing is held.</ResponseField>
    <ResponseField name="escrowedCollateralRaw" type="string">The same amount in the token's smallest unit.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/lending-external-securities/api/positions/{marketId}/escrowed-collateral/0xabc7f1093d5e26b804a1c3f78de025916b47c0d3" \
    -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}/escrowed-collateral/${holder}`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  const claimable = data.escrowedCollateralRaw !== '0';
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "holderAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
      "adapterAddress": "0x4d2b93f70e18c6a5d34b027fe95c81a6730d77ae",
      "escrowedCollateral": "250.000000000000000000",
      "escrowedCollateralRaw": "250000000000000000000"
    }
  }
  ```

  ```json Error - Not Custody Mode theme={null}
  {
    "success": false,
    "error": {
      "code": "NOT_CUSTODY_MODE",
      "message": "Escrow only applies to custody-mode markets"
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                | HTTP  | Cause                                                                   |
| ------------------- | ----- | ----------------------------------------------------------------------- |
| `NOT_CUSTODY_MODE`  | `400` | The market runs in `FREEZE` mode                                        |
| `ESCROW_UNREADABLE` | `400` | The custody adapter escrow could not be read from the network right now |
| `VALIDATION_ERROR`  | `400` | `holderAddress` is not a valid address                                  |
| `MARKET_NOT_FOUND`  | `404` | No market with this ID on your instance                                 |
