How to prefill values for label field while sending document from template for signature?
BoldSign allows you to prefill values for existing form fields when sending documents from a template. This article provides a guide on how to prefill values for label fields. The label fields are common fields that will be visible to all the signers and cannot be edited by the signers.
Templates are pre-designed layouts that streamline the creation of new documents. They offer a consistent structure and format, saving time, especially when sending the same contracts to multiple recipients. For more information, please refer to the Create Template article.
Once the template is created, you can get the template ID of the template. Then you can prefill the values for existing form fields and send document from the template. To prefill values for existing form fields in a template, you need to use the Properties
API to retrieve the form field IDs and assign values to these fields. For more details, read about the Template Properties API.
Once you have the IDs for the label field, you can assign the label form field ID to the existingFormFields
ID and assign the value which label form field you want to prefill the value.
Here is an example demonstrating how to prefill label field values when sending a document from a template:
Code snippet
curl -X 'POST' \ 'https://api.boldsign.com/v1/template/send?templateId=6357f511-xxxx-xxxx-8235-7a43be83cffc' \ -H 'accept: application/json' \ -H 'X-API-KEY: {Your API Key}' \ -H 'Content-Type: application/json;odata.metadata=minimal;odata.streaming=true' \ -d '{ "title": "Sample document", "message": "Kindly review and sign this.", "roles": [ { "roleIndex": 1, "signerName": "Richard", "signerEmail": "richards@cuberflakes.com", "privateMessage": "Please check and sign the document.", "signerType": "Signer", "signerRole": "Manager", "existingFormFields": [ { "id": "State", "value": "North Carolina" }, ], "locale": "EN" } ], "disableEmails": false, "disableSMS": false }'
using BoldSign.Api; using BoldSign.Model; var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}"); var templateClient = new TemplateClient(apiClient); var existingFormFieldCollections = new List<ExistingFormField> { new ExistingFormField( id: "State", value: "North Carolina" ) }; var templateRole = new Roles( roleSignerName:"Richard", roleSignerEmailAddress:"richards@cuberflakes.com", roleSignerIndex:1, existingFormFields:existingFormFieldCollections, locale: Locales.EN); var roles = new List<Roles> { templateRole, }; var sendForSignFromTemplate = new SendForSignFromTemplate() { TemplateId = "6357f511-xxxx-xxxx-8235-7a43be83cffc", Roles = roles, }; var documentCreated = templateClient.SendUsingTemplate(sendForSignFromTemplate); Console.WriteLine(documentCreated.DocumentId);
import requests import json url = "https://api.boldsign.com/v1/template/send?templateId=6357f511-xxxx-xxxx-8235-7a43be83cffc" payload = { "message": "Kindly review and sign this.", "roles": [ { "roleIndex": 1, "signerName": "Richard", "signerEmail": "richards@cuberflakes.com", "existingFormFields": [ { "id": "State", "value": "North Carolina" } ] } ] } 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, data=json.dumps(payload)) print(response.text)
const axios = require('axios'); async function GetData(){ try{ const response = await axios.post( 'https://api.boldsign.com/v1/template/send', { 'roles': [ { 'roleIndex': 1, 'signerName': 'Richard', 'signerEmail': 'richards@cuberflakes.com', 'existingFormFields': [ { 'id': 'State', 'value': 'North Carolina' } ] }, ], title: "Simple document", message: "Kindly review and sign this.", }, { params: { 'templateId': '6357f511-xxxx-xxxx-8235-7a43be83cffc', }, headers: { 'accept': 'application/json', 'X-API-KEY': '{your API Key}', 'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true' } } ); console.log(JSON.stringify(response.data)); return response; } catch (error) { console.error('Error:', error.message); throw error; } } GetData();
In the provided code examples, make sure to replace the templateId
with the actual ID of the template you created. Also, update the SignerEmail
and SignerName
properties with the email and name of the signer you wish to send the document. Once the above code is executed, the label form field will be successfully prefilled with the provided values.