Skip to content

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).

FieldTypeRequiredDescription
namestringYes

Human-readable template name (must be unique within the tenant).

Max length: 255

bindingstringYes

Data binding context (e.g. "invoice", "contract", "payslip").

template_formatstringYes

Source format of the template body field.

One of: "html", "docx", "odt"

bodystringYes

Template content — HTML string for html format, base64-encoded binary for docx/odt.

output_formatsarray of stringNo

Output formats to generate when this template is rendered.

notesstringNo

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.

FieldTypeRequiredDescription
idintegerNo

Auto-incremented primary key.

namestringNo

Human-readable template name.

statusstringNo

Current publication status.

One of: "draft", "published", "archived"

bindingstringNo

The data binding context this template is designed for (e.g. "invoice", "contract").

template_formatstringNo

Source format of the template body.

One of: "html", "docx", "odt"

output_formatsarray of stringNo

List of output formats that render jobs for this template will produce.

current_versionintegerNo

Latest draft version number.

published_versioninteger, nullableNo

Currently active published version number. Null if never published.

notesstring, nullableNo
created_atstring (date-time)No
updated_atstring (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."}'
Loading