Beta
Beyond create and version, sections and templates share a uniform management + discovery surface: read resolved or raw, update metadata, soft-delete with inheritance guards, and filter LIST results by language, region, specialty and label.
The endpoints below detail the per-resource specifics. The semantics — resolved-vs-raw reads, soft-delete conflicts, deletion visibility, and filter query params — are shared across both resource types.
Resolved vs. raw reads
Reads come in two shapes:
- Resolved.
GET /documents/sections/{sectionID} and GET /documents/templates/{templateID} return the resource resolved — all inheritance applied, sections fully expanded on templates. This is the ready-to-consume shape that will be used at generation time.
- Raw.
GET .../versions/{versionID} and LIST .../versions return the version raw — only the values this version explicitly owns, plus inheritFromId and (for templates) sectionId references. Use this when you need to distinguish inherited fields from fields the resource explicitly overrides.
Soft-delete & inheritance guards
DELETE on a section or template returns 409 Conflict if any other section or template inherits from it. Resolve the dependency first — delete or re-parent the inheriting resources — before retrying the delete.
Deletion visibility. After deletion, LIST no longer returns the resource, but GET on the resource ID and its version reads continue to work — useful for audit, debugging, and resolving resources still referenced by historical documents or inheritance chains.
Managing sections
| Action | Endpoint |
|---|
List sections (filter by source, lang, region, specialty, label, published) | GET /documents/sections |
| Get a section (resolved, ready-to-use) | GET /documents/sections/{sectionID} |
Update metadata (name, description, languages, regions, specialties, labels) | PATCH /documents/sections/{sectionID} |
| Soft-delete a section | DELETE /documents/sections/{sectionID} — returns 409 Conflict if another section inherits from this one |
| List versions (raw) | GET /documents/sections/{sectionID}/versions |
| Get a specific version (raw — owned values only) | GET /documents/sections/{sectionID}/versions/{versionID} |
| Soft-delete a version | DELETE /documents/sections/{sectionID}/versions/{versionID} |
PATCH /documents/sections/{sectionID} only updates section-level metadata. To change the prompts or output schema, create a new
version and publish it — see
Versioning.
Managing templates
| Action | Endpoint |
|---|
List templates (filter by source, lang, region, specialty, label, published) | GET /documents/templates |
| Get a template (resolved, ready-to-use) | GET /documents/templates/{templateID} |
Update metadata (name, description, languages, regions, specialties, labels) | PATCH /documents/templates/{templateID} |
| Soft-delete a template | DELETE /documents/templates/{templateID} — returns 409 Conflict if another template or section inherits from this template |
| List versions (raw) | GET /documents/templates/{templateID}/versions |
| Get a specific version (raw — owned values + section refs) | GET /documents/templates/{templateID}/versions/{versionID} |
| Soft-delete a version | DELETE /documents/templates/{templateID}/versions/{versionID} |
PATCH /documents/templates/{templateID} only updates template-level metadata. To change the prompt or section composition, create a new
version and publish it — see
Versioning.
Discovery: filtering & listing
Both GET /documents/sections and GET /documents/templates accept the same set of query parameters. Use any combination — they’re additive.
| Query param | Behavior |
|---|
lang | BCP-47 language subtag (e.g. fr, de). Repeatable (e.g. ?lang=en&lang=da). Matches resources whose languages[] contains any of the supplied values. |
region | ISO 3166-1 alpha-3 country code (e.g. BEL, USA). Repeatable. Matches resources whose regions[] contains any of the supplied values. |
specialty | Clinical specialty (e.g. dermatology, cardiology). Repeatable. Matches resources whose specialties[] contains any of the supplied values. |
label | Label filter in key:value format (e.g. ?label=customer:acme). Repeatable; matches resources that carry any of the given Label entries. |
published | Omit for both, true for published-only, false for unpublished-only. |
Empty languages, regions, or specialties means “no tweaks for that dimension” — the resource is generic along that axis. The fields are arrays but each one is optional and empty by default.
Listing sections
Listing templates