API reference
Templates & drafts API
Endpoints behind template field-marking and the draft authoring → negotiation → signature lifecycle.
Admin-gated; tenant-scoped
Field detection, approval and draft generation require an admin. All endpoints operate within the caller’s tenant. See Authentication.
Template fields
GET/api/templatesList templates with detection / approval state.
GET/api/templates/{id}/fieldsGet a template’s marked fields. Runs detection and caches it on first access; each field carries a status of suggested, confirmed or rejected.
POST/api/templates/{id}/detect-fieldsForce a fresh detection pass. Bumps the version and resets approval.
POST/api/templates/{id}/fieldsSave the reviewed field set and optionally approve it. Returns 409 if approving while any field is still suggested.
Generate
POST/api/drafts/generateGenerate a draft .docx from an approved template and field values. Requires approved fields (400) and a bound Drafts folder (409); fails closed (422) if a required placeholder cannot be filled, and 502 if the SharePoint upload fails. Returns the draft id, download URL, SharePoint location, residual_brackets and manual_fields.
Drafts & versions
GET/api/draftsList drafts (clmSpace is the system of record).
GET/api/drafts/{id}/metaRaw draft metadata (state, approval pin, envelope id).
GET/api/drafts/{id}/fileDownload the outbound (v0) draft.
GET/api/drafts/{id}/versionsList the version chain (outbound + inbound redlines).
GET/api/drafts/{id}/versions/{version}/fileDownload a specific version.
GET/api/drafts/{id}/diffDiff the outbound draft against the latest inbound redline.
GET/api/drafts/{id}/deviationsDeviations flagged in the latest inbound version.
POST/api/drafts/{id}/counter-versionUpload the counterparty’s redlined version (amendment intake).
POST/api/drafts/{id}/relocateRe-upload the draft to the currently-bound Drafts folder.
DELETE/api/drafts/{id}Delete the clmSpace copy (the SharePoint copy is left in place).
Lifecycle
POST/api/drafts/{id}/transitionAdvance the lifecycle. action is one of approve / reject / reopen / issue. approve pins the content hash; issue is only valid from Approved and sends to DocuSign.
Related
Clause-level counter-positions use a separate pair of endpoints:
POST /api/draft and GET /api/negotiation/counter/{id}.