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

# Overview

> Generate quote and policy documents from smart tag templates via API

<Note>
  **Planned** — Document generation endpoints are being added to the v1 API. See the [Roadmap](/api-v1-reference/roadmap) for overall API direction.
</Note>

The Document Generation API lets you upload form templates, generate populated documents for quotes and policies, and download the results.

## Key Concepts

* **Form template** — a DOCX file containing smart tags (placeholders) that get resolved against entity data
* **Smart tags** — placeholder tokens in a template that map to configured fields. Every field you define in your configuration automatically gets a smart tag
* **Document generation** — the process of resolving all smart tags in a template against a quote or policy, producing a final PDF

## Planned Endpoints

### Template Management

| Method | Endpoint                                     | Description                            |
| ------ | -------------------------------------------- | -------------------------------------- |
| POST   | `/v1/form-templates`                         | Upload a DOCX template with smart tags |
| GET    | `/v1/form-templates`                         | List templates                         |
| GET    | `/v1/form-templates/{templateId}`            | Get template metadata                  |
| DELETE | `/v1/form-templates/{templateId}`            | Delete a template                      |
| GET    | `/v1/form-templates/{templateId}/smart-tags` | List smart tags found in the template  |

### Quote Documents

| Method | Endpoint                                      | Description                          |
| ------ | --------------------------------------------- | ------------------------------------ |
| POST   | `/v1/quotes/{quoteId}/documents/generate`     | Generate documents for a quote       |
| GET    | `/v1/quotes/{quoteId}/documents`              | List generated documents for a quote |
| GET    | `/v1/quotes/{quoteId}/documents/{documentId}` | Download a generated quote document  |

### Policy Documents

| Method | Endpoint                                         | Description                           |
| ------ | ------------------------------------------------ | ------------------------------------- |
| POST   | `/v1/policies/{policyId}/documents/generate`     | Generate documents for a policy       |
| GET    | `/v1/policies/{policyId}/documents`              | List generated documents for a policy |
| GET    | `/v1/policies/{policyId}/documents/{documentId}` | Download a generated policy document  |

## Workflow

1. **Upload a template** — upload a DOCX file containing smart tags to `POST /v1/form-templates`
2. **Inspect smart tags** — call `GET /v1/form-templates/{templateId}/smart-tags` to see which tags the system found in your template
3. **Generate a document** — call the generate endpoint for a quote or policy. The system resolves all smart tags against the entity data and produces a PDF
4. **Download the result** — retrieve the generated PDF via the document download endpoint

## Smart Tags

Every field you define in your configuration automatically gets a corresponding smart tag. When you add a field (e.g., `insuredName`), its smart tag becomes immediately available for use in templates. The smart tags endpoint on a template lets you verify that all tags in your template map to configured fields.

A dedicated configuration endpoint will also be available for listing all smart tags across your company, independent of any specific template:

| Method | Endpoint         | Description                                    |
| ------ | ---------------- | ---------------------------------------------- |
| GET    | `/v1/smart-tags` | List all available smart tags for your company |

## Related Resources

* [Configuration API](/api-v1-reference/configuration/overview) — define the fields that power smart tags
* [Quotes API](/api-v1-reference/quotes/overview) — create quotes to generate documents for
* [Policy API](/api-v1-reference/policies/overview) — generate documents for bound policies
* [Roadmap](/api-v1-reference/roadmap) — overall API direction
