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

> Read the published terms of use for a market

Returns the terms of use published by the market's lender of record. A borrow button cannot be shipped compliantly without them. This is where an integrating application fetches them: by API key, on the market it already knows, in the form it renders.

Only published terms are returned. A draft that was never promoted reads as if no terms exist.

## Path Parameters

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

## Query Parameters

<ParamField query="format" type="string" default="markdown">
  `markdown` or `html`. Any other value is rejected with `VALIDATION_ERROR`.
</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="terms" type="object">
      <Expandable>
        <ResponseField name="id" type="string">Terms record ID.</ResponseField>
        <ResponseField name="marketAddress" type="string">Market the terms belong to.</ResponseField>
        <ResponseField name="title" type="string">Document title.</ResponseField>
        <ResponseField name="version" type="integer">Current version number.</ResponseField>
        <ResponseField name="contentHash" type="string">Hash of the content, stable per version.</ResponseField>
        <ResponseField name="curatorAddress" type="string">Address of the lender of record that published this version.</ResponseField>
        <ResponseField name="published" type="boolean">Always `true` on this endpoint.</ResponseField>
        <ResponseField name="publishedAt" type="string">ISO 8601 publication timestamp.</ResponseField>
        <ResponseField name="createdAt" type="string">ISO 8601 creation timestamp.</ResponseField>
        <ResponseField name="updatedAt" type="string">ISO 8601 timestamp of the last save.</ResponseField>
        <ResponseField name="contentBytes" type="integer">Size of the source content in bytes.</ResponseField>
        <ResponseField name="format" type="string">Echoes the requested format.</ResponseField>
        <ResponseField name="content" type="string">Raw markdown. Present when `format` is `markdown`.</ResponseField>
        <ResponseField name="plainText" type="string">Rendered plain text. Present when `format` is `markdown`.</ResponseField>
        <ResponseField name="html" type="string">Rendered HTML. Present when `format` is `html`.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  The markdown form travels with its plain-text rendering in the same response, so displaying terms in a surface that has no markdown renderer never costs a second request.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/lending-external-securities/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/api/markets/${marketId}/terms?format=html`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  container.innerHTML = data.terms.html;
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "terms": {
        "id": "secterms_001",
        "marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
        "title": "ACME Secured Lending Facility: Terms of Use",
        "version": 3,
        "contentHash": "0x8c1f42a7d905b63e0f27c4a8b13d95e6027f4a81c39b6d20e5847af13c02b96d",
        "curatorAddress": "0x4e91a7c05d3b62f18a0c94e7db2358f1c60a4e93",
        "published": true,
        "publishedAt": "2025-06-10T09:12:44.000Z",
        "createdAt": "2025-05-28T14:03:07.000Z",
        "updatedAt": "2025-06-10T09:12:44.000Z",
        "contentBytes": 8421,
        "format": "markdown",
        "content": "# Terms of Use\n\n## 1. Parties\n...",
        "plainText": "Terms of Use\n\n1. Parties\n..."
      }
    }
  }
  ```

  ```json Error - Not Published theme={null}
  {
    "success": false,
    "error": {
      "code": "TERMS_NOT_PUBLISHED",
      "message": "The lender of record has not published terms of use for this market yet."
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                  | HTTP  | Cause                                                       |
| --------------------- | ----- | ----------------------------------------------------------- |
| `NO_MARKET_ADDRESS`   | `400` | The market has no on-chain address                          |
| `VALIDATION_ERROR`    | `400` | `format` is not `markdown` or `html`                        |
| `MARKET_NOT_FOUND`    | `404` | No market with this ID on your instance                     |
| `TERMS_NOT_PUBLISHED` | `404` | The lender of record has published no terms for this market |
