> ## 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 Loan Auction

> Find the auction currently open against a loan

Looks up the Dutch auction the market's auction venue holds open against a specific loan. Use it to show a borrower that their collateral is being auctioned, or to check a loan before liquidating it again.

A loan carries at most one open auction at a time. While it is open, the market refuses `liquidate`, `addCollateral`, `withdrawCollateral` and `borrowMore` on that loan, and an expired auction keeps blocking them until it is settled through [Settle Expired Auction](https://docs.trusset.org/endpoints/lending/settle-expired-auction.md). Repayment stays available.

## Path Parameters

**marketId** `string` *required*

The market's record ID, as `id` on [List Markets](https://docs.trusset.org/endpoints/lending/list-markets.md), not its contract address. See [Market IDs](https://docs.trusset.org/endpoints/lending/list-markets.md#market-ids).

**loanId** `integer` *required*

On-chain loan ID. Must be a positive whole number written in digits only, at most 9007199254740991.

## Response Fields

**data** `object`

**loanId** `string`

The loan ID from the path, echoed back.

**auction** `object`

The open auction, with the same fields as [Get Auction](https://docs.trusset.org/endpoints/lending/get-auction.md) including `phase` and `venueAddress`, or `null` when there is none.

> [!WARNING]
>
> This is a live lookup, not a history. The venue unlinks a loan from its auction when the last unit sells or when the expired auction is settled, so a loan auctioned yesterday returns `auction: null` today. An auction that has passed its end time without settlement is still linked and comes back with `phase: "EXPIRED"`. To inspect a finished auction, query it by ID through [Get Auction](https://docs.trusset.org/endpoints/lending/get-auction.md).

> [!NOTE]
>
> A loan ID above the market's loan counter answers `404 LOAN_NOT_FOUND` instead. When the counter cannot be read, that check is skipped and the answer stays `auction: null`.
>
> `auction: null` also answers a market with no auction venue wired and a venue that could not be read. Confirm the venue through [Get Auction Module](https://docs.trusset.org/endpoints/lending/get-auction-module.md) before treating `null` as proof that no auction exists.

```bash cURL theme={null}
curl "https://api.trusset.org/lending-external-securities-v2/api/liquidations/{marketId}/loan-auction/7" \
  -H "X-API-Key: trusset_your_key_here"
```

```typescript TypeScript theme={null}
const res = await fetch(
  `https://api.trusset.org/lending-external-securities-v2/api/liquidations/${marketId}/loan-auction/${loanId}`,
  { headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
const auctionOpen = data.auction !== null;
```

```json Response - Auction Open theme={null}
{
  "success": true,
  "data": {
    "loanId": "7",
    "auction": {
      "auctionId": "3",
      "loanId": "7",
      "borrower": "0x7d2e9B4c1A8f03e6B5D9c2A7F4e18B06c3D5a92F",
      "collateralRemaining": "120.0",
      "debtRemaining": "11540.1",
      "currentPrice": "112.18",
      "endTime": 1718449200,
      "active": true,
      "expired": false,
      "biddable": true,
      "settleable": false,
      "phase": "RUNNING",
      "venueAddress": "0x5c3e8a91d2f04b7e6a1c9d38f0b2e47a6d15c8e3"
    }
  }
}
```

```json Response - No Auction theme={null}
{
  "success": true,
  "data": {
    "loanId": "7",
    "auction": null
  }
}
```

```json Error - Invalid Loan ID theme={null}
{
  "success": false,
  "error": {
    "code": "INVALID_LOAN_ID",
    "message": "Valid loan ID required"
  }
}
```

## Error Codes

| Code | HTTP | Cause |
| - | - | - |
| `MISSING_MARKET_ID` | `400` | The market ID is longer than 100 characters |
| `NO_MARKET_ADDRESS` | `400` | The market has no on-chain address recorded |
| `INVALID_LOAN_ID` | `400` | `loanId` is not a positive whole number in range, for example `0`, `1.5` or an 80-digit value |
| `MARKET_NOT_FOUND` | `404` | No market with this ID on your instance |
| `LOAN_NOT_FOUND` | `404` | No loan has been opened under this ID on the market |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.