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:
crmWho can execute the method: administrator
The method crm.contact.userfield.get returns a custom contact field by its identifier.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
Identifier of the custom field associated with the contact. The identifier can be obtained using the methods |
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>
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();
}
from b24pysdk.client import BaseClient
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
client: BaseClient
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}")
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>';
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 |
Description |
|
result |
Root element of the response, contains information about the custom field |
|
time |
Information about the request execution time |
Userfield
|
Parameter |
Description |
|
ID |
Identifier of the custom field |
|
ENTITY_ID |
String identifier binding the custom field to the entity. In the case of methods |
|
FIELD_NAME |
Field code. Unique |
|
USER_TYPE_ID |
Data type of the custom field. Possible values:
|
|
XML_ID |
External code |
|
SORT |
Sorting index |
|
MULTIPLE |
Indicates whether the field is multiple. Possible values:
|
|
MANDATORY |
Is the field mandatory? Possible values:
|
|
SHOW_FILTER |
Indicates whether to show the field in the filter. Possible values:
|
|
SHOW_IN_LIST |
Should the user field be shown in the list? This parameter does not affect anything within Possible values:
|
|
EDIT_IN_LIST |
Allows user editing. Possible values:
|
|
IS_SEARCHABLE |
Are the field values searchable? This parameter does not affect anything within Possible values:
|
|
SETTINGS |
Additional field parameters. Each field type ( |
|
LIST |
List of possible values for the custom field of type |
|
EDIT_FORM_LABEL |
Label in the edit form |
|
LIST_COLUMN_LABEL |
Header in the list |
|
LIST_FILTER_LABEL |
Filter label in the list |
|
ERROR_MESSAGE |
Error message |
|
HELP_MESSAGE |
Help |
|
USER_TYPE_OWNER |
Returned when the field type is custom |
Parameter Settings
|
Name |
Description |
|
PRECISION |
Precision (number of decimal places) |
|
SIZE |
Input field size for display |
|
MIN_VALUE |
Minimum value (0 — do not check) |
|
MAX_VALUE |
Maximum value (0 — do not check) |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DEFAULT_VALUE |
Is it a default value. Possible values:
|
|
DISPLAY |
Appearance. Possible values:
|
|
LABEL |
Labels for values, where:
|
|
LABEL_CHECKBOX |
Checkbox label |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. Object format:
where:
|
|
Name |
Description |
|
SIZE |
Input field size for display |
|
MIN_VALUE |
Minimum value (0 — do not check) |
|
MAX_VALUE |
Maximum value (0 — do not check) |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. Object format:
where:
|
|
USE_SECOND |
Use seconds. Possible values:
|
|
USE_TIMEZONE |
Use time zones. Possible values:
|
|
Name |
Description |
|
SIZE |
Input field size for display |
|
ROWS |
Number of input field lines |
|
REGEXP |
Regular expression for validation |
|
MIN_LENGTH |
Minimum string length (0 — do not check) |
|
MAX_LENGTH |
Maximum string length (0 — do not check) |
|
DEFAULT_VALUE |
Default value |
|
Name |
Description |
|
DISPLAY |
Appearance. Possible values:
|
|
LIST_HEIGHT |
List height |
|
CAPTION_NO_VALUE |
Label when value is missing |
|
SHOW_NO_VALUE |
Whether to show an empty value for a required field. Possible values:
|
|
Name |
Description |
|
DISPLAY |
Appearance. Possible values:
|
|
LIST_HEIGHT |
List height |
|
IBLOCK_ID |
Information block ID |
|
DEFAULT_VALUE |
Default value |
|
ACTIVE_FILTER |
Show only active items. Possible values:
|
|
Name |
Description |
|
ENTITY_TYPE |
CRM directory. The structure is similar to the elements returned by the |
|
Name |
Description |
|
LEAD |
Whether binding to Leads is enabled |
|
CONTACT |
Whether binding to Contacts is enabled |
|
COMPANY |
Whether binding to Companies is enabled |
|
DEAL |
Whether binding to Deals is enabled |
|
ORDER |
Whether binding to Orders is enabled |
|
QUOTE |
Whether binding to Commercial proposals is enabled |
|
SMART_INVOICE |
Whether binding to New invoices is enabled |
|
DYNAMIC_... |
Whether binding to a specific SPA is enabled. Each such field has the form: |
|
Name |
Description |
|
DEFAULT_VALUE |
Default value. The value of this field has the format:
For example: |
|
Name |
Description |
|
SHOW_MAP |
Show map |
|
Name |
Description |
|
POPUP |
Open in a new window |
|
SIZE |
Input field size for display |
|
MIN_LENGTH |
Minimum string length (0 — do not check) |
|
MAX_LENGTH |
Maximum string length (0 — do not check) |
|
DEFAULT_VALUE |
Default value |
|
ROWS |
Number of input field lines |
|
Name |
Description |
|
SIZE |
Input field size for display |
|
LIST_WIDTH |
Maximum width for display in the list |
|
LIST_HEIGHT |
Maximum height for display in the list |
|
MAX_SHOW_SIZE |
Maximum allowable size for display in the list (0 — no limit) |
|
MAX_ALLOWED_SIZE |
Maximum allowable file size for upload (0 — do not check) |
|
EXTENSIONS |
Allowed extensions |
|
TARGET_BLANK |
Open file in a new tab |
uf_enum_element Type
|
Name |
Description |
|
ID |
Identifier of the list element |
|
VALUE |
Value of the list element |
|
SORT |
Sorting index |
|
DEF |
Indicates whether the list element is the default value. Possible values:
|
Error Handling
HTTP status: 400
{
"error": "",
"error_description": "ID is not defined or invalid."
}
|
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 |
|
|
|
Occurs when:
|
|
|
|
The provided |
|
|
|
The custom field with the provided |
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 |