# Using pre-defined templates

## Using pre-defined templates

emSigner allows origination of PDF documents based on existing document templates defined in emSigner. Document templates allow you to define number of signatories and their signature placeholders on one or more pages.

Document templates are of two types

• Flexiforms
• Form Templates

Flexiforms are document templates that allow field placeholders (such as Name, Email, Date, Textbox etc) on the document along with definition for number of signatories and their placeholders on one or more pages. In case of Flexiforms, emSigner uses the document template itself as the final document on which only the field values sent by API calls are superimposed.

Form Templates are document templates without field placeholders but with definition for number of signatories and their placeholders on one or more pages. In case of form templates, emSigner uses the document template only as a reference for the # of signatories and placeholders but expects that the API call send a request of the actual final output expected to be signed

To get documents signed using document templates defined on emSigner, please use the following API calls along with JWT token generated as part of “Making your first API call” section as shown below

#### Sample Request

[
{
"Data": "<DocumentElement><BulkData><name>Jayanta</name><mobile>8904285978</mobile></BulkData></DocumentElement>",
"isBulk": false,
"Signatories": [
{
"EmailId": "jayanta.d@emudhra.com"
},
{
"EmailId": "jayanta.d@yopmail.com"
}
],
"TemplateId": 9712
}
]

#### Key points

1. In the above request, the PDF document is not passed as emSigner uses the document template as a base document based on the templateID passed as part of the input
2. Note that the Data parameter is used to populate form fields defined in the flexiform based on which the final PDF document is prepared
3. Please refer the POSTMAN API call for more information on the parameters used in the API call

#### Sample Response

{
"IsSuccess": true,
"Messages": [
"Workflow initiated successfully"
],
"ErrorCode": 0,
"Response": {
"ReferenceNo": null,
"DocumentNumberList": [
"OT/JUL/2021/12312"
],
"DocumentIdList": null,
"Status": true,
"WorkflowId": 12312
}
}

#### Sample Request

[
{
"DocumentName": "sample.pdf",
"listAttachmentDetails": [],
"QRCodeCordinats": [],
"Signatories": [
{
"EmailId": "jayanta.d@emudhra.com"
},
{
"EmailId": "jayanta.d@yopmail.com"
}
],
"SigningType": 1,
"TemplateId": 9710
}
]

#### Key points

1. In the above request, the PDF document is passed as a BASE64 string
2. Note that the templateID is passed as a parameter using which the # of signatories and their signature placeholders are automatically retrieved from emSigner. Therefore the coordinates need not be passed as part of the API request
3. Workflow routing
• If the signatories are passed, emSigner will prepare the document and send it to the participants directly without any intervention from the originator
• In case the signatories are not passed, emSigner treats this document as a draft and allows the user or originator to login to emSigner to decide the recipients and routing before sending the document
4. Please refer the POSTMAN API call for more information on the parameters used in the API call

#### Sample Response

{
"IsSuccess": true,
"Messages": [
"Workflow initiated successfully"
],
"ErrorCode": 0,
"Response": {
"ReferenceNo": null,
"DocumentNumberList": [
"OT/JUL/2021/12312"
],
"DocumentIdList": null,
"Status": true,
"WorkflowId": 12312
}
}