Articles in this section
Category / Section

How to send document using multiple templates by filling existing form fields using API?

Published:
3 mins read

This article provides a step-by-step guide on how to create templates in BoldSign’s web app and then use those templates to fill in existing form field values programmatically before sending the document for signature. For example, you may have multiple forms in different templates that you need to send to a signer by pre-filling the values in the form fields programmatically and then sending a signature request.

Follow the steps below to send a document for signature using multiple templates with pre-filled form fields:

  • Begin by creating templates in BoldSign’s web app. If you’re unsure how to create templates, you can refer to the guide: How to Create a Template in the BoldSign Web App for detailed instructions.
  • Once you’ve created your templates, take note of the unique field IDs associated with each field you’ve added to the templates. You will need these field IDs in the next steps to programmatically fill in the fields using the BoldSign API.
  • Please refer to the code examples below, which contain two template IDs (ID of the templates). One template has a field with ID as Name, and the other one has a field with ID as Place. Use the ExistingFormFields property to retrieve all the form fields from both templates and assign values based on the IDs. As a result, the templates will be merged into a single document containing both form fields with updated values and will be sent to the signer.

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",
    "existingFormFields": [
   {
     "id": "Name",
     "value": "David"
   },
   {
     "id": "Place",
     "value": "Washington"
   }
 ],      
     "locale": "EN"
   }
 ] 
 }'

In the provided code examples, make sure to replace the templateIds with the actual IDs of the templates you created. Also, update the signerEmail and signerName properties with the email and name of the signer you wish to send the document to. Lastly, use the field IDs you noted earlier to pre-fill the fields with the desired values and include these field IDs and values in the existingFormFields array.

By following these steps and using the code snippets provided, you can send documents using multiple templates with pre-filled form fields through BoldSign.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied