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: 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 |
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>
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 |
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 consists of digits, Latin letters, and underscores. It may arrive empty — in that case only |
|
error_description |
Error message for the developer. Do not show it to the end user without processing |
Possible Error Codes
|
Code |
Description |
Value |
|
Empty value |
|
Occurs when:
|
|
Empty value |
|
The provided |
|
|
|
The custom field with the provided |
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 |
Description |
|
|
|
An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
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 |
|
|
|
The request contains no authorization data: neither an access token nor a webhook code was passed |
|
|
|
Methods are called over the HTTPS protocol only |
|
|
|
The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans. A webhook receives a different error message — |
|
|
|
No active webhook with the specified user identifier and secret code was 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 |
|
|
|
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 |
|
|
|
The access token has expired |
|
|
|
The application is installed, but the Bitrix24 administrator has granted access to it only to specific users |
|
|
|
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 |