Prefill form fields

patch/v1/document/prefillFields

Overview

Prefill form fields is a feature that allows you to assign values to the form fields in the document before or after sending it to the signers. You can prefill the form fields with the data collected from the signer or from any other source. However, it's important to note that prefilling form fields is not allowed after the document has been signed by the signer.

Supported field types

The following field types are supported for prefilling:

  • Textbox
  • Checkbox
  • Radio buttons
  • Editable date
  • Dropdown

Unsupported field types

The following field types are not supported for prefilling:

  • Name
  • Email
  • Signature
  • Initial
  • DateSigned
  • Attachment
  • Hyperlink
  • Image
  • Title
  • Company
  • Label

DataSync

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.

Limitations

  • Unsupported fields cannot be prefilled.
  • The signer related to the form field should not have already signed the document.
  • Revoked, declined, expired or other invalid status documents cannot be prefilled. Only in-progress documents can be prefilled.

Usage

To prefill, you need to use the properties API to retrieve the form field IDs and then use the prefill API to assign the value to the form field.

Read more about document properties API

Code snippet

curl --location --request PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=2a448030-xxx-xxx-xxxx-58b1349662fc' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: {your-api-key}' \
--data '{
    "fields": [
        {
            "id": "textbox_mShRr",
            "value": "Prefill value"
        }
    ]
}'
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");
var documentClient = new DocumentClient(apiClient);

var documentId = "b5529f7e-a904-49ff-859f-7686e52dfa8a";
var prefillFieldRequest = new PrefillFieldRequest(documentId)
{
    Fields = new List<PrefillField>()
    {
        new PrefillField()
        {
            Id = "textbox_mShRr",
            Value = "Prefill value"
        }
    },
};

await documentClient.PrefillFieldsAsync(prefillFieldRequest);
import requests

url = 'https://api.boldsign.com/v1/document/prefillFields'
headers = {
    'Content-Type': 'application/json',
    'X-API-KEY': '{your-api-key}'
}
data = {
    "fields": [
        {
            "id": "textbox_mShRr",
            "value": "Prefill value"
        }
    ]
}

document_id = '2a448030-xxx-xxx-xxxx-58b1349662fc'
params = {'documentId': document_id}

response = requests.patch(url, headers=headers, json=data, params=params)
const axios = require('axios');

const url = 'https://api.boldsign.com/v1/document/prefillFields';
const apiKey = '{your-api-key}';
const documentId = '2a448030-xxx-xxx-xxxx-58b1349662fc';

const headers = {
    'Content-Type': 'application/json',
    'X-API-KEY': apiKey
};

const data = {
    fields: [
        {
            id: 'textbox_mShRr',
            value: 'Prefill value'
        }
    ]
};

axios.patch(url, data, { headers, params: { documentId } })
    .then(response => {
        console.log(response);
    })
    .catch(error => {
        console.error('Error:', error);
    });
<?php

require 'vendor/autoload.php'; // Make sure to include the autoload file from GuzzleHttp

use GuzzleHttp\Client;

$url = 'https://api.boldsign.com/v1/document/prefillFields';
$apiKey = '{your-api-key}';
$documentId = '2a448030-xxx-xxx-xxxx-58b1349662fc';

$headers = [
    'Content-Type' => 'application/json',
    'X-API-KEY' => $apiKey
];

$data = [
    'fields' => [
        [
            'id' => 'textbox_mShRr',
            'value' => 'Prefill value'
        ]
    ]
];

$client = new GuzzleHttp\Client();

$response = $client->request('PATCH', $url, [
    'headers' => $headers,
    'json' => $data,
    'query' => ['documentId' => $documentId]
]);

$body = $response->getBody();
echo $body;

Query parameters

documentIdstringRequiredThe ID of the document to which the form fields have to be prefilled.

Request body

fieldsarrayRequired

Array of form fields to be prefilled.

idstringRequiredThe ID of the form field to be prefilled. This can be obtained from the properties API.
valuestringRequiredThe value to be assigned to the form field.
onBehalfOfarrayEmail ID of the sender if you are prefilling the on behalf of documents.