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

> Read the market loan terms, which loans a change would reach, and the exit horizon

Reads the market's loan terms live from the chain: the maximum duration, the terminal due date, the grace period, the term penalty and the extension switch. It also says which of those a change would reach on loans already open, and when the book could have turned liquid.

A termed loan falls due at its maturity. Once the grace period after it has run out, an unrepaid loan becomes realizable whatever its health. The whole claim is then realized at the term penalty, and collateral beyond what that needs returns to the borrower in the same transaction. Change the terms with [Set Term Config](/endpoints/lending/set-term-config).

## Path Parameters

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

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="termStamping" type="string">`PER_LOAN` when the market stamps the grace period and term penalty onto each loan at signing, so a change reaches new loans only. `MARKET_CONFIG` on the earlier implementation, which reads both from the market at realization, so a change reaches every open termed loan. `UNKNOWN` when the implementation could not be read.</ResponseField>
    <ResponseField name="stampedOnNewLoansOnly" type="array">The term fields a change reaches on new loans only. The maturity fields are always here, and on `PER_LOAN` so are the grace period and the penalty.</ResponseField>
    <ResponseField name="appliesToOpenLoans" type="array">The term fields a change also reaches on open loans: `termGracePeriod` and `termPenalty` unless the market is `PER_LOAN`, where the array is empty.</ResponseField>
    <ResponseField name="openLoansFollowingConfig" type="integer">On a `PER_LOAN` market, open termed loans signed before the market stamped terms. They still follow the live configuration. Counted over at most 200 of the positions Trusset has recorded for the market. Present only on `PER_LOAN` markets, and only when the count could be made.</ResponseField>
    <ResponseField name="termsEnabled" type="boolean">`true` when the market sets a maximum duration, a terminal due date, or both.</ResponseField>
    <ResponseField name="maxLoanDurationSeconds" type="string">Longest a new loan may run, in seconds. `"0"` when no duration is set.</ResponseField>
    <ResponseField name="termGracePeriodSeconds" type="string">Time between maturity and realizability, in seconds.</ResponseField>
    <ResponseField name="terminalDueDate" type="string">Unix seconds by which every new loan falls due, whatever its duration. `null` when none is set.</ResponseField>
    <ResponseField name="marketDueFloor" type="string">Unix seconds below which no termed loan's effective maturity falls, raised by a `FLOOR` extension. `null` when none is set.</ResponseField>
    <ResponseField name="termPenaltyBps" type="integer">Charge on the whole claim when a loan is realized for its term, in basis points. Never above the liquidation penalty.</ResponseField>
    <ResponseField name="allowExtension" type="boolean">Whether the extension flow is switched on. See [Set Allow Extension](/endpoints/lending/set-allow-extension).</ResponseField>
    <ResponseField name="latestDueAt" type="string">The latest maturity any loan on this market has carried, in unix seconds. It only ever rises, so it can outlive the loan that set it. `null` when no loan has carried one.</ResponseField>
    <ResponseField name="bookEmpty" type="boolean">`true` when nothing is lent out. `null` when it could not be read.</ResponseField>

    <ResponseField name="exitHorizon" type="object">
      When the whole book can have turned liquid, absent new borrows.

      <Expandable>
        <ResponseField name="horizon" type="string">Unix seconds: the latest maturity plus its grace. `null` when no loan has carried a term.</ResponseField>
        <ResponseField name="bounded" type="boolean">`false` when a loan without a term is outstanding. No horizon exists then: withdrawals depend on borrowers repaying.</ResponseField>
        <ResponseField name="applies" type="boolean">`true` when a bounded horizon exists and the book is not empty.</ResponseField>
        <ResponseField name="basis" type="string">`OPEN_LOANS` when the horizon was taken from the open loans' own maturities, `HIGH_WATER_MARK` when it falls back to `latestDueAt` plus the longest grace. Present only when `applies` is `true`.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="closedToNewLoans" type="boolean">`true` when the terminal due date has passed. The contract then refuses every new loan, while repayment, collateral release and liquidity withdrawal stay open.</ResponseField>
    <ResponseField name="closedReason" type="string">Why the market is closed to new loans and how the issuer reopens it. `null` when it is open.</ResponseField>

    <ResponseField name="termFloorExposure" type="object">
      Whether a term realization sold at the auction floor could leave the pool short. `null` when the market configuration could not be read.

      <Expandable>
        <ResponseField name="exposed" type="boolean">`true` when terms and Dutch auctions are both on, the term penalty does not cover the gap to the auction floor, and the implementation does not size the seized collateral against the floor.</ResponseField>
        <ResponseField name="uncoveredBps" type="integer">The part of that gap the term penalty leaves uncovered, in basis points of the claim. `0` when the market sizes the seized collateral against the floor.</ResponseField>
        <ResponseField name="sliceSizedToFloor" type="boolean">`true` on the implementation that sizes the seized collateral against the auction floor, where the exposure does not arise.</ResponseField>
        <ResponseField name="floorGapBps" type="integer">`10000` minus `auctionMinPremiumBps`.</ResponseField>
        <ResponseField name="auctionMinPremiumBps" type="integer">The auction floor, in basis points of the attested price.</ResponseField>
        <ResponseField name="termPenaltyBps" type="integer">The term penalty.</ResponseField>
        <ResponseField name="useDutchAuction" type="boolean">Whether Dutch auctions are on.</ResponseField>
        <ResponseField name="reserveCoversFloorSales" type="boolean">`true` when the insurance fund is drawn first for a sale settled below the debt. `false` when the shortfall lands on liquidity providers, `null` when the implementation could not be read.</ResponseField>
        <ResponseField name="reserveFloorSaleNote" type="string">That answer in one sentence.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/term-config" \
    -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/markets/${marketId}/term-config`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  if (data.appliesToOpenLoans.length > 0) {
    console.warn(`A term change reaches open loans too: ${data.appliesToOpenLoans.join(', ')}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "termStamping": "PER_LOAN",
      "stampedOnNewLoansOnly": ["maxLoanDuration", "terminalDueDate", "termGracePeriod", "termPenalty"],
      "appliesToOpenLoans": [],
      "openLoansFollowingConfig": 0,
      "termsEnabled": true,
      "maxLoanDurationSeconds": "15552000",
      "termGracePeriodSeconds": "259200",
      "terminalDueDate": null,
      "marketDueFloor": null,
      "termPenaltyBps": 200,
      "allowExtension": true,
      "latestDueAt": "1789516800",
      "bookEmpty": false,
      "exitHorizon": {
        "horizon": "1789776000",
        "bounded": true,
        "applies": true,
        "basis": "OPEN_LOANS"
      },
      "closedToNewLoans": false,
      "closedReason": null,
      "termFloorExposure": {
        "useDutchAuction": false,
        "auctionMinPremiumBps": 9500,
        "termPenaltyBps": 200,
        "floorGapBps": 500,
        "uncoveredBps": 0,
        "exposed": false,
        "sliceSizedToFloor": true,
        "reserveCoversFloorSales": true,
        "reserveFloorSaleNote": "The reserve is drawn first for a sale settled below the debt and only what it cannot pay lands on liquidity providers."
      }
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                | HTTP  | Cause                                                            |
| ------------------- | ----- | ---------------------------------------------------------------- |
| `MISSING_MARKET_ID` | `400` | The `marketId` path segment is longer than 100 characters        |
| `MARKET_NOT_FOUND`  | `404` | No market with this ID on your instance                          |
| `INTERNAL_ERROR`    | `500` | The market's term configuration could not be read. Retry shortly |
