---
title: "Import Document"
method: POST
path: "/api/declaration-templates/import-document"
tags: ["Declaration Templates (Admin)"]
---

# Import Document

`POST /api/declaration-templates/import-document`

Convert one or more uploaded .docx/.doc/.pdf/.txt files into our template
model using AI, merging them into a SINGLE editable DRAFT.

Returns a DRAFT (design_json + html_content + unmapped fields) — it is NOT
saved. The frontend opens it in the editor; the user reviews and saves via the
normal POST /declaration-templates. Conversion is best-effort.

Multipart form:
    files: one or more .docx/.doc/.pdf/.txt (repeated part; up to MAX_IMPORT_FILES).
           A single legacy `file` part is also accepted for backward compat.
    id_modulo: int (required) — 5 (Contratos), 11 (Viaturas) or 12 (Clientes)
    instructions: optional freeform guidance passed to the AI (not persisted)
    name / trigger_action / tipo_doc: optional, pre-fill the draft's metadata

## Headers

- `x-api-token` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/multigest/apis/multigest-protected-api.md) · [All operations](https://skmtc.dev/multigest/apis/multigest-protected-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/multigest/multigest-protected-api/revisions/4b44eb76b3ee/schema)
