How to send document from template and notify the signer through email using BoldSign API?

This article guides you on how to send a document from template and notify signer via email using the BoldSign API. If you want to send the same set of documents repeatedly, you can create a template with the document and use the template to send out for signature.

Create a template in BoldSign's web app

  1. Create a template in BoldSign's web app. See How to Create a Template in the BoldSign Web App for instructions.
  2. The default delivery option will be Email; make sure to use the same delivery option while creating the template.

Send document to the signer via Email

Below are example codes for sending a document using a template to the signer via email:

Code snippet

curl -X 'POST' \ 'https://api.boldsign.com/v1/template/send?templateId=b8085b47-xxxx-47f8-xxxx-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": 1,
                "signerName": "David",
                "signerEmail": "david@cubeflakes.com",
                "signerType": "Signer",
                "deliveryMode": "Email",
                "signerRole": "Landlord",
                "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 sendForSignFromTemplate = new SendForSignFromTemplate()
{
    TemplateId = "4fe17627-xxxx-41ff-xxxx-0af80fd77740",
    Roles = roles
};

var documentCreated = await templateClient.SendUsingTemplateAsync(sendForSignFromTemplate).ConfigureAwait(false);
import requests

url = "https://api.boldsign.com/v1/template/send?templateId=4fe17627-xxxx-41ff-xxxx-0af80fd77740"

payload = {
    "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/template/send?templateId=4fe17627-xxxx-41ff-xxxx-0af80fd77740',
    {
        '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'
        }
    }
).then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });

In the above example, update the templateId with the ID of the template you created earlier. Update the deliveryMode as Email. Then, update the SignerEmail and SignerName properties with the email and name of the signer you want to send the document to. Also, provide form fields for the document in the formFields array.

After executing the above code, the document will be created, and an email will be sent to the signer. Now, the signer can sign the document by clicking the link in the email.

Email received by the signer after executing the above code

Step 1