Upload Template
upload_templateUpload and store a reusable Carbone template. Once uploaded, use render_document with the returned Template ID to generate documents from it.
Instructions
Upload and store a reusable Carbone template. Once uploaded, use render_document with the returned Template ID to generate documents from it. Supports versioning: multiple versions can live under a single stable Template ID, and rendering by Template ID uses the version with the most recent deployedAt. A result deployedAt of 0 means the version is not explicitly deployed: if another version of the same Template ID is deployed, renders by Template ID keep using that one. Accepted formats: DOCX, XLSX, PPTX, ODT, ODS, ODP, ODG, HTML, XHTML, XML, SVG, IDML, Markdown, TXT, CSV, RTF and PDF (not the legacy binary DOC, XLS or PPT).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Existing Template ID (64-bit format) to add this upload to its version history. If omitted, a new Template ID is generated. Providing a Version ID (SHA-256) is not allowed and will cause an error. | |
| name | No | Display name for the template, max 200 characters (e.g. "Invoice Template", "NDA Contract"). Optional but recommended: list_templates shows it and its search matches it. | |
| tags | No | Labels shown by list_tags and on each list_templates result (e.g. ["sales", "billing", "v2"]). Duplicates are removed and the list is sorted; the whole list is limited to 100 characters (about 8 tags of 9 characters). | |
| sample | No | Sample input data attached to the template for testing in Carbone Studio: an array with at most ONE object, whose keys data, complement, translations and enum are all optional. Example: [{ "data": { "name": "Acme" } }]. | |
| comment | No | Free-text comment to describe the template version or its purpose, max 200 characters. | |
| category | No | Group templates into folders/categories, max 200 characters (e.g. "invoices", "legal", "hr"). | |
| expireAt | No | Schedule deletion at a UTC Unix timestamp (seconds); 0 (default) means the template never expires. After that time it is no longer listed, downloadable or renderable (404), and the file is purged after the retention delay. To remove a template now, use delete_template. | |
| template | Yes | The template file. Three input forms are accepted: (1) Local file path — absolute, e.g. "/Users/me/report.docx" (or "C:\Users\me\report.docx" on Windows), or under the home directory, e.g. "~/report.docx". A relative path must start with "./" or "../" and resolves against the server process's working directory, which is rarely yours: prefer an absolute path. A bare file name such as "report.docx" is NOT a path: it would be sent as base64 content. (2) HTTPS URL — the file is downloaded automatically, e.g. "https://example.com/file.pptx". (3) Base64-encoded string — the raw file content encoded as base64. Supported input formats: DOCX, XLSX, PPTX, ODT, ODS, ODP, ODG, HTML, XHTML, XML, SVG, IDML, MD, TXT, CSV, RTF, PDF. Carbone reads XML-based and text-based documents (plus PDF): the legacy binary Office formats DOC, XLS and PPT are rejected as input, although they are valid outputs. Re-save such a file as DOCX, XLSX or PPTX first. | |
| deployedAt | No | UTC Unix timestamp (seconds) to set as the deployment time for this version. Carbone uses the version with the most recent deployedAt when rendering via Template ID. Use 42000000000 to deploy immediately (special "NOW" sentinel value). Future values are not allowed. | |
| versioning | No | Enable template versioning (default: true). When true, a stable Template ID is generated and multiple versions can be managed under it. When false, behaves as legacy mode and returns only a templateId (SHA-256 hash) and templateExtension. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Stable Template ID (when versioning is enabled). | |
| name | No | Template display name, when one was given. | |
| size | No | Template size in bytes. | |
| type | No | Detected template file type. | |
| createdAt | No | UTC Unix timestamp (seconds) of the upload. | |
| versionId | No | Version ID (SHA-256) of this uploaded version. | |
| deployedAt | No | UTC Unix timestamp of deployment; 0 means this version is not explicitly deployed. | |
| templateId | No | Template ID returned in legacy/non-versioned mode. | |
| templateExtension | No | Detected file extension, e.g. "docx" (legacy/non-versioned mode). |