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

# Unpublish Terms

> Take a market terms of use offline without deleting them

Takes the market's terms of use offline. [Get Terms](/endpoints/lending/get-terms) answers `TERMS_NOT_PUBLISHED` for every instance from then on, and loan builds on the market, [Open Loan](/endpoints/lending/open-loan) and [Borrow More](/endpoints/lending/borrow-more), carry a `TERMS_NOT_PUBLISHED` warning. Nothing on chain changes and nothing is signed.

Despite the method, nothing is deleted. The text stays stored, every version stays readable through [Get Terms Version](/endpoints/lending/get-terms-version), and no new version is written, so the version number does not move. A later [Save Terms](/endpoints/lending/save-terms) with `published` left at `true` puts the terms back online as a new version.

The same authority check as Save Terms applies. One of this instance's verified wallets must be the lender of record recorded on the factory, or hold the market's admin role or issuer role.

## Path Parameters

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

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="unpublished" type="boolean">`true` whenever the market has a terms record, including one that was already offline. `false` only when the market never had terms.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/terms" \
    -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}/terms`,
    { method: 'DELETE', headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { success, data, error } = await res.json();
  if (!success) throw new Error(`${error.code}: ${error.message}`);
  console.log(data.unpublished ? 'Terms are offline' : 'The market never had terms');
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "unpublished": true
    }
  }
  ```

  ```json Error - Not Authorized theme={null}
  {
    "success": false,
    "error": {
      "code": "NOT_CURATOR",
      "message": "This market has no lender of record yet. The terms of use are authored by the lender once it has taken the role."
    }
  }
  ```
</ResponseExample>

## 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                                                                     |
| `TERMS_DELETE_FAILED`   | `400` | The update failed for a reason the service did not classify                                            |
| `NOT_CURATOR`           | `403` | No verified wallet of this instance is the lender of record or holds the market's admin or issuer role |
| `MARKET_NOT_FOUND`      | `404` | No market with this ID on your instance                                                                |
| `WALLET_NOT_CONFIGURED` | `412` | This instance has no verified wallet                                                                   |
| `MARKET_UNREADABLE`     | `503` | The market's roles could not be read on chain, so authority could not be established. Retry shortly    |
