When dealing with complex agreements or contracts, it’s often necessary to combine multiple templates into a single document before sending it out for signatures.
Consider a legal firm that needs to send out a comprehensive agreement package to a client. The package might include a standard contract, a confidentiality agreement, and an appendix with specific terms. Typically, each of these forms exists as a separate template. Instead of sending these documents individually, they can use an API to merge the templates into a single, cohesive document. This ensures that the client receives a well-organized, complete agreement in one go.
In this blog, we will take a detailed look at how to implement this process using an API, complete with code examples to guide you through the steps.
Please note that the following conditions are not supported when merging templates:
- Templates with different signer types: If one template has a role as a signer and the other template has the same role as a reviewer or in-person signer, they will not merge. The roles must be of the same signer type.
- Templates with different signer authentication modes: If one template has a role that requires SMS OTP for authentication and the other template with the same role require it to use an access code for authentication, they will not merge. Both templates must have the same signer authentication mode.
- Templates with different signer languages: If one template has a role set to use a specific signer language, such as English, and the other template with the same role uses a different signer language, such as French, they will not merge. Both templates must be set to the same signer language.
Step-by-Step Guide
Let’s see how to send a document containing multiple templates for signature via the API.
Step 1: Create templates in BoldSign
To perform merge and send, you need to retrieve the template IDs of the templates you are going to use. If you don’t have templates in your account, you can create them using either the API or web app:
Step 2: Merge and send
Once you have your template IDs, provide them to templateIds. Modify the
signerEmail and signerName properties to match the email address and name of the signer to whom you intend to send the document.
The following code snippets demonstrate how to send documents for signature using multiple templates via the API.
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": [
"{templateId 1}", "{templateId 2}"
],
"title": "Invitation form",
"message": "Kindly review and sign this.",
"roles": [
{
"roleIndex": 1,
"signerName": "David",
"signerEmail": "[email protected]",
"signerType": "Signer",
"deliveryMode": "Email",
"locale": "EN"
}
]
}'
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}");
var templateClient = new TemplateClient(apiClient);
var templateRole = new Roles(
roleSignerIndex: 1,
roleSignerName: "David",
roleSignerEmailAddress: "[email protected]",
locale: Locales.EN
);
templateRole.DeliveryMode = DeliveryMode.Email;
var roles = new List<Roles>
{
templateRole
};
var mergeAndSend = new MergeAndSendForSign()
{
TemplateIds = new string[] { "{templateId 1}", "templateId 2" },
Roles = roles
};
var documentCreated = await templateClient.MergeAndSendAsync(mergeAndSend).ConfigureAwait(false);
import requests
url = "https://api.boldsign.com/v1-beta/template/mergeAndSend"
payload = {
"templateIds": ["{templateId 1}", "{templateId 2}"],
"roles": [
{
"roleIndex": 1,
"signerName": "David",
"signerEmail": "[email protected]",
"signerRole": "Manager",
"deliveryMode": "Email"
}
]
}
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)
<?php
require_once "vendor/autoload.php";
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
$client = new GuzzleHttp\Client([ 'verify' => false,]);
$headers = [
'accept' => 'application/json',
'X-API-KEY' => '{your API key}',
'Content-Type' => 'application/json;odata.metadata=minimal;odata.streaming=true'
];
$body = '{
"templateIds": ["{templateId 1}", "{templateId 2}"],
"title": "Invitation form",
"message": "Kindly review and sign this.",
"roles": [
{
"roleIndex": 1,
"signerName": "david",
"signerOrder": 1,
"signerEmail": "[email protected]",
"privateMessage": "Please check and sign the document.",
"signerType": "Signer",
"signerRole": "Manager",
"locale": "EN"
}
]
}';
$request = new Request('POST', 'https://api.boldsign.com/v1-beta/template/mergeAndSend', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
const axios = require('axios');
const response = axios.post(
'https://api.boldsign.com/v1-beta/template/mergeAndSend',
{
'templateIds': ['{templateId 1}', '{templateId 2}'],
'roles': [
{
'roleIndex': 1,
'signerName': 'David',
'signerEmail': '[email protected]',
'signerRole': 'Manager',
'deliveryMode': 'Email'
}
]
},
{
headers: {
'accept': 'application/json',
'X-API-KEY': '{Your API key}',
'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true'
}
}
);
Conclusion
Combining multiple templates into a single document before sending it for signature is convenient. It eases both the sending and signing processes, preventing documents from getting overlooked or forgotten. BoldSign lets senders use this feature to improve everyone’s signing experience.
Start your 30-day free BoldSign trial today and try merging and sending multiple templates as one document. We value your feedback, so please share your thoughts below. If you have any questions or need more information about our services, don’t hesitate to schedule a demo or reach out to our support team through our support portal.
