Upload a template.
Changed onUploads a new template to the Carbone storage, supporting optional metadata and advanced features like template versioning. When versioning is enabled, multiple versions of a template can be managed under the same template id, and specific versions can be deployed using the deployedAt parameter.
Features
- Metadata Support: Attach metadata such as name, comment, and tags to the template for better organization and retrieval.
- Template Versioning: By enabling the versioning parameter, users can manage multiple versions of a template, allowing for a history of changes and rollbacks.
- Deployed Version Control: Specify which version of a template is deployed using the deployedAt timestamp.
- Sample Data: Attach sample input data to templates to facilitate testing and development in the Carbone Studio environment.
Backward Compatibility
For backward compatibility, if the versioning parameter is not provided or is set to false, the endpoint behaves as it did in previous versions. This means it does not enable the new versioning features and maintains the returned body request { "success": true, "data": { "templateId": "SHA256", "templateExtension": "docx" }} that older applications expect.
Use Cases
Ideal for template management, including maintaining multiple versions of a document template, automating document generation workflows with precise control over deployments, and enhancing template metadata for better search and retrieval.
Request
- Base URLhttps://api.carbone.io
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Headers
Carbone API major version to use. Only a major version can be specified: it automatically includes all future minor versions and patches.
- 5: latest version, recommended.
- 4: default when the header is not provided.
- 3: legacy.
- staging: not intended for production environments.
It is strongly recommended to always set this header explicitly to avoid unexpected behavior. See API versioning documentation
Request body
Example request
{
"template": "Base64-encoded Template File contents, supported formats: DOCX, XLSX, PPTX, ODT, ODS, ODP, ODG, XHTML, IDML, HTML or an XML file",
"tags": [
"invoice",
"contract",
"v2"
],
"sample": [
{
"data": {},
"complement": {},
"translations": {},
"enum": {}
}
]
}Response
On success, returns metadata about the uploaded template. When versioning is enabled, it returns a comprehensive object containing identifiers (id and versionId), file type, size, and creation timestamp. When versioning is disabled or undefined (versioning and id fields not provided), it returns only templateId (SHA-256 hash of the template file) and templateExtension.
Changes
- breaking
the
carbone-versionrequest header's property undefined was restricted to a list of enum values - breaking
the
headerrequest parametercarbone-versionwas restricted to a list of enum values - breaking
the
request property format changed from no format toint64(media type: multipart/form-data) - breaking
the
request property format changed from no format toint64(media type: application/json) - breaking
added
subschema #1subschema #2to theresponse propertyoneOflist for the response status - warning
the
request property's maxLength was set to200(media type: multipart/form-data) - warning
the
request property's maxLength was set to200(media type: application/json) - warning
the
request property's maxLength was set to200(media type: multipart/form-data) - warning
the
request property's maxLength was set to200(media type: application/json) - warning
the
request property's maxLength was set to200(media type: multipart/form-data) - warning
the
request property's maxLength was set to200(media type: application/json) - warning
the
request property's min was set to0.00(media type: multipart/form-data) - warning
the
request property's min was set to0.00(media type: application/json) - info
added the new optional request property
(media type: multipart/form-data) - info
added the new optional request property
(media type: application/json) - info
added the new enum value
3to theheaderrequest parametercarbone-version - info
added the new enum value
4to theheaderrequest parametercarbone-version - info
added the new enum value
5to theheaderrequest parametercarbone-version - info
added the new enum value
stagingto theheaderrequest parametercarbone-version - info
for the
headerrequest parametercarbone-version, the type was generalized fromintegertostring, and format fromint32to no format - info
the request property
//became optional (media type: multipart/form-data) - info
the request property
//became optional (media type: application/json) - info
the request property
//became optional (media type: multipart/form-data) - info
the request property
//became optional (media type: application/json) - info
the request property
//became optional (media type: multipart/form-data) - info
the request property
//became optional (media type: application/json) - info
the request property
//became optional (media type: multipart/form-data) - info
the request property
//became optional (media type: application/json) - info
added the non-success response with the status
- info
added the non-success response with the status
- info
removed
subschema #1subschema #2from theresponse propertyoneOflist for the response status
- breaking
- warning
removed the request property
(media type: multipart/form-data) - warning
removed the request property
(media type: application/json) - info
added the new optional request property
(media type: multipart/form-data) - info
added the new optional request property
(media type: application/json) - info
added the optional property
//to the response with the status
- warning