# Custom Field

Custom field is the support that helps to speed up your document preparation by dragging and dropping the customized fields and eliminating repetitive modifications. Each field can be saved with frequently used values. Each field saved as a custom field will be associated with the brand. You can easily access the collection of saved custom fields and select the ones you need for a particular document. 
By dragging and dropping the desired custom fields into the document, you can quickly populate the necessary information without the need for manual entry or modification.

## Create custom field

{% post /%}
{% path text="/v1/customField/create" /%}

To create a custom field using this API, provide essential details such as field name, field description, field order, and form field. These parameters are required for generating a custom field according to specific requirements and ensuring accurate customization.

## Code snippet

{% codetab %}

cURL

```shell
curl -X POST 'https://api.boldsign.com/v1/customField/create' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'Authorization: {{apiKey}}' \
-d '{
  "FieldName": "string",
  "FieldDescription": "string",
  "FieldOrder": 1,
  "BrandId": "string",
  "SharedField": true,
  "FormField": {
    "FieldType": "Signature",
    "Font": "Courier",
    "Width": 60,
    "Height": 20,
    "IsRequired": true,
    "IsReadOnly": true,
    "Value": "string",
    "FontSize": 13,
    "FontHexColor": "string",
    "IsBoldFont": true,
    "IsItalicFont": true,
    "IsUnderLineFont": true,
    "LineHeight": 15,
    "CharacterLimit": 0,
    "PlaceHolder": "string",
    "ValidationType": "NumbersOnly",
    "ValidationCustomRegex": "string",
    "ValidationCustomRegexMessage": "string",
    "DateFormat": "string",
    "TimeFormat": "string",
    "ImageInfo": {
      "AllowedFileExtensions": "string",
      "Title": "string",
      "Description": "string"
    },
    "AttachmentInfo": {
      "AllowedFileTypes": "string",
      "Title": "string",
      "Description": "string",
      "AcceptedFileTypes": [
        "string",
        "string"
      ]
    },
    "EditableDateFieldSettings": {
      "DateFormat": "string",
      "MinDate": ""2023-06-26T04:11:52.213Z"",
      "MaxDate": ""2023-06-26T04:11:52.213Z""
    },
    "HyperlinkText": "string",
    "DataSyncTag": "string",
    "DropdownOptions": [
      "string",
      "string"
    ],
    "TextAlign": "Center",
    "TextDirection": "LTR",
    "CharacterSpacing": 0,
    "IdPrefix": "string",
    "RestrictIdPrefixChange": false,
    "BackgroundHexColor": "string"
  }
}'
```

C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "Your_API_Key");

var customFieldClient = new CustomFieldClient(apiClient);

List<CustomFormField> customFormField = new List<CustomFormField>
{
    new CustomFormField(FieldType.Signature)
};

var customFieldDetails = new BrandCustomFieldDetails()
{
    FieldName = "string",
    BrandId = "YOUR_BRAND_ID",
    SharedField = true,
    FormField = customFormField[0]
};

var customFieldCreated = customFieldClient.CreateCustomField(customFieldDetails);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:
    
    custom_field_api = boldsign.CustomFieldApi(api_client)
	
    custom_form_field = boldsign.CustomFormField(fieldType="Signature")
    
    custom_field_details = boldsign.BrandCustomFieldDetails(
        fieldName="string",
        brandId="YOUR_BRAND_ID",
        sharedField=True,
        formField=custom_form_field)   
    
    custom_field_created = custom_field_api.create_custom_field(custom_field_details)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\CustomFieldApi;
use BoldSign\Model\{CustomFormField, BrandCustomFieldDetails};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$custom_field_api = new CustomFieldApi($config);

$custom_form_field = new CustomFormField();
$custom_form_field->setFieldType('Signature');

$custom_field_details = new BrandCustomFieldDetails();
$custom_field_details->setFieldName('string');
$custom_field_details->setBrandId('YOUR_BRAND_ID');
$custom_field_details->setSharedField(true);
$custom_field_details->setFormField($custom_form_field);

$custom_field_created = $custom_field_api->createCustomField($custom_field_details);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
        
CustomFieldApi customFieldApi = new CustomFieldApi(client);

CustomFormField customFormField = new CustomFormField();
customFormField.setFieldType(CustomFormField.FieldTypeEnum.SIGNATURE);
		        
BrandCustomFieldDetails customFieldDetails = new BrandCustomFieldDetails();
customFieldDetails.setFieldName("string");
customFieldDetails.setBrandId("YOUR_BRAND_ID");   
customFieldDetails.setSharedField(true);   
customFieldDetails.setFormField(customFormField);              
        
CustomFieldMessage customFieldCreated = customFieldApi.createCustomField(customFieldDetails);
```

NodeJS

```js
import { CustomFieldApi, BrandCustomFieldDetails, CustomFormField } from "boldsign";

const customFieldApi = new CustomFieldApi("https://api.boldsign.com");
customFieldApi.setApiKey("YOUR_API_KEY");

const customFormField = new CustomFormField();
customFormField.fieldType = CustomFormField.FieldTypeEnum.Signature;

const customFieldDetails = new BrandCustomFieldDetails();
customFieldDetails.fieldName = "string";
customFieldDetails.brandId = "YOUR_BRAND_ID";
customFieldDetails.sharedField = true;
customFieldDetails.formField = customFormField;

const customFieldCreated = customFieldApi.createCustomField(customFieldDetails);
```

{% /codetab %}

## Request body

{% nestedtable %}
- {% arguments name="FieldName" /%}{% batch datatype="string" /%}
- The name of the custom field you want to create. For example, you can use "My Custom Field" as the field name.
---
- {% arguments name="FieldDescription" /%}{% batch datatype="string" /%}
- A brief description or additional information about the custom field.
---
- {% arguments name="FieldOrder" /%}{% batch datatype="string" /%}
- The order or position of the custom field within a list of form fields.
---
- {% arguments name="BrandId" /%}{% batch datatype="string" /%}
- The unique identifier associated with the brand for which the custom field is being created. This property allows you to associate the custom field specifically with a particular brand within your organization.
---
- {% arguments name="SharedField" /%}{% batch datatype="boolean" /%}
- This property indicates whether the custom field is intended to be shared across users within your organization. If set to true, the field will be accessible and visible to all users in your organization. On the other hand, if set to false, the field will be specific to your individual account and not visible or accessible to other users. Choose true or false based on your specific requirements.
---
- {% arguments name="FormField" /%}{% batch datatype="object" /%}
- The custom form field associated with the brand.

  {% nestedtable %}
    - {% arguments name="FieldType" /%}{% batch datatype="string" /%}
    - Type of the form field. The available values are `Signature`, `Initial`, `CheckBox`, `TextBox`, `Label`, `DateSigned`, `Image`, `Attachment`, `EditableDate`, `Hyperlink`, `Formula`, `Dropdown` and `Drawing`. The `Formula` field is only available in the beta version.

      **Note:**
      To add `Email`, `Name`, `Title`, and `Company` fields via API, use `TextBox` fields with the validation type set to `Regex` .
    ---
    - {% arguments name="Width" /%}{% batch datatype="float" /%}
    - Width of the form field. The width must be greater than zero.
    ---
    - {% arguments name="Height" /%}{% batch datatype="float" /%}
    - Height of the form field. The height must be greater than zero.
    ---
    - {% arguments name="IsReadOnly" /%}{% batch datatype="boolean" /%}
    - Decides whether this form field is readOnly or not.
    --- 
    - {% arguments name="IsRequired" /%}{% batch datatype="boolean" /%}
    - Decides whether this form field is required to be filled or not.
    ---
    - {% arguments name="IsMasked" /%}{% batch datatype="Nullable boolean" /%}
    - Decides whether this form field should be masked so that its value is hidden from other signers present in the document.
    ---
    - {% arguments name="Value" /%}{% batch datatype="string" /%}
    - Value to be displayed on the label form field.
    ---
    - {% arguments name="FontSize" /%}{% batch datatype="float" /%}
    - Size of the font. The default size font is **13.0** .
    ---
    - {% arguments name="Font " /%}{% batch datatype="string" /%}
    - Font family. The values are `Courier`, `Helvetica` and `TimesNewRoman` . The default font family is ` Helvetica`.
    ---
    - {% arguments name="FontHexColor" /%}{% batch datatype="string" /%}
    - Color of the font. The value should be a hex color code. Example - `#035efc`.
    ---
    - {% arguments name="IsBoldFont" /%}{% batch datatype="boolean" /%}
    - Decides whether the font should be in bold or not.
    ---
    - {% arguments name="IsItalicFont" /%}{% batch datatype="boolean" /%}
    - Decides whether the font should be in italic or not.
    ---
    - {% arguments name="IsUnderLineFont" /%}{% batch datatype="boolean" /%}
    - Decides whether the font should be underlined or not.
    ---
    - {% arguments name="LineHeight" /%}{% batch datatype="integer" /%}
    - Height of a line in the text. The default line height is **15.0** .
    ---
    - {% arguments name="CharacterLimit" /%}{% batch datatype="integer" /%}
    - Limits the number of characters in the text. The character limit value must be greater than zero.
    ---
    - {% arguments name="PlaceHolder" /%}{% batch datatype="string" /%}
    - A hint text to be displayed on the textbox form field by default.
    ---
    - {% arguments name="ValidationType" /%}{% batch datatype="string" /%}
    - Type of validation for the textbox form field. The values are `Only Numbers`, `Regex`, `Currency`, `Email`, and `None`. The default validation type is `None` .
    ---
    - {% arguments name="ValidationCustomRegex" /%}{% batch datatype="string" /%}
    - Value for regex validation. This is applicable when the `validationType` is set to `Regex.`
    ---
    - {% arguments name="ValidationCustomRegexMessage" /%}{% batch datatype="string" /%}
    - Description for regex validation. This message is displayed when the signer enters an invalid regex format value in the textbox form field.
    ---
    - {% arguments name="DateFormat" /%}{% batch datatype="string" /%}
    - Format of the date to be displayed on the date signed form field. The default value is `MM/dd/yyyy`. When `null` is provided, the value is inherited from the business profile settings of your account. 
    Accepted formats are 
      - `MM/dd/yyyy` (02/08/2024)
      - `dd/MM/yyyy` (08/02/2024)
      - `dd-MMM-yyyy` (08-Feb-2024)
      - `MMM-dd-yyyy` (Feb-08-2024)
      - `MMM dd, yyyy` (Feb 08, 2024)
      - `dd MMM, yyyy` (08 Feb, 2024)
      - `yyyy, MMM dd` (2024, Feb 08)
      - `yyyy/MM/dd` (2024/02/08)
      - `dd-MM-yyyy` (08-02-2024)
      - `MM-dd-yyyy` (02-08-2024)
      - `yyyy-MM-dd` (2024-02-08)
    ---
    - {% arguments name="TimeFormat" /%}{% batch datatype="string" /%}
    - Format of the time to be displayed on the date signed form field. When `null` is provided, the value is inherited from the business profile settings of your account. 
    Accepted formats are 
      - `hh:mm tt` (12:30 PM)
      - `h:mm tt` (2:45 PM)
      - `HH:mm` (14:30)
      - `H:mm` (9:15)
      - `hh:mm:ss tt` (12:30:15 PM)
      - `h:mm:ss tt` (2:45:30 PM)
      - `HH:mm:ss` (14:30:10)
      - `H:mm:ss` (9:15:40)
      - `None` (Disabled, no time will be displayed)
    ---
    - {% arguments name="ImageInfo" /%}{% batch datatype="object" /%}
    - Options to customize the image form field.

      {% nestedtable %}
        - {% arguments name="Title" /%}{% batch datatype="string" /%}
        - Title of the image form field.
        ---
        - {% arguments name="Description" /%}{% batch datatype="string" /%}
        - Description of the image form field.
        ---
        - {% arguments name="AllowedFileExtensions" /%}{% batch datatype="string" /%}
        - Controls the image formats that are allowed to upload on the image form field. The values are `.jpg` or `.jpeg,` `.svg,` `.png,` and `.bmp.`
      {% /nestedtable %}

    ---
    - {% arguments name="AttachmentInfo" /%}{% batch datatype="object" /%}
    - Options to customize the attachment form field.

      {% nestedtable %}
        - {% arguments name="Title" /%}{% batch datatype="string" /%}
        - Title of the attachment form field.
        ---
        - {% arguments name="Description" /%}{% batch datatype="string" /%}
        - Description of the attachment form field.
        ---
        - {% arguments name="AllowedFileTypes" /%}{% batch datatype="string" /%}
        - Controls the file formats that are allowed to upload on the attachment form field. The values are `PDF,` `Document,` and `Image.`
      {% /nestedtable %}

    ---
    - {% arguments name="EditableDateFieldSettings" /%}{% batch datatype="object" /%}
    - Options to customize the editable date form field.

      {% nestedtable %}
        - {% arguments name="DateFomat" /%}{% batch datatype="string" /%}
        - BoldSign API supports a variety of date-time formats, including:

          - `MM/dd/yyyy`
          - `dd/MM/yyyy`
          - `dd-MMM-yyyy`
          - `MMM-dd-yyyy`
          - `MMM dd,yyyy`
          - `dd MMM,yyyy`
          - `yyyy,MMM dd`
          - `yyyy/MM/dd`
          - `dd-MM-yyyy`
          - `MM-dd-yyyy`
          - `yyyy-MM-dd`

          Format of the date to be displayed on the date signed form field. The default value is `MM/dd/yyyy`.
        ---
        - {% arguments name="MinDate" /%}{% batch datatype="string" /%}
        - The minimum date that can be selected. The string should be in date-time format.
          The default ISO standard `YYYY-MM-DDTHH:MM:SSZ`.
          ##### Example Format 
          minDate : `2024-01-01T00:00:00Z`

          The date-time should be passed in UTC timezone using Z (e.g., `2024-01-01T00:00:00Z`).

          If using a specific timezone, provide the UTC offset:
            - IST (UTC+5:30): `2024-01-01T00:00:00+05:30`
            - PST (UTC-8:00): `2024-01-01T00:00:00-08:00`

        ---
        - {% arguments name="MaxDate" /%}{% batch datatype="string" /%}
        - The maximum date that can be selected. The string should be in date-time format.
          The default ISO 8601 standard `YYYY-MM-DDTHH:MM:SSZ`.
          ##### Example Format 
          maxDate : `2025-12-31T23:59:59Z`

          Pass the date-time in UTC timezone using Z (e.g., `2025-12-31T23:59:59Z`).

          For specific timezones, provide the UTC offset:
            - EST (UTC-5:00): `2025-12-31T23:59:59-05:00`
            - CET (UTC+1:00): `2025-12-31T23:59:59+01:00`
      {% /nestedtable %}

    ---
    - {% arguments name="HyperLinkText" /%}{% batch datatype="string" /%}
    - Text to be displayed for the hyperlink.
    ---
    - {% arguments name="DataSyncTag" /%}{% batch datatype="string" /%}
    - The value that can be specified on two or more textbox form fields to sync them.
    ---
    - {% arguments name="DropDownOptions" /%}{% batch datatype="array" /%}
    - The values that have to be displayed on the dropdown form field. One or more values can be specified.
    ---
    - {% arguments name="TextAlign" /%}{% batch datatype="string" /%}
    - Determines the horizontal alignment of text for the textbox and label form fields, and can be set to `Left`,  `Center` or `Right`. The default of alignment of text is `Left`.
    ---
    - {% arguments name="TextDirection" /%}{% batch datatype="string" /%}
    - Determines the text direction of text for the textbox and label form fields, and can be set to `LTR` or `RTL`. The default text direction is `LTR`.
    ---
    - {% arguments name="CharacterSpacing" /%}{% batch datatype="float" /%}
    - Determines the character spacing of text for the textbox and label form fields. It can be set as a floating-point value.
    ---
    - {% arguments name="IdPrefix" /%}{% batch datatype="string" /%}
    - This property holds the initial part of the ID which will be combined with a numerical count.
    ---
    - {% arguments name="RestrictIdPrefixChange" /%}{% batch datatype="boolean" /%}
    - This boolean property indicates whether the modification of the ID prefix is allowed or not. When set to true, it restricts the sender from altering the ID prefix.
    ---
    - {% arguments name="BackgroundHexColor" /%}{% batch datatype="string" /%}
    - This property specifies the color that will be used for the background of the label field. The value should be a hex color code. Example - `#FFFFFF`.
    ---
    - {% arguments name="ResizeOption" /%}{% batch datatype="enum" /%}
    - Defines how the Textbox form field resizes based on the entered text. The available values are `GrowHorizontally`, `GrowVertically`, `GrowBoth`, `FixedSize`, and `AutoResizeFont`.
  {% /nestedtable %}

{% /nestedtable %}

## Example response

***200 Success***

```json
{
  "customFieldId": "e33502d4-xxxx-xxxx-xxxx-6v3n85d51948",
  "message": "Custom field saved successfully."
}
```
