This guide saves an envelope configuration as a reusable Envelope Template, then creates and sends an envelope from it. For what a template stores and how placeholder roles work, see Templates.
Not familiar with the envelope structure yet? Read Create and Send Envelope first — the template follows the same structure.
Upload each document with POST /signatures/document/upload and keep the returned id. Use it within 24 hours; it works only once. This is the only upload in the flow — see What a template stores.
Call POST /signatures/template/create. The body mirrors envelope create, with settings under template and each recipient as a placeholder with a templateRole — see What a template stores for the differences.
POST https://api.doctavian.com/v1/signatures/template/create
Authorization: Bearer <token>
x-api-key: <api-key>
Content-Type: application/json
{
"template": {
"templateName": "NDA Template",
"templateDescription": "Reusable NDA signing template",
"subject": "Please sign: NDA Agreement",
"message": "Please review and sign the attached NDA.",
"senderName": "World Industries",
"senderEmail": "contracts@worldindustries.com",
"isSignOrder": false,
"expireInDays": 7,
"alertDaysBeforeExpiry": 1,
"firstReminderDays": null,
"repeatingReminderDays": null,
"notifyWhenOpened": true,
"notifyWhenSigned": true,
"locale": "en-GB",
"timeZone": "Europe/Zagreb"
},
"documents": [
{
"referenceDocumentId": 1,
"name": "NDA Agreement",
"loadMethod": "Storage",
"urn": "af567f07-cafa-4d5c-830c-0f24af7555df"
}
],
"recipients": [
{
"referenceSignerId": 1,
"templateRole": "Counterparty",
"role": "signer",
"mandatory": true,
"isMfaEnabled": false
}
],
"fields": [
{
"type": "signature",
"name": "signature_counterparty",
"isRequired": true,
"referenceSignerId": 1,
"referenceDocumentId": 1,
"page": 1,
"positionX": 100,
"positionY": 650,
"width": 200,
"height": 60
}
]
}The response returns 201 with the template in full (trimmed here):
{
"result": {
"statusCode": 201,
"data": {
"template": {
"id": "17e540aa-d1dd-4714-9cb3-2d28504a048d",
"templateName": "NDA Template"
},
"recipients": [
{ "id": "2908514c-b7b6-4080-9ded-2f441cd7c2ef", "templateRole": "Counterparty", "role": "signer" }
]
}
}
}Save data.template.id — you'll need it to create envelopes from this template.
Call POST /signatures/template/{templateId}/envelope/create with the real people for each templateRole and any subject or message override. For what you can and can't override, see Creating an envelope from a template.
POST https://api.doctavian.com/v1/signatures/template/17e540aa-d1dd-4714-9cb3-2d28504a048d/envelope/create
Authorization: Bearer <token>
x-api-key: <api-key>
Content-Type: application/json
{
"template": {
"subject": "Please sign: NDA Agreement — Acme Corp",
"externalContext": { "crmDealId": "D-31077" }
},
"recipients": [
{
"templateRole": "Counterparty",
"name": "Jane Smith",
"email": "jane.smith@acmecorp.com",
"language": "es",
"externalContext": { "contactId": "C-90412" }
}
]
}If the template has sign groups,
signGroupsis mandatory and must include an entry for every one of them, even with nothing to override — e.g.{ "templateRole": "Approvers" }. Leaving any out, or sending an empty array, fails with500FUNCTION_EXECUTION_ERROR.
The response is a Draft envelope in the same shape as envelope create (trimmed here):
{
"result": {
"statusCode": 201,
"data": {
"envelope": {
"id": "f8ffb194-8eb1-4bd5-ae4b-4d783a6a5019",
"status": "Draft"
}
}
}
}Save data.envelope.id — it is an envelope id, not a template id.
POST https://api.doctavian.com/v1/signatures/envelope/f8ffb194-8eb1-4bd5-ae4b-4d783a6a5019/send
Authorization: Bearer <token>
x-api-key: <api-key>
Content-Type: application/json
{}Add an X-Client-Authorization header to this call to receive status callbacks — see Status callbacks. Send works only once, from Draft.
Setting up a template with multiple recipients? See Configure Signing Order to control how they sign — the same
signOrder,mandatoryand sign group rules apply, set on the template.
To list, get, update, move or delete templates, see Changing and organising templates. An update replaces the whole template, so re-send every value and re-upload every document.