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

> Read one terms library template with its text, its versions and the markets bound to it

Returns one template of this instance's terms library in full: the current text, the version history and every market whose terms are bound to it. Archived templates are returned too. See [List Terms Templates](https://docs.trusset.org/endpoints/lending/list-terms-templates.md) for how the library works.

Any key of the instance can read a template. Only templates of this instance are found.

## Path Parameters

**templateId** `string` *required*

Template ID from [List Terms Templates](https://docs.trusset.org/endpoints/lending/list-terms-templates.md), 1 to 100 characters.

## Response Fields

**data** `object`

**template** `object`

The template with the fields of a row on [List Terms Templates](https://docs.trusset.org/endpoints/lending/list-terms-templates.md#response-fields), `usage` included, plus the fields below.

**content** `string`

The current text as markdown.

**versions** `array`

Every version of the template, newest first, at most 100. The text of an older version is not returned.

**id** `string`

Version record ID.

**version** `integer`

Version number.

**title** `string`

Title at that version.

**contentHash** `string`

keccak256 over the UTF-8 bytes of the text at that version.

**createdBy** `string`

The issuer account that wrote the version, or `null`.

**createdAt** `string`

ISO 8601.

**markets** `array`

Every market whose terms of use are bound to the template.

**generation** `string`

`v2` for a market of the current lending factory, `v1` for one of the earlier generation.

**marketAddress** `string`

Market contract address.

**templateVersion** `integer`

The template version the market's terms were bound at.

**status** `string`

One of `NONE` (no terms), `UNPUBLISHED` (the terms are a draft or offline), `CUSTOM` (terms written without a template), `TEMPLATE_ARCHIVED` (the template is archived), `CUSTOMISED` (the text was edited after binding), `TEMPLATE_OUTDATED` (the template has a newer version than the market published) or `TEMPLATE` (the market serves the current version). The same statuses as `binding.status` on [Get Terms](https://docs.trusset.org/endpoints/lending/get-terms.md).

```bash cURL theme={null}
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/terms-library/cmwh2t9e10002l80d7s3k5m8c" \
  -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/terms-library/${templateId}`,
  { headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { success, data, error } = await res.json();
if (!success) throw new Error(`${error.code}: ${error.message}`);
const behind = data.template.markets.filter((market) => market.status === 'TEMPLATE_OUTDATED');
```

```json Response theme={null}
{
  "success": true,
  "data": {
    "template": {
      "id": "cmwh2t9e10002l80d7s3k5m8c",
      "instanceId": "cmrz4d1v20000cghx8k6p3m7t",
      "title": "Secured credit line, house terms",
      "version": 3,
      "contentHash": "0x6c1f0b2e9a47d385c2e0f81b97a4d6c3e5f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8",
      "archived": false,
      "archivedAt": null,
      "createdBy": "cmrz3a8q10000cghxf5w2n9k4",
      "updatedBy": "cmrz3a8q10000cghxf5w2n9k4",
      "createdAt": "2026-11-10T08:15:00.000Z",
      "updatedAt": "2026-11-16T13:58:22.000Z",
      "contentBytes": 172,
      "content": "# Terms of Use\n\n## 1. Lender of record\n\nACME Bank AG acts as lender of record for this market.\n\n## 2. Collateral\n\nPledged tokens stay frozen in the wallet of the borrower.\n",
      "usage": {
        "markets": 2,
        "current": 1,
        "outdated": 1,
        "customised": 0,
        "unpublished": 0
      },
      "versions": [
        {
          "id": "cmwj8a1b40011l80dz7c3e9qk",
          "version": 3,
          "title": "Secured credit line, house terms",
          "contentHash": "0x6c1f0b2e9a47d385c2e0f81b97a4d6c3e5f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8",
          "createdBy": "cmrz3a8q10000cghxf5w2n9k4",
          "createdAt": "2026-11-16T13:58:22.000Z"
        },
        {
          "id": "cmwi4f6g20009l80dk1m5p2xr",
          "version": 2,
          "title": "Secured credit line, house terms",
          "contentHash": "0x2b9e7d4c1a0f83e65d2c9b8a7f6e5d4c3b2a1908f7e6d5c4b3a2918f7e6d5c4b",
          "createdBy": "cmrz3a8q10000cghxf5w2n9k4",
          "createdAt": "2026-11-12T10:31:09.000Z"
        },
        {
          "id": "cmwh2t9e30003l80dh8j2n4vs",
          "version": 1,
          "title": "Secured credit line",
          "contentHash": "0x9a8b7c6d5e4f30210fedcba98765432100112233445566778899aabbccddeeff",
          "createdBy": "cmrz3a8q10000cghxf5w2n9k4",
          "createdAt": "2026-11-10T08:15:00.000Z"
        }
      ],
      "markets": [
        {
          "generation": "v2",
          "marketAddress": "0x1c74f9a2b0e63d581a47c02f9b8de3517a604c2b",
          "templateVersion": 3,
          "status": "TEMPLATE"
        },
        {
          "generation": "v2",
          "marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
          "templateVersion": 2,
          "status": "TEMPLATE_OUTDATED"
        }
      ]
    }
  },
  "error": null,
  "metadata": {
    "timestamp": "2026-11-17T10:00:00.000Z",
    "requestId": "550e8400-e29b-41d4-a716-446655440000",
    "instanceId": "cmrz4d1v20000cghx8k6p3m7t"
  }
}
```

## Error Codes

| Code | HTTP | Cause |
| - | - | - |
| `VALIDATION_ERROR` | `400` | `templateId` is longer than 100 characters |
| `TEMPLATE_READ_FAILED` | `400` | The template could not be read for a reason that carries no code of its own |
| `TEMPLATE_NOT_FOUND` | `404` | No template with this ID exists on this instance |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.