Declaration Templates (Admin)

Ai Generate Template

Generate declaration template HTML using AI (Claude).

The AI generates HTML body content using the V5 CSS design system and we return it as an editable DRAFT (design_json + html_content) — it is NOT saved. The frontend opens it in the editor; the user picks the mandatory Tipo de Documento and saves via the normal POST /declaration-templates (which enforces a valid tipo_doc). This mirrors the import-document flow and guarantees no NULL-tipo_doc template is ever persisted.

Body: example_text: str (required, min 10 chars) — description of what the user wants placeholders: list[str] (required, min 1) — placeholder keys to include id_modulo: int (required) — 5, 11, or 12 name: str (optional) — template name (defaults to "Declaração IA") trigger_action: str (optional) — trigger for auto-generation tipo_doc: int (optional) — document type ID, pre-fills the draft's metadata

post/api/declaration-templates/ai-generate

Headers

x-api-tokenstring nullable

Request body

object required

Response

Successful Response

{"stackTrail":"paths:/api/declaration-templates/ai-generate:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}

Changes