> ## 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.

# Operators

> Find markets seeking a lender of record, take the role, and manage the roles on each market

An operator is the institution that holds a lending market's lender-of-record role and runs the market. An issuer deploys a market without parties, and the market takes no loans until an operator adopts it. Only an institution Trusset approved as a lender of record can take the role through this API.

This group covers the endpoints built for that institution. They find and review markets seeking a lender of record, take the role, and manage the roles on each market afterwards. Running an adopted market, including liquidation management, is documented in [Lending](/endpoints/lending/introduction).

## Base Path

```
https://api.trusset.org/lending-external-securities-v2/api/markets
```

These are Lending API endpoints. Authentication, the response envelope, unsigned writes, rate limits and credits work as described in [Lending](/endpoints/lending/introduction). The queue endpoints that act on one market take its contract address, because a candidate usually does not record the market yet. After adoption, the `/markets/{marketId}` endpoints take the market ID that [Confirm Lender Role](/endpoints/operators/confirm-lender-role) returns.

| Endpoint | Method | Purpose |
| - | - | - |
| [List Pending Markets](/endpoints/operators/list-pending-markets) | GET | Every market on the network that still seeks a lender of record |
| [List Queued Markets](/endpoints/operators/list-queued-markets) | GET | The markets this instance can take, or is waiting on |
| [Get Queued Market](/endpoints/operators/get-queued-market) | GET | Everything to review before taking a market |
| [Accept Lender Role](/endpoints/operators/accept-lender-role) | POST | Builds the transaction that takes the role |
| [Confirm Lender Role](/endpoints/operators/confirm-lender-role) | POST | Records the mined adoption on this instance |
| [Get Operator](/endpoints/operators/get-operator) | GET | Who holds the role, the institution behind it, and the fees accrued |
| [Get Handover](/endpoints/operators/get-handover) | GET | Whether the oracle, rate model and insurance fund reached their named owners |
| [Get Access Role](/endpoints/operators/get-access-role) | GET | Whether an address holds a role on the market, its router or its oracle |
| [Set Access Role](/endpoints/operators/set-access-role) | POST | Grants or revokes one of six roles across the market's three contracts |
| [Set Liquidator Role](/endpoints/operators/set-liquidator-role) | POST | Grants or revokes `LIQUIDATOR_ROLE` on the market |

## Taking a market

<Warning>
  Adoption is final. No path returns the market to seeking a lender of record, and every address in the adoption terms receives its role in the same transaction. Check each one before signing.
</Warning>

<Steps>
  <Step title="Find a market">
    [List Queued Markets](/endpoints/operators/list-queued-markets) returns the markets this instance may take or is waiting on. Each row names its `origin`, and `canAccept` says whether this instance can take the market. [List Pending Markets](/endpoints/operators/list-pending-markets) shows every market on the network still seeking a lender of record.
  </Step>

  <Step title="Review it">
    [Get Queued Market](/endpoints/operators/get-queued-market) covers the market, its offering, the terms status and the asset data the issuer attested. It describes the collateral token twice, as the chain reports it and as the issuer published it, and ends with a deterministic review.
  </Step>

  <Step title="Take the role">
    [Accept Lender Role](/endpoints/operators/accept-lender-role) returns the adoption transaction. It names every party on the market, declares how seized collateral is realized, and approves the asset data version reviewed. The verified wallet that signs it becomes the market's operator wallet. Claiming an open market without a nomination takes two transactions, announced and then completed after a delay.
  </Step>

  <Step title="Record it">
    Once the transaction mines, [Confirm Lender Role](/endpoints/operators/confirm-lender-role) records the market on this instance. The `market.id` it returns is the ID every `/markets/{marketId}` endpoint takes from then on.
  </Step>

  <Step title="Complete the handover">
    On a current market, adoption hands the oracle, rate model and insurance fund to their named owners in the same transaction. On a market from an earlier factory generation, each named owner must accept. [Get Handover](/endpoints/operators/get-handover) returns what is still outstanding.
  </Step>
</Steps>

The market then continues through the [market lifecycle](/endpoints/lending/introduction#market-lifecycle): authorize, configure, publish terms, price, fund and lend.

## Roles

Roles sit on three contracts: the market, its liquidation router and its price oracle. Adoption grants each party named in its terms the matching role. Add or remove holders later with [Set Access Role](/endpoints/operators/set-access-role), and check any address with [Get Access Role](/endpoints/operators/get-access-role). The wallet that administers a role signs each change, and the same POST with `txHash` verifies the mined transaction.

<Warning>
  Revoking `MARKET_ADMIN` or `ROUTER_ADMIN` from its last holder leaves that contract with no admin. Nobody could then grant its roles or upgrade it, and neither the contracts nor the API stop it.
</Warning>

[Set Liquidator Role](/endpoints/operators/set-liquidator-role) grants or revokes the role that starts liquidations. The liquidations themselves, their settlement, Dutch auctions and liquidation bots are in [Lending](/endpoints/lending/introduction#liquidations).
