How to prefill values for image field after sending document for signature?

BoldSign allows you to prefill values for existing form fields after sending document for signature. This article provides a guide on how to prefill the image form fields.

To prefill values for existing form fields in a document, 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 Document Properties API.

Once you have the IDs for the image fields and assign the value to which image field you want to prefill the value.You can provide the image field in base64 format like data:application/{{fileType}};base64,{{content}}.

Here is an example demonstrating how to prefill image field after sending a document for e-Signature:

Code snippet

curl --location --request PATCH '
https://api.boldsign.com/v1-beta/document/prefillFields?documentId=73742d3f-xxxx-xxxx-8481-01dca586ed14'
\
--header 'X-API-KEY: {Your API Key}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "fields": [
      {
      "id": "Image1",
      "value": "data:image/png;base64,iVBORw0KGgoAAAANS..."
     },
   ] 
}'


using BoldSign.Api;
using BoldSign.Api.Model;

var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}");
var documentClient = new DocumentClient(apiClient);

var documentId = "d2566905-xxxx-xxxx-b38c-da0fc387971a";
var prefillFieldRequest = new PrefillFieldRequest(documentId)
{
    Fields = new List<PrefillField>()
    {
        new PrefillField()
        {
            Id = "Image1",
            Value = "data:image/png;base64,iVBORw0KGgoAAAANSU..."
        },
      
    },
};

await documentClient.PrefillFieldsAsync(prefillFieldRequest);
import requests

url = 'https://api.boldsign.com/v1-beta/document/prefillFields'
headers = {
    'Content-Type': 'application/json',
    'X-API-KEY': '{Your API Key}'
}
data = {
    "fields": [
        {
            "id": "Image1",
            "value": "data:image/png;base64,iVBORw0KG..."
        }
        
    ]
}

document_id = 'cca1770c-xxxx-xxxx-b0b6-f554591de7b4'
params = {'documentId': document_id}

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

const url = 'https://api.boldsign.com/v1-beta/document/prefillFields';
const apiKey = '{Your API Key}';
const documentId = '2d60c66a-xxxx-xxxx-904b-f8d0c4f02241';

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

const data = {
    fields: [
        {
            id: 'Image1',
            value: 'data:image/png;base64,iVBORw0KG...',
            
        }
    ]
};

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

In the provided code examples, make sure to replace the documentId with the actual ID of the document you created. Once the above code is executed, the image form field will be successfully prefilled with the provided image in the document.