Signatures

Envelope Create From Template

Markdown for LLMs
POST
/signatures/template/{templateId}/envelope/create

Creates an envelope from a stored template, filling its placeholder roles with real people. The envelope inherits the envelope template's documents, fields, signing order and notification settings; the request supplies only what differs for this instance.

Recipients and sign groups are matched to the template by templateRole, not by position or id. A templateRole that the template does not define has nothing to override; a recipient templateRole the template defines but the request omits keeps the template's stored values.

When the envelope template has sign groups, signGroups is mandatory and must include an entry for every one of them, naming each by its templateRole, even when nothing about the group is overridden — for example {"templateRole": "Approvers"}. A request that leaves any of the template's sign groups out, including one that sends an empty signGroups array, fails with 500 FUNCTION_EXECUTION_ERROR. When the template has no sign groups, signGroups can be left out.

There are no documents in this request. They come from the template, already in Storage from when the template was created, so signatures-document-upload is not part of this flow — upload documents when building the template with signatures-template-create instead.

Only template.subject and template.message can be overridden at envelope level. Sender identity, signing order, expiry, reminders, locale and time zone come from the template, and changing them means updating the template with signatures-template-update.

The result is an ordinary envelope in Draft status — nothing is sent to recipients by this call. Send it with signatures-envelope-send, and from that point it behaves exactly like an envelope created with signatures-envelope-create.

Authorization

AuthorizationBearer <token>

JWT token to authenticate the request.

In: header

X-Api-Key<token>

API key, sent as a request header.

In: header

Path Parameters

templateId*string

GUID of the envelope template to create the envelope from, as returned by signatures-template-create in result.data.template.id.

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body for creating an envelope from a stored template. It carries overrides only — the documents, fields, signing order and notification settings all come from the envelope template, so none of them appear here and none can be supplied.

Recipients and sign groups are matched to the template by templateRole, not by position or id. A templateRole that the template does not define has nothing to override; one the template defines but the request omits keeps the template's stored values.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/signatures/template/17e540aa-d1dd-4714-9cb3-2d28504a048d/envelope/create" \  -H "Content-Type: application/json" \  -d '{    "template": {      "subject": "Please sign: NDA Agreement - Acme Corp",      "message": "Please review and sign the attached NDA.",      "externalContext": {        "crmDealId": "D-20931"      }    },    "recipients": [      {        "templateRole": "Counterparty",        "name": "Jane Doe",        "email": "jane.doe@example.com",        "language": "es",        "externalContext": {          "id": "456"        }      }    ],    "externalContext": {      "id": "789"    }  }'
{  "result": {    "statusCode": 201,    "message": "Created",    "data": {      "envelope": {        "id": "f8ffb194-8eb1-4bd5-ae4b-4d783a6a5019",        "createdBy": {          "id": "12f0a7b9-ec67-4232-863d-46e3d4e5ba44",          "name": "Jane Doe",          "email": "name@example.com"        },        "uploadDate": "2026-09-17T09:14:22.000Z",        "sendDate": "",        "status": "Draft",        "subject": "Please sign: NDA Agreement - Acme Corp",        "message": "Please review and sign the attached NDA.",        "isSignOrder": false,        "expireInDays": 7,        "firstReminderDays": 3,        "repeatingReminderDays": 2,        "notifyWhenOpened": true,        "notifyWhenSigned": true,        "alertDaysBeforeExpiry": 2,        "locale": "en-GB",        "timeZone": "Europe/London",        "externalContext": {          "crmDealId": "D-20931"        }      },      "documents": [        {          "id": "a53cb557-a742-422d-919c-2ac5ecf001c4",          "name": "NDA Agreement",          "externalContext": ""        }      ],      "originalDocuments": [        {          "id": "6e0f4c3d-8b21-4a57-9d6e-1f3b7c2a9e40",          "referenceDocumentId": "a53cb557-a742-422d-919c-2ac5ecf001c4",          "name": "NDA Agreement"        }      ],      "recipients": [        {          "id": "4c3a8ff0-5c2c-4db8-804b-cafc59f6205a",          "name": "Jane Doe",          "email": "jane.doe@example.com",          "role": "signer",          "status": "In Progress",          "signDate": "",          "signOrder": 1,          "signGroupId": "00000000-0000-0000-0000-000000000000",          "userId": "",          "mandatory": true,          "hostEmail": "",          "isMFAEnabled": false,          "phoneNumber": "",          "language": "es",          "externalContext": {            "id": "456"          }        }      ],      "signGroups": [],      "fields": [        {          "id": "d4d09bc2-4bbe-4cca-8bd3-6fb28e91f434",          "name": "mds_signature_counterparty",          "recipientId": "4c3a8ff0-5c2c-4db8-804b-cafc59f6205a",          "signGroupId": "",          "documentId": "a53cb557-a742-422d-919c-2ac5ecf001c4",          "type": "signature",          "value": "",          "page": 1,          "height": 60,          "width": 200,          "positionX": 100,          "positionY": 650,          "tooltip": "Sign here to accept the agreement.",          "isRequired": true,          "properties": "",          "signerInfo": ""        }      ]    }  },  "origin": "POST https://api.doctavian.com/v1/signatures/template/{templateId}/envelope/create",  "dateTime": "2026-07-20T12:00:00.000Z",  "externalContext": {    "id": "789"  },  "userId": "12f0a7b9-ec67-4232-863d-46e3d4e5ba44",  "operationId": "f31c8b06d5a74e2290bd41c7e6035a8f"}
{  "error": {    "statusCode": 400,    "message": "A recipient entry is missing its template role.",    "innerErrors": [      {        "code": "RECIPIENT_TEMPLATE_ROLE_REQUIRED",        "message": "A recipient entry is missing its template role.",        "userMessage": "Each recipient must say which template role they are filling."      }    ]  },  "origin": "POST https://api.doctavian.com/v1/signatures/template/{templateId}/envelope/create",  "dateTime": "2026-07-20T12:00:00.000Z",  "userId": "29eeeed1-6575-4cd6-87eb-0c9f978da19a",  "operationId": "8c4018a60ae91bb5346e291890d45210"}
{  "error": {    "statusCode": 403,    "message": "Forbidden",    "innerErrors": [      {        "code": "ENVELOPE_ACCESS_DENIED",        "message": "Envelope access denied for envelope id 17e540aa-d1dd-4714-9cb3-2d28504a048d",        "userMessage": "You do not have permission to access envelope with id 17e540aa-d1dd-4714-9cb3-2d28504a048d"      }    ]  },  "origin": "POST https://api.doctavian.com/v1/signatures/template/{templateId}/envelope/create",  "dateTime": "2026-10-01T09:41:06.000Z",  "userId": "29eeeed1-6575-4cd6-87eb-0c9f978da19a",  "operationId": "c4e81a0f6b2d49e7a35f90d1b8e62c47"}
Empty
{  "error": {    "statusCode": 500,    "message": "An unexpected error occurred while creating the envelope from the template.",    "innerErrors": [      {        "code": "FUNCTION_EXECUTION_ERROR",        "message": "An unexpected error occurred while creating the envelope from the template.",        "userMessage": "Something went wrong. Please try again or contact support."      }    ]  },  "origin": "POST https://api.doctavian.com/v1/signatures/template/{templateId}/envelope/create",  "dateTime": "2026-07-20T12:00:00.000Z",  "userId": "b08de32e-e596-45ae-ac5e-5c9e263755aa",  "operationId": "123e21e74ff2a16e18f56f7f44fc75f0"}