> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Custom Field

> <div>                   <p> Create Custom Field </p>                    <div>                     <span style= "display: inline-block;                                 width: 25px; height: 25px;       

\<div>
\<p> Create Custom Field \</p>
\<div>
\<span style= "display: inline-block;
width: 25px; height: 25px;
background-color: yellow;
color: black;
font-weight: bold;
font-size: 24px;
text-align: center;
line-height: 22px;
border: 2px solid black;
border-radius: 10%;
margin-right: 10px;">
!
\</span>
\<span>
\<strong>
Only supports Custom Objects and Company (Business) today. Will be extended to other Standard Objects in the future.
\</strong>
\</span>
\</div>
\</div>

```http theme={null}
POST https://services.leadconnectorhq.com/custom-fields/
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Body

<ParamField body="locationId" type="string" required default="ve9EPM428h8vShlRW1KT">
  Account Id
</ParamField>

<ParamField body="name" type="string" default="Name">
  Field name
</ParamField>

<ParamField body="description" type="string">
  Description of the field
</ParamField>

<ParamField body="placeholder" type="string">
  Placeholder text for the field
</ParamField>

<ParamField body="showInForms" type="boolean" required>
  Whether the field should be shown in forms
</ParamField>

<ParamField body="options" type="object[]">
  Options for the field (Optional, valid only for SINGLE\_OPTIONS, MULTIPLE\_OPTIONS, RADIO, CHECKBOX, TEXTBOX\_LIST type)

  <Expandable title="cada item">
    <ParamField body="key" type="string" required>
      Key of the option (Included in Create and Response, excluded in Update)
    </ParamField>

    <ParamField body="label" type="string" required>
      Value of the option
    </ParamField>

    <ParamField body="url" type="string">
      URL associated with the option (Optional, valid only for RADIO type)
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="acceptedFormats" type="string">
  Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png, .gif, .csv, .xlsx, .xls, all Posibles valores: '.pdf', '.docx', '.doc', '.jpg', '.jpeg', '.png', '.gif', '.csv', '.xlsx', '.xls', 'all'
</ParamField>

<ParamField body="dataType" type="string" required>
  Type of field that you are trying to create Posibles valores: 'TEXT', 'LARGE\_TEXT', 'NUMERICAL', 'PHONE', 'MONETORY', 'CHECKBOX', 'SINGLE\_OPTIONS', 'MULTIPLE\_OPTIONS', 'DATE', 'TEXTBOX\_LIST', 'FILE\_UPLOAD', 'RADIO', 'EMAIL'
</ParamField>

<ParamField body="fieldKey" type="string" required default="custom_object.pet.name">
  Field key. For Custom Object it's formatted as "custom\_object.\{objectKey}.\{fieldKey}". "custom\_object" is a fixed prefix, "\{objectKey}" is your custom object's identifier, and "\{fieldKey}" is the unique field name within that object. Example: "custom\_object.pet.name" for a "name" field in a "pet" custom object.
</ParamField>

<ParamField body="objectKey" type="string" required default="custom_object.pet">
  The key for your custom object. This key uniquely identifies the custom object. Example: "custom\_object.pet" for a custom object related to pets.
</ParamField>

<ParamField body="maxFileLimit" type="number" default="2">
  Maximum file limit for uploads. Applicable only for fields with a data type of FILE\_UPLOAD.
</ParamField>

<ParamField body="allowCustomOption" type="boolean" default="True">
  Determines if users can add a custom option value different from the predefined options in records for RADIO type fields. A custom value added in one record does not automatically become an option and will not appear as an option for other records.
</ParamField>

<ParamField body="parentId" type="string" required>
  ID of the parent folder
</ParamField>

## Respuestas

<Accordion title="201 - Successful response">
  <ResponseField name="field" type="object">
    <Expandable title="propiedades">
      <ResponseField name="locationId" type="string" required default="ve9EPM428h8vShlRW1KT">
        Account Id
      </ResponseField>

      <ResponseField name="name" type="string" default="Name">
        Field name
      </ResponseField>

      <ResponseField name="description" type="string">
        Description of the field
      </ResponseField>

      <ResponseField name="placeholder" type="string">
        Placeholder text for the field
      </ResponseField>

      <ResponseField name="showInForms" type="boolean" required>
        Whether the field should be shown in forms
      </ResponseField>

      <ResponseField name="options" type="object[]">
        Options for the field (Optional, valid only for SINGLE\_OPTIONS, MULTIPLE\_OPTIONS, RADIO, CHECKBOX, TEXTBOX\_LIST type)

        <Expandable title="cada item">
          <ResponseField name="key" type="string" required>
            Key of the option (Included in Create and Response, excluded in Update)
          </ResponseField>

          <ResponseField name="label" type="string" required>
            Value of the option
          </ResponseField>

          <ResponseField name="url" type="string">
            URL associated with the option (Optional, valid only for RADIO type)
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="acceptedFormats" type="string">
        Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png, .gif, .csv, .xlsx, .xls, all Posibles valores: '.pdf', '.docx', '.doc', '.jpg', '.jpeg', '.png', '.gif', '.csv', '.xlsx', '.xls', 'all'
      </ResponseField>

      <ResponseField name="id" type="string" required>
        Unique identifier of the object
      </ResponseField>

      <ResponseField name="objectKey" type="string" required default="custom_object.pet">
        The key for your custom / standard object. This key uniquely identifies the custom object. Example: "custom\_object.pet" for a custom object related to pets.
      </ResponseField>

      <ResponseField name="dataType" type="string" required>
        Type of field that you are trying to create Posibles valores: 'TEXT', 'LARGE\_TEXT', 'NUMERICAL', 'PHONE', 'MONETORY', 'CHECKBOX', 'SINGLE\_OPTIONS', 'MULTIPLE\_OPTIONS', 'DATE', 'TEXTBOX\_LIST', 'FILE\_UPLOAD', 'RADIO'
      </ResponseField>

      <ResponseField name="parentId" type="string" required default="3v34PM428h8vShlRW1KT">
        ID of the parent folder
      </ResponseField>

      <ResponseField name="fieldKey" type="string" required default="custom_object.pet.name">
        Field key. For Custom Object it's formatted as "custom\_object.\{objectKey}.\{fieldKey}". "custom\_object" is a fixed prefix, "\{objectKey}" is your custom object's identifier, and "\{fieldName}" is the unique field name within that object. Example: "custom\_object.pet.name" for a "name" field in a "pet" custom object.
      </ResponseField>

      <ResponseField name="allowCustomOption" type="boolean" default="True">
        Determines if users can add a custom option value different from the predefined options in records for RADIO type fields. A custom value added in one record does not automatically become an option and will not appear as an option for other records.
      </ResponseField>

      <ResponseField name="maxFileLimit" type="number" default="2">
        Maximum file limit for uploads
      </ResponseField>

      <ResponseField name="dateAdded" type="string" required>
        Date and time when the object was added
      </ResponseField>

      <ResponseField name="dateUpdated" type="string" required>
        Date and time when the object was last updated
      </ResponseField>
    </Expandable>
  </ResponseField>

  ```json theme={null}
  {
    "field": {
      "locationId": "ve9EPM428h8vShlRW1KT",
      "name": "Name",
      "description": "string",
      "placeholder": "string",
      "showInForms": true,
      "options": [
        {
          "key": "string",
          "label": "string",
          "url": "string"
        }
      ],
      "acceptedFormats": ".pdf",
      "id": "string",
      "objectKey": "custom_object.pet",
      "dataType": "TEXT",
      "parentId": "3v34PM428h8vShlRW1KT",
      "fieldKey": "custom_object.pet.name",
      "allowCustomOption": true,
      "maxFileLimit": 2,
      "dateAdded": "2024-01-15T10:30:00Z",
      "dateUpdated": "2024-01-15T10:30:00Z"
    }
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/custom-fields/' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "locationId": "ve9EPM428h8vShlRW1KT",
    "name": "Name",
    "description": "string",
    "placeholder": "string",
    "showInForms": true,
    "options": [
      {
        "key": "string",
        "label": "string",
        "url": "string"
      }
    ],
    "acceptedFormats": ".pdf",
    "dataType": "TEXT",
    "fieldKey": "custom_object.pet.name",
    "objectKey": "custom_object.pet",
    "maxFileLimit": 2,
    "allowCustomOption": true,
    "parentId": "string"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/custom-fields/', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"locationId": "ve9EPM428h8vShlRW1KT", "name": "Name", "description": "string", "placeholder": "string", "showInForms": true, "options": [{"key": "string", "label": "string", "url": "string"}], "acceptedFormats": ".pdf", "dataType": "TEXT", "fieldKey": "custom_object.pet.name", "objectKey": "custom_object.pet", "maxFileLimit": 2, "allowCustomOption": true, "parentId": "string"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/custom-fields/',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"locationId": "ve9EPM428h8vShlRW1KT", "name": "Name", "description": "string", "placeholder": "string", "showInForms": true, "options": [{"key": "string", "label": "string", "url": "string"}], "acceptedFormats": ".pdf", "dataType": "TEXT", "fieldKey": "custom_object.pet.name", "objectKey": "custom_object.pet", "maxFileLimit": 2, "allowCustomOption": true, "parentId": "string"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/custom-fields/');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'locationId': 've9EPM428h8vShlRW1KT', 'name': 'Name', 'description': 'string', 'placeholder': 'string', 'showInForms': true, 'options': [{'key': 'string', 'label': 'string', 'url': 'string'}], 'acceptedFormats': '.pdf', 'dataType': 'TEXT', 'fieldKey': 'custom_object.pet.name', 'objectKey': 'custom_object.pet', 'maxFileLimit': 2, 'allowCustomOption': true, 'parentId': 'string'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
