POST
Import my own template
Company space For: Administrator, Manager · Permission: company_templates.import, company_templates.activate (only when activating) Conditions
  • Activating the template at once (is_active true) also needs the company_templates.activate permission.
  • type must be invoice, purchase-order-form or delivery-receipt.
  • template_file must be named template.hbs (at most 256 KB) and config_file config.json (at most 64 KB).
  • The files must pass validation: size limit, a valid configuration schema, compilation and a test render against sample data.
  • A name does not have to be unique; the template is always created as a new one.
What else happens
  • Creates a company-owned template (unlisted, price 0) and its first version v1.0, and a company template pinned to it, inactive unless is_active is true.
  • When is_active is true, the company’s other active template of the same type is switched off.
  • An import refused by the size, schema, compilation or test-render checks is recorded in the template publication log; a configuration file that cannot be read as a JSON object is refused before that and is not recorded.
Part of Invoice and document templates.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
type
enum<string>
required

Document type the template is for: invoice, purchase-order-form or delivery-receipt. Required.

Available options:
invoice,
purchase-order-form,
delivery-receipt
name
string
required

Name of the template, at most 255 characters. Required.

Maximum string length: 255
template_file
file
required

The template source, uploaded as a file that must be named template.hbs, at most 256 KB. Required.

Maximum string length: 256
config_file
file
required

The configuration schema as a JSON file that must be named config.json, at most 64 KB. It lists the settings the company can customize, each with a type and a default. Required.

Maximum string length: 64
is_active
boolean | null

Whether the template becomes the active one for its type right away, replacing the current active one. Defaults to false. Needs the company_templates.activate permission when true.

Response

CompanyTemplateResource

data
CompanyTemplateResource · object
required

Items of this page.