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

# Create Contract Template

> Create a reusable contract template, optionally with a localized translation.

## Method

`POST` `/v1/contract-templates`

## Body Parameters

<ParamField name="name" type="string" required>Display name for the template.</ParamField>
<ParamField name="type" type="string">Optional template type (`customer`, `supplier`, or `partner`).</ParamField>
<ParamField name="description" type="string">Optional description shown in dashboards.</ParamField>
<ParamField name="templateJson" type="object">Structured JSON defining sections, clauses, and variables (defaults to `{}`).</ParamField>
<ParamField name="active" type="boolean">Whether the template is enabled (defaults to `true`).</ParamField>
<ParamField name="translation" type="object">Optional localized override for content rendered in PDFs/e-sign flows.</ParamField>

<Expandable title="Translation object">
  <ParamField name="translation.locale" type="string" required>Locale code (e.g., `en`, `fr-FR`).</ParamField>
  <ParamField name="translation.name" type="string">Localized template name.</ParamField>
  <ParamField name="translation.description" type="string">Localized description.</ParamField>
  <ParamField name="translation.bodyHtml" type="string">HTML body rendered when generating the contract.</ParamField>
  <ParamField name="translation.variables" type="object">Map of variable keys to human-readable 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 POST "https://api.voyantcloud.com/v1/contract-templates" \
    -H "Authorization: Bearer $VOYANT_API_KEY" \
    -H "content-type: application/json" \
    -d '{
      "name": "Customer Master Agreement",
      "type": "customer",
      "description": "Standard customer contract",
      "templateJson": {
        "sections": [
          {
            "type": "paragraph",
            "text": "This Agreement is made between {{seller.name}} and {{buyer.name}}."
          }
        ]
      },
      "translation": {
        "locale": "fr",
        "bodyHtml": "<p>Ce contrat lie {{seller.name}} à {{buyer.name}}.</p>",
        "variables": {
          "seller.name": "Raison sociale du vendeur",
          "buyer.name": "Raison sociale du client"
        }
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const res = await fetch("https://api.voyantcloud.com/v1/contract-templates", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.VOYANT_API_KEY}`,
      "content-type": "application/json",
    },
    body: JSON.stringify({
      name: "Supplier Agreement",
      type: "supplier",
      templateJson: { placeholders: ["supplier.name", "contract.startDate"] },
      active: false,
    }),
  })
  const payload = await res.json()
  ```

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

  payload = {
    "name": "Partner NDA",
    "description": "Mutual NDA for channel partners",
    "templateJson": {"sections": []},
    "translation": {
      "locale": "en",
      "name": "Partner NDA",
      "bodyHtml": "<p>Confidentiality terms between {{partner.name}} and {{voyant.name}}.</p>"
    }
  }

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

## Response

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "template": {
      "id": "ct_01J0BE7Z3S494F9D4T3E2QJ0XR",
      "workspaceId": "ws_01HZYPM2QF2R8X9SZQ0J9SYBCN",
      "name": "Customer Master Agreement",
      "type": "customer",
      "description": "Standard customer contract",
      "templateJson": {
        "sections": [
          {
            "type": "paragraph",
            "text": "This Agreement is made between {{seller.name}} and {{buyer.name}}."
          }
        ]
      },
      "active": true,
      "createdBy": null,
      "createdAt": "2025-01-10T11:08:44.000Z",
      "updatedAt": "2025-01-10T11:08:44.000Z"
    }
  }
  ```
</ResponseExample>

<Tip>
  If you supply `translation`, only the specified locale is stored. Use the update endpoint to add additional locales later.
</Tip>
