Create a Custom Field for Deals crm.deal.userfield.add

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

Scope: crm

Who can execute the method: a user with the "Allow to modify settings" access permission in CRM

DEPRECATED

The development of this method has been halted. Please use the REST 3.0 method crm.deal.field.custom.add. The REST 3.0 method does not create fields of the List enumeration and File file types, so use this method for them.

The crm.deal.userfield.add method creates a new custom field that appears in all deals in Bitrix24.

Method Parameters

Required parameters are marked with *

Name
type

Description

fields*
object

Object format:

{
            field_1: value_1,
            field_2: value_2,
            ...,
            field_n: value_n,
        }
        
  • field_n — field name
  • value_n — field value

The list of available fields is described below.

An incorrect field in fields will be ignored

Parameter fields

Required parameters are marked with *

Name
type

Description

USER_TYPE_ID*
string

Data type of the custom field. The method crm.userfield.types returns the list of types available in Bitrix24. Possible values:

  • string — string
  • integer — integer
  • double — number
  • boolean — yes/no
  • datetime — date/time
  • date — date
  • money — money
  • url — link
  • address — address
  • enumeration — list
  • file — file
  • employee — link to employee
  • crm_status — link to CRM directory
  • iblock_section — link to information block sections
  • iblock_element — link to information block elements
  • crm — link to CRM elements
  • custom field types

FIELD_NAME*
string

Field code. Unique within deals. The full field name with the prefix is the key used to write the field value with the method crm.deal.update and read it with the method crm.deal.get.

The prefix UF_CRM_ is always added to the code, and the system builds the full field name itself:

  • MANAGER_NOTE becomes UF_CRM_MANAGER_NOTE
  • UF_MANAGER_NOTE becomes UF_CRM_MANAGER_NOTE — the prefix UF_ is replaced with UF_CRM_
  • UF_CRM_MANAGER_NOTE remains unchanged

The length limit is 50 characters including the prefix, that is, up to 43 characters for the code. If a longer value is passed, the method returns the error ERROR_CORE.

Allowed characters: A-Z, 0-9, and _. Lowercase letters are converted to uppercase, and any other characters cause the error ERROR_CORE

LABEL
string

Default name of the custom field.

The provided value will be set in the following fields: LIST_FILTER_LABEL, LIST_COLUMN_LABEL, EDIT_FORM_LABEL, ERROR_MESSAGE, HELP_MESSAGE, if no value is provided for them.

If LABEL is not provided, the full field name is used instead, for example, UF_CRM_MANAGER_NOTE

XML_ID
string

External code

LIST_FILTER_LABEL
string|lang_map

Filter label in the list.

When a string is provided, it will be set for all language identifiers.

When a lang_map type value is provided, the value from LABEL will be set for all languages that were not provided.

By default, the value passed in LABEL is set for all language identifiers

LIST_COLUMN_LABEL
string|lang_map

Header in the list.

When a string is provided, it will be set for all language identifiers.

When a lang_map type value is provided, the value from LABEL will be set for all languages that were not provided.

By default, the value passed in LABEL is set for all language identifiers

EDIT_FORM_LABEL
string|lang_map

Label in the edit form.

When a string is provided, it will be set for all language identifiers.

When a lang_map type value is provided, the value from LABEL will be set for all languages that were not provided.

By default, the value passed in LABEL is set for all language identifiers

ERROR_MESSAGE
string|lang_map

Error message. A string and a lang_map are processed the same way as for LIST_FILTER_LABEL

HELP_MESSAGE
string|lang_map

Help. A string and a lang_map are processed the same way as for LIST_FILTER_LABEL

MULTIPLE
char

Is the field multiple. Possible values:

  • Y — yes
  • N — no

Fields of type boolean cannot be multiple: if you pass MULTIPLE = Y, the method saves N without an error.

By default, N

MANDATORY
boolean

Is the field mandatory. Possible values:

  • Y — yes
  • N — no

By default, N

SHOW_FILTER
char

Show the field in the filter. Possible values:

  • Y — yes
  • N — no

By default, N.

The method saves not the passed value but the filter mode that crm.deal.userfield.get and crm.deal.userfield.list return:

  • for the employee type, Y is saved as I — exact match
  • for other types, Y is saved as E — mask
  • for the money, url, address, file types and custom types, N is always saved

SETTINGS
object

Additional field parameters. Each USER_TYPE_ID field type has its own set of available settings, described below

LIST
uf_enum_element[]

List of possible values for the custom field of type enumeration, described below

By default []

SORT
integer

Sort index. Must be greater than zero.

By default 100

SHOW_IN_LIST
char

Show the custom field in the list.

This parameter does not affect anything within crm.

Possible values:

  • Y — yes
  • N — no

By default Y

EDIT_IN_LIST
char

Allow user editing. Possible values:

  • Y — yes
  • N — no

By default Y. The value N is not supported by all field types within crm

IS_SEARCHABLE
char

Are the field values included in the search.

This parameter does not affect anything within crm.

Possible values:

  • Y — yes
  • N — no

By default N

Parameter SETTINGS

Each type of custom field has its own set of additional settings. The method saves only the settings described below and ignores other SETTINGS keys. For the money, url, address, file, employee types and custom types, the method ignores SETTINGS entirely, and the field gets the default type settings.

The method crm.deal.userfield.get returns the full set of type settings. This set is described by the method crm.userfield.settings.fields.

Name
type

Description

DEFAULT_VALUE
string

Default value.

Default ''

ROWS
integer

Number of rows in the input field. Must be greater than 0.

Default 1

Name
type

Description

DEFAULT_VALUE
integer

Default value

Name
type

Description

DEFAULT_VALUE
double

Default value

PRECISION
integer

Number precision. Must be greater than or equal to 0.

Default 2

Name
type

Description

DEFAULT_VALUE
integer

Default value, where 1 is yes, 0 is no.

Possible values:

  • >= 1 -> 1
  • <= 0 -> 0

Default 0

DISPLAY
string

Appearance. Possible values:

  • CHECKBOX — checkbox
  • RADIO — radio buttons
  • DROPDOWN — dropdown list

Default CHECKBOX

Name
type

Description

DEFAULT_VALUE
object

Default value.
Format object:

{
            VALUE: datetime|date,
            TYPE: 'NONE'|'NOW'|'FIXED',
        }
        

where:

  • VALUE — default value of type datetime or date in ISO 8601 format, for example, 2026-10-28T10:00:00+01:00
  • TYPE — default value type:
    • NONE — do not set a default value
    • NOW — use current time/date
    • FIXED — use time/date from VALUE

Default value:

{
            VALUE: '',
            TYPE: 'NONE',
        }
        

Name
type

Description

DISPLAY
string

Appearance. Possible values:

  • LIST — list
  • UI — autocomplete list
  • CHECKBOX — checkboxes
  • DIALOG — item selection dialog

Default LIST

LIST_HEIGHT
integer

List height. Must be greater than 0.

Available only with DISPLAY = LIST or DISPLAY = UI.

Default 1

Name
type

Description

IBLOCK_TYPE_ID
string

Information block type identifier.

Default ''

IBLOCK_ID
string

Information block identifier.

Default 0

DEFAULT_VALUE
string

Default value.

Default ''

DISPLAY
string

Appearance. Possible values:

  • DIALOG — dialog
  • UI — autocomplete list
  • LIST — list
  • CHECKBOX — checkboxes

Default LIST

LIST_HEIGHT
integer

List height. Must be greater than 0.

Default 1

ACTIVE_FILTER
char

Whether to show items with the activity flag enabled. Possible values:

  • Y — yes
  • N — no

Default N

Name
type

Description

ENTITY_TYPE
string

Dictionary type identifier.

Use crm.status.entity.types to find possible values.

Default ''

Each option is N by default. If all options are N, Bitrix24 enables binding to leads LEAD = Y.

Name
type

Description

LEAD
char

Whether binding to Leads is enabled. Possible values:

  • Y — yes
  • N — no

Default N

CONTACT
char

Whether binding to Contacts is enabled. Possible values:

  • Y — yes
  • N — no

Default N

COMPANY
char

Whether binding to Companies is enabled. Possible values:

  • Y — yes
  • N — no

Default N

DEAL
char

Is the link to Deals enabled? Possible values:

  • Y — yes
  • N — no

Default is N

Parameter LIST

Name
type

Description

VALUE
string

Value of the list element.

List elements with an empty or missing VALUE will be ignored

SORT
integer

Sort index. A value of 0 or less is not saved; the item gets 500 instead.

By default 500

DEF
char

Is the list item a default value? Possible values:

  • Y — yes
  • N — no

For a multiple field, several DEF = Y are allowed. For a non-multiple field, the first passed list item with DEF = Y is considered the default.

Default is N

XML_ID
string

External code of the value. Must be unique within the elements of the user field list

Code Examples

How to Use Examples in Documentation

Example of Creating a String Type Custom Field

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","ru":"Hello, world! Column","de":"Hallo, Welt! Spalte"},"EDIT_FORM_LABEL":{"en":"Hello, World! Edit","ru":"Hello, world! Edit","de":"Hallo, Welt! Bearbeiten"},"ERROR_MESSAGE":{"en":"Hello, World! Error","ru":"Hello, world! Error","de":"Hallo, Welt! Fehler"},"HELP_MESSAGE":{"en":"Hello, World! Help","ru":"Hello, world! Help","de":"Hallo, Welt! Hilfe"}}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.deal.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","ru":"Hello, world! Column","de":"Hallo, Welt! Spalte"},"EDIT_FORM_LABEL":{"en":"Hello, World! Edit","ru":"Hello, world! Edit","de":"Hallo, Welt! Bearbeiten"},"ERROR_MESSAGE":{"en":"Hello, World! Error","ru":"Hello, world! Error","de":"Hallo, Welt! Fehler"},"HELP_MESSAGE":{"en":"Hello, World! Help","ru":"Hello, world! Help","de":"Hallo, Welt! Hilfe"}},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.deal.userfield.add
        
BX24.callMethod(
            'crm.deal.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",
                        "ru": "Hello, world! Column",
                        "de": "Hallo, Welt! Spalte"
                    },
                    EDIT_FORM_LABEL: {
                        "en": "Hello, World! Edit",
                        "ru": "Hello, world! Edit",
                        "de": "Hallo, Welt! Bearbeiten"
                    },
                    ERROR_MESSAGE: {
                        "en": "Hello, World! Error",
                        "ru": "Hello, world! Error",
                        "de": "Hallo, Welt! Fehler"
                    },
                    HELP_MESSAGE: {
                        "en": "Hello, World! Help",
                        "ru": "Hello, world! Help",
                        "de": "Hallo, Welt! Hilfe"
                    },
                },
            },
            (result) => {
                result.error()
                    ? console.error(result.error())
                    : console.info(result.data())
                ;
            },
        );
        
try {
            $userfieldItemFields = [
                'FIELD_NAME' => 'TEST_FIELD',
                'USER_TYPE_ID' => 'string',
                'XML_ID' => 'test_field_1',
                'SORT' => 100,
                'MULTIPLE' => 'N',
                'MANDATORY' => 'N',
                'SHOW_FILTER' => 'Y',
                'SHOW_IN_LIST' => 'Y',
                'EDIT_IN_LIST' => 'Y',
                'IS_SEARCHABLE' => 'Y',
                'EDIT_FORM_LABEL' => 'Test Field Label',
                'LIST_COLUMN_LABEL' => 'Test Field List Label',
                'LIST_FILTER_LABEL' => 'Test Field Filter Label',
                'ERROR_MESSAGE' => 'Error occurred',
                'HELP_MESSAGE' => 'Help message for Test Field',
            ];
        
            $result = $serviceBuilder
                ->getCRMScope()
                ->dealUserfield()
                ->add($userfieldItemFields);
        
            print($result->getId());
        } catch (Throwable $e) {
            print('Error: ' . $e->getMessage());
        }
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.deal.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",
                        'ru' => "Hello, world! Column",
                        'de' => "Hallo, Welt! Spalte"
                    ],
                    'EDIT_FORM_LABEL' => [
                        'en' => "Hello, World! Edit",
                        'ru' => "Hello, world! Edit",
                        'de' => "Hallo, Welt! Bearbeiten"
                    ],
                    'ERROR_MESSAGE' => [
                        'en' => "Hello, World! Error",
                        'ru' => "Hello, world! Error",
                        'de' => "Hallo, Welt! Fehler"
                    ],
                    'HELP_MESSAGE' => [
                        'en' => "Hello, World! Help",
                        'ru' => "Hello, world! Help",
                        'de' => "Hallo, Welt! Hilfe"
                    ],
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

        from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.crm.deal.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",
                        "ru": "Hello, world! Column",
                        "de": "Hallo, Welt! Spalte",
                    },
                    "EDIT_FORM_LABEL": {
                        "en": "Hello, World! Edit",
                        "ru": "Hello, world! Edit",
                        "de": "Hallo, Welt! Bearbeiten",
                    },
                    "ERROR_MESSAGE": {
                        "en": "Hello, World! Error",
                        "ru": "Hello, world! Error",
                        "de": "Hallo, Welt! Fehler",
                    },
                    "HELP_MESSAGE": {
                        "en": "Hello, World! Help",
                        "ru": "Hello, world! Help",
                        "de": "Hallo, Welt! Hilfe",
                    },
                },
            ).response
            result = bitrix_response.result
            print(result)
        except BitrixAPIError as error:
            print(
                "Bitrix API error",
                f"error: {error.error}",
                f"error_description: {error.error_description}",
                sep="\n",
            )
        except BitrixSDKException as error:
            print(f"Bitrix SDK error: {error.message}")
        except Exception as error:
            print(f"Unexpected error: {error}")
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "crm.deal.userfield.add", b24.Params{
        	"fields": b24.Params{
        		"LABEL":        "Field “Hello, world!”",
        		"USER_TYPE_ID": "string",
        		"FIELD_NAME":   "HELLO_WORLD",
        		"MULTIPLE":     "Y",
        		"MANDATORY":    "Y",
        		"SHOW_FILTER":  "Y",
        		"SETTINGS": b24.Params{
        			"DEFAULT_VALUE": "Hello, world! Default value",
        			"ROWS":          3,
        		},
        		"SORT":              1000,
        		"EDIT_IN_LIST":      "Y",
        		"LIST_FILTER_LABEL": "Hello, world! Filter",
        		"LIST_COLUMN_LABEL": b24.Params{
        			"en": "Hello, World! Column",
        			"de": "Hallo, Welt! Spalte",
        		},
        		"EDIT_FORM_LABEL": b24.Params{
        			"en": "Hello, World! Edit",
        			"de": "Hallo, Welt! Bearbeiten",
        		},
        		"ERROR_MESSAGE": b24.Params{
        			"en": "Hello, World! Error",
        			"de": "Hallo, Welt! Fehler",
        		},
        		"HELP_MESSAGE": b24.Params{
        			"en": "Hello, World! Help",
        			"de": "Hallo, Welt! Hilfe",
        		},
        	},
        })
        if err != nil {
        	return fmt.Errorf("crm.deal.userfield.add: %w", err)
        }
        
        var newID b24.ID
        if err := json.Unmarshal(res.Result, &newID); err != nil {
        	return fmt.Errorf("parse response: %w", err)
        }
        fmt.Println("id:", newID)
        

Example of Creating a List Type Custom Field

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.deal.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.deal.userfield.add
        
BX.rest.callMethod(
            'crm.deal.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())
                ;
            },
        );
        

        from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.crm.deal.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,
                },
            ).response
            result = bitrix_response.result
            print(result)
        except BitrixAPIError as error:
            print(
                "Bitrix API error",
                f"error: {error.error}",
                f"error_description: {error.error_description}",
                sep="\n",
            )
        except BitrixSDKException as error:
            print(f"Bitrix SDK error: {error.message}")
        except Exception as error:
            print(f"Unexpected error: {error}")
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.deal.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>';
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "crm.deal.userfield.add", b24.Params{
        	"fields": b24.Params{
        		"LABEL":        "Custom field (list)",
        		"USER_TYPE_ID": "enumeration",
        		"FIELD_NAME":   "ENUMERATION_EXAMPLE",
        		"MULTIPLE":     "N",
        		"MANDATORY":    "N",
        		"SHOW_FILTER":  "Y",
        		"LIST": []b24.Params{
        			{
        				"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": b24.Params{
        			"DISPLAY":     "UI",
        			"LIST_HEIGHT": 2,
        		},
        		"SORT": 2000,
        	},
        })
        if err != nil {
        	return fmt.Errorf("crm.deal.userfield.add: %w", err)
        }
        
        var newID b24.ID
        if err := json.Unmarshal(res.Result, &newID); err != nil {
        	return fmt.Errorf("parse response: %w", err)
        }
        fmt.Println("id:", newID)
        

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
type

Description

result
integer

Root element of the response, contains the identifier of the created custom field

time
time

Information about the request execution time

Error Handling

HTTP status: 400

{
            "error": "",
            "error_description": "The 'USER_TYPE_ID' field is not found."
        }
        

Name
type

Description

error
string

String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only error_description shows the reason

error_description
string

Error message for the developer. Do not show it to the end user without processing

Possible Error Codes

If both USER_TYPE_ID and FIELD_NAME are not provided, both errors are returned in one error_description, separated by a line break.

Status

Code

Description

Value

400

Empty value

Access denied.

The user does not have the "Allow to modify settings" access permission in CRM

400

Empty value

The 'FIELD_NAME' field is not found.

Either an empty FIELD_NAME was provided, or it was not provided at all

400

ERROR_CORE

The field name is too long (exceeds 50 symbols).

The full field name including the prefix UF_CRM_ contains more than 50 characters, that is, more than 43 characters were provided in FIELD_NAME

400

ERROR_CORE

The field name contains invalid symbols. Valid symbols are: A-Z, 0-9 and _.

The provided FIELD_NAME contains characters other than A-Z, 0-9, and _

400

Empty value

The 'USER_TYPE_ID' field is not found.

Either an empty USER_TYPE_ID was provided, or it was not provided at all

400

ERROR_CORE

The custom type is invalid.

The provided USER_TYPE_ID does not exist

400

ERROR_CORE

The field UF_CRM_CODE for entity CRM_DEAL already exists.

A deal field with this FIELD_NAME already exists

400

ERROR_CORE

List element with XML_ID=xml_id already exists.

The provided XML_ID in list items are not unique

500

INTERNAL_SERVER_ERROR

Depends on the cause

Deals already have 1016 custom fields, or the field creation did not complete within max_execution_time. For details, see Errors When Working with Custom Fields

Statuses and System Error Codes

HTTP Status: 4xx, 5xx

The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

429

OPERATION_TIME_LIMIT
Method is blocked due to operation time limit

The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit

401

NO_AUTH_FOUND
Wrong authorization data

The request contains no authorization data: neither an access token nor a webhook code was passed

401

INVALID_REQUEST
Https required

Methods are called over the HTTPS protocol only

401

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support

401

ACCESS_DENIED
REST is available only on commercial plans

REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — REST is available only by subscription

401

INVALID_CREDENTIALS
Invalid request credentials

No active webhook with the specified user identifier and secret code was found

404

ERROR_METHOD_NOT_FOUND
Method not found!

No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope

401

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with provided by the access token

401

expired_token
The access token provided has expired

The access token has expired

401

user_access_error
The user does not have access to the application

The application is installed, but the Bitrix24 administrator has granted access to it only to specific users

403

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open it 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