Skip to main content

Create a draft

Open Templates in the workspace and choose a starter, such as Invoice, Quote, Certificate or Shipping label. Edit the layout alongside the sample data and preview. Save updates the draft. Publish creates an immutable numbered version that generation requests can use. For the API equivalent, GET /v1/library returns starter definitions. Submit a complete definition as the JSON body of POST /v1/templates. Save later edits with PUT /v1/templates/{id} and publish with POST /v1/templates/{id}/publish. The create and save operations receive the definition itself. The create response includes the new template ID.

Map fields and repeat rows

The Invoice starter reads the recipient from {{recipient.name}}, the total from {{total}} and table rows from items. Its three column mappings are field1, field2 and field3, relative to each item.
invoice-data.json
Send the formatted amounts you want printed. DocKiln interpolates scalar values and does not calculate totals. A supplied repeating-table path must resolve to an array. A structured document supports up to 500 rows and eight columns. On multipage PDFs the table header repeats.

Generate from a published version

Save the data above as invoice-data.json. Set TEMPLATE_ID to the published Invoice template and submit version 1:
Terminal
Omit version to use the current publication. Omit data to use that version’s sample. The job stores a snapshot when accepted. Subsequent draft changes or publications cannot change that job.

Coordinate concurrent edits

Read the template’s updated value. Send it in the If-Unmodified-Since-Version header on save or publish. A stale value returns 409. Reload the draft and review the competing edits before trying again. GET /v1/templates/{id}/versions lists the published definitions.

HTML templates in the review build

The 1.1 review build also accepts HTML templates with escaped data slots, iteration, conditions, stable slugs and immutable published versions. See the HTML template example.