Add Custom Field user.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:
user.userfieldWho can execute the method: administrator
The method user.userfield.add adds a custom field.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
fields* |
Values of the fields to add a new custom field |
Parameter fields
Required parameters are marked with *
|
Name |
Description |
|
FIELD_NAME* |
Name (code) of the field. Prefixed with |
|
USER_TYPE_ID* |
Type of the custom field. Possible values:
|
|
XML_ID |
External code |
|
SORT |
Sorting order |
|
MULTIPLE |
Is the field multiple. Possible values:
|
|
MANDATORY |
Is the custom field mandatory. Possible values:
|
|
SHOW_FILTER |
Show the field in the list filter. Possible values:
|
|
SHOW_IN_LIST |
Show the field in the list. Possible values:
|
|
EDIT_IN_LIST |
Edit the field in the list. Possible values:
|
|
IS_SEARCHABLE |
Is the field searchable. Possible values:
|
|
SETTINGS |
Object in the format |
|
EDIT_FORM_LABEL |
Label in the edit form. You can pass a string or an object with labels by languages in the format |
|
LIST_COLUMN_LABEL |
Column header in the list. You can pass a string or an object with labels by languages in the format |
|
LIST_FILTER_LABEL |
Filter header in the list. You can pass a string or an object with labels by languages in the format |
|
ERROR_MESSAGE |
Error message for invalid input. You can pass a string or an object with texts by languages in the format |
|
HELP_MESSAGE |
Help text for the field. You can pass a string or an object with texts by languages in the format |
|
LABEL |
Default name of the custom field. The value will be set in the fields |
Parameter SETTINGS
Each type of custom field has its own set of additional settings.
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. Default is |
|
ROWS |
Number of rows in the input field. Must be greater than 0. Default is |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value |
|
PRECISION |
Precision of the number. Must be greater than or equal to 0. Default is |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value, where Possible values:
Default is |
|
DISPLAY |
Appearance. Possible values:
Default is |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. Object format:
where:
Default value:
|
|
Name |
Description |
|
DISPLAY |
Appearance. Possible values:
Default is |
|
LIST_HEIGHT |
Height of the list. Must be greater than 0. Available only when Default is |
|
Name |
Description |
|
IBLOCK_TYPE_ID |
Identifier of the information block type. Default is |
|
IBLOCK_ID |
Identifier of the information block. Default is |
|
DEFAULT_VALUE |
Default value. Default is |
|
DISPLAY |
Appearance. Possible values:
Default is |
|
LIST_HEIGHT |
Height of the list. Must be greater than 0. Default is |
|
ACTIVE_FILTER |
Show elements with the active flag enabled. Possible values:
Default is |
|
Name |
Description |
|
ENTITY_TYPE |
Identifier of the directory type. Use Default is |
If none of the following options are provided, the binding to leads will be enabled by default (LEAD = Y).
|
Name |
Description |
|
LEAD |
Is the binding to Leads enabled. Possible values:
Default is |
|
CONTACT |
Is the binding to Contacts enabled. Possible values:
Default is |
|
COMPANY |
Is the binding to Companies enabled. Possible values:
Default is |
|
DEAL |
Is the binding to Deals enabled. Possible values:
Default is |
If you need to create a custom field with an added custom type via the API, you must specify rest_<app_number>_<USER_TYPE_ID of the added type> in the USER_TYPE_ID field. For example, rest_436278_test_type.
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields": {
"FIELD_NAME": "UF_USER_DEALS",
"USER_TYPE_ID": "crm",
"XML_ID": "UF_CRM_DEALS",
"SORT": 100,
"MULTIPLE": "Y",
"MANDATORY": "N",
"SHOW_FILTER": "N",
"SHOW_IN_LIST": "Y",
"EDIT_IN_LIST": "Y",
"SETTINGS": {
"DEAL": "Y"
},
"LABEL": "Binding to CRM deals",
"EDIT_FORM_LABEL": {
"de": "Binding to CRM deals"
}
}
}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/user.userfield.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields": {
"FIELD_NAME": "UF_USER_DEALS",
"USER_TYPE_ID": "crm",
"XML_ID": "UF_CRM_DEALS",
"SORT": 100,
"MULTIPLE": "Y",
"MANDATORY": "N",
"SHOW_FILTER": "N",
"SHOW_IN_LIST": "Y",
"EDIT_IN_LIST": "Y",
"SETTINGS": {
"DEAL": "Y"
},
"LABEL": "Binding to CRM deals",
"EDIT_FORM_LABEL": {
"de": "Binding to CRM deals"
}
},
"auth": "**put_access_token_here**"
}' \
https://**put_your_bitrix24_address**/rest/user.userfield.add
try
{
const response = await $b24.callMethod(
'user.userfield.add',
{
fields: {
FIELD_NAME: 'UF_USER_DEALS',
USER_TYPE_ID: 'crm',
XML_ID: 'UF_CRM_DEALS',
SORT: 100,
MULTIPLE: 'Y',
MANDATORY: 'N',
SHOW_FILTER: 'N',
SHOW_IN_LIST: 'Y',
EDIT_IN_LIST: 'Y',
SETTINGS: {
DEAL: 'Y',
},
LABEL: 'Binding to CRM deals',
EDIT_FORM_LABEL: {
de: 'Binding to CRM deals'
},
}
}
);
const result = response.getData().result;
console.log('Created element with ID:', result);
processResult(result);
}
catch( error )
{
console.error('Error:', error);
}
try {
$response = $b24Service
->core
->call(
'user.userfield.add',
[
'fields' => [
'FIELD_NAME' => 'UF_USER_DEALS',
'USER_TYPE_ID' => 'crm',
'XML_ID' => 'UF_CRM_DEALS',
'SORT' => 100,
'MULTIPLE' => 'Y',
'MANDATORY' => 'N',
'SHOW_FILTER' => 'N',
'SHOW_IN_LIST' => 'Y',
'EDIT_IN_LIST' => 'Y',
'SETTINGS' => [
'DEAL' => 'Y',
],
'LABEL' => 'Binding to CRM deals',
'EDIT_FORM_LABEL' => [
'de' => 'Binding to CRM deals'
],
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error adding user field: ' . $e->getMessage();
}
BX24.callMethod(
'user.userfield.add',
{
fields: {
FIELD_NAME: "UF_USER_DEALS",
USER_TYPE_ID: "crm",
XML_ID: "UF_CRM_DEALS",
SORT: 100,
MULTIPLE: "Y",
MANDATORY: "N",
SHOW_FILTER: "N",
SHOW_IN_LIST: "Y",
EDIT_IN_LIST: "Y",
SETTINGS: {
DEAL: "Y",
},
LABEL: "Binding to CRM deals",
EDIT_FORM_LABEL: {
de: "Binding to CRM deals"
},
},
},
function(result)
{
if(result.error())
console.error(result.error());
else
console.log(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'user.userfield.add',
[
'fields' => [
'FIELD_NAME' => 'UF_USER_DEALS',
'USER_TYPE_ID' => 'crm',
'XML_ID' => 'UF_CRM_DEALS',
'SORT' => 100,
'MULTIPLE' => 'Y',
'MANDATORY' => 'N',
'SHOW_FILTER' => 'N',
'SHOW_IN_LIST' => 'Y',
'EDIT_IN_LIST' => 'Y',
'SETTINGS' => [
'DEAL' => 'Y',
],
'LABEL' => 'Binding to CRM deals',
'EDIT_FORM_LABEL' => [
'de' => 'Binding to CRM deals'
],
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP status: 200
{
"result":177,
"time":{
"start":1747301035.550121,
"finish":1747301037.514112,
"duration":1.9639909267425537,
"processing":0.5865437984466553,
"date_start":"2025-05-15T11:23:55+02:00",
"date_finish":"2025-05-15T11:23:57+02:00",
"operating":0
}
}
Returned Data
|
Name |
Description |
|
result |
Identifier of the created custom field |
|
time |
Information about the request execution time |
Error Handling
HTTP status: 400
{
"error":"",
"error_description":"The \u0027FIELD_NAME\u0027 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 |
|
ERROR_ARGUMENT |
Argument 'USER_TYPE_ID' is null or empty |
|
|
ERROR_ARGUMENT |
Argument 'HANDLER' is null or empty |
|
|
ERROR_CORE |
Field *** for the USER object already exists |
Field *** for the |
|
ERROR_CORE |
Fail to create new user field |
Error creating field |
|
Empty string |
The \u0027FIELD_NAME\u0027 field is not found. |
Mandatory field |
|
Empty string |
The \u0027USER_TYPE_ID\u0027 field is not found. |
Mandatory field |
Statuses and System Error Codes
HTTP Status: 20x, 40x, 50x
The errors described below may occur when calling any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred. Please contact the server administrator or Bitrix24 technical support |
|
|
|
An internal server error has occurred. Please contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The current method is not permitted for calls using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The HTTPS protocol is required for method calls |
|
|
|
The REST API is blocked due to overload. This is a manual individual block; please contact Bitrix24 technical support to lift it |
|
|
|
The REST API is only available on commercial plans |
|
|
|
The user associated with the access token or webhook used to call the method lacks the necessary permissions |
|
|
|
The manifest is not available |
|
|
|
The request requires higher privileges than those provided by the webhook token |
|
|
|
The provided access token has expired |
|
|
|
The user does not have access to the application. This means that the application is installed, but the portal administrator has restricted access to this application to specific users only |
|
|
|
The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |
Continue Learning
- Update User Field user.userfield.update
- Get a list of custom fields user.userfield.list
- Delete User Field user.userfield.delete