Declaration Templates (Admin)
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
post/api/declaration-templates/import-document
Headers
x-api-tokenstring nullable
Response
Successful Response
{"stackTrail":"paths:/api/declaration-templates/import-document:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}