Send document using multiple templates
post/v1-beta/template/mergeAndSendTemplates play a pivotal role in enhancing your document management workflow. Users can merge one or more templates into a single document. This merge template process takes an array of template IDs as input and performs a series of checks and operations to seamlessly merge the templates into a finalized document.
Code snippet
curl -X 'POST' \ 'https://api.boldsign.com/v1-beta/template/mergeAndSend' \ -H 'accept: application/json' \ -H 'X-API-KEY: {your API key}' \ -H 'Content-Type: application/json;odata.metadata=minimal;odata.streaming=true' \ -d '{ "templateIds": [ "1a62a39c-xxxx-xxxx-xxxx-c0a09ee3fc82", "01c19aef-xxxx-xxxx-xxxx-7178ef2e1036" ], "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 } ], "locale": "EN" } ], "brandId": "8208b6d3-xxxx-xxxx-xxxx-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, "roleRemovalIndices": [1, 2] }'
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, locale: Locales.EN); var roles = new List<Roles> { templateRole, }; var mergeAndSendForSign = new MergeAndSendForSign () { TemplateIds = new string[] { "01c19aef-xxxx-xxxx-xxxx-7178ef2e1036", "6a80bba9-xxxx-xxxx-xxxx-5d4dcd5cb08a" }, Roles = roles, RoleRemovalIndices = new [] {1, 2} }; var documentCreated = templateClient.MergeAndSend(mergeAndSendForSign);
import requests url = "https://api.boldsign.com/v1-beta/template/mergeAndSend" payload = { "templateIds": [ "01c19aef-xxxx-xxxx-xxxx-7178ef2e1036", "6a80bba9-xxxx-xxxx-xxxx-5d4dcd5cb08a" ], "roles": [ { "roleIndex": 3, "signerName": "David", "signerEmail": "david@cubeflakes.com", "formFields": [ { "fieldType": "Signature", "pageNumber": 1, "bounds": { "x": 100, "y": 100, "width": 100, "height": 50 } } ] } ], "roleRemovalIndices": [1, 2] } headers = { 'accept': 'application/json', 'X-API-KEY': '{your API key}', 'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true' } response = requests.post(url, headers=headers, json=payload) print(response.text)
const axios = require('axios'); const response = await axios.post( 'https://api.boldsign.com/v1-beta/template/mergeAndSend', { 'templateIds': [ '01c19aef-xxxx-xxxx-xxxx-7178ef2e1036', '6a80bba9-xxxx-xxxx-xxxx-5d4dcd5cb08a' ], 'roles': [ { 'roleIndex': 3, 'signerName': 'David', 'signerEmail': 'david@cubeflakes.com', 'formFields': [ { 'fieldType': 'Signature', 'pageNumber': 1, 'bounds': { 'x': 100, 'y': 100, 'width': 100, 'height': 50 } } ] } ], 'roleRemovalIndices': [1, 2] }, { headers: { 'accept': 'application/json', 'X-API-KEY': '{your API key}', 'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true' } } );
Request body
templateIdsarray | This is the templateIds of the existing templates to be used for sending the document. One or more values can be specified. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
titlestring | This is the title of the document that will be displayed in the BoldSign user interface as well as in the signature request email. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
messagestring | A message for all the recipients. You can include the instructions that the signer should know before signing the document. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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,
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
brandIdstring | You 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
labelsarray | Labels (tags) are added to the documents to categorize and filter them. One or more labels can be added. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
disableEmailsboolean | Disables the sending of document related emails to all the recipients. The default value is false. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hideDocumentIdboolean | Decides whether the document ID should be hidden or not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
reminderSettingsboolean | Options to customize the auto reminder settings.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ccarray | Mail ID of the CC recipients. One or more CC recipients can be specified.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
expiryDaysinteger | The number of days after which the document expires. The default value is 60 days. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
enablePrintAndSignboolean | Allows the signer to print the document, sign, and upload it. The default value is false. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
enableReassignboolean | Allows the signer to reassign the signature request to another person. The default value is true. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
enableSigningOrderboolean | Enables 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
disableExpiryAlertboolean | Disables the alert, which was shown one day before the expiry of the document. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
documentInfoarray | Options to customize the information like title and description of the document for a particular signer.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onBehalfOfstring | Mail ID of the user to send the document on behalf of them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
roleRemovalIndicesarray | Removes the roles present in the template with their indices given in this property. |
Notes
When merging multiple templates without enabling a signing order, templates with the same role, email, and name are combined into a single role, and the signing document is then sent to that consolidated role.
When merging multiple templates with a signing order enabled, templates with the same role, email, name, and order are merged into a single role, and the signing document is sent accordingly.
When merging multiple templates and encountering fields with identical names and data types in both templates, if these fields are assigned to the same signer, updating the value of one of these fields using the
existingFormFields
property will automatically reflect the change in both corresponding fields.
Example response
200 Success
{ "documentId": "755195d8-xxxx-xxxx-xxxx-88ff77d35419" }