Template

Templates are created in the same way as regular documents, but instead of associating signature fields with people, we simply associate fields with roles. A role is simply a placeholder for a real person. For example, if we have a purchase order that will always be signed by two people, one from the company and one from the customer, we can create a template with two roles, Customer and Representative.

This section demonstrates how to create, list, and delete templates. Templates can be created programmatically or via the BoldSign web interface and then used in your application.

Asynchronous template processing

The process of template create is asynchronous. Although you will promptly receive the template ID upon initiation, the actual file may still be undergoing processing in the background. To determine whether the template has been successfully created, you must listen for the webhooks.

The system will trigger either a TemplateCreated or TemplateCreateFailed event, indicating the success or failure of the template create, respectively. In the event of failure, the system will send a TemplateCreateFailed event along with an accompanying error message. It is imperative to address and resolve this error to ensure the proper creating of the template in the next request.

Read more about webhooks

Template not found

If you discover that a template is not present in your account even after receiving a templateId in the API response, it is directly tied to the asynchronous template processing, as explained in the preceding section. To ascertain whether the template has been successfully created, you should actively monitor the TemplateCreated and TemplateCreateFailed webhook events. These events will provide confirmation regarding the status of the template, indicating whether it has been successfully created or if an issue has occurred during the process.

Create template

post/v1/template/create

When you need to send the same contracts out for signature to different groups of people repeatedly, you can use templates to save time. Once a template is created, sending contracts using that template takes less than a minute. Templates can be created for both self-signing and sending signature requests to other signers.

Code snippet

curl -X 'POST' \ 'https://api.boldsign.com/v1/template/create' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {your API key}' \
  -H 'Content-Type: multipart/form-data' \
  -F 'DocumentMessage=document message for signers' \
  -F 'Files=@Bill-of-Sale.pdf;type=application/pdf' \
  -F 'Title=title of the template' \
  -F 'AllowMessageEditing=true' \
  -F 'Description=testingDescription' \
  -F 'DocumentTitle=title of the document' \
  -F 'AllowNewFiles=true' \
  -F 'AllowModifyFiles=true' \
  -F 'Roles={
  "name": "Hr",
  "index": 1,
  "defaultSignerName": "Alex Gayle",
  "defaultSignerEmail": "alexgayle@cubeflakes.com",
  "signerOrder": 1,
  "signerType": "Signer",
  "formFields": [
    {
      "id": "sign_id",
      "fieldType": "Signature",
      "pageNumber": 1,
      "bounds": {
        "x": 50,
        "y": 100,
        "width": 100,
        "height": 60
      },
      "isRequired": true
    }
  ]
}'
var apiClient = new ApiClient("https://api.boldsign.com", "API-KEY");
var templateClient = new TemplateClient(apiClient);
var documentFilePath = new DocumentFilePath
{
    ContentType = "application/pdf",

    FilePath = @"D:\Bill-of-Sale.pdf",
};

var filesToUpload = new List<IDocumentFile>
{
    documentFilePath,
};

var signatureField = new FormField(
    id: "sign_id",
    type: FieldType.Signature,
    pageNumber: 1,
    bounds: new Rectangle(x: 50, y: 50, width: 200, height: 30));

var formFieldsCollections = new List<FormField>
{
    signatureField,
};

var templateRole = new TemplateRole(
    roleIndex: 1,
    name: "Hr",
    defaultSignerName: "Alex Gayle",
    defaultSignerEmail: "alexgayle@cubeflakes.com",
    signerOrder: 1,
    signerType: SignerType.Signer,
    formFields: formFieldsCollections,
    locale: Locales.EN);

var roles = new List<TemplateRole>
{
    templateRole,
};

var templateRequest = new CreateTemplateRequest()
{
    Title = "title of the template",
    DocumentMessage = "document message for signers",
    Files = filesToUpload,
    Description = "testingDescription",
    DocumentTitle = "title of the document",
    AllowNewFiles = true,
    AllowModifyFiles = true,
    Roles = roles
};

var templateCreated = templateClient.CreateTemplate(templateRequest);
import requests
import json
url = "https://api.boldsign.com/v1/template/create"
payload = {
    "BrandId": "",
    "EnableReassign": "true",
    "AllowNewRoles": "true",
    "EnablePrintAndSign": "false",
    "DocumentMessage": "document message for signers",
    "EnableSigningOrder": "false",
    "UseTextTags": "false",
    "Title": "title of the template",
    "AllowMessageEditing": "true",
    "Description": "testingDescription",
    "DocumentTitle": "title of the document",
    "AllowNewFiles": True,
    "AllowModifyFiles": True,
    "Roles": json.dumps(
        {
            "name": "Hr",
            "index": 1,
            "defaultSignerName": "Alex Gayle",
            "defaultSignerEmail": "alexgayle@boldsign.dev",
            "signerOrder": 1,
            "signerType": "Signer",
            "locale": "EN",
            "imposeAuthentication": "None",
            "deliveryMode": "Email",
            "formFields": [
                {
                    "id": "sign_id",
                    "name": "sign",
                    "fieldType": "Signature",
                    "pageNumber": 1,
                    "bounds": {"x": 50, "y": 100, "width": 100, "height": 60},
                    "isRequired": True,
                }
            ],
            "allowRoleEdit": True,
            "allowRoleDelete": True,
        }
    ),
}
files = [
    ("Files", ("file", open("sample.docx", "rb"), "application/msword"))
]
headers = {
    "accept": "application/json",
    "X-API-KEY": "<<<API-KEY>>>",
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('BrandId', '');
form.append('EnableReassign', 'true');
form.append('AllowNewRoles', 'true');
form.append('EnablePrintAndSign', 'false');
form.append('DocumentMessage', 'document message for signers');
form.append('EnableSigningOrder', 'false');
form.append('UseTextTags', 'false');
form.append('AllowNewFiles', 'true');
form.append('AllowModifyFiles', 'true');
form.append('Files', fs.readFileSync('Bill-of-Sale.pdf;type=application/pdf'), 'Bill-of-Sale.pdf;type=application/pdf');
form.append('Title', 'title of the template');
form.append('AllowMessageEditing', 'true');
form.append('Description', 'testingDescription');
form.append('DocumentTitle', 'title of the document');
form.append('Roles', '{\n  "name": "Hr",\n  "index": 1,\n  "defaultSignerName": "Alex Gayle",\n  "defaultSignerEmail": "alexgayle@cubeflakes.com",\n  "signerOrder": 1,\n  "signerType": "Signer",\n  "locale": "En",\n  "deliveryMode": "Email",\n  "imposeAuthentication": "None",\n  "formFields": [\n    {\n      "id": "sign_id",\n      "name": "sign",\n      "fieldType": "Signature",\n      "pageNumber": 1,\n      "bounds": {\n        "x": 50,\n        "y": 100,\n        "width": 100,\n        "height": 60\n      },\n      "isRequired": true\n    }\n  ],\n  "allowRoleEdit": true,\n  "allowRoleDelete": true\n}');
const response = await axios.post(

    ' https://api.boldsign.com/v1/template/create',

    form,
    {
        headers: {
            ...form.getHeaders(),
            'accept': 'application/json',
            'X-API-KEY': '<API-KEY>',
            'Content-Type': 'multipart/form-data'
        }
    }
);

Request body

TitlestringRequiredThe title of the template.
DescriptionstringThe description of the template.
DocumentTitlestringThis is the name of the document that will be displayed in the BoldSign user interface as well as in the signature request email.
DocumentMessagestringThe message that will be seen by all recipients. You can include any instructions related to this document that the signer should be aware of before signing.
FilesarrayThe files to be uploaded for the template. .pdf, .png, .jpg, and .docx are supported file formats. You may upload up to 25 files. Each document may have a maximum of 1000 pages and must be no larger than 25MB in size.
FileUrlsarrayThe URL of the file to be uploaded that is publicly accessible. .pdf, .png, .jpg, and .docx are supported file formats. You may upload up to 25 files. Each document may have a maximum of 1000 pages and must be no larger than 25MB in size.

Rolesarray

A role is simply a placeholder for a real person. For example, if we have a purchase order that will always be signed by two people, one from the company and one from the customer, we can create a template with two roles, Customer and Representative.

namestringThe name of the Role.
indexintegerThe row index of the role. The role index should be in linear increments for each role (1, 2, 3, and so on). The index value must be between 1 and 50.
defaultSignerNamestringThe signer name of the document. This name appears in all email communications, signing notifications, and the audit file.
defaultSignerEmailstringThe signer email of the document. This email appears in all email communications, signing notifications, and the audit file.
signerOrderintegerThe order of the signer. When you enable the signing order option, this will be required. The value must be between 1 and 50.
signerTypestringThe type of the signer and the values are Signer, Reviewer, and InPersonSigner.
hostEmailstringThe host email address. It is a required property when the signerType is set to InPersonSigner. Your organization should have HostEmail.
languageintegerThe language for the signer. The supported languages are 1-English, 2-Spanish, 3-German, 4-French, and 5-Romanian. Note that 'locale' should now be used instead of 'language' as it has replaced the deprecated term.
localestringSpecify the language index for rendering document signing pages and emails for the signer, choosing from the supported locales such as EN-English, NO-Norwegian, FR-French, DE-German,ES-Spanish, BG-Bulgarian, CS-Czech, DA-Danish,IT-Italian, NL-Dutch, PL-Polish, PT-Portuguese,RO-Romanian, RU-Russian, and SV-Swedish.
imposeAuthenticationstringThis is used to allow authentication for a specific signer. We have three types of authentication. They are AccessCode , EmailOTP, SMSOTP and IdVerification. The default value is None.

phoneNumberobject

When the delivery mode is set to SMS or EmailAndSMS, you can provide the phone number with the country code.

countryCodestringThis property represents the country code associated with the phone number.
numberstringThis property represents the actual phone number.
deliveryModestringThis property allows you to specify the desired delivery mode for sending notifications. We have three types of delivery modes. They are Email , SMS and EmailAndSMS. The default value is Email.
allowFieldConfigurationbooleanThis option enables the signer to add fields at their end while signing the document. You can also assign fields to the signer if anything is required, and it becomes mandatory if set to false. By default, it is set to false.

formFieldsarray

List of fields associated with the signer.

idstringThe id of the form field.
namestringThe name of the form field.
fieldTypestringThe type of the form field. The available values are Signature, Initial, CheckBox, TextBox, Label, DateSigned, RadioButton, Image, Attachment, EditableDate, Hyperlink, and Dropdown.
pageNumberintegerThis will be used to specify which page the form field should be placed on.

boundsobject

This will contain the form field's x and y coordinates, width, and height.

xfloatThe form field's x coordinate value.
yfloatThe form field's y coordinate value.
widthfloatThe form field's width.
heightfloatThe form field's height.
isRequiredbooleanWhen disabled, the signer does not want to fill out the form field. The default value is true.
valuestringThe value of the form field.
fontSizeintegerThe font size of the form field.
fontstringThe font family of the form field.
fontHexColorstringThe font color of the form field.
isBoldFontbooleanWhen enabled, the font will be displayed in bold.
isItalicFontbooleanWhen enabled, the font will be italic.
isUnderLineFontbooleanWhen enabled, the font will be displayed in Underline format.
lineHeightintegerThe line height of the form field.
characterLimitintegerThe character limit in the form field.
groupNamestringThe groupName of the form field. This field is required when the fieldType is set to RadioButton.
placeHolderstringThe placeholder of the form field.
validationTypestringThe validation type of the textbox form field. The available values are None, NumbersOnly, EmailAddress, Currency, and CustomRegex. The default value is None.
validationCustomRegexstringThe custom regex of the textbox form field. When we set the ValidationType to CustomRegex, it will be required.
validationCustomRegexMessagestringThe text box field's custom regex message. This message is displayed when the signer enters an invalid regex format value in the text box form field while signing the document.
dateFormatstringFormat of the date to be displayed on the date signed form field. The default value is MM/dd/yyyy. When null is provided, the value is inherited from the business profile settings of your account. Accepted formats are MM/dd/yyyy (02/08/2024), dd/MM/yyyy (08/02/2024), dd-MMM-yyyy (08-Feb-2024), MMM-dd-yyyy (Feb-08-2024), MMM dd, yyyy (Feb 08, 2024), dd MMM, yyyy (08 Feb, 2024), yyyy, MMM dd (2024, Feb 08), yyyy/MM/dd (2024/02/08), dd-MM-yyyy (08-02-2024), MM-dd-yyyy (02-08-2024), yyyy-MM-dd (2024-02-08).
timeFormatstringFormat of the time to be displayed on the date signed form field. When null is provided, the value is inherited from the business profile settings of your account. Accepted formats are hh:mm tt (12:30 PM), h:mm tt (2:45 PM), HH:mm (14:30), H:mm (9:15), None (Disabled, no time will be displayed).

imageInfoobject

The information about the image field.

titlestringThe title of the image.
descriptionstringThe description of the image.
allowedFileExtensionsstringThis includes file extensions such as .jpg or .jpeg, .svg, .png, and .bmp.

attachmentInfoobject

The information about the attachment field.

titlestringThe title of the attachment.
descriptionstringThe description of the attachment.
allowedFileTypesstringThe file types that can be used are .pdf, .docx, .jpg, .jpeg, and .png.

editableDateFieldSettingsobject

The settings for the editable date form field and it contains date format, min, and max values.

dateFormatstringThe dateFormat of the editable date field.
minDatestringThe min date of the editable date field.
maxDatestringThe max date of the editable date field.
hyperlinkTextstringThe text of the hyperlink form field.
dataSyncTagstringThe value of the dataSync tag.
dropdownOptionsarrayThe options of the dropdown form field.
textAlignstringDetermines the horizontal alignment of text for the textbox and label form fields, and can be set to Left, Center, or Right.
textDirectionstringDetermines the text direction of text for the textbox and label form fields, and can be set to LTR or RTL.
characterSpacingfloatDetermines the character spacing of text for the textbox and label form fields. It can be set as a floating-point value.
allowRoleEditbooleanYou cannot change the signer details while sending the document out for signature if it is disabled. The default value is true.
allowRoleDeletebooleanYou cannot remove the signer details while sending the document out for signature if it is disabled. The default value is true.

AllowNewFilesboolean

When set to true, the sender can add new files while using this template to send signature requests. If set to false, the sender will not be able to add new files.

Defaults to true.

AllowModifyFilesboolean

When set to true, the sender can replace or delete existing files while using this template to send signature requests. If set to false, the sender will not have the ability to replace or delete files.

Defaults to true.

CCarrayYou can add anyone who needs to receive a copy of the signed document by adding their email address.
BrandIdstringYou can customize the branding of signature request emails and document signing pages with your own colors, logos, and other elements. The brand id can be obtained from both the branding API and the web app branding page.
AllowMessageEditingbooleanWhen disabled, you cannot change the message while creating a document with this template. The default value is true.
AllowNewRolesbooleanWhen disabled, you cannot add additional signers to the document. The default value is true.
EnableReassignbooleanWhen disabled, the reassign option is not available after sending the document out for signature. The default value is true.
EnablePrintAndSignbooleanWhen enabled, the document can be printed and signed offline. The default value is false.
EnableSigningOrderbooleanWhen enabled, signers can only sign the document in the order specified. Furthermore, the next signer will be notified when the previous signer has signed the document. The default value is false.

DocumentInfoarray

This is used to specify the title and description of the document in the various supported languages.

languageintegerThe language of the document. The supported languages are 1-English, 2-Spanish, 3-German, 4-French, and 5-Romanian. Note that 'locale' should now be used instead of 'language' as it has replaced the deprecated term.
titlestringThe title of the document.
descriptionstringThe description of the document.
localestringSpecify the language index for rendering document signing pages and emails for the signer, choosing from the supported locales such as EN-English, NO-Norwegian, FR-French, DE-German,ES-Spanish, BG-Bulgarian, CS-Czech, DA-Danish,IT-Italian, NL-Dutch, PL-Polish, PT-Portuguese,RO-Romanian, RU-Russian, and SV-Swedish.
UseTextTagsbooleanWhen enabled, it will convert all the tags defined in the document to BoldSign form fields. The default value is false.

TextTagDefinitionsarray

This can be used for long text tag handling.

definitionIdstringThe definition id of the text tag.
typestringThe type of the form field.
signerIndexintegerThe signer index of the form field.
isRequiredbooleanWhen disabled, the signer is not required to fill out the specific form field. The default value is true.
placeholderstringThe placeholder of the form field.
fieldIdstringThe field id of the form field.

fontobject

The font of the form field.

namestringThe name of the font in the form field.
colorstringThe font color of the form field.
sizeintegerThe font size of the form field.
stylestringThe font style of the form field.
lineHeightintegerThe lineheight of the form field.

validationobject

When we select the type as TextBox, the validation of the form field is required.

typestringThe validation type of the textbox form field. The available values are None, NumbersOnly, EmailAddress, Currency, and CustomRegex. The default value is None.
regexstringThe custom regex of the text box form field. When we set the ValidationType to CustomRegex, it will be required.

sizeobject

This can be used to specify the form field's height and width.

widthfloatThe width of the form field.
heightfloatThe height of the form field.
dateFormatstringFormat of the date to be displayed on the date signed form field. The default value is MM/dd/yyyy. When null is provided, the value is inherited from the business profile settings of your account. Accepted formats are MM/dd/yyyy (02/08/2024), dd/MM/yyyy (08/02/2024), dd-MMM-yyyy (08-Feb-2024), MMM-dd-yyyy (Feb-08-2024), MMM dd, yyyy (Feb 08, 2024), dd MMM, yyyy (08 Feb, 2024), yyyy, MMM dd (2024, Feb 08), yyyy/MM/dd (2024/02/08), dd-MM-yyyy (08-02-2024), MM-dd-yyyy (02-08-2024), yyyy-MM-dd (2024-02-08).
timeFormatstringFormat of the time to be displayed on the date signed form field. When null is provided, the value is inherited from the business profile settings of your account. Accepted formats are hh:mm tt (12:30 PM), h:mm tt (2:45 PM), HH:mm (14:30), H:mm (9:15), None (Disabled, no time will be displayed).
radioGroupNamestringThe form field's groupName, which is required when we set the type RadioButton.
valuestringThe value of the form field.
dropdownOptionsarrayThe options of the dropdown form field.
autoDetectFieldsbooleanWhen enabled, it will convert all the fillable form fields in the document to BoldSign form fields. BoldSign supports Textbox, Checkbox, Radio button, and Signature form fields. Other fields will not be detected as of now. The default value is false.
labelsstring[]The labels (Tags) that will be assigned to the document when a document is created using this template which can be used to categorize and filter the documents.
templateLabelsstring[]The template labels (Tags) are added to the template to categorize and filter the documents.
onBehalfOfstringThe email address of the user to create the template on their behalf.

Example response

201 Created

{
  "templateId": "4e2375dd-xxxx-xxxx-xxxx-870952cee6f8"
}