# Create Custom Field

POST https://services.leadconnectorhq.com/custom-fields/

Create Custom Field.

:::info
Supports Custom Objects, Company (Business), and Project Management tasks (objectKey: "task", optional scopes). Contact and Opportunity fields continue to use the Locations custom-fields endpoints.
:::

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `locations/customFields.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2023-02-21"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/custom-fields/": {
      "post": {
        "summary": "Create Custom Field",
        "operationId": "createCustomField",
        "description": "Create Custom Field.\n\n:::info\nSupports Custom Objects, Company (Business), and Project Management tasks (objectKey: \"task\", optional scopes). Contact and Opportunity fields continue to use the Locations custom-fields endpoints.\n:::",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2023-02-21"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomFieldsDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomFieldSuccessfulResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "locations/customFields.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "CreateCustomFieldsDTO": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "Location Id",
            "example": "ve9EPM428h8vShlRW1KT"
          },
          "name": {
            "type": "string",
            "description": "Field name",
            "example": "Name"
          },
          "description": {
            "type": "string",
            "description": "Description of the field",
            "example": "Pet name field"
          },
          "placeholder": {
            "type": "string",
            "description": "Placeholder text for the field",
            "example": "Enter pet name"
          },
          "showInForms": {
            "type": "boolean",
            "description": "Whether the field should be shown in forms",
            "example": true
          },
          "options": {
            "description": "Options for the field (Optional, valid only for SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO, CHECKBOX, TEXTBOX_LIST type)",
            "example": [
              {
                "key": "option_a",
                "label": "Option A"
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "description": "Key of the option (Included in Create and Response, excluded in Update)",
                  "example": "option_a"
                },
                "label": {
                  "type": "string",
                  "description": "Value of the option",
                  "example": "Option A"
                },
                "url": {
                  "type": "string",
                  "description": "URL associated with the option (Optional, valid only for RADIO type)",
                  "example": "https://example.com"
                }
              },
              "required": [
                "key",
                "label"
              ],
              "title": "OptionDTO"
            }
          },
          "acceptedFormats": {
            "type": "string",
            "enum": [
              ".pdf",
              ".docx",
              ".doc",
              ".jpg",
              ".jpeg",
              ".png",
              ".gif",
              ".csv",
              ".xlsx",
              ".xls",
              "all"
            ],
            "description": "Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png, .gif, .csv, .xlsx, .xls, all",
            "example": [
              ".pdf",
              ".jpg"
            ]
          },
          "dataType": {
            "type": "string",
            "enum": [
              "TEXT",
              "LARGE_TEXT",
              "NUMERICAL",
              "PHONE",
              "MONETORY",
              "CHECKBOX",
              "SINGLE_OPTIONS",
              "MULTIPLE_OPTIONS",
              "DATE",
              "TEXTBOX_LIST",
              "FILE_UPLOAD",
              "RADIO",
              "EMAIL"
            ],
            "description": "Type of field that you are trying to create",
            "example": "TEXT"
          },
          "fieldKey": {
            "type": "string",
            "description": "Field key. For Custom Objects: `custom_object.{objectKey}.{fieldKey}`. For standard objects such as tasks: `task.{fieldKey}` (e.g. `task.priority_n`). When setting values via the Projects Tasks API, omit the `task.` prefix in `customFields`.",
            "example": "task.my_field"
          },
          "objectKey": {
            "type": "string",
            "description": "Object this field belongs to. Use `task` for Project Management task fields, or `custom_object.{key}` for custom objects (e.g. `custom_object.pet`).",
            "example": "task"
          },
          "isUnique": {
            "type": "boolean",
            "description": "Whether the field should be unique within the object. Only applicable for custom objects with TEXT, LARGE_TEXT, NUMERICAL, and PHONE field types.",
            "example": false
          },
          "maxFileLimit": {
            "type": "number",
            "description": "Maximum file limit for uploads. Applicable only for fields with a data type of FILE_UPLOAD.",
            "example": 2
          },
          "allowCustomOption": {
            "type": "boolean",
            "description": "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.",
            "example": true
          },
          "parentId": {
            "type": "string",
            "description": "ID of the parent folder",
            "example": "3v34PM428h8vShlRW1KT"
          },
          "scopes": {
            "description": "Optional visibility scopes for Project Management / task fields. Each entry limits the field to a space, folder, list, or workspace. Omit or pass `[]` for location-wide fields. Example: `[{ \"scopeType\": \"list\", \"scopeId\": \"<listId>\" }]`.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scopeType": {
                  "type": "string",
                  "enum": [
                    "workspace",
                    "space",
                    "folder",
                    "list"
                  ],
                  "description": "Wrapper type this field is limited to. For Projects / tasks use `space`, `folder`, or `list` (or `workspace` for location-wide).",
                  "example": "list"
                },
                "scopeId": {
                  "type": "string",
                  "description": "Id of the space, folder, list, or workspace this field is scoped to",
                  "example": "6a102435124ecfb348bd5507"
                }
              },
              "required": [
                "scopeType",
                "scopeId"
              ],
              "title": "CustomFieldScopeDto"
            },
            "example": [
              {
                "scopeType": "list",
                "scopeId": "6a102435124ecfb348bd5507"
              }
            ]
          }
        },
        "required": [
          "locationId",
          "dataType",
          "fieldKey",
          "objectKey",
          "parentId"
        ],
        "title": "CreateCustomFieldsDTO"
      },
      "CustomFieldSuccessfulResponseDto": {
        "type": "object",
        "properties": {
          "field": {
            "description": "The custom field or folder matching the requested id",
            "example": {
              "id": "661c06b4ffde146bdb469442",
              "locationId": "ve9EPM428h8vShlRW1KT",
              "name": "Pet Name",
              "fieldKey": "custom_object.pet.name",
              "objectKey": "custom_object.pet",
              "dataType": "TEXT",
              "parentId": "3v34PM428h8vShlRW1KT",
              "showInForms": true,
              "dateAdded": "2025-01-02T09:35:39.032Z",
              "dateUpdated": "2025-01-02T09:35:39.032Z"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "locationId": {
                    "type": "string",
                    "description": "Location Id",
                    "example": "ve9EPM428h8vShlRW1KT"
                  },
                  "name": {
                    "type": "string",
                    "description": "Field name",
                    "example": "Name"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of the field",
                    "example": "Pet name field"
                  },
                  "placeholder": {
                    "type": "string",
                    "description": "Placeholder text for the field",
                    "example": "Enter pet name"
                  },
                  "showInForms": {
                    "type": "boolean",
                    "description": "Whether the field should be shown in forms",
                    "example": true
                  },
                  "options": {
                    "description": "Options for the field (Optional, valid only for SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO, CHECKBOX, TEXTBOX_LIST type)",
                    "example": [
                      {
                        "key": "option_a",
                        "label": "Option A"
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "description": "Key of the option (Included in Create and Response, excluded in Update)",
                          "example": "option_a"
                        },
                        "label": {
                          "type": "string",
                          "description": "Value of the option",
                          "example": "Option A"
                        },
                        "url": {
                          "type": "string",
                          "description": "URL associated with the option (Optional, valid only for RADIO type)",
                          "example": "https://example.com"
                        }
                      },
                      "required": [
                        "key",
                        "label"
                      ],
                      "title": "OptionDTO"
                    }
                  },
                  "acceptedFormats": {
                    "type": "string",
                    "enum": [
                      ".pdf",
                      ".docx",
                      ".doc",
                      ".jpg",
                      ".jpeg",
                      ".png",
                      ".gif",
                      ".csv",
                      ".xlsx",
                      ".xls",
                      "all"
                    ],
                    "description": "Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png, .gif, .csv, .xlsx, .xls, all",
                    "example": [
                      ".pdf",
                      ".jpg"
                    ]
                  },
                  "id": {
                    "type": "string",
                    "description": "Unique identifier of the object",
                    "example": "661c06b4ffde146bdb469442"
                  },
                  "objectKey": {
                    "type": "string",
                    "description": "The key for your custom / standard object. Use `task` for Project Management tasks, or e.g. `custom_object.pet` for custom objects.",
                    "example": "task"
                  },
                  "originId": {
                    "type": "string",
                    "description": "Origin ID of the object",
                    "example": "661c06b4ffde146bdb469442"
                  },
                  "dataType": {
                    "type": "string",
                    "enum": [
                      "TEXT",
                      "LARGE_TEXT",
                      "NUMERICAL",
                      "PHONE",
                      "MONETORY",
                      "CHECKBOX",
                      "SINGLE_OPTIONS",
                      "MULTIPLE_OPTIONS",
                      "DATE",
                      "TEXTBOX_LIST",
                      "FILE_UPLOAD",
                      "RADIO",
                      "EMAIL"
                    ],
                    "description": "Type of field that you are trying to create",
                    "example": "TEXT"
                  },
                  "parentId": {
                    "type": "string",
                    "description": "ID of the parent folder",
                    "example": "3v34PM428h8vShlRW1KT"
                  },
                  "fieldKey": {
                    "type": "string",
                    "description": "Field key. For Custom Objects: `custom_object.{objectKey}.{fieldKey}`. For standard objects such as tasks: `task.{fieldKey}` (e.g. `task.priority_n`). When setting values via the Projects Tasks API, omit the `task.` prefix in `customFields`.",
                    "example": "task.my_field"
                  },
                  "allowCustomOption": {
                    "type": "boolean",
                    "description": "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.",
                    "example": true
                  },
                  "maxFileLimit": {
                    "type": "number",
                    "description": "Maximum file limit for uploads",
                    "example": 2
                  },
                  "dateAdded": {
                    "type": "string",
                    "description": "Date and time when the object was added",
                    "format": "date-time",
                    "example": "2025-01-02T09:35:39.032Z"
                  },
                  "dateUpdated": {
                    "type": "string",
                    "description": "Date and time when the object was last updated",
                    "format": "date-time",
                    "example": "2025-01-02T09:35:39.032Z"
                  },
                  "scopes": {
                    "description": "Visibility scopes for this field. Empty array means location-wide. For Projects tasks, entries use scopeType `space` | `folder` | `list` | `workspace` with the wrapper id as scopeId.",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "scopeType": {
                          "type": "string",
                          "enum": [
                            "workspace",
                            "space",
                            "folder",
                            "list"
                          ]
                        },
                        "scopeId": {
                          "type": "string"
                        }
                      }
                    },
                    "example": [
                      {
                        "scopeType": "list",
                        "scopeId": "6a102435124ecfb348bd5507"
                      }
                    ]
                  }
                },
                "required": [
                  "locationId",
                  "id",
                  "objectKey",
                  "originId",
                  "dataType",
                  "parentId",
                  "fieldKey",
                  "dateAdded",
                  "dateUpdated"
                ],
                "title": "ICustomField"
              }
            ]
          }
        },
        "title": "CustomFieldSuccessfulResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const body = {
  "locationId": "ve9EPM428h8vShlRW1KT",
  "name": "Name",
  "description": "Pet name field",
  "placeholder": "Enter pet name",
  "showInForms": true,
  "options": [
    {
      "key": "option_a",
      "label": "Option A"
    }
  ],
  "acceptedFormats": [
    ".pdf",
    ".jpg"
  ],
  "dataType": "TEXT",
  "fieldKey": "task.my_field",
  "objectKey": "task",
  "isUnique": false,
  "maxFileLimit": 2,
  "allowCustomOption": true,
  "parentId": "3v34PM428h8vShlRW1KT",
  "scopes": [
    {
      "scopeType": "list",
      "scopeId": "6a102435124ecfb348bd5507"
    }
  ]
};

const response = await ghl.customFields.createCustomField(body);
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

body = {
    "locationId": "ve9EPM428h8vShlRW1KT",
    "name": "Name",
    "description": "Pet name field",
    "placeholder": "Enter pet name",
    "showInForms": true,
    "options": [
        {
            "key": "option_a",
            "label": "Option A"
        }
    ],
    "acceptedFormats": [
        ".pdf",
        ".jpg"
    ],
    "dataType": "TEXT",
    "fieldKey": "task.my_field",
    "objectKey": "task",
    "isUnique": false,
    "maxFileLimit": 2,
    "allowCustomOption": true,
    "parentId": "3v34PM428h8vShlRW1KT",
    "scopes": [
        {
            "scopeType": "list",
            "scopeId": "6a102435124ecfb348bd5507"
        }
    ]
}

response = await client.customFields.create_custom_field(body=body)
print(response)
```

**PHP** (`gohighlevel/api-client`)

```php
<?php
require_once 'vendor/autoload.php';

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$body = [
    'locationId' => 've9EPM428h8vShlRW1KT',
    'name' => 'Name',
    'description' => 'Pet name field',
    'placeholder' => 'Enter pet name',
    'showInForms' => true,
    'options' => [
        [
            'key' => 'option_a',
            'label' => 'Option A'
        ]
    ],
    'acceptedFormats' => [
        '.pdf',
        '.jpg'
    ],
    'dataType' => 'TEXT',
    'fieldKey' => 'task.my_field',
    'objectKey' => 'task',
    'isUnique' => false,
    'maxFileLimit' => 2,
    'allowCustomOption' => true,
    'parentId' => '3v34PM428h8vShlRW1KT',
    'scopes' => [
        [
            'scopeType' => 'list',
            'scopeId' => '6a102435124ecfb348bd5507'
        ]
    ]
];

$response = $ghl->customFields->createCustomField($body);
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/custom-fields/' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2023-02-21' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationId": "ve9EPM428h8vShlRW1KT",
  "name": "Name",
  "description": "Pet name field",
  "placeholder": "Enter pet name",
  "showInForms": true,
  "options": [
    {
      "key": "option_a",
      "label": "Option A"
    }
  ],
  "acceptedFormats": [
    ".pdf",
    ".jpg"
  ],
  "dataType": "TEXT",
  "fieldKey": "task.my_field",
  "objectKey": "task",
  "isUnique": false,
  "maxFileLimit": 2,
  "allowCustomOption": true,
  "parentId": "3v34PM428h8vShlRW1KT",
  "scopes": [
    {
      "scopeType": "list",
      "scopeId": "6a102435124ecfb348bd5507"
    }
  ]
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2023-02-21',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationId": "ve9EPM428h8vShlRW1KT",
      "name": "Name",
      "description": "Pet name field",
      "placeholder": "Enter pet name",
      "showInForms": true,
      "options": [
        {
          "key": "option_a",
          "label": "Option A"
        }
      ],
      "acceptedFormats": [
        ".pdf",
        ".jpg"
      ],
      "dataType": "TEXT",
      "fieldKey": "task.my_field",
      "objectKey": "task",
      "isUnique": false,
      "maxFileLimit": 2,
      "allowCustomOption": true,
      "parentId": "3v34PM428h8vShlRW1KT",
      "scopes": [
        {
          "scopeType": "list",
          "scopeId": "6a102435124ecfb348bd5507"
        }
      ]
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/custom-fields/', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/custom-fields/"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2023-02-21"
}

payload = {
    "locationId": "ve9EPM428h8vShlRW1KT",
    "name": "Name",
    "description": "Pet name field",
    "placeholder": "Enter pet name",
    "showInForms": true,
    "options": [
        {
            "key": "option_a",
            "label": "Option A"
        }
    ],
    "acceptedFormats": [
        ".pdf",
        ".jpg"
    ],
    "dataType": "TEXT",
    "fieldKey": "task.my_field",
    "objectKey": "task",
    "isUnique": false,
    "maxFileLimit": 2,
    "allowCustomOption": true,
    "parentId": "3v34PM428h8vShlRW1KT",
    "scopes": [
        {
            "scopeType": "list",
            "scopeId": "6a102435124ecfb348bd5507"
        }
    ]
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/custom-fields/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2023-02-21',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationId": "ve9EPM428h8vShlRW1KT",
  "name": "Name",
  "description": "Pet name field",
  "placeholder": "Enter pet name",
  "showInForms": true,
  "options": [
    {
      "key": "option_a",
      "label": "Option A"
    }
  ],
  "acceptedFormats": [
    ".pdf",
    ".jpg"
  ],
  "dataType": "TEXT",
  "fieldKey": "task.my_field",
  "objectKey": "task",
  "isUnique": false,
  "maxFileLimit": 2,
  "allowCustomOption": true,
  "parentId": "3v34PM428h8vShlRW1KT",
  "scopes": [
    {
      "scopeType": "list",
      "scopeId": "6a102435124ecfb348bd5507"
    }
  ]
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/custom-fields/")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2023-02-21")
  .header("Content-Type", "application/json")
  .body("{\"locationId\":\"ve9EPM428h8vShlRW1KT\",\"name\":\"Name\",\"description\":\"Pet name field\",\"placeholder\":\"Enter pet name\",\"showInForms\":true,\"options\":[{\"key\":\"option_a\",\"label\":\"Option A\"}],\"acceptedFormats\":[\".pdf\",\".jpg\"],\"dataType\":\"TEXT\",\"fieldKey\":\"task.my_field\",\"objectKey\":\"task\",\"isUnique\":false,\"maxFileLimit\":2,\"allowCustomOption\":true,\"parentId\":\"3v34PM428h8vShlRW1KT\",\"scopes\":[{\"scopeType\":\"list\",\"scopeId\":\"6a102435124ecfb348bd5507\"}]}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/custom-fields/"
  payload := strings.NewReader(`{
  "locationId": "ve9EPM428h8vShlRW1KT",
  "name": "Name",
  "description": "Pet name field",
  "placeholder": "Enter pet name",
  "showInForms": true,
  "options": [
    {
      "key": "option_a",
      "label": "Option A"
    }
  ],
  "acceptedFormats": [
    ".pdf",
    ".jpg"
  ],
  "dataType": "TEXT",
  "fieldKey": "task.my_field",
  "objectKey": "task",
  "isUnique": false,
  "maxFileLimit": 2,
  "allowCustomOption": true,
  "parentId": "3v34PM428h8vShlRW1KT",
  "scopes": [
    {
      "scopeType": "list",
      "scopeId": "6a102435124ecfb348bd5507"
    }
  ]
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2023-02-21")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/custom-fields/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2023-02-21"
request["Content-Type"] = "application/json"
request.body = '{
  "locationId": "ve9EPM428h8vShlRW1KT",
  "name": "Name",
  "description": "Pet name field",
  "placeholder": "Enter pet name",
  "showInForms": true,
  "options": [
    {
      "key": "option_a",
      "label": "Option A"
    }
  ],
  "acceptedFormats": [
    ".pdf",
    ".jpg"
  ],
  "dataType": "TEXT",
  "fieldKey": "task.my_field",
  "objectKey": "task",
  "isUnique": false,
  "maxFileLimit": 2,
  "allowCustomOption": true,
  "parentId": "3v34PM428h8vShlRW1KT",
  "scopes": [
    {
      "scopeType": "list",
      "scopeId": "6a102435124ecfb348bd5507"
    }
  ]
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2023-02-21"
}

$body = '{
  "locationId": "ve9EPM428h8vShlRW1KT",
  "name": "Name",
  "description": "Pet name field",
  "placeholder": "Enter pet name",
  "showInForms": true,
  "options": [
    {
      "key": "option_a",
      "label": "Option A"
    }
  ],
  "acceptedFormats": [
    ".pdf",
    ".jpg"
  ],
  "dataType": "TEXT",
  "fieldKey": "task.my_field",
  "objectKey": "task",
  "isUnique": false,
  "maxFileLimit": 2,
  "allowCustomOption": true,
  "parentId": "3v34PM428h8vShlRW1KT",
  "scopes": [
    {
      "scopeType": "list",
      "scopeId": "6a102435124ecfb348bd5507"
    }
  ]
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/custom-fields/' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
