Create office template
POST/office/templates
Creates a new document template in draft status. Templates define the layout, branding, and merge-field placements for rendered documents. Supply the template body as HTML or as a base64-encoded binary (DOCX/ODT) depending on the template_format.
Request
Request body
Content type application/json (required).
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable template name (must be unique within the tenant). Max length: 255 |
binding | string | Yes | Data binding context (e.g. "invoice", "contract", "payslip"). |
template_format | string | Yes | Source format of the template body field. One of: |
body | string | Yes | Template content — HTML string for html format, base64-encoded binary for docx/odt. |
output_formats | array of string | No | Output formats to generate when this template is rendered. |
notes | string | No | Internal notes or changelog entry for this template. |
Example
{
"name": "Standard Invoice Template",
"binding": "invoice",
"template_format": "html",
"body": "<html><body><h1>Invoice {{invoice_number}}</h1>...</body></html>",
"output_formats": [
"pdf",
"docx"
],
"notes": "Used for all standard client invoices."
}
Responses
201 Template created in draft status
Content type application/json, object · OfficeTemplateV1.
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | No | Auto-incremented primary key. |
name | string | No | Human-readable template name. |
status | string | No | Current publication status. One of: |
binding | string | No | The data binding context this template is designed for (e.g. "invoice", "contract"). |
template_format | string | No | Source format of the template body. One of: |
output_formats | array of string | No | List of output formats that render jobs for this template will produce. |
current_version | integer | No | Latest draft version number. |
published_version | integer, nullable | No | Currently active published version number. Null if never published. |
notes | string, nullable | No | |
created_at | string (date-time) | No | |
updated_at | string (date-time) | No |
422 Validation failed — check binding, template_format, or output_formats enum values
Example request
curl -X POST "https://{tenant}.faciotech.net/api/v1/office/templates" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name": "Standard Invoice Template", "binding": "invoice", "template_format": "html", "body": "<html><body><h1>Invoice {{invoice_number}}</h1>...</body></html>", "output_formats": ["pdf", "docx"], "notes": "Used for all standard client invoices."}'