Create a Custom Field for Companies crm.company.userfield.add
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
Scope:
crmWho can execute the method: CRM administrator
The method crm.company.userfield.add creates a new custom field for companies.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
fields* |
Object format:
The list of available fields is described below. An incorrect field in |
Parameter fields
Required parameters are marked with *
|
Name |
Description |
|
USER_TYPE_ID* |
Data type of the custom field. Possible values:
|
|
FIELD_NAME* |
Field code. Unique. The system limit for the field code is 20 characters. The custom field name always has the prefix Allowed characters: |
|
LABEL |
Default name of the custom field. The provided value will be set in the following fields: |
|
XML_ID |
External code |
|
Filter label in the list. When a string is provided, it will be set for all language identifiers. When a By default, the value passed in |
|
|
Header in the list. When a string is provided, it will be set for all language identifiers. When a By default, the value passed in |
|
|
Label in the edit form. When a string is provided, it will be set for all language identifiers. When a By default, the value passed in |
|
|
Error message |
|
|
Help |
|
|
MULTIPLE |
Is the field multiple. Possible values:
Fields of type By default, |
|
MANDATORY |
Is the field mandatory. Possible values:
By default, |
|
SHOW_FILTER |
Show the field in the filter. Possible values:
By default, |
|
SETTINGS |
Additional field parameters. Each |
|
LIST |
List of possible values for the custom field of type By default |
|
SORT |
Sort index. Must be greater than zero. By default |
|
SHOW_IN_LIST |
Show the custom field in the list. This parameter does not affect anything within Possible values:
By default |
|
EDIT_IN_LIST |
Allow user editing. Possible values:
By default |
|
IS_SEARCHABLE |
Are the field values included in the search. This parameter does not affect anything within Possible values:
By default |
Parameter SETTINGS
Each type of custom fields has its own set of additional settings. This method only supports those described below.
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. By default |
|
ROWS |
Number of rows in the input field. Must be greater than 0. By default |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value |
|
PRECISION |
Number precision. Must be greater than or equal to 0. By default |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value, where Possible values:
By default |
|
DISPLAY |
Appearance. Possible values:
By default |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value.
where:
Default value:
|
|
Name |
Description |
|
DISPLAY |
Appearance. Possible values:
By default |
|
LIST_HEIGHT |
List height. Must be greater than 0. Available only when By default |
|
Name |
Description |
|
IBLOCK_TYPE_ID |
Identifier of the information block type. By default |
|
IBLOCK_ID |
Identifier of the information block. By default |
|
DEFAULT_VALUE |
Default value. By default |
|
DISPLAY |
Appearance. Possible values:
By default |
|
LIST_HEIGHT |
List height. Must be greater than 0. By default |
|
ACTIVE_FILTER |
Show elements with the active flag enabled. Possible values:
By default |
|
Name |
Description |
|
ENTITY_TYPE |
Identifier of the directory type. Use By default |
If none of the following options are provided, the link to leads will be enabled by default LEAD = Y.
|
Name |
Description |
|
LEAD |
Is the link to Leads enabled. Possible values:
By default |
|
CONTACT |
Is the link to Contacts enabled. Possible values:
By default |
|
COMPANY |
Is the link to Companies enabled. Possible values:
By default |
|
DEAL |
Is the link to Deals enabled. Possible values:
By default |
Parameter LIST
|
Name |
Description |
|
VALUE |
Value of the list item. List items with an empty or missing |
|
SORT |
Sort index. Must be greater than or equal to 0. By default |
|
DEF |
Is the list item the default value. Possible values:
For a multiple field, multiple By default |
|
XML_ID |
External code of the value. Must be unique within the list items of the custom field |
Code Examples
How to Use Examples in Documentation
Example of Creating a Custom Field of Type String
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"LABEL":"Field Hello, World!","USER_TYPE_ID":"string","FIELD_NAME":"HELLO_WORLD","MULTIPLE":"Y","MANDATORY":"Y","SHOW_FILTER":"Y","SETTINGS":{"DEFAULT_VALUE":"Hello, World! Default value","ROWS":3},"SORT":1000,"EDIT_IN_LIST":"Y","LIST_FILTER_LABEL":"Hello, World! Filter","LIST_COLUMN_LABEL":{"en":"Hello, World! Column","de":"Hallo, Welt! Spalte"},"EDIT_FORM_LABEL":{"en":"Hello, World! Edit","de":"Hallo, Welt! Bearbeiten"},"ERROR_MESSAGE":{"en":"Hello, World! Error","de":"Hallo, Welt! Fehler"},"HELP_MESSAGE":{"en":"Hello, World! Help","de":"Hallo, Welt! Hilfe"}}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.company.userfield.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"LABEL":"Field Hello, World!","USER_TYPE_ID":"string","FIELD_NAME":"HELLO_WORLD","MULTIPLE":"Y","MANDATORY":"Y","SHOW_FILTER":"Y","SETTINGS":{"DEFAULT_VALUE":"Hello, World! Default value","ROWS":3},"SORT":1000,"EDIT_IN_LIST":"Y","LIST_FILTER_LABEL":"Hello, World! Filter","LIST_COLUMN_LABEL":{"en":"Hello, World! Column","de":"Hallo, Welt! Spalte"},"EDIT_FORM_LABEL":{"en":"Hello, World! Edit","de":"Hallo, Welt! Bearbeiten"},"ERROR_MESSAGE":{"en":"Hello, World! Error","de":"Hallo, Welt! Fehler"},"HELP_MESSAGE":{"en":"Hello, World! Help","de":"Hallo, Welt! Hilfe"}},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.company.userfield.add
try
{
const response = await $b24.callMethod(
'crm.company.userfield.add',
{
fields: {
LABEL: 'Field Hello, World!',
USER_TYPE_ID: 'string',
FIELD_NAME: 'HELLO_WORLD',
MULTIPLE: 'Y',
MANDATORY: 'Y',
SHOW_FILTER: 'Y',
SETTINGS: {
DEFAULT_VALUE: 'Hello, World! Default value',
ROWS: 3,
},
SORT: 1000,
EDIT_IN_LIST: 'Y',
LIST_FILTER_LABEL: 'Hello, World! Filter',
LIST_COLUMN_LABEL: {
en: 'Hello, World! Column',
de: 'Hallo, Welt! Spalte',
},
EDIT_FORM_LABEL: {
en: 'Hello, World! Edit',
de: 'Hallo, Welt! Bearbeiten',
},
ERROR_MESSAGE: {
en: 'Hello, World! Error',
de: 'Hallo, Welt! Fehler',
},
HELP_MESSAGE: {
en: 'Hello, World! Help',
de: 'Hallo, Welt! Hilfe',
},
},
}
);
console.info(response.getData().result);
}
catch (error)
{
console.error(error);
}
try {
$userfieldItemFields = [
'FIELD_NAME' => 'HELLO_WORLD',
'USER_TYPE_ID' => 'string',
'SORT' => 1000,
'MULTIPLE' => 'Y',
'MANDATORY' => 'Y',
'SHOW_FILTER' => 'Y',
'EDIT_IN_LIST' => 'Y',
'LIST_FILTER_LABEL' => 'Hello, World! Filter',
'LIST_COLUMN_LABEL' => [
'en' => 'Hello, World! Column',
'de' => 'Hallo, Welt! Spalte',
],
'EDIT_FORM_LABEL' => [
'en' => 'Hello, World! Edit',
'de' => 'Hallo, Welt! Bearbeiten',
],
'ERROR_MESSAGE' => [
'en' => 'Hello, World! Error',
'de' => 'Hallo, Welt! Fehler',
],
'HELP_MESSAGE' => [
'en' => 'Hello, World! Help',
'de' => 'Hallo, Welt! Hilfe',
],
'SETTINGS' => [
'DEFAULT_VALUE' => 'Hello, World! Default value',
'ROWS' => 3,
],
];
$result = $serviceBuilder
->getCRMScope()
->companyUserfield()
->add($userfieldItemFields);
print($result->getId());
} catch (Throwable $e) {
print('Error: ' . $e->getMessage());
}
BX24.callMethod(
'crm.company.userfield.add',
{
fields: {
LABEL: 'Field Hello, World!',
USER_TYPE_ID: 'string',
FIELD_NAME: 'HELLO_WORLD',
MULTIPLE: 'Y',
MANDATORY: 'Y',
SHOW_FILTER: 'Y',
SETTINGS: {
DEFAULT_VALUE: 'Hello, World! Default value',
ROWS: 3,
},
SORT: 1000,
EDIT_IN_LIST: 'Y',
},
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'crm.company.userfield.add',
[
'fields' => [
'LABEL' => 'Field Hello, World!',
'USER_TYPE_ID' => 'string',
'FIELD_NAME' => 'HELLO_WORLD',
'MULTIPLE' => 'Y',
'MANDATORY' => 'Y',
'SHOW_FILTER' => 'Y',
'SETTINGS' => [
'DEFAULT_VALUE' => 'Hello, World! Default value',
'ROWS' => 3,
],
'SORT' => 1000,
'EDIT_IN_LIST' => 'Y',
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Example of Creating a Custom Field of Type List
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"LABEL":"Custom Field (list)","USER_TYPE_ID":"enumeration","FIELD_NAME":"ENUMERATION_EXAMPLE","MULTIPLE":"N","MANDATORY":"N","SHOW_FILTER":"Y","LIST":[{"VALUE":"List Item #1","DEF":"Y","XML_ID":"XML_ID_1","SORT":100},{"VALUE":"List Item #2","XML_ID":"XML_ID_2","SORT":200},{"VALUE":"List Item #3","XML_ID":"XML_ID_3","SORT":300},{"VALUE":"List Item #4","XML_ID":"XML_ID_4","SORT":400}],"SETTINGS":{"DISPLAY":"UI","LIST_HEIGHT":2},"SORT":2000}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.company.userfield.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"LABEL":"Custom Field (list)","USER_TYPE_ID":"enumeration","FIELD_NAME":"ENUMERATION_EXAMPLE","MULTIPLE":"N","MANDATORY":"N","SHOW_FILTER":"Y","LIST":[{"VALUE":"List Item #1","DEF":"Y","XML_ID":"XML_ID_1","SORT":100},{"VALUE":"List Item #2","XML_ID":"XML_ID_2","SORT":200},{"VALUE":"List Item #3","XML_ID":"XML_ID_3","SORT":300},{"VALUE":"List Item #4","XML_ID":"XML_ID_4","SORT":400}],"SETTINGS":{"DISPLAY":"UI","LIST_HEIGHT":2},"SORT":2000},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.company.userfield.add
try
{
const response = await $b24.callMethod(
'crm.company.userfield.add',
{
fields: {
LABEL: 'Custom Field (list)',
USER_TYPE_ID: 'enumeration',
FIELD_NAME: 'ENUMERATION_EXAMPLE',
MULTIPLE: 'N',
MANDATORY: 'N',
SHOW_FILTER: 'Y',
LIST: [
{ VALUE: 'List Item #1', DEF: 'Y', XML_ID: 'XML_ID_1', SORT: 100 },
{ VALUE: 'List Item #2', XML_ID: 'XML_ID_2', SORT: 200 },
{ VALUE: 'List Item #3', XML_ID: 'XML_ID_3', SORT: 300 },
{ VALUE: 'List Item #4', XML_ID: 'XML_ID_4', SORT: 400 },
],
SETTINGS: {
DISPLAY: 'UI',
LIST_HEIGHT: 2,
},
SORT: 2000,
},
}
);
console.info(response.getData().result);
}
catch (error)
{
console.error(error);
}
try {
$userfieldItemFields = [
'LABEL' => 'Custom Field (list)',
'USER_TYPE_ID' => 'enumeration',
'FIELD_NAME' => 'ENUMERATION_EXAMPLE',
'MULTIPLE' => 'N',
'MANDATORY' => 'N',
'SHOW_FILTER' => 'Y',
'LIST' => [
['VALUE' => 'List Item #1', 'DEF' => 'Y', 'XML_ID' => 'XML_ID_1', 'SORT' => 100],
['VALUE' => 'List Item #2', 'XML_ID' => 'XML_ID_2', 'SORT' => 200],
['VALUE' => 'List Item #3', 'XML_ID' => 'XML_ID_3', 'SORT' => 300],
['VALUE' => 'List Item #4', 'XML_ID' => 'XML_ID_4', 'SORT' => 400],
],
'SETTINGS' => ['DISPLAY' => 'UI', 'LIST_HEIGHT' => 2],
'SORT' => 2000,
];
$result = $serviceBuilder
->getCRMScope()
->companyUserfield()
->add($userfieldItemFields);
print($result->getId());
} catch (Throwable $e) {
print('Error: ' . $e->getMessage());
}
BX24.callMethod(
'crm.company.userfield.add',
{
fields: {
LABEL: 'Custom Field (list)',
USER_TYPE_ID: 'enumeration',
FIELD_NAME: 'ENUMERATION_EXAMPLE',
MULTIPLE: 'N',
MANDATORY: 'N',
SHOW_FILTER: 'Y',
LIST: [
{ VALUE: 'List Item #1', DEF: 'Y', XML_ID: 'XML_ID_1', SORT: 100 },
{ VALUE: 'List Item #2', XML_ID: 'XML_ID_2', SORT: 200 },
{ VALUE: 'List Item #3', XML_ID: 'XML_ID_3', SORT: 300 },
{ VALUE: 'List Item #4', XML_ID: 'XML_ID_4', SORT: 400 },
],
SETTINGS: { DISPLAY: 'UI', LIST_HEIGHT: 2 },
SORT: 2000,
},
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'crm.company.userfield.add',
[
'fields' => [
'LABEL' => 'Custom Field (list)',
'USER_TYPE_ID' => 'enumeration',
'FIELD_NAME' => 'ENUMERATION_EXAMPLE',
'MULTIPLE' => 'N',
'MANDATORY' => 'N',
'SHOW_FILTER' => 'Y',
'LIST' => [
['VALUE' => 'List Item #1', 'DEF' => 'Y', 'XML_ID' => 'XML_ID_1', 'SORT' => 100],
['VALUE' => 'List Item #2', 'XML_ID' => 'XML_ID_2', 'SORT' => 200],
['VALUE' => 'List Item #3', 'XML_ID' => 'XML_ID_3', 'SORT' => 300],
['VALUE' => 'List Item #4', 'XML_ID' => 'XML_ID_4', 'SORT' => 400],
],
'SETTINGS' => [
'DISPLAY' => 'UI',
'LIST_HEIGHT' => 2,
],
'SORT' => 2000,
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP status: 200
{
"result": 6997,
"time": {
"start": 1753789240.8146,
"finish": 1753789241.058695,
"duration": 0.2440950870513916,
"processing": 0.19217395782470703,
"date_start": "2025-07-29T14:40:40+03:00",
"date_finish": "2025-07-29T14:40:41+03:00",
"operating_reset_at": 1753789840,
"operating": 0.19216084480285645
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response, contains the identifier of the created custom field |
|
time |
Information about the request execution time |
Error Handling
HTTP status: 400
{
"error": "",
"error_description": "The 'USER_TYPE_ID' field is not found."
}
|
Name |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
error_description |
Textual description of the error. The description is not intended to be shown to the end user in its raw form |
Possible Error Codes
|
Code |
Description |
Value |
|
|
The 'FIELD_NAME' field is not found |
Either an empty |
|
|
Field name is too long (more than 50 characters). |
The provided |
|
|
Field name contains invalid characters. The allowed characters are: A-Z, 0-9, and _. |
The provided |
|
|
The 'USER_TYPE_ID' field is not found |
Either an empty |
|
|
Invalid user type specified |
The provided |
|
|
List item with value XML_ID='XML_ID' already exists |
The provided |
Continue Learning
- Update Company User Field crm.company.userfield.update
- Get Company Custom Field by ID crm.company.userfield.get
- Get a list of custom fields for companies crm.company.userfield.list
- Delete Custom Field for Companies crm.company.userfield.delete