Get Custom Contact Field by Id crm.contact.userfield.get

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: crm

Who can execute the method: any user with "read" access permission for contacts

The method crm.contact.userfield.get returns a custom contact field by its identifier.

Method Parameters

Required parameters are marked with *

Name
type

Description

id*
integer

Identifier of the custom field associated with the contact.

The identifier can be obtained using the methods crm.contact.userfield.add or crm.contact.userfield.list

Code Examples

How to Use Examples in Documentation

Get the custom field with id = 399

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"id":399}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.contact.userfield.get
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"id":399,"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.contact.userfield.get
        
// This snippet is an ES module: top-level await requires type="module" or a bundler.
        // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
        import { Text } from '@bitrix24/b24jssdk'
        import type { B24Frame } from '@bitrix24/b24jssdk'
        
        declare const $b24: B24Frame
        
        // Shape of the payload returned in result (match the "response handling" section of the page)
        type CrmContactUserfield = {
          ID: string
          ENTITY_ID: string
          FIELD_NAME: string
          USER_TYPE_ID: string
          XML_ID: string | null
          SORT: string
          MULTIPLE: string
          MANDATORY: string
        }
        
        try {
          const response = await $b24.actions.v2.call.make<CrmContactUserfield>({
            method: 'crm.contact.userfield.get',
            params: {
              id: 399,
            },
            requestId: Text.getUuidRfc4122()
          })
        
          // The payload is available only on a successful response
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
          } else {
            const result = response.getData()!.result
            console.info('Userfield:', result.ID, result.FIELD_NAME)
          }
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
        
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
        <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
        <script>
          async function getContactUserfield() {
            try {
              // Initialize the SDK inside a Bitrix24 frame
              const $b24 = await B24Js.initializeB24Frame()
        
              const response = await $b24.actions.v2.call.make({
                method: 'crm.contact.userfield.get',
                params: {
                  id: 399,
                },
                requestId: B24Js.Text.getUuidRfc4122()
              })
        
              // The payload is available only on a successful response
              if (!response.isSuccess) {
                console.error(response.getErrorMessages().join('; '))
                return
              }
        
              const result = response.getData().result
              console.info('Userfield:', result.ID, result.FIELD_NAME)
            } catch (error) {
              // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
              console.error(error)
            }
          }
        
          document.addEventListener('DOMContentLoaded', getContactUserfield)
        </script>
        

        from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.crm.contact.userfield.get(bitrix_id=399).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}")
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'crm.contact.userfield.get',
                    [
                        'id' => 399,
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            if ($result->error()) {
                echo 'Error: ' . $result->error();
            } else {
                echo 'Data: ' . print_r($result->data(), true);
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error getting contact user field: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'crm.contact.userfield.get',
            {
                id: 399,
            },
            (result) => {
                result.error()
                    ? console.error(result.error())
                    : console.info(result.data())
                ;
            },
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.contact.userfield.get',
            [
                'id' => 399
            ]
        );
        
        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.contact.userfield.get", b24.Params{
        	"id": 399,
        }, b24.WithIdempotent())
        if err != nil {
        	return fmt.Errorf("crm.contact.userfield.get: %w", err)
        }
        
        var item struct {
        	ID         b24.ID `json:"ID"`
        	EntityID   string `json:"ENTITY_ID"`
        	FieldName  string `json:"FIELD_NAME"`
        	UserTypeID string `json:"USER_TYPE_ID"`
        	Sort       string `json:"SORT"`
        	Multiple   string `json:"MULTIPLE"`
        }
        if err := json.Unmarshal(res.Result, &item); err != nil {
        	return fmt.Errorf("parse response: %w", err)
        }
        fmt.Println(item.ID, item.EntityID)
        

Response Handling

HTTP status: 200

{
            "result": {
                "ID": "399",
                "ENTITY_ID": "CRM_CONTACT",
                "FIELD_NAME": "UF_CRM_HELLO_WORLD",
                "USER_TYPE_ID": "string",
                "XML_ID": null,
                "SORT": "1000",
                "MULTIPLE": "Y",
                "MANDATORY": "Y",
                "SHOW_FILTER": "E",
                "SHOW_IN_LIST": "Y",
                "EDIT_IN_LIST": "Y",
                "IS_SEARCHABLE": "Y",
                "SETTINGS": {
                    "SIZE": 20,
                    "ROWS": 3,
                    "REGEXP": "",
                    "MIN_LENGTH": 0,
                    "MAX_LENGTH": 0,
                    "DEFAULT_VALUE": "Hello, world! Default value"
                },
                "EDIT_FORM_LABEL": {
                    "ar": "Field 'Hello, world!'",
                    "br": "Field 'Hello, world!'",
                    "en": "Hello, World! Edit",
                    "fr": "Field 'Hello, world!'",
                    "id": "Field 'Hello, world!'",
                    "it": "Field 'Hello, world!'",
                    "ja": "Field 'Hello, world!'",
                    "la": "Field 'Hello, world!'",
                    "ms": "Field 'Hello, world!'",
                    "pl": "Field 'Hello, world!'",
                    "de": "Hello, world! Edit",
                    "sc": "Field 'Hello, world!'",
                    "tc": "Field 'Hello, world!'",
                    "th": "Field 'Hello, world!'",
                    "tr": "Field 'Hello, world!'",
                    "vn": "Field 'Hello, world!'"
                },
                "LIST_COLUMN_LABEL": {
                    "ar": "Field 'Hello, world!'",
                    "br": "Field 'Hello, world!'",
                    "en": "Hello, World! Column",
                    "fr": "Field 'Hello, world!'",
                    "id": "Field 'Hello, world!'",
                    "it": "Field 'Hello, world!'",
                    "ja": "Field 'Hello, world!'",
                    "la": "Field 'Hello, world!'",
                    "ms": "Field 'Hello, world!'",
                    "pl": "Field 'Hello, world!'",
                    "de": "Hello, world! Column",
                    "sc": "Field 'Hello, world!'",
                    "tc": "Field 'Hello, world!'",
                    "th": "Field 'Hello, world!'",
                    "tr": "Field 'Hello, world!'",
                    "vn": "Field 'Hello, world!'"
                },
                "LIST_FILTER_LABEL": {
                    "ar": "Hello, world! Filter",
                    "br": "Hello, world! Filter",
                    "en": "Hello, world! Filter",
                    "fr": "Hello, world! Filter",
                    "id": "Hello, world! Filter",
                    "it": "Hello, world! Filter",
                    "ja": "Hello, world! Filter",
                    "la": "Hello, world! Filter",
                    "ms": "Hello, world! Filter",
                    "pl": "Hello, world! Filter",
                    "de": "Hello, world! Filter",
                    "sc": "Hello, world! Filter",
                    "tc": "Hello, world! Filter",
                    "th": "Hello, world! Filter",
                    "tr": "Hello, world! Filter",
                    "vn": "Hello, world! Filter"
                },
                "ERROR_MESSAGE": {
                    "ar": "Field 'Hello, world!'",
                    "br": "Field 'Hello, world!'",
                    "en": "Hello, World! Error",
                    "fr": "Field 'Hello, world!'",
                    "id": "Field 'Hello, world!'",
                    "it": "Field 'Hello, world!'",
                    "ja": "Field 'Hello, world!'",
                    "la": "Field 'Hello, world!'",
                    "ms": "Field 'Hello, world!'",
                    "pl": "Field 'Hello, world!'",
                    "de": "Hello, world! Error",
                    "sc": "Field 'Hello, world!'",
                    "tc": "Field 'Hello, world!'",
                    "th": "Field 'Hello, world!'",
                    "tr": "Field 'Hello, world!'",
                    "vn": "Field 'Hello, world!'"
                },
                "HELP_MESSAGE": {
                    "ar": "Field 'Hello, world!'",
                    "br": "Field 'Hello, world!'",
                    "en": "Hello, World! Help",
                    "fr": "Field 'Hello, world!'",
                    "id": "Field 'Hello, world!'",
                    "it": "Field 'Hello, world!'",
                    "ja": "Field 'Hello, world!'",
                    "la": "Field 'Hello, world!'",
                    "ms": "Field 'Hello, world!'",
                    "pl": "Field 'Hello, world!'",
                    "de": "Hello, world! Help",
                    "sc": "Field 'Hello, world!'",
                    "tc": "Field 'Hello, world!'",
                    "th": "Field 'Hello, world!'",
                    "tr": "Field 'Hello, world!'",
                    "vn": "Field 'Hello, world!'"
                }
            },
            "time": {
                "start": 1724318753.341079,
                "finish": 1724318753.621247,
                "duration": 0.2801680564880371,
                "processing": 0.023567914962768555,
                "date_start": "2024-08-22T11:25:53+02:00",
                "date_finish": "2024-08-22T11:25:53+02:00",
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

result
userfield

Root element of the response, contains information about the custom field

time
time

Information about the request execution time

Userfield

Parameter
type

Description

ID
integer

Identifier of the custom field

ENTITY_ID
string

String identifier binding the custom field to the entity.

In the case of methods crm.contact.userfield.*, the value CRM_CONTACT is automatically assigned

FIELD_NAME
string

Field code. Unique

USER_TYPE_ID
string

Data type of the custom field. 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 — employee binding
  • crm_status — binding to CRM directory
  • iblock_section — binding to information block sections
  • iblock_element — binding to information block elements
  • crm — binding to CRM elements
  • custom field types

XML_ID
string

External code

SORT
integer

Sorting index

MULTIPLE
boolean

Indicates whether the field is multiple. Possible values:

  • Y — yes
  • N — no

MANDATORY
boolean

Is the field mandatory? Possible values:

  • Y — yes
  • N — no

SHOW_FILTER
boolean

Indicates whether to show the field in the filter. Possible values:

  • N — do not show
  • I — exact match
  • E — mask
  • S — substring

SHOW_IN_LIST
boolean

Should the user field be shown in the list?

This parameter does not affect anything within crm.

Possible values:

  • Y — yes
  • N — no

EDIT_IN_LIST
boolean

Allows user editing. Possible values:

  • Y — yes
  • N — no

IS_SEARCHABLE
boolean

Are the field values searchable?

This parameter does not affect anything within crm.

Possible values:

  • Y — yes
  • N — no

SETTINGS
object

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

LIST
uf_enum_element[]

List of possible values for the custom field of type enumeration. For custom fields of other types, this parameter is meaningless

EDIT_FORM_LABEL
lang_map

Label in the edit form

LIST_COLUMN_LABEL
lang_map

Header in the list

LIST_FILTER_LABEL
lang_map

Filter label in the list

ERROR_MESSAGE
lang_map

Error message

HELP_MESSAGE
lang_map

Help

USER_TYPE_OWNER
string

CLIENT_ID of the application that serves this field type.

Returned when the field type is custom

Parameter Settings

Name
type

Description

PRECISION
integer

Precision (number of decimal places)

SIZE
integer

Input field size for display

MIN_VALUE
double

Minimum value (0 — do not check)

MAX_VALUE
double

Maximum value (0 — do not check)

DEFAULT_VALUE
double

Default value

Name
type

Description

DEFAULT_VALUE
integer

Is it a default value. Possible values:

  • 0 — no
  • 1 — yes

DISPLAY
string

Appearance. Possible values:

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

LABEL
string[]

Labels for values, where:

  • array item with index 0 — label for value No
  • array item with index 1 — label for value Yes

LABEL_CHECKBOX
string

Checkbox label

Name
type

Description

DEFAULT_VALUE
object

Default value. Object format:

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

where:

  • TYPE — default value type:
    • NONE — none
    • NOW — current date
    • FIXED — date from VALUE
  • VALUE has type date

Name
type

Description

SIZE
integer

Input field size for display

MIN_VALUE
integer

Minimum value (0 — do not check)

MAX_VALUE
integer

Maximum value (0 — do not check)

DEFAULT_VALUE
integer

Default value

Name
type

Description

DEFAULT_VALUE
object

Default value. Object format:

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

where:

  • TYPE — default value type:
    • NONE — none
    • NOW — current date and time
    • FIXED — date and time from VALUE
  • VALUE has type datetime

USE_SECOND
boolean

Use seconds. Possible values:

  • Y — yes
  • N — no

USE_TIMEZONE
boolean

Use time zones. Possible values:

  • Y — yes
  • N — no

Name
type

Description

SIZE
integer

Input field size for display

ROWS
integer

Number of input field lines

REGEXP
string

Regular expression for validation

MIN_LENGTH
integer

Minimum string length (0 — do not check)

MAX_LENGTH
integer

Maximum string length (0 — do not check)

DEFAULT_VALUE
string

Default value

Name
type

Description

DISPLAY
string

Appearance. Possible values:

  • LIST — list
  • CHECKBOX — checkboxes
  • UI — searchable list
  • DIALOG — entity selection dialog

LIST_HEIGHT
integer

List height

CAPTION_NO_VALUE
string

Label when value is missing

SHOW_NO_VALUE
boolean

Whether to show an empty value for a required field. Possible values:

  • Y — yes
  • N — no

Name
type

Description

DISPLAY
string

Appearance. Possible values:

  • LIST — list
  • CHECKBOX — checkboxes
  • UI — searchable list
  • DIALOG — entity selection dialog

LIST_HEIGHT
integer

List height

IBLOCK_ID
integer

Information block ID

DEFAULT_VALUE
integer

Default value

ACTIVE_FILTER
boolean

Show only active items. Possible values:

  • Y — yes
  • N — no

Name
type

Description

ENTITY_TYPE
object

CRM directory. The structure is similar to the elements returned by the crm.status.entity.types method

Name
type

Description

LEAD
boolean

Whether binding to Leads is enabled

CONTACT
boolean

Whether binding to Contacts is enabled

COMPANY
boolean

Whether binding to Companies is enabled

DEAL
boolean

Whether binding to Deals is enabled

ORDER
boolean

Whether binding to Orders is enabled

QUOTE
boolean

Whether binding to Commercial proposals is enabled

SMART_INVOICE
boolean

Whether binding to New invoices is enabled

DYNAMIC_...
boolean

Whether binding to a specific SPA is enabled.

Each such field has the form: DYNAMIC_{entityTypeId}, where entityTypeId is the SPA type ID to which the binding is enabled

Name
type

Description

DEFAULT_VALUE
string

Default value.

The value of this field has the format: {VALUE}|{CURRENCY}, where:

  • VALUE — default amount of money
  • CURRENCY — string currency identifier

For example: 300|USD — 300 dollars

Name
type

Description

SHOW_MAP
boolean

Show map

Name
type

Description

POPUP
boolean

Open in a new window

SIZE
integer

Input field size for display

MIN_LENGTH
integer

Minimum string length (0 — do not check)

MAX_LENGTH
integer

Maximum string length (0 — do not check)

DEFAULT_VALUE
string

Default value

ROWS
integer

Number of input field lines

Name
type

Description

SIZE
integer

Input field size for display

LIST_WIDTH
integer

Maximum width for display in the list

LIST_HEIGHT
integer

Maximum height for display in the list

MAX_SHOW_SIZE
integer

Maximum allowable size for display in the list (0 — no limit)

MAX_ALLOWED_SIZE
integer

Maximum allowable file size for upload (0 — do not check)

EXTENSIONS
string[]

Allowed extensions

TARGET_BLANK
boolean

Open file in a new tab

uf_enum_element Type

Name
type

Description

ID
integer

Identifier of the list element

VALUE
string

Value of the list element

SORT
integer

Sorting index

DEF
boolean

Indicates whether the list element is the default value. Possible values:

  • Y — yes
  • N — no

Error Handling

HTTP status: 400

{
            "error": "",
            "error_description": "ID is not defined or invalid."
        }
        

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

Code

Description

Value

Empty value

Access denied

Occurs when:

  • the user does not have administrative rights
  • the user attempts to access a custom field not linked to contacts

Empty value

ID is not defined or invalid

The provided id is less than or equal to zero, or not provided at all

ERROR_NOT_FOUND

The entity with ID 'id' is not found

The custom field with the provided id was not found

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

The REST API is available only on commercial plans. 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