> ## 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 Liquidation Config

> Check whether a market can be liquidated and settled

Returns the readiness of the liquidation path for a market: every gate `liquidate` passes through, the onward delivery of seized collateral to the sale recipient, and aggregate liquidation counters.

Call this before relying on liquidation. A market can accept loans while its liquidation path is incomplete, which leaves bad debt with no remedy.

Realization is two hops with two different signers, so readiness carries two aggregates. `seizureConfigured` covers everything up to and including moving collateral to the router. `isConfigured` covers that and one thing more: the collateral must also be able to leave the router for the sale recipient.

## Path Parameters

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

## Query Parameters

<ParamField query="signerAddress" type="string">
  Wallet to evaluate the role and signer checks against. Omit to use your instance's registered wallet. Anything that is not a valid address is ignored.
</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="marketId" type="string">Market ID.</ResponseField>
    <ResponseField name="marketAddress" type="string">Market contract.</ResponseField>
    <ResponseField name="liquidationRouterAddress" type="string">This market's liquidation router, resolved per market. Also present as `routerAddress`.</ResponseField>
    <ResponseField name="routerAuthorized" type="boolean">The router accepts liquidations originating from this market. Set by the factory at deployment.</ResponseField>
    <ResponseField name="routerTokenEligible" type="boolean">The router can legally receive the collateral token under its ERC-3643 compliance rules, either as an allow-listed contract or as a verified identity. Without this, seizing collateral reverts.</ResponseField>
    <ResponseField name="liquidatorRoleReady" type="boolean">The resolved signer holds `LIQUIDATOR_ROLE` on the market, which calling `liquidate` requires. Null when it could not be read.</ResponseField>
    <ResponseField name="operatorRoleReady" type="boolean">The resolved signer holds `OPERATOR_ROLE` on the router, which withdrawal and settlement require.</ResponseField>
    <ResponseField name="signerAddress" type="string">The address the role checks were resolved against, or null when none was available.</ResponseField>
    <ResponseField name="collateralTransferAllowed" type="boolean">Whether the collateral token would permit the seizure transfer to the router. Null when it could not be evaluated, which includes every `FREEZE` market, where collateral is frozen in place rather than moved. `collateralTransferChecked` says whether the check ran, and `collateralTransferCode` carries the restriction code below.</ResponseField>
    <ResponseField name="saleRecipient" type="string">The recipient the lender of record fixed for onward sale, or null when none is set.</ResponseField>
    <ResponseField name="saleDeliveryAllowed" type="boolean">Whether the collateral token would permit the onward transfer from the router to that recipient. `saleDeliveryChecked` and `saleDeliveryCode` accompany it.</ResponseField>
    <ResponseField name="priceStale" type="boolean">Whether the oracle price sits outside its window, which makes `liquidate` revert. `priceAge` in seconds accompanies it.</ResponseField>
    <ResponseField name="seizureConfigured" type="boolean">Every gate up to and including the seizure is satisfied.</ResponseField>
    <ResponseField name="isConfigured" type="boolean">`seizureConfigured`, plus onward delivery to the sale recipient.</ResponseField>
    <ResponseField name="canSeizeNow" type="boolean">`seizureConfigured` and the price is not stale.</ResponseField>
    <ResponseField name="canRealizeNow" type="boolean">`isConfigured` and the price is not stale.</ResponseField>
    <ResponseField name="routerTokenRequirement" type="string">What the collateral token asks of the router, when it could be established.</ResponseField>
    <ResponseField name="liquidatorViaBot" type="boolean">`true` when `LIQUIDATOR_ROLE` is held by a connected liquidation bot rather than by a signer wallet. `liquidatorBotAddress` names it.</ResponseField>
    <ResponseField name="operatorAddress" type="string">The address the operator-role check ran against. `operatorDeclared` says whether the market records a liquidation operator at all.</ResponseField>
    <ResponseField name="saleRecipientFixed" type="boolean">Whether the sale recipient is fixed on the router. `saleRecipientRotatable` says whether the router supports rotating it, and `configuredSaleVenue` and `saleVenue` name the destination that applies.</ResponseField>
    <ResponseField name="collateralTransferChecked" type="boolean">Whether the seizure transfer probe ran. `collateralTransferCode` and `collateralTransferAmount` accompany it, and `saleDeliveryChecked`, `saleDeliveryCode` and `saleDeliveryAmount` do the same for the onward transfer.</ResponseField>
    <ResponseField name="priceAge" type="integer">Seconds since the oracle was last priced.</ResponseField>
    <ResponseField name="readFailed" type="boolean">`true` when at least one gate could not be read. `unverifiedSections` lists which, `errors` carries the same as objects, and `unverifiedReason` states it in one sentence. A failed read is never reported as a closed gate.</ResponseField>
    <ResponseField name="blockedConfirmed" type="boolean">`true` only when a gate was actually read and found closed. `seizureBlockedConfirmed` is the same restricted to the seizure gates.</ResponseField>
    <ResponseField name="blockedReason" type="string">The first gate that fails, in words. Null when nothing blocks.</ResponseField>

    <ResponseField name="stats" type="object">
      <Expandable>
        <ResponseField name="totalLiquidations" type="integer">Lifetime liquidations on this market.</ResponseField>
        <ResponseField name="pendingLiquidationDebt" type="string">Debt seized but not yet settled, in borrow asset units.</ResponseField>
        <ResponseField name="totalAuctions" type="integer">Lifetime Dutch auctions created.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="onChainError" type="string">Present when the chain reads failed. The readiness fields and `stats` are absent in that case.</ResponseField>
  </Expandable>
</ResponseField>

<Warning>
  `routerTokenEligible` is reported as `true` when the collateral token exposes no identity registry and no contract allow-list, because eligibility cannot be evaluated without one. That is an unknown, not a pass. Confirm the router's compliance status out of band for such markets.
</Warning>

<Note>
  `operatorRoleReady` and `liquidatorRoleReady` are evaluated against `signerAddress`, or against your instance's registered wallet when it is omitted. If the market's lender of record named a different `liquidationOperator`, settlement runs through that wallet rather than this API and the flag reads `false` by design. Pass `signerAddress` to ask about that wallet instead.
</Note>

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

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "marketId": "clx_secmarket_001",
      "marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
      "routerAddress": "0x067a3feea46649adad8e31c33b3a4d8774b8d8cf",
      "liquidationRouterAddress": "0x067a3feea46649adad8e31c33b3a4d8774b8d8cf",
      "routerAuthorized": true,
      "routerTokenEligible": true,
      "liquidatorRoleReady": true,
      "operatorRoleReady": true,
      "signerAddress": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
      "collateralTransferChecked": true,
      "collateralTransferAllowed": true,
      "collateralTransferCode": null,
      "saleRecipient": "0x5a72e0b41d3f8c62079ae4b1d38f0c95261ba473",
      "saleDeliveryChecked": true,
      "saleDeliveryAllowed": true,
      "saleDeliveryCode": null,
      "priceStale": false,
      "priceAge": 184,
      "seizureConfigured": true,
      "isConfigured": true,
      "canSeizeNow": true,
      "canRealizeNow": true,
      "blockedReason": null,
      "stats": {
        "totalLiquidations": 2,
        "pendingLiquidationDebt": "0.000000",
        "totalAuctions": 1
      }
    }
  }
  ```

  ```json Response - Router Not Eligible theme={null}
  {
    "success": true,
    "data": {
      "marketId": "clx_secmarket_001",
      "marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
      "routerAddress": "0x067a3feea46649adad8e31c33b3a4d8774b8d8cf",
      "liquidationRouterAddress": "0x067a3feea46649adad8e31c33b3a4d8774b8d8cf",
      "routerAuthorized": true,
      "routerTokenEligible": false,
      "liquidatorRoleReady": true,
      "operatorRoleReady": true,
      "signerAddress": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
      "collateralTransferChecked": true,
      "collateralTransferAllowed": false,
      "collateralTransferCode": 2,
      "saleRecipient": null,
      "saleDeliveryChecked": false,
      "saleDeliveryAllowed": null,
      "saleDeliveryCode": null,
      "priceStale": false,
      "priceAge": 92,
      "seizureConfigured": false,
      "isConfigured": false,
      "canSeizeNow": false,
      "canRealizeNow": false,
      "blockedReason": "The liquidation router is not an eligible holder of the collateral token.",
      "stats": {
        "totalLiquidations": 0,
        "pendingLiquidationDebt": "0.000000",
        "totalAuctions": 0
      }
    }
  }
  ```
</ResponseExample>

## Transfer Restriction Codes

`collateralTransferCode` and `saleDeliveryCode` are the collateral token's own transfer restriction codes. `0` means the transfer is permitted, and `null` means the check did not run.

| Code | Meaning                                             | Lever that lifts it                                                     |
| ---- | --------------------------------------------------- | ----------------------------------------------------------------------- |
| `1`  | The sender is not a verified holder on this token   | Restore the holder's verified status on the token's identity registry   |
| `2`  | The receiver is not a verified holder on this token | Restore the receiver's verified status on the token's identity registry |
| `3`  | The sender address is frozen on this token          | Unfreeze the sender address                                             |
| `4`  | The receiver address is frozen on this token        | Unfreeze the receiver address                                           |
| `5`  | The token compliance module rejects this transfer   | Lift the restriction on the token's compliance contract                 |
| `6`  | The token is paused                                 | Un-pause the token                                                      |
| `7`  | The sender does not hold enough unfrozen balance    | Release the sender's frozen balance                                     |

## Error Codes

| Code                | HTTP  | Cause                                       |
| ------------------- | ----- | ------------------------------------------- |
| `NO_MARKET_ADDRESS` | `400` | The market has no on-chain address recorded |
| `MARKET_NOT_FOUND`  | `404` | No market with this ID on your instance     |
