# Prefill form fields

{% patch /%}
{% path text="/v1/document/prefillFields" /%}

The prefill form fields API enables the assignment of values to fields within active, in-progress documents using data captured from signers or external sources. This functionality is supported exclusively for documents in an in-progress state and does not apply to drafts or documents generated via embedded request URLs.

## Supported field types

The following field types are supported for prefilling:

-   Textbox
-   Checkbox
-   Radio buttons
-   Editable date
-   Dropdown
-   Image

## Unsupported field types

The following field types are not supported for prefilling:

-   Name
-   Email
-   Signature
-   Initial
-   DateSigned
-   Attachment
-   Hyperlink
-   Title
-   Company
-   Label
-   Drawing

## 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.

## Prerequisite

To prefill a form field, you need to know its `id`. This identifier allows you to target the specific field and assign a value. 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. {% customlink href="/documents/document-details-and-status/" text="Learn more about the document properties API" /%}

Custom IDs provide more control and predictability when prefilling fields. Auto-generated IDs can be used when working with existing documents or when custom IDs weren't assigned.

## Textbox

Prefilling a textbox form field is a straightforward process. You need to provide the `id` of the form field and the `value` you want to assign to it.

{% codetab %}

cURL

```shell
curl -X PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=2a448030-xxx-xxx-xxxx-58b1349662fc' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {your-api-key}' \
-d '{
    "Fields": [
        {
            "Id": "textbox_mShRr",
            "Value": "Prefill value"
        }
    ]
}'
```

C#

```csharp
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 = "Prefill value"
        }
    },
};

documentClient.PrefillFields(prefillFieldRequest);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    document_api = boldsign.DocumentApi(api_client)
	
    prefill_field = boldsign.PrefillField(
        id="textbox_mShRr",
        value="Prefill value")
    
    prefill_field_request = boldsign.PrefillFieldRequest(fields=[prefill_field])
    
    document_api.prefill_fields(document_id="YOUR_DOCUMENT_ID", prefill_field_request=prefill_field_request)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{PrefillField, PrefillFieldRequest};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$prefill_field = new PrefillField();
$prefill_field->setId('textbox_mShRr');
$prefill_field->setValue('Prefill value');

$prefill_field_request = new PrefillFieldRequest();
$prefill_field_request->setFields([$prefill_field]);

$document_api->prefillFields($document_id = 'YOUR_DOCUMENT_ID', $prefill_field_request);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
			
DocumentApi documentApi = new DocumentApi(client);

PrefillField prefillField = new PrefillField();
prefillField.setId("textbox_mShRr");
prefillField.setValue("Prefill value");

PrefillFieldRequest prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.setFields(Arrays.asList(prefillField));

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

NodeJS

```js
import { DocumentApi, PrefillField, PrefillFieldRequest } from "boldsign";

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const prefillField = new PrefillField();
prefillField.id = "TextBox1";
prefillField.value = "Prefill Value";

const prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.fields = [prefillField];

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

{% /codetab %}

## Checkbox

To prefill a checkbox form field, you will need to provide the `id` of the form field and its `value`. The `id` must match exactly with the checkbox's `id` in your document, while the `value` should be either `"ON"` (to check the box) or `"OFF"` (to uncheck it).

{% codetab  id="codetab2" %}

cURL

```shell
curl -X PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=2a448030-xxx-xxx-xxxx-58b1349662fc' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {your-api-key}' \
-d '{
    "Fields": [
        {
            "Id": "checkbox_b5yuo",
            "Value": "ON"
        }
    ]
}'

```

C#

```csharp
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 = "checkbox_b5yuo",
            Value = "ON"
        }
    },
};

documentClient.PrefillFields(prefillFieldRequest);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    document_api = boldsign.DocumentApi(api_client)
	
    prefill_field = boldsign.PrefillField(
        id="checkbox_b5yuo",
        value="ON")
    
    prefill_field_request = boldsign.PrefillFieldRequest(fields=[prefill_field])
    
    document_api.prefill_fields(document_id="YOUR_DOCUMENT_ID", prefill_field_request=prefill_field_request)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{PrefillField, PrefillFieldRequest};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$prefill_field = new PrefillField();
$prefill_field->setId('checkbox_b5yuo');
$prefill_field->setValue('Prefill value');

$prefill_field_request = new PrefillFieldRequest();
$prefill_field_request->setFields([$prefill_field]);

$document_api->prefillFields($document_id = 'YOUR_DOCUMENT_ID', $prefill_field_request);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
		   
DocumentApi documentApi = new DocumentApi(client);

PrefillField prefillField = new PrefillField();
prefillField.setId("checkbox_b5yuo");
prefillField.setValue("Prefill value");

PrefillFieldRequest prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.setFields(Arrays.asList(prefillField));

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

NodeJS

```js
import { DocumentApi, PrefillField, PrefillFieldRequest } from "boldsign";

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const prefillField = new PrefillField();
prefillField.id = "CheckBox1";
prefillField.value = "Prefill Value";

const prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.fields = [prefillField];

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

{% /codetab %}

## Radio button

Radio buttons can be prefilled in two ways:

1. Using the `id` of a radio button in the group
2. Using the `groupName` and `label` property of radio buttons

### Using radio button ID

To prefill a radio button form field using its ID:

-   Provide the `id` of the form field and its `value`
-   The `id` must match exactly with one of the radio button's `id` in your document
-   Set `value` to `"ON"` to select it or `"OFF"` to unselect it

Selecting one radio button automatically unselects other radio buttons in the same group.

{% codetab  id="codetab3" %}

cURL

```shell
curl -X PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=2a448030-xxx-xxx-xxxx-58b1349662fc' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {your-api-key}' \
-d '{
    "Fields": [
        {
            "Id": "radioChild_AknIg",
            "Value": "ON"
        }
    ]
}
'
```

C#

```csharp
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 = "radioChild_AknIg",
            Value = "ON"
        }
    },
};

documentClient.PrefillFields(prefillFieldRequest);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    document_api = boldsign.DocumentApi(api_client)
	
    prefill_field = boldsign.PrefillField(
        id="radioChild_AknIg",
        value="ON")
    
    prefill_field_request = boldsign.PrefillFieldRequest(fields=[prefill_field])
    
    document_api.prefill_fields(document_id="YOUR_DOCUMENT_ID", prefill_field_request=prefill_field_request)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{PrefillField, PrefillFieldRequest};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$prefill_field = new PrefillField();
$prefill_field->setId('radioChild_AknIg');
$prefill_field->setValue('Prefill value');

$prefill_field_request = new PrefillFieldRequest();
$prefill_field_request->setFields([$prefill_field]);

$document_api->prefillFields($document_id = 'YOUR_DOCUMENT_ID', $prefill_field_request);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
			
DocumentApi documentApi = new DocumentApi(client);

PrefillField prefillField = new PrefillField();
prefillField.setId("radioChild_AknIg");
prefillField.setValue("Prefill value");

PrefillFieldRequest prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.setFields(Arrays.asList(prefillField));

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

NodeJS

```js
import { DocumentApi, PrefillField, PrefillFieldRequest } from "boldsign";

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const prefillField = new PrefillField();
prefillField.id = "RadioGroupChild1";
prefillField.value = "Prefill Value";

const prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.fields = [prefillField];

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

{% /codetab %}

### Using radio button group

To prefill a radio button using `groupName` and `label`:

-   Use the `groupName` of the radio button group as the `id`
-   Provide one of the radio button's `label` as the `value`

Consider the following example where a radio button group is created to allow job applicants to select their level of expertise in a coding. The radio buttons provide three options: `Novice`, `Intermediate` and `Expert`.

Below is a simplified code snippet for document send API request. Please note that this is a minimal example, and many properties have been omitted for the brevity.

```json
{
    "signers": {
        "formFields": {
            {
                "fieldType": "RadioButton",
                "label": "Novice",
                "groupName": "CodingExpertise",
            },
            {
                "fieldType": "RadioButton",
                "label": "Intermediate",
                "groupName": "CodingExpertise",
            },
            {
                "fieldType": "RadioButton",
                "label": "Expert",
                "groupName": "CodingExpertise",
            }
        }
    }
}
```

Here's how you can select the `Intermediate` radio button within the `CodingExpertise` group. If either the `Novice` or `Expert` radio buttons are currently selected, they will automatically deselect when you prefill the choice as `Intermediate`.

{% codetab  id="codetab4" %}

cURL

```shell
curl -X PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=2a448030-xxx-xxx-xxxx-58b1349662fc' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {your-api-key}' \
-d '{
    "Fields": [
        {
            "Id": "CodingExpertise",
            "Value": "Intermediate"
        }
    ]
}
'
```

C#

```csharp
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 = "CodingExpertise",
            Value = "Intermediate"
        }
    },
};

documentClient.PrefillFields(prefillFieldRequest);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    document_api = boldsign.DocumentApi(api_client)
	
    prefill_field = boldsign.PrefillField(
        id="CodingExpertise",
        value="Intermediate")

    prefill_field_request = boldsign.PrefillFieldRequest(fields=[prefill_field])
    
    document_api.prefill_fields(document_id = "YOUR_DOCUMENT_ID", prefill_field_request=prefill_field_request)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{PrefillField, PrefillFieldRequest};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$prefill_field = new PrefillField();
$prefill_field->setId('CodingExpertise');
$prefill_field->setValue('Intermediate');

$prefill_field_request = new PrefillFieldRequest();
$prefill_field_request->setFields([$prefill_field]);

$document_api->prefillFields($document_id = 'YOUR_DOCUMENT_ID', $prefill_field_request);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");

DocumentApi documentApi = new DocumentApi(client);

PrefillField prefillField = new PrefillField();
prefillField.setId("CodingExpertise");
prefillField.setValue("Intermediate");

PrefillFieldRequest prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.setFields(Arrays.asList(prefillField));

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

NodeJS

```js
import { DocumentApi, PrefillField, PrefillFieldRequest } from "boldsign";

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const prefillField = new PrefillField();
prefillField.id = "CodingExpertise";
prefillField.value = "Intermediate";

const prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.fields = [prefillField];

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

{% /codetab %}

## Editable date

To prefill an editable date field, you must provide the date value exactly as it was specified when sending the document or as configured in the template.

{% codetab  id="codetab5" %}

cURL

```shell
curl -X PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=2a448030-xxx-xxx-xxxx-58b1349662fc' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {your-api-key}' \
-d '{
    "Fields": [
        {
            "Id": "editableDate_67P9d",
            "Value": "02/19/2024"
        }
    ]
}
'
```

C#

```csharp
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 = "editableDate_67P9d",
            Value = "Prefill value"
        }
    },
};

documentClient.PrefillFields(prefillFieldRequest);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    document_api = boldsign.DocumentApi(api_client)
	
    prefill_field = boldsign.PrefillField(
        id="editableDate_67P9d",
        value="Prefill value")
    
    prefill_field_request = boldsign.PrefillFieldRequest(fields=[prefill_field])

    document_api.prefill_fields(document_id="YOUR_DOCUMENT_ID", prefill_field_request=prefill_field_request)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{PrefillField, PrefillFieldRequest};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$prefill_field = new PrefillField();
$prefill_field->setId('editableDate_vA8I8');
$prefill_field->setValue('Prefill value');

$prefill_field_request = new PrefillFieldRequest();
$prefill_field_request->setFields([$prefill_field]);

$document_api->prefillFields($document_id = 'YOUR_DOCUMENT_ID', $prefill_field_request);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
			
DocumentApi documentApi = new DocumentApi(client);

PrefillField prefillField = new PrefillField();
prefillField.setId("editableDate_vA8I8");
prefillField.setValue("Prefill value");

PrefillFieldRequest prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.setFields(Arrays.asList(prefillField));

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

NodeJS

```js
import { DocumentApi, PrefillField, PrefillFieldRequest } from "boldsign";

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const prefillField = new PrefillField();
prefillField.id = "EditableDate1";
prefillField.value = "Prefill Value";

const prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.fields = [prefillField];

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

{% /codetab %}

## Dropdown

To prefill an dropdown field, you must provide one of the dropdonw value exactly as it was specified when sending the document or as configured in the template.

{% codetab  id="codetab6" %}

cURL

```shell
curl -X PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=2a448030-xxx-xxx-xxxx-58b1349662fc' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {your-api-key}' \
-d '{
    "Fields": [
        {
            "Id": "dropdown_qrsr1",
            "Value": "option1"
        }
    ]
}
'
```

C#

```csharp
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 = "dropdown_qrsr1",
            Value = "option1"
        }
    },
};

documentClient.PrefillFields(prefillFieldRequest);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    document_api = boldsign.DocumentApi(api_client)
	
    prefill_field = boldsign.PrefillField(
        id="dropdown_qrsr1",
        value="option1")
    
    prefill_field_request = boldsign.PrefillFieldRequest(fields=[prefill_field])
    
    document_api.prefill_fields(document_id="YOUR_DOCUMENT_ID", prefill_field_request=prefill_field_request)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{PrefillField, PrefillFieldRequest};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$prefill_field = new PrefillField();
$prefill_field->setId('dropdown_7IcZv');
$prefill_field->setValue('option2');

$prefill_field_request = new PrefillFieldRequest();
$prefill_field_request->setFields([$prefill_field]);

$document_api->prefillFields($document_id = 'YOUR_DOCUMENT_ID', $prefill_field_request);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
			
DocumentApi documentApi = new DocumentApi(client);

PrefillField prefillField = new PrefillField();
prefillField.setId("dropdown_7IcZv");
prefillField.setValue("option2");

PrefillFieldRequest prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.setFields(Arrays.asList(prefillField));

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

NodeJS

```js
import { DocumentApi, PrefillField, PrefillFieldRequest } from "boldsign";

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const prefillField = new PrefillField();
prefillField.id = "Dropdown1";
prefillField.value = "Prefill Value";

const prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.fields = [prefillField];

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

{% /codetab %}

## Image

To prefill an image field, you must provide the image in base64 (data URI scheme) format in the `value` property.

### Format Syntax

The format for the `value` property should be:

```
data:{{imageType}};base64,{{content}}
```

Where:

-   `{{imageType}}` is the MIME type of the image (e.g., image/png, image/jpeg)
-   `{{content}}` is the base64-encoded image data

{% codetab  id="codetab7" %}

cURL

```shell
curl -X PATCH 'https://api.boldsign.com/v1/document/prefillFields?documentId=2a448030-xxx-xxx-xxxx-58b1349662fc' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: {your-api-key}' \
-d '{
    "Fields": [
        {
            "Id": "image_6Ogud",
            "Value": "data:image/png;base64,iVBORw0KGgoAAAANS..."
        }
    ]
}
'
```

C#

```csharp
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 = "image_6Ogud",
            Value = "data:image/png;base64,iVBORw0KGgoAAAANS..."
        }
    },
};

documentClient.PrefillFields(prefillFieldRequest);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    document_api = boldsign.DocumentApi(api_client)
	
    prefill_field = boldsign.PrefillField(
        id="image_6Ogud",
        value="data:image/png;base64,iVBORw0KGgoAAAANS...")
    
    prefill_field_request = boldsign.PrefillFieldRequest(fields=[prefill_field])
        
    document_api.prefill_fields(document_id="YOUR_DOCUMENT_ID", prefill_field_request=prefill_field_request)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{PrefillField, PrefillFieldRequest};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$prefill_field = new PrefillField();
$prefill_field->setId('image_J0Z7w');
$prefill_field->setValue('data:image/png;base64,iVBORw0KGgoAAAANS...');

$prefill_field_request = new PrefillFieldRequest();
$prefill_field_request->setFields([$prefill_field]);

$document_api->prefillFields($document_id = 'YOUR_DOCUMENT_ID', $prefill_field_request);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
		   
DocumentApi documentApi = new DocumentApi(client);

PrefillField prefillField = new PrefillField();
prefillField.setId("image_J0Z7w");
prefillField.setValue("data:image/png;base64,iVBORw0KGgoAAAANS...");

PrefillFieldRequest prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.setFields(Arrays.asList(prefillField));

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

NodeJS

```js
import { DocumentApi, PrefillField, PrefillFieldRequest  } from "boldsign";
import * as fs from 'fs';

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const prefillField = new PrefillField();
prefillField.id = "Image1";
const imageBase64 = `data:image/png;base64,${fs.readFileSync('YOUR_FILE_PATH').toString('base64')}`;
prefillField.value = imageBase64;

const prefillFieldRequest = new PrefillFieldRequest();
prefillFieldRequest.fields = [prefillField];

documentApi.prefillFields("YOUR_DOCUMENT_ID", prefillFieldRequest);
```

{% /codetab %}

## Query parameters

{% nestedtable %}

-   {% arguments name="documentId" /%}{% batch datatype="string" /%}{% required /%}
-   The ID of the document to which the form fields have to be prefilled.

{% /nestedtable %}

## Request body

{% nestedtable %}

-   {% arguments name="Fields" /%}{% batch datatype="array" /%}{% required /%}
-   Array of form fields to be prefilled.
    {% nestedtable %}

    -   {% arguments name="Id" /%}{% batch datatype="string" /%}{% required /%}
    -   The ID of the form field to be prefilled. This can be obtained from the properties API.

    ***

    -   {% arguments name="Value" /%}{% batch datatype="string" /%}{% required /%}
    -   The value to be assigned to the form field.

    {% /nestedtable %}

---

-   {% arguments name="OnBehalfOf" /%}{% batch datatype="array" /%}
-   Email address of the sender if you are prefilling the on behalf of documents.

{% /nestedtable %}
