# Replace Fillable Fields with BoldSign Fields

BoldSign supports automatic detection of form fields within fillable documents. By setting the `AutoDetectFields` property to `true` during document creation, BoldSign can identify and replace fillable fields with corresponding BoldSign form fields. The auto-detection feature supports text boxes, checkboxes, radio buttons, dropdowns, and signature fields.

Here are some code examples that illustrate how to detect fillable fields in a document and automatically replace them with BoldSign form fields when sending the document through the API.

## Code snippet using multipart/form-data

{% codetab id="codetab1" %}
cURL
```shell 
curl -X 'POST' \
  'https://api.boldsign.com/v1/document/send' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {your API key}' \
  -H 'Content-Type: multipart/form-data' \
  -F 'AutoDetectFields=true' \
  -F 'Title="Sample Document"' \
  -F 'Signers={
  "name": "hanky",
  "emailAddress": "hankyWhites@gmail.com",
  "signerType": "Signer",
  "locale": "EN"
}' \
  -F 'Files=@{your file}' \
```

C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API key}");
var documentClient = new DocumentClient(apiClient);

var documentFilePath = new DocumentFilePath
{
    ContentType = "application/pdf",
    FilePath = "{Your File path}"
};

var filesToUpload = new List<IDocumentFile>
{
    documentFilePath,
};

var signer = new DocumentSigner(
    signerName: "David",
    signerType: SignerType.Signer,
    signerEmail: "david@cubeflakes.com",
    locale: Locales.EN);

var documentSigners = new List<DocumentSigner>()
{
    signer
};

var sendForSign = new SendForSign()
{
    Signers = documentSigners,
    Title = "Sample Document",
    AutoDetectFields = true,
    Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
```

Python

```python
import requests
import json

url = "https://api.boldsign.com/v1/document/send"

signer_data = {
    "name": "hanky",
    "emailAddress": "hankyWhites@gmail.com",
    "signerType": "Signer",
    "locale": "EN"
}

payload = {
    'Signers': json.dumps(signer_data),
    'Title': "Sample Document",
    'AutoDetectFields': True
}

files = [
    ('Files', ('{Your file name}', open('{Your file path}', 'rb'), 'application/pdf'))
]

headers = {
    'accept': 'application/json',
    'X-API-KEY': '{Your API key}'
}

response = requests.post(url, headers=headers, data=payload, files=files)

print(response.text)
```

NodeJS

```js
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('Signers', '{\r\n  "name": "hanky",\r\n  "emailAddress": "hankyWhites@gmail.com",\r\n  "signerType": "Signer",\r\n  "locale": "EN"\r\n}');
data.append('Files', fs.createReadStream('{Your file path}'));
data.append('Title', "Sample Document");
data.append('AutoDetectFields', 'true');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.boldsign.com/v1/document/send',
  headers: { 
    'accept': 'application/json', 
    'X-API-KEY': '{Your API key}', 
    ...data.getHeaders()
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
```

PHP

```php
<?php
require_once "vendor/autoload.php";
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use \GuzzleHttp\Psr7\Utils;
$client = new Client([
    'verify' => false, // Disable SSL verification
]);
$headers = [
  'accept' => 'application/json',
  'X-API-KEY' => '{Your API Key}'
];
$options = [
  'multipart' => [
    [
      'name' => 'Signers',
      'contents' => '{
        "name": "David",
        "emailAddress": "david@boldsign.dev",
        "signerType": "Signer",
        "locale": "EN"
      }'
    ],
    [
      'name' => 'Title',
      'contents' => 'Sample'
    ],
    [
      'name' => 'AutoDetectFields',
      'contents' => 'true'
    ],
    [
      'name' => 'Files',
      'contents' => Utils::tryFopen('{Your File Path}', 'r'),
      'filename' => '{Your File name}',
      'headers'  => [
        'Content-Type' => 'application/pdf'
      ]
    ]
]];
$request = new Request('POST', 'https://api.boldsign.com/v1/document/send', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
?>
```

{% /codetab %}

In the examples provided above, please ensure that the `AutoDetectFields` option is set to `true`. This will automatically detect fillable fields within the document and replace them with BoldSign form fields when the document is sent to the signer.
