Prefilling Form Fields After Sending eSignatures via API

Prefilling Form Fields After Sending eSignatures via API
Prefilling Form Fields After Sending eSignatures via API

Table of Contents

Sign Docs 3x Faster

Send, sign, and manage documents securely and efficiently.

Summarize the blog post with:

Sometimes, we are in such a rush to get a document signed that we forget certain steps in the process. If you realize that you forgot to prefill the form fields right after sending your document in BoldSign, it’s not a problem. In this blog post, we will look at how to prefill form fields after sending an eSignature document via the API.

After a document has been sent to signers, the Prefill Form Fields API allows you to assign values to certain fields in it. This function is very beneficial for adding data from a variety of sources, ensuring that the document is ready for signature without the need for error-prone manual entry. However, it is important to note that once the document has been signed by the signer, prefilling is not permitted. To learn more about Prefill Form Fields API, refer to the official Prefill form fields guide.

Supported Form Fields

The following form fields support prefilling:

  • Text boxes: Ideal for inserting text data such as names, addresses, and other information.
  • Checkboxes: Useful for yes/no questions or selections.
  • Radio Buttons: Allows selection from multiple options.
  • Editable Dates: Enable prefilling date fields with specific dates.
  • Dropdowns: Facilitate selection from a predefined list of options.
  • Image: Allows prefilling image fields such as logos, signatures, or stamps by providing a base64‑encoded image in data URI format.

Step-by-Step Guide

Step 1: Retrieve Form Field IDs

Before you can prefill fields, you need to identify the form field IDs in the document.

There are two methods to obtain the id:

  1. Assign Custom IDs When Sending a Document When you send a document for signing, you can assign custom id values to form fields. This approach allows you to predetermine the id of fields you may want to prefill later.
  2. Retrieve Auto-generated IDs Using the API If you haven’t assigned custom IDs, you can use the /v1/document/properties API to retrieve the entire document details, including auto-generated id values for all form fields. Learn more about the document properties API

Step 2: Prefill the Form Fields

Once you have the form field IDs, you can use the Prefill API to assign values. You can assign values in the fields array by providing id as the form field ID and value as the form field value. Following are some examples in different programming languages using the BoldSign API.

Note:

The prefill fields feature also supports the DataSyncTag. If the form field has a DataSyncTag, then the value applied to the targeted field will also be applied to other form fields with the same DataSyncTag value and the same form field type.

curl --location --request PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=YOUR_DOCUMENT_ID' \
  --header 'accept: */*' \
  --header 'X-API-KEY: {YOUR_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
    "fields": [
      {
        "id": "textbox_mShRr",
        "value": "John Doe"
      },
      {
        "id": "checkbox_b5yuo",
        "value": "on"
      },
      {
        "id": "radioChild_AknIg",
        "value": "on"
      },
      {
        "id": "editableDate_67P9d",
        "value": "05/10/2023"
      },
      {
        "id": "dropdown_qrsr1",
        "value": "United States"
      },
      {
        "id": "image_6Ogud",
        "value": "data:image/png;base64,iVBORw0KGgoAAAANS..."
      }
    ]
  }'    
    

var apiClient = new ApiClient("https://api.boldsign.com", "YOUR_API_KEY");
var documentClient = new DocumentClient(apiClient);
var prefillFieldRequest = new PrefillFieldRequest("YOUR_DOCUMENT_ID")
{
    Fields = new List<PrefillField>()
    {
        new PrefillField()
        {
            Id = "textbox_mShRr",
            Value = "John Doe"
        },
       new PrefillField()
        {
            Id = "checkbox_b5yuo",
            Value = "on"
        },
       new PrefillField()
        {
            Id = "radioChild_AknIg",
            Value = "on"
        },
        new PrefillField()
        {
            Id = "editableDate_67P9d",
            Value = "05/10/2023"
        },
        new PrefillField()
        {
            Id = "dropdown_qrsr1",
            Value = "United States"
        },
        new PrefillField()
        {
            Id = "image_6Ogud",
            Value = "data:image/png;base64,iVBORw0KGgoAAAANS..."
        }
    },
};
documentClient.PrefillFields(prefillFieldRequest);
    

import boldsign
configuration = boldsign.Configuration(api_key="YOUR_API_KEY")
with boldsign.ApiClient(configuration) as api_client:
    document_api = boldsign.DocumentApi(api_client)
    fields = [
    boldsign.PrefillField(id="textbox_mShRr", value="John Doe"),
    boldsign.PrefillField(id="checkbox_b5yuo", value="on"),
    boldsign.PrefillField(id="radioChild_AknIg", value="on"),
    boldsign.PrefillField(id="editableDate_67P9d", value="05/10/2023"),
    boldsign.PrefillField(id="dropdown_qrsr1", value="United States"),
    boldsign.PrefillField(id="image_6Ogud", value="data:image/png;base64,iVBORw0KGgoAAAANS..."),
   ]
    prefill_field_request = boldsign.PrefillFieldRequest(fields=fields)
        
    document_api.prefill_fields(document_id="YOUR_DOCUMENT_ID",
    prefill_field_request=prefill_field_request)
    

<?php
require_once "vendor/autoload.php";
use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{PrefillField, PrefillFieldRequest};
$config = new Configuration();
$config->setApiKey('YOUR_API_KEY');
$document_api = new DocumentApi($config);
$fields = [];
$f = new PrefillField();
$f->setId('textbox_mShRr');
$f->setValue('John Doe');
$fields[] = $f;
$f = new PrefillField();
$f->setId('checkbox_b5yuo');
$f->setValue('on');
$fields[] = $f;
$f = new PrefillField();
$f->setId('radioChild_AknIg');
$f->setValue('on');
$fields[] = $f;
$f = new PrefillField();
$f->setId('editableDate_67P9d');
$f->setValue('05/10/2023');
$fields[] = $f;
$f = new PrefillField();
$f->setId('dropdown_qrsr1');
$f->setValue('United States');
$fields[] = $f;
$f = new PrefillField();
$f->setId('image_6Ogud');
$f->setValue('data:image/png;base64,iVBORw0KGgoAAAANS...');
$fields[] = $f;
$prefill_field_request = new PrefillFieldRequest();
$prefill_field_request->setFields($fields);
$document_api->prefillFields($document_id = 'YOUR_DOCUMENT_ID', 
$prefill_field_request);
?>
    

ApiClient client = Configuration.getDefaultApiClient();  
client.setApiKey("YOUR_API_KEY");
            
DocumentApi documentApi = new DocumentApi(client);
PrefillField pfTextbox = new PrefillField();
pfTextbox.setId("textbox_mShRr");
pfTextbox.setValue("John Doe");
PrefillField pfCheckbox = new PrefillField();
pfCheckbox.setId("checkbox_b5yuo");
pfCheckbox.setValue("on");
PrefillField pfRadio = new PrefillField();
pfRadio.setId("radioChild_AknIg");
pfRadio.setValue("on");
PrefillField pfDate = new PrefillField();
pfDate.setId("editableDate_67P9d");
pfDate.setValue("05/10/2023");
PrefillField pfDropdown = new PrefillField();
pfDropdown.setId("dropdown_qrsr1");
pfDropdown.setValue("United States");
PrefillField pfImage = new PrefillField();
pfImage.setId("image_6Ogud");
pfImage.setValue("data:image/png;base64,iVBORw0KGgoAAAANS...");
PrefillFieldRequest prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.setFields(Arrays.asList(
    pfTextbox,
    pfCheckbox,
    pfRadio,
    pfDate,
    pfDropdown,
    pfImage
));
documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
    

import { DocumentApi, PrefillField, PrefillFieldRequest } from "boldsign";
async function main() {
const documentApi = new DocumentApi();
documentApi.setApiKey("YOUR_API_KEY");
const fields = [];
let field = new PrefillField();
field.id = "textbox_mShRr";
field.value = "John Doe";
fields.push(field);
field = new PrefillField();
field.id = "checkbox_b5yuo";
field.value = "on";
fields.push(field);
field = new PrefillField();
field.id = "radioChild_AknIg";
field.value = "on";
fields.push(field);
field = new PrefillField();
field.id = "editableDate_67P9d";
field.value = "05/10/2023";
fields.push(field);
field = new PrefillField();
field.id = "dropdown_qrsr1";
field.value = "United States";
fields.push(field);
field = new PrefillField();
field.id = "image_6Ogud";
field.value = "data:image/png;base64,iVBORw0KGgoAAAANS...";
fields.push(field);
const prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.fields = fields;
await documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
}
 
main();
    

What Limitations Should You Know Before Prefilling Fields?

Not all form fields or document statuses support prefilling. Keep the following restrictions in mind:

  1. Unsupported Field Types
    The following field types cannot be prefilled through the Prefill API: Name, Email, Signature, Initial, DateSigned, Attachment, Hyperlink, Title, Company, and Label.
  2. The Assigned Signer Must Not Have Already Signed
    Prefilling is not allowed if the signer for that field has already signed the document. Once a signer completes their part, the fields they control become locked and cannot be changed.
  3. The Document Must Be in “In Progress” Status
    You cannot prefill fields when a document is in any non active state, including Revoked, Declined, Expired, Completed, or any other invalid status.
    Only in progress documents allow prefilling.

Using Templates to Prefill Documents

If you send similar documents frequently, templates let you reuse predefined fields and roles and prefill existing field values programmatically before sending for signature. This approach works well for form‑driven or recurring workflows. Refer to Send document from template by filling existing fields guide in the BoldSign Documentation.

Conclusion

Prefilling form fields in eSignature documents is a useful feature that enhances efficiency and accuracy. Even if you forget to do so before sending a document, BoldSign lets you correct that oversight, ensuring that documents are ready for signing without the need for manual entry. Implementing the Prefill Form Fields API in your workflow can save time, reduce errors, and improve the overall signing experience for all parties involved.

If you are not yet a customer, feel free to start a 30-day free trial of BoldSign to test out all its features. Please leave any comments you may have below; your thoughts are much appreciated. Schedule a demo or contact our support team via our support portal if you have any questions or would like more information about our services.

Like what you see? Share with a friend.

Latest blog posts

Healthcare eSignature: How Healthcare Providers Collect Patient Consent Digitally 

Healthcare eSignature: How Healthcare Providers Collect Patient Consent Digitally 

Explore healthcare eSignature workflows that help providers collect patient consent digitally across intake, check-in, telehealth, and record management.

Webinar Show Notes: Verify Signers with Knowledge-Based Authentication in BoldSign

Webinar Show Notes: Verify Signers with Knowledge-Based Authentication in BoldSign

KBA authentication webinar recap: how signers verify with security questions, what happens when verification fails, and how KBA compares to ID Verification.

How to Choose Authentication Levels for Internal vs External Approval Documents

How to Choose Authentication Levels for Internal vs External Approval Documents

Learn how to choose document authentication levels for internal and external approvals using a simple risk-based framework for better security and control.

Sign up for your free trial today!

  • Yes
    30-day free trial
  • Yes
    No credit card required
  • Yes
    30-day free trial
  • Yes
    No credit card required
Sign up for a free BoldSign trial