fileUploadUrl) for uploading the corresponding .docx file.fields) sent in this call are not persisted as the template's final configuration — the following step, defining the fields, is always required for the fields to actually take effect. After the file upload and the field definition, the template still needs to be activated to become available for document generation.templateProcessor field only accepts the value docx-templates. The scope field corresponds to the identifier of the flow the template belongs to — a template is always specific to one flow; reusing the identifier of a template created in another flow returns a resource-not-found error. The application field is optional and defaults to agflow when omitted. The description field is required — when there is no specific description, we recommend resending the same value as name.fields must have a key (key) identical to the {{key}} variable used in the .docx file — the comparison is case-sensitive and should not be translated. The source data format of each field varies according to its origin: fields coming from the flow's initial form use a fixed path of start-form and a reference equal to the field's identifier; fields coming from a phase use path in the format phase-field.<phase-identifier> and reference in the format <phase-identifier>:<field-identifier>; fields coming from the technical opinion use a fixed path of opinion-field and a reference equal to the field's identifier; native fields — such as the client's basic data, approvals, or credit engine results — use only a fixed path (for example basic-data.name or credit-engine.score) and do not need a reference. A path not recognized by the API does not raise an error, but results in an empty field in the generated document.curl --location '/templates' \
--header 'Content-Type: application/json' \
--data '{
"templateProcessor": "docx-templates",
"application": "agflow",
"scope": "string",
"name": "string",
"description": "string",
"sections": [
{
"section": "string",
"title": "string",
"index": 0
}
],
"fields": [
{
"key": "string",
"title": "string",
"type": "default",
"path": "string",
"reference": "string",
"required": true,
"uiComponent": "short-text",
"section": "string",
"options": [
"string"
],
"children": [
{}
]
}
]
}'{
"template": {
"id": "string",
"name": "string",
"active": true
},
"fileUploadUrl": "string"
}