> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voyantcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Contract Template

> Update contract template metadata, JSON payload, or add/edit translations.

## Method

`PUT` `/v1/contract-templates/:id`

## Path Parameters

<ParamField path="id" type="uuid" required>Contract template ID.</ParamField>

## Body Parameters

<ParamField name="name" type="string">Updated name.</ParamField>
<ParamField name="type" type="string">Updated template type (`customer`, `supplier`, or `partner`).</ParamField>
<ParamField name="description" type="string">Updated description (set to `null` to clear).</ParamField>
<ParamField name="templateJson" type="object">Updated structured content.</ParamField>
<ParamField name="active" type="boolean">Enable or disable the template.</ParamField>
<ParamField name="translation" type="object">Upsert or replace a translation for the given locale.</ParamField>

<Expandable title="Translation object">
  <ParamField name="translation.locale" type="string" required>Locale code to upsert.</ParamField>
  <ParamField name="translation.name" type="string">Localized name.</ParamField>
  <ParamField name="translation.description" type="string">Localized description.</ParamField>
  <ParamField name="translation.bodyHtml" type="string">Localized HTML body.</ParamField>
  <ParamField name="translation.variables" type="object">Map of variables to localized hints.</ParamField>
</Expandable>

## Headers

<ParamField header="Authorization" type="string">Bearer token (requires `contract-templates:write`).</ParamField>
<ParamField header="content-type" type="string">`application/json`</ParamField>

## Request Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.voyantcloud.com/v1/contract-templates/ct_01J0BE7Z3S494F9D4T3E2QJ0XR" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -H "content-type: application/json" \
    -d '{
      "name": "Customer Master Agreement (2025)",
      "active": true,
      "translation": {
        "locale": "fr",
        "bodyHtml": "<p>Version 2025 pour {{buyer.name}}.</p>",
        "variables": {
          "buyer.name": "Nom légal du client"
        }
      }
    }'
  ```

  ```javascript Node.js theme={null}
  await fetch("https://api.voyantcloud.com/v1/contract-templates/ct_01J0BE7Z3S494F9D4T3E2QJ0XR", {
    method: "PUT",
    headers: {
      Authorization: `Bearer ${process.env.VOYANT_API_KEY}`,
      "content-type": "application/json",
    },
    body: JSON.stringify({
      templateJson: {
        sections: [{ type: "paragraph", text: "Updated clause" }],
      },
    }),
  })
  ```

  ```python Python theme={null}
  import os, requests

  payload = {
    "type": "customer",
    "description": None,
    "translation": {
      "locale": "en",
      "bodyHtml": "<p>Updated contract body.</p>"
    }
  }

  resp = requests.put(
    "https://api.voyantcloud.com/v1/contract-templates/ct_01J0BE7Z3S494F9D4T3E2QJ0XR",
    headers={
      "Authorization": f"Bearer {os.environ['VOYANT_API_KEY']}",
      "content-type": "application/json",
    },
    json=payload,
  )
  updated = resp.json()
  ```
</RequestExample>

## Response

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "template": {
      "id": "ct_01J0BE7Z3S494F9D4T3E2QJ0XR",
      "workspaceId": "ws_01HZYPM2QF2R8X9SZQ0J9SYBCN",
      "name": "Customer Master Agreement (2025)",
      "type": "customer",
      "description": null,
      "templateJson": {
        "sections": [
          {
            "type": "paragraph",
            "text": "Updated clause"
          }
        ]
      },
      "active": true,
      "createdBy": null,
      "createdAt": "2025-01-10T11:08:44.000Z",
      "updatedAt": "2025-03-22T09:52:10.000Z"
    }
  }
  ```
</ResponseExample>

<Tip>
  Translations are upserted per locale—sending a translation with the same `locale` overwrites the existing localized body and metadata.
</Tip>
