Get the API key from Key Generation
Get the documented
Prepare the JSON Body
{"signingType": "PDF_TEMPLATE", // "PDF_TEMPLATE" or "FORM_TEMPLATE""receiversList": [{"name": "Chirag Gupta", // name of the role"email": "[email protected]", // email of the role"message": "Message me when you're done", // you can leave this empty it will take the message from emailData"subject": "Please sign this Chirag", // you can leave this empty it will take the message from emailData"roleTitle": "Senior Doctor", // this has to exactly same as the role you added otherwise it will not work properly"roleColour": "#FEE0EF" // give color to your role you can pass any hex code but it's nessacary},{"name": "Chirag Gupta", // name of the role"email": "[email protected]", // email of the role"message": "Message me when you're done",// you can leave this empty it will take the message from emailData"subject": "Please sign this Paresh",// you can leave this empty it will take the message from emailData"roleTitle": "Junior Doctor",// this has to exactly same as the role you added otherwise it will not work properly"roleColour": "#8FB1C8" // give color to your role you can pass any hex code but it's nessacary}],"customVariables": [ {"varName": "[v1]", "varValue": "v1 value from api" },{"varName": "[v2]", "varValue": "v2 value from api" }, {"varName": "[v3]", "varValue": "v3 value from api" }],"mailData": {"subject": "subject",// this is the global subject if you will not add anything in the receiversList// subject this will be sent"message": "message"// this is the global message if you will not add anything in the receiversList// message this will be sent},"documentId": "42d3b486-g946-4744-86cb-7ee25f634576","pdfData": "data:application/pdf;base64,JVBERi0xLjQKJSDi48/TCjMKMApvYmoKPDwKL1R5cGUKL0NhdGFsb2cKL05hbWVzCjw8Cj4+Ci9QYWdlTGFiZWxzCjw8Ci9OdW1zClsKMAo8PAovUwovRAov"}
"signingType": "PDF_TEMPLATE" or "FORM_TEMPLATE" which you want to send for signing
"receiversList": [{"name": "Chirag Gupta", // name of the role"email": "[email protected]", // email of the role"message": "Message me when you're done", // you can leave this empty it will take the message from emailData"subject": "Please sign this Chirag", // you can leave this empty it will take the message from emailData"roleTitle": "Senior Doctor", // this has to exactly same as the role you added otherwise it will not work properly"roleColour": "#FEE0EF" // give color to your role you can pass any hex code but it's nessacary},],
"customVariables": [ {"varName": "[v1]", "varValue": "v1 value from api" }, // v1- variable name has to be in square barckets{"varName": "[v2]", "varValue": "v2 value from api" }, {"varName": "[v3]", "varValue": "v3 value from api" }]// if you leave varValue empty it will still work.// if you don't pass customVariables then also the call would work, we'll pass each variable as empty.
"mailData": {"subject": "subject",// this is the global subject if you will not add anything in the receiversList// subject this will be sent"message": "message"// this is the global message if you will not add anything in the receiversList// message this will be sent}
"documentId": is the document Id which you got from previous step
"pdfData": pdf data in base64 format
4. Send a POST request with the prepared JSON body
Example Request
const axios = require('axios');let data = JSON.stringify({"signingType": "PDF_TEMPLATE","receiversList": [{"name": "Chirag Gupta","email": "[email protected]","message": "Message me when you're done","subject": "Please sign this Chirag","roleTitle": "Senior Doctor","roleColour": "#FEE0EF"},{"name": "Chirag Gupta","email": "[email protected]","message": "Message me when you're done","subject": "Please sign this Paresh","roleTitle": "Junior Doctor","roleColour": "#8FB1C8"}],"mailData": {"subject": "subject","message": "message"},"documentId": "YOUR_PDF_DOCUMENT_ID","pdfData": "data:application/pdf;base64,JVBERi0xLjQKJSDi48/TCjMKMApvYmoKPDwKL1R5cGUKL0NhdGFsb2cKL05hbWVzCjw8Cj4+Ci9QYWdlTGFiZWxzCjw8Ci9OdW1zClsKMAo8PAovUwovRAov"});let config = {method: 'post',maxBodyLength: Infinity,url: 'https://sapi.boloforms.com/signature/pdf-template-lambda',headers: { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json'},data : data};axios.request(config).then((response) => {console.log(JSON.stringify(response.data));}).catch((error) => {console.log(error);});