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

# Inquiry Templates

> Define reusable Web inquiry configuration with draft and publish, and use template_key from the API

A **Web inquiry template** stores the capture configuration your organization reuses when creating inquiries: query, URLs, fields, acceptance guide, capture type, and more. Each template has a stable **`key`** (for example `web_tpl_key_…`) that you pass as **`template_key`** on [Create Web inquiry](/api-reference/endpoint/web-inquiry-create) so the inquiry inherits that configuration.

<Info>
  Use templates so you only pass **`subject_id`** and **`template_key`** when creating inquiries, or to keep product and compliance text in one place. See the [Quickstart](/web/quickstart) for the end-to-end flow.
</Info>

## Draft and published

* **Draft** – Editable working copy. New templates default to draft unless you set **`status`** to **`published`** on create.
* **Published** – The version that **`template_key`** resolves to for **new** inquiries. Only **published** templates should be referenced from `POST /web/inquiry` (draft templates will not resolve for inquiries).

You can build templates in the InkLink dashboard or entirely via the [Template API](#template-api) below.

## API workflow

Typical first-time flow:

1. **[Create template](/api-reference/endpoint/web-template-create)** – `POST /web/template`. The server assigns **`key`**. The public API requires non-empty **`query`**, **`start_url`**, and **`return_url`**. You may set **`status`** to **`published`** to skip a separate publish step, or leave the default **`draft`**.
2. **[Update draft](/api-reference/endpoint/web-template-update-draft)** – `PATCH /web/template/{key}` to change the **current draft** row (partial body; **`settings`** and **`metadata`** are shallow-merged with existing values).
3. **[Publish](/api-reference/endpoint/web-template-publish)** – `POST /web/template/{key}/publish` to make the draft the latest **published** version and the one used for new inquiries.

When you already have a **published** version and need another edit cycle without overwriting production immediately:

1. **[Create draft from published](/api-reference/endpoint/web-template-create-draft)** – `POST /web/template/{key}/draft` (optional field overrides in the body). Fails with **409** if a draft already exists; publish the existing draft first.
2. Patch the draft, then publish again.

## Listing and versions

* **[List templates](/api-reference/endpoint/web-template-list)** – `GET /web/template` returns a **paginated list of all template rows** in your organization (not only the latest per key), ordered newest first. Use for auditing or building admin UIs; filter client-side if you only need `is_latest` rows.
* **[Get template versions](/api-reference/endpoint/web-template-versions)** – `GET /web/template/{key}` returns **every version** of that key (newest version first).

## Template API

| Page                                                                                          | Use case                                     |
| --------------------------------------------------------------------------------------------- | -------------------------------------------- |
| [List Web templates](/api-reference/endpoint/web-template-list)                               | Paginate template rows (`after_id`, `limit`) |
| [Create Web template](/api-reference/endpoint/web-template-create)                            | New template; server assigns `key`           |
| [Get Web template versions](/api-reference/endpoint/web-template-versions)                    | All versions for one `key`                   |
| [Update Web template draft](/api-reference/endpoint/web-template-update-draft)                | Patch the current draft                      |
| [Create Web template draft from published](/api-reference/endpoint/web-template-create-draft) | New draft version from published             |
| [Publish Web template](/api-reference/endpoint/web-template-publish)                          | Promote draft to published                   |

Error responses follow the same shape as the rest of the platform. See [Error handling](/error-handling). For example, list pagination returns **`VALIDATION_ERROR`** with **`INVALID_AFTER_ID`** on **`after_id`** when the cursor id is missing or not in your organization, similar to [List Web inquiries](/api-reference/endpoint/web-inquiry-list).

## Next steps

<CardGroup cols={2}>
  <Card title="Create Web inquiry" href="/api-reference/endpoint/web-inquiry-create">
    Use `template_key` after publishing a template.
  </Card>

  <Card title="Quickstart" href="/web/quickstart">
    Hosted capture and return URL flow.
  </Card>
</CardGroup>
