Skip to main content
Sections and templates share the same draft-then-promote lifecycle. Every time you change a section’s prompts/schema or a template’s instructions/composition, you create a new version. New versions are not published automatically — your previously published version stays live until you explicitly publish a new one. That gives you safe iteration in production: drafts are private to your project until promotion, and consumers continue to see the previously published version.
Treat unpublished versions as drafts. You can GET the list of versions, inspect each, and only publish once you’re confident.

Versioning a section

Once a section exists, iterate by creating new versions.
The response returns the new version with an auto-incremented versionNumber.
A successful publish returns { "status": "published" } and the section’s publishedVersion will reflect the new version on subsequent GET calls.

Versioning a template

Once a template exists, iterate by creating new versions. The published version stays live until you explicitly publish a new one.
A successful publish returns { "status": "published" } and subsequent GET /documents/templates/{templateID} reflects the new publishedVersion.
Publishing a template version validates that every referenced section has a published version. Fix any unpublished sections before retrying the publish.

Independent versioning — what a template version captures

Sections and templates are versioned independently. A template version records:
  • the template’s instructions,
  • which sections it references,
  • the ordering of those sections.
It does not pin a specific version of each referenced section — sections always resolve to their own published version at request time. So reverting a template version reverts the composition and template instructions, but each section still uses its latest published version.
This means reverting a template version does not roll back changes you made to individual sections. For example, if you edit section A, add a new section B to the template, then edit section C, reverting only the template keeps all three section changes. Reverting each section individually would restore its prior prompts and schema, but not affect the template’s composition. And because sections are shared across templates, reverting a section affects every template that references it.Practical takeaway: if you need to roll back a template and its sections to a known-good state, revert the template version first, then revert the individual section versions. There is no single operation that reverts both at once.