Signatures

Template Create

POST
/signatures/template/create

Creates a reusable signature template: a stored envelope configuration — documents, fields, signing order, notification settings — with placeholders in place of real recipients. Envelopes are then created from it with signatures-envelope-create-from-template, supplying only what changes between instances.

A template has no real recipients, so each one is a placeholder identified by its templateRole — a label such as Counterparty or Approver. Every templateRole in the request must be unique across recipients and sign groups together, otherwise the request is rejected with DUPLICATE_TEMPLATE_ROLE. A recipient that is not in a sign group must carry one, and every sign group must.

template.templateName is the only value the server requires. documents, recipients, fields and signGroups may all be absent or empty, so a template can be saved as a stub and completed later with signatures-template-update — signatures-envelope-create has no equivalent allowance.

Documents still have to be in Storage first. Upload each one with signatures-document-upload and reference the returned id in documents[].urn with documents[].loadMethod set to storage; there is no way to send document content inline. Storage keeps an uploaded document for 24 hours, and a reference that cannot be resolved fails the request with a 500 carrying FILE_NOT_EXISTS_IN_STORAGE.

This operation is metered. A successful call reports one unit of the templates-created dimension, returned in consumption.

Authorization

AuthorizationBearer <token>

JWT token to authenticate the request.

In: header

X-Api-Key<token>

API key, sent as a request header.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body for creating or updating a signature envelope template. It mirrors signatures-envelope-create, with three differences: the envelope-level settings sit under template rather than envelope; that object carries templateName, templateDescription and folderId; and recipients and sign groups are placeholders identified by templateRole rather than real people.

templateName is the only value the server requires. documents, recipients, fields and signGroups may all be absent or empty — a template can be saved as a stub and filled in later, which signatures-envelope-create does not allow.

The sections are linked by client-assigned reference ids, exactly as on signatures-envelope-create: each document, recipient and sign group carries an id you choose, fields points at those ids, and every id must be unique within the request — duplicates are rejected with DUPLICATE_REFERENCE_DOCUMENT_ID, DUPLICATE_REFERENCE_RECIPIENT_ID or DUPLICATE_REFERENCE_SIGNGROUP_ID.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/signatures/template/create" \  -H "Content-Type: application/json" \  -d '{    "template": {      "templateName": "NDA Template",      "templateDescription": "Reusable NDA signing template",      "subject": "Please sign: NDA Agreement",      "message": "Please review and sign the attached NDA.",      "senderName": "Contracts Team",      "senderEmail": "ops@example.com",      "isSignOrder": false,      "expireInDays": 7,      "alertDaysBeforeExpiry": 2,      "firstReminderDays": 3,      "repeatingReminderDays": 2,      "notifyWhenOpened": true,      "notifyWhenSigned": true,      "locale": "en-US",      "timezone": "America/New_York"    },    "documents": [      {        "referenceDocumentId": 1,        "name": "NDA Agreement",        "loadMethod": "Storage",        "urn": "b6a5f346-6b60-4c1a-9d55-782651280abc",        "externalContext": {          "id": "123"        }      }    ],    "recipients": [      {        "referenceSignerId": 1,        "templateRole": "Counterparty",        "role": "signer",        "mandatory": true,        "externalContext": {          "id": "456"        }      }    ],    "fields": [      {        "referenceSignerId": 1,        "referenceDocumentId": 1,        "name": "mds_signature_counterparty",        "type": "signature",        "page": 1,        "height": 60,        "width": 200,        "positionX": 100,        "positionY": 650,        "isRequired": true,        "tooltip": "Sign here to accept the agreement."      }    ],    "externalContext": {      "id": "789"    }  }'
{  "result": {    "statusCode": 201,    "message": "Created",    "data": {      "template": {        "id": "17e540aa-d1dd-4714-9cb3-2d28504a048d",        "uploadDate": "2026-09-17T09:14:22.000Z"      },      "documents": [        {          "id": "71c057f6-433e-4ca6-9367-0be821441294",          "externalContext": {            "id": "123"          }        }      ],      "recipients": [        {          "id": "2908514c-b7b6-4080-9ded-2f441cd7c2ef",          "externalContext": {            "id": "456"          }        }      ],      "signGroups": [],      "fields": [        {          "id": "cd3084fe-1137-4735-afac-fa33c1749f9a",          "recipientId": "2908514c-b7b6-4080-9ded-2f441cd7c2ef",          "signGroupId": "",          "documentId": "71c057f6-433e-4ca6-9367-0be821441294"        }      ]    }  },  "origin": "POST https://api.doctavian.com/v1/signatures/template/create",  "dateTime": "2026-07-20T12:00:00.000Z",  "consumption": [    {      "dimension": "templates-created",      "value": 1    }  ],  "externalContext": {    "id": "789"  },  "userId": "12f0a7b9-ec67-4232-863d-46e3d4e5ba44",  "operationId": "b7f4e0a91c8d4a3e85260fb17d9c43ae"}
{  "error": {    "statusCode": 400,    "message": "A template role is used more than once: 'Counterparty'.",    "innerErrors": [      {        "code": "DUPLICATE_TEMPLATE_ROLE",        "message": "A template role is used more than once: 'Counterparty'.",        "userMessage": "Each role on a template must have a different name."      }    ]  },  "origin": "POST https://api.doctavian.com/v1/signatures/template/create",  "dateTime": "2026-07-20T12:00:00.000Z",  "userId": "29eeeed1-6575-4cd6-87eb-0c9f978da19a",  "operationId": "8c4018a60ae91bb5346e291890d45210"}
{  "error": {    "statusCode": 500,    "message": "An unexpected error occurred while creating the template.",    "innerErrors": [      {        "code": "FUNCTION_EXECUTION_ERROR",        "message": "An unexpected error occurred while creating the template.",        "userMessage": "Something went wrong. Please try again or contact support."      }    ]  },  "origin": "POST https://api.doctavian.com/v1/signatures/template/create",  "dateTime": "2026-07-20T12:00:00.000Z",  "userId": "b08de32e-e596-45ae-ac5e-5c9e263755aa",  "operationId": "123e21e74ff2a16e18f56f7f44fc75f0"}