BoldSignDocumentation
BoldSign Mobile Icon

Send document to sign using template

Mon, 12 Apr, 2021

Using templates to send signature request is useful when the same set of document needs to be requested for signature. You can directly use the template with the predefined set of recipients or can add the recipients to the document before sending signature request.

The below given table shows the different properties available in SendForSignFromTemplate and their description:

Property Description
TemplateId ID of the template to be used for signature request
Title Title of the signature request
Message Message to be shown for the signers
Roles Signer role collection containing information about all the signers
BrandId ID for the brand setting created in your BoldSign account

Send signature request from template

The ID of the template is required for this API request and the template can be used directly to send the signature request using below code:

C#CURL

// This is an example template id, add your own template id upon usage.
var templateId = "949ebf20-45a8-4a3e-91a9-68e9540e0020";
var templateDetails = new SendForSignFromTemplate(
                        templateId: templateId,
                        title: "Document from Template",
                        message: "This document description");
var createdDocumentResult = this.templateApi.SendUsingTemplate(templateDetails); 
curl -X POST 'https://api.boldsign.com/v1/template/send?templateId=949ebf20-45a8-4a3e-91a9-68e9540e0020' -H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <authtoken>' \
-d '{"title":"Document from Template","message":"This document description"}'

Send document from template with new recipients and form fields

You can add new recipients to the signature request from template along with form fields or you can customize form fields of the existing recipients present in the template.

This can be done by adding the roles in SendForSignFromTemplate. The below mentioned table shows the different properties available in Roles and their description:

Property Description
SignerName Name of the signer
SignerEmail Email address of the signer
SignerType Signer type (Signer/ Reviewer)
SignerOrder Signing order of the signer
SignerRole Signer role in the document can be specified
RoleIndex Role index of the signer in template if already present
AuthenticationCode Authentication code for signing the document
EnableEmailOTP Boolean to enable email OTP authentication for the signer
FormFields Form field collection to be assigned to signer
ExistingFormFields Existing form field changes for already present signer in the template can be changed here
PrivateMessage Private message to the signer

The below code snippet shows the addition of new signer role and sending the document to sign using the template:

C#CURL

// This is an example template id, add your own template id upon usage.
var templateId = "949ebf20-45a8-4a3e-91a9-68e9540e0020";

// Creating signature field.
var signatureField = new FormField(
                            id: "Sign",
                            type: FieldType.Signature,
                            pageNumber: 1,
                            isRequired: true,
                            bounds: new Rectangle(x: 50, y: 50, width: 200, height: 30));

// Adding the field to the collection.
List<FormField> formFeildsCollection = new List<FormField>();
formFeildsCollection.Add(signatureField);

// Specify the new recipients to be added in the document to be sent.
var roles = new List<Roles>
{
   new Roles
   {
     SignerEmail = "signer1@email.com",
     SignerName = "Signer Name",
     FormFields = formFeildsCollection,
     SignerType = SignerType.Signer,
   },
};

var templateDetails = new SendForSignFromTemplate(
        templateId: templateId,
        title: "Document from Template",
        message: "This document description",
        roles: roles);

var documentCreated = this.templateApi.SendUsingTemplate(templateDetails);
curl -X POST 'https://api.boldsign.com/v1/template/send?templateId=aa74e915-76cf-4a6c-bf01-3e3f1855f235' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <authtoken>' \
-d '{ "title": "Document from Template", "message": "This document description", "roles": [ { "signerName": "Signer Name", "signerEmail": "signer1@email.com", "signerType": "Signer","roleIndex":2, "formFields": [ { "id": "Sign", "fieldType": "Signature", "pageNumber": 1, "bounds": { "x": 50, "y": 50, "width": 200, "height": 30 }, "isRequired": true } ] } ]}'

Send document from template by filling existing fields

You can fill the existing template fields before sending the template for signature with the help of field name. This can be done by specifying the field name while the template is created and use this name to fill the fields.

Follow the below mentioned steps to create template and add form fields with name:

  • Click create new template option in your BoldSign application.
    create-new-template.png

  • In the create template page fill the required fields to be filled and upload the documents required and click ‘next’ to open prepare document page.
    create-template-docs.png

  • Drag and drop the fields required. You can see each form field which is dropped will have name field to be filled. You can fill this field as per your choice.
    fill-template-fields.PNG

  • Now save the template and navigate to My Templates section in your BoldSign application. You will see that the created template will be listed in this section.
    template-option.png

  • Click the option button at the right end of the template and you will see the option to copy the template ID.
    copy-tmplateId.png

The below code snippet shows how to fill the existing field of existing signer role and sending the document to sign using the template.

C#

// Use the template ID copied from the options.
var templateId = "949ebf20-45a8-4a3e-91a9-68e9540e0020";

// Fill the existing form fields value by name.
var existingFormFields = new List<ExistingFormField>()
{​​​​​​​
    new ExistingFormField()
    {​​​​​​​
        Id = "QuestionField",
        Value = "How would you rate our service ?",
    }​​​​​​​,
    new ExistingFormField()
    {​​​​​​​
        Id = "Answer1",
        Value = "Good",
    }​​​​​​​,
    new ExistingFormField()
    {​​​​​​​
        Id = "Answer2",
        Value = "Satisfactory",
    }​​​​​​​,
    new ExistingFormField()
    {​​​​​​​
        Id = "Answer3",
        Value = "Bad",
    }​​​​​​​,
}​​​​​​​;

// Add the existing filled form fields to a signer role.
var roles = new List<Roles>
{
    new Roles
    {
        RoleIndex = 1,
        SignerEmail = "signer1@email.com",
        SignerName = "Signer Name",
        ExistingFormFields = existingFormFields,
    },
};

var templateDetails = new SendForSignFromTemplate(
    templateId: templateId,
    title: "Document from Template",
    message: "This document description",
    roles: roles);

// Send the template for sign request.
var documentCreated = this.templateApi.SendUsingTemplate(templateDetails);
Copied to clipboard