How to send document by merging multiple templates and notify the signer through email using BoldSign API?

This guide will walk you through the process of sending a document by merging multiple templates and notify the signer through email using BoldSign API. If you need to send the same static documents via email, creating templates with the documents and utilizing these templates for signatures is an efficient approach.

Create templates in BoldSign's web app

  1. Create templates in BoldSign's web app. See How to Create a Template in the BoldSign Web App for instructions.
  2. While creating the templates, ensure that you configure the delivery option as Email for the recipients.

Send document to the signer via Email

Here, we provide example code snippets for sending a document using templates to the signer via email. You can choose the code snippet that corresponds to your preferred programming language:

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": [
          "4fe17627-xxxx-41ff-xxxx-0af80fd77740", "d57d9f60-xxxx-4f30-xxxx-2830b6a8fb3f"
        ],
       "title": "Invitation form",
       "message": "Kindly review and sign this.",
       "roles": [
        {
        "roleIndex": 1,
        "signerName": "David",
        "signerEmail": "david@cubeflakes.com",
        "signerType": "Signer",
        "deliveryMode": "Email",
        "formFields": [
                        {
                            "id": "SignField",
                            "fieldType": "Signature",
                            "pageNumber": 1,
                            "bounds": {
                            "x": 100,
                            "y": 100,
                            "width": 100,
                            "height": 50
                            },
                            "isRequired": true
                        }
                    ],      
        "locale": "EN"
        }
    ]
}'
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}");
var templateClient = new TemplateClient(apiClient);

var signatureField = new FormField(
    id: "sign",
    isRequired: true,
    type: FieldType.Signature,
    pageNumber: 1,
    bounds: new Rectangle(x: 100, y: 100, width: 100, height: 50));

var formFieldCollections = new List<FormField>()
{
    signatureField
};

var templateRole = new Roles(
    roleSignerIndex:1,
    roleSignerName:"David",
    roleSignerEmailAddress:"david@cubeflakes.com",
    formFields: formFieldCollections,
    locale: Locales.EN);

templateRole.DeliveryMode = DeliveryMode.Email;

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

var mergeAdSend = new MergeAndSendForSign()
{
    TemplateIds = new string[] { "4fe17627-xxxx-41ff-xxxx-0af80fd77740", "d57d9f60-xxxx-4f30-xxxx-2830b6a8fb3f" },
    Roles = roles
};

var documentCreated = await templateClient.MergeAndSendAsync(mergeAdSend).ConfigureAwait(false);

import requests

url = "https://api.boldsign.com/v1-beta/template/mergeAndSend"

payload = {
    "templateIds": ["4fe17627-xxxx-41ff-xxxx-0af80fd77740", "d57d9f60-xxxx-4f30-xxxx-2830b6a8fb3f"],
    "roles": [
        {
            "roleIndex": 1,
            "signerName": "David",
            "signerEmail": "david@cubeflakes.com",
            "deliveryMode": "Email",
            "formFields": [
                {
                    "id": "string",
                    "name": "string",
                    "fieldType": "Signature",
                    "pageNumber": 1,
                    "bounds": {
                        "x": 50,
                        "y": 50,
                        "width": 1,
                        "height": 1
                    },
                    "isRequired": True
                }
            ]
        }
    ]
}

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 = axios.post(
    'https://api.boldsign.com/v1-beta/template/mergeAndSend',
    {
        'templateIds': ['4fe17627-xxxx-41ff-xxxx-0af80fd77740', 'd57d9f60-xxxx-4f30-xxxx-2830b6a8fb3f'],
        'roles': [
            {
                'roleIndex': 1,
                'signerName': 'David',
                'signerEmail': 'david@cubeflakes.com',
                'deliveryMode': 'Email',
                'formFields': [
                    {
                        'id': 'string',
                        'name': 'string',
                        'fieldType': 'Signature',
                        'pageNumber': 1,
                        'bounds': {
                            'x': 50,
                            'y': 50,
                            'width': 1,
                            'height': 1
                        },
                        'isRequired': true
                    }
                ],
            }
        ]
    },
    {
        headers: {
            'accept': 'application/json',
            'X-API-KEY': '{Your API key}',
            'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true'
        }
    }
);

In the code snippets above, ensure to update the templateIds with the IDs of the templates you've created. Update the deliveryMode as Email. Additionally, modify the signerEmail and signerName properties to match the email and name of the signer you intend to send the document to. You can also provide form field details for the document in the formFields array.

After executing the code, a document will be generated, and an email will be dispatched to the signer. The recipient can sign the document by clicking the link in the email.

Email received by the signer after executing the above code

Step 1