Send document from template

post/v1/template/send

Templates are created in the same way as regular documents, but instead of associating signature fields with people, we simply associate fields with roles. Please refer to the Create template article to know more details.

When you need to send the same contracts out for signature to different groups of people repeatedly, you can use templates to save time. This section demonstrates how to send a document for signature by using an existing template.

Code snippet

curl -X 'POST' \ 'https://api.boldsign.com/v1/template/send?templateId=b8085b47-63b3-47f8-8d5e-cb0acfe2d916' \
     -H 'accept: application/json' \
     -H 'X-API-KEY: {your API key}' \
     -H 'Content-Type: application/json;odata.metadata=minimal;odata.streaming=true' \
     -d '{
       "title": "Invitation form",
       "message": "Kindly review and sign this.",
       "roles": [
    {
      "roleIndex": 50,
      "signerName": "Richard",
      "signerOrder": 1,
      "signerEmail": "richard@cubeflakes.com",
      "privateMessage": "Please check and sign the document.",
      "authenticationCode": "281028",
      "enableEmailOTP": false,
      "signerType": "Signer",
      "signerRole": "Manager",
     "formFields": [
    {
      "id": "SignField",
      "fieldType": "Signature",
      "pageNumber": 1,
      "bounds": {
        "x": 100,
        "y": 100,
        "width": 100,
        "height": 50
      },
      "isRequired": true
    },
  ],      
      "language": 1
    }
  ],
  "brandId": "8208b6d3-7ee0-4a1a-b597-1bbe41018107",
  "labels": [
    "Invitation"
  ],
  "disableEmails": false,
  "hideDocumentId": true,
  "reminderSettings": {
    "enableAutoReminder": true,
    "reminderDays": 3,
    "reminderCount": 10
  },
  "cc": [
    {
      "emailAddress": "alexgayle@cubeflakes.com"
    }
  ],
  "expiryDays": 180,
  "expiryDateType": "Days",
  "expiryValue": 60,
  "disableExpiryAlert": true,
  "enablePrintAndSign": true,
  "enableReassign": true,
  "enableSigningOrder": true,
  "useTextTags": true,
  }`
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");
var templateClient = new TemplateClient(apiClient);
var signatureField = new FormField(
  id: "sign_id",
  type: FieldType.Signature,
  pageNumber: 1,
  bounds: new Rectangle(x: 100, y: 100, width: 100, height: 50));
  
  var formFieldsCollections = new List<FormField>
  {
    signatureField,
  };
    
  var templateRole = new Roles(
    roleIndex:3,
    signerName:"David",
    signerEmail:"david@cubeflakes.com",
    formFields: formFieldsCollections);
      
  var roles = new List<Roles>
  {
    templateRole,
  };
      
  var sendForSignFromTemplate = new SendForSignFromTemplate()
  {
    TemplateId = "01c19aef-2dad-476d-b801-7178ef2e1036",
    Roles = roles
  };
            
var documentCreated =  templateClient.SendUsingTemplate(sendForSignFromTemplate);
import requests

url = "https://api.boldsign.com/v1/template/send?templateId=b67e6933-xxxx-xxxx-xxxx-a613cd83b5cd"

payload = "{\n  \"roles\": [\n    {\n      \"roleIndex\": 3,\n      \"signerName\": \"David\",\n      \"signerEmail\": \"david@cubeflakes.com\",\n      \"formFields\": [\n        {\n          \"fieldType\": \"Signature\",\n          \"pageNumber\": 1,\n          \"bounds\": {\n            \"x\": 100,\n            \"y\": 100,\n            \"width\": 100,\n            \"height\": 50\n          }\n        }\n      ]\n    }\n  ]\n}"
headers = {
  'accept': 'application/json',
  'X-API-KEY': '{your API key}',
  'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true'
}

response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const axios = require('axios');
const response = await axios.post(
    'https://api.boldsign.com/v1/template/send',
    // '{\n  "roles": [\n    {\n      "roleIndex": 3,\n      "signerName": "David",\n      "signerEmail": "david@cubeflakes.com",\n      "formFields": [\n        {\n          "fieldType": "Signature",\n          "pageNumber": 1,\n          "bounds": {\n            "x": 100,\n            "y": 100,\n            "width": 100,\n            "height": 50\n          }\n        }\n      ]\n    }\n  ]\n}',
    {
        'roles': [
            {
                'roleIndex': 3,
                'signerName': 'David',
                'signerEmail': 'david@cubeflakes.com',
                'formFields': [
                    {
                        'fieldType': 'Signature',
                        'pageNumber': 1,
                        'bounds': {
                            'x': 100,
                            'y': 100,
                            'width': 100,
                            'height': 50
                        }
                    }
                ]
            }
        ]
    },
    {
        params: {
            'templateId': 'b67e6933-xxxx-xxxx-xxxx-a613cd83b5cd'
        },
        headers: {
            'accept': 'application/json',
            'X-API-KEY': '{your API key}',
            'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true'
        }
    }
);

Query parameters

h1h2
templateIdstringRequiredThe ID of the existing template to be used for sending the document.

Request body

h1h2
titlestringThis is the title of the document that will be displayed in the BoldSign user interface as well as in the signature request email.
messagestringA message for all the recipients. You can include the instructions that the signer should know before signing the document.
rolesarrayA 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. Role properties are available here.
brandIdstringYou can customize the logo, colors, and other elements of the signature request emails and document signing pages to match your company branding. The ID of the existing brand can be obtained from the branding API and from the web app.
labelsarrayLabels(tags) are added to the documents to categorize and filter them. One or more labels can be added.
disableEmailsbooleanDisables the sending of document related emails to all the recipients. The default value is false.
hideDocumentIdbooleanDecides whether the document ID should be hidden or not.
reminderSettingsbooleanOptions to customize the auto reminder settings. ReminderSettings properties are available here.
ccarrayMail ID of the CC recipients. One or more CC recipients can be specified. DocumentCC properties are available here.
expiryDaysintegerThe number of days after which the document expires. The default value is 60 days.
enablePrintAndSignbooleanAllows the signer to print the document, sign, and upload it. The default value is false.
enableReassignbooleanAllows the signer to reassign the signature request to another person. The default value is true.
enableSigningOrderbooleanEnables or disables the signing order. If this option is enabled, then the signers can only sign the document in the specified order and cannot sign parallelly. The default value is false.
disableExpiryAlertbooleanDisables the alert, which was shown one day before the expiry of the document.
documentInfoarrayOptions to customize the information like title and description of the document for a particular signer. DocumentInfo properties are available here.
onBehalfOfstringMail ID of the user to send the document on behalf of them.

Role properties

h1h2
roleIndexintegerThe row index value of the role. The index value must be between 1 and 50.
signerNamestringName of the signer. This name will appear on all the emails, notifications, and on the audit file.
signerOrderintegerSigning order of the signer. This is applicable when the signing order option is enabled.
signerEmailstringMail ID of the signer. This ID will appear on all the emails, notifications, and on the audit file.
hostEmailstringMail ID of the host. It is applicable when the signerType is set to InPersonSigner.
privateMessagestringDisplays a message to the specified signer when he proceeds to sign the document. You can include the instructions that the signer should know before signing the document.
authenticationCodestringThe authentication access code which must be entered by the signer to access the document. This should be shared to the signer.
enableEmailOTPbooleanEnables the email OTP authentication. If this is enabled, the signer must enter the OTP which was received in the email, to access the document.
signerTypeSignerTypeType of the signer. The values are Signer, Reviewer, and InPersonSigner.
signerRolestringThe role of the signer which was specified while creating the template.
formFieldsarrayList of form fields associated to the signer. FormField properties are available here.
existingFormFieldsarrayList of existing form fields in the document. ExistingFormFields properties are available here.
languageintegerIndex of the language in which the document signing pages and emails for the signer should render. The supported languages are 1-English, 2-Spanish, 3-German, 4-French, and 5-Romanian.

FormField properties

h1h2
idstringThe ID of the form field.
namestringName of the form field.
fieldTypestringType of the form field. The available values are Signature, Initial, CheckBox, TextBox, Label, DateSigned, RadioButton, Image, Attachment, EditableDate, Hyperlink, and Dropdown.
pageNumberintegerPage number in the document in which the form field has to be placed.
boundsRectanglePosition and size values of the form field to be placed. Bounds properties are available here.
isRequiredbooleanDecides whether this form field is required to be filled or not.
valuestringValue to be displayed on the label form field.
fontSizefloatSize of the font.
fontstringFont family. The values are Courier, Helvetica, and TimesNewRoman.
fontHexColorstringColor of the font. The value should be hex color code. Example - #035efc.
isBoldFontbooleanDecides whether the font should be in bold or not.
isItalicFontbooleanDecides whether the font should be in italic or not.
isUnderLineFontbooleanDecides whether the font should be underlined or not.
lineHeightintegerHeight of a line in the text.
characterLimitintegerLimits the number of characters in the text.
groupNamestringThe group name of the form field. This field is required when the fieldType is set to RadioButton.
placeHolderstringA hint text to be displayed on the text form field by default.
validationTypeValidationTypeType of validation for the text box form field. The values are Only Numbers, Regex, Currency, Email, and None.
validationCustomRegexstringValue for regex validation. This is applicable when the validationType is set to Regex.
validationCustomRegexMessagestringDescription for regex validation. This message is displayed when the signer enters an invalid regex format value in the text box form field.
dateFormatstringFormat of the date to be displayed on the date signed form field. The default value is MM/dd/yyyy.
imageInfoobjectOptions to customize the image form field. ImageInfo properties are available here.
attachmentInfoobjectOptions to customize the attachment form field. AttachmentInfo properties are available here.
editableDateFieldSettingsobjectOptions to customize the editable date form field. EditableDateFieldSettings properties are available here.
hyperLinkTextstringText to be displayed for the hyperlink.
dataSyncTagstringThe value that can be specified on two or more textbox form fields to sync them.
dropDownOptionsarrayThe values which have to be displayed on the dropdown form field. One or more values can be specified.

Bounds properties

h1h2
xfloatX coordinate value to place the form field.
yfloatY coordinate value to place the form field.
widthfloatWidth of the form field.
heightfloatHeight of the form field.

ImageInfo properties

h1h2
titlestringTitle of the image form field.
descriptionstringDescription of the image form field.
allowedFileExtensionsstringControls the image formats that can be allowed to upload on the image form field. The values are .jpg or .jpeg, .svg, .png, and .bmp.

AttachmentInfo properties

h1h2
titlestringTitle of the attachment form field.
descriptionstringDescription of the image form field.
allowedFileTypesstringControls the file formats that can be allowed to upload on the attachment form field. The values are PDF, Document and Image.

EditableDateFieldSettings properties

h1h2
dateFormatstringFormat of the date to be displayed on the date signed form field. The default value is MM/dd/yyyy.
minDatestringThe minimum date that can be selected. The string should be in date-time format.
maxDatestringThe maximum date that can be selected. The string should be in date-time format.

ExistingFormFields properties

h1h2
indexintegerIndex of the existing form field.
idstringThe ID of the existing form field.
valuestringValue of the existing form field.

DocumentCC properties

h1h2
emailAddressstringMail ID of the CC recipients.

ReminderSettings properties

h1h2
enableAutoReminderbooleanEnables or disables the auto reminder.
reminderDaysintegerThe number of days between each automatic reminder.
reminderCountintegerThe number of times the auto reminder should be sent.

DocumentInfo properties

h1h2
languageintegerLanguage in which the document signing pages and emails for the signer should render. The supported languages are 1-English, 2-Spanish, 3-German, 4-French, and 5-Romanian.
titlestringTitle of the document.
DescriptionstringA message for the signer. You can include the instructions that the signer should know before signing the document.

Example response

200 Success

{
  "documentId": "755195d8-xxxx-xxxx-xxxx-88ff77d35419"
}