Update Contact crm.contact.update
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:
crmWho can execute the method: any user with "edit" access permission for contacts
DEPRECATED
Development of this method has been discontinued. Please use crm.item.update.
The method crm.contact.update updates an existing contact.
It is recommended to pass the complete set of address fields when updating an address.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
The identifier of the contact to be changed. The identifier can be obtained using the methods |
|
fields* |
An object in the following format:
where:
The list of available fields is described below. An incorrect field in Only the fields that need to be changed should be passed in |
|
params |
An object containing a set of additional parameters. The structure and possible values are described below |
Parameter fields
|
Name |
Description |
|
HONORIFIC |
Salutation. The list of available salutation types can be obtained using |
|
NAME |
First name |
|
SECOND_NAME |
Middle name |
|
LAST_NAME |
Last name |
|
PHOTO |
Photograph |
|
BIRTHDATE |
Date of birth |
|
TYPE_ID |
Contact type. |
|
SOURCE_ID |
Source |
|
SOURCE_DESCRIPTION |
Additional information about the source |
|
POST |
Position |
|
COMMENTS |
Comment. Supports BB codes |
|
OPENED |
Is it available to everyone? Possible values:
|
|
EXPORT |
Is the contact participating in the export? Possible values:
|
|
ASSIGNED_BY_ID |
Identifier of the user responsible for the item |
|
COMPANY_ID |
Identifier of the main company for the contact. The list of companies can be obtained using the method |
|
COMPANY_IDS |
Array of identifiers of companies to which the contact is linked. The list of companies can be obtained using the method |
|
UTM_SOURCE |
Advertising system (Google Ads, Microsoft Advertising, etc.) |
|
UTM_MEDIUM |
Traffic type. Possible values:
|
|
UTM_CAMPAIGN |
Advertising campaign designation |
|
UTM_CONTENT |
Content of the campaign. For example, for contextual ads |
|
UTM_TERM |
Search condition of the campaign. For example, keywords for contextual advertising |
|
PHONE |
Phone |
|
EMAIL |
|
|
WEB |
Website |
|
Messenger |
|
|
LINK |
Links. System field |
|
UF_... |
Custom fields. For example, Depending on the portal settings, contacts may have a set of custom fields of defined types. To change file fields, it is recommended to use the method crm.item.update. A custom field can be added to a contact using the method crm.contact.userfield.add |
|
PARENT_ID_... |
Relationship fields. If there are smart processes related to contacts on the portal, there is a field for each such smart process that stores the relationship between that smart process and the contact. The field itself stores the identifier of the element of that smart process. For example, the field |
Fields for external data sources
If the contact was created by an external system, then:
- the field
ORIGINATOR_IDstores the string identifier of that system - the field
ORIGIN_IDstores the string identifier of the contact in that external system - the field
ORIGIN_VERSIONstores the version of the contact data in that external system
|
Name |
Description |
|
ORIGINATOR_ID |
Identifier of the external system that is the source of data about this contact |
|
ORIGIN_ID |
Version of the contact data in the external system. Used to protect data from accidental overwriting by the external system. If the data was imported and not changed in the external system, then such data can be edited in CRM without fear that the next export will lead to overwriting of the data |
|
ORIGIN_VERSION |
Version of the original |
Deprecated fields
Address fields in the contact are deprecated and are only used in compatibility mode. To work with the address, use requisites.
|
Name |
Description |
|
ADDRESS |
Address |
|
ADDRESS_2 |
Second line of the address |
|
ADDRESS_CITY |
City |
|
ADDRESS_POSTAL_CODE |
Postal code |
|
ADDRESS_REGION |
Region |
|
ADDRESS_PROVINCE |
Province |
|
ADDRESS_COUNTRY |
Country |
|
ADDRESS_COUNTRY_CODE |
Country code |
|
ADDRESS_LOC_ADDR_ID |
Location address identifier |
Parameter params
|
Name |
Description |
|
REGISTER_SONET_EVENT |
Should the update event of the contact be registered in the activity stream? Possible values:
Default is |
|
REGISTER_HISTORY_EVENT |
Should the update of the contact be registered in the history? Possible values:
Default is |
Code Examples
How to Use Examples in Documentation
Update contact with id = 43
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":43,"FIELDS":{"NAME":"John","BIRTHDATE":"11.11.1999","TYPE_ID":"RECOMMENDATION","SOURCE_ID":"WEB","POST":"Network Administrator","COMMENTS":"New comment","OPENED":"N","EXPORT":"Y","ASSIGNED_BY_ID":1,"COMPANY_ID":12,"COMPANY_IDS":[13,15],"UF_CRM_1720697698689":"Example of a new value for a custom field of type \"String\"","PARENT_ID_1224":14},"PARAMS":{"REGISTER_SONET_EVENT":"N","REGISTER_HISTORY_EVENT":"N"}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.contact.update
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":43,"FIELDS":{"NAME":"John","BIRTHDATE":"11.11.1999","TYPE_ID":"RECOMMENDATION","SOURCE_ID":"WEB","POST":"Network Administrator","COMMENTS":"New comment","OPENED":"N","EXPORT":"Y","ASSIGNED_BY_ID":1,"COMPANY_ID":12,"COMPANY_IDS":[13,15],"UF_CRM_1720697698689":"Example of a new value for a custom field of type \"String\"","PARENT_ID_1224":14},"PARAMS":{"REGISTER_SONET_EVENT":"N","REGISTER_HISTORY_EVENT":"N"},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.contact.update
// 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
try {
const response = await $b24.actions.v2.call.make<boolean>({
method: 'crm.contact.update',
params: {
id: 43,
fields: {
NAME: 'Sergey',
BIRTHDATE: '11.11.1999',
TYPE_ID: 'RECOMMENDATION',
SOURCE_ID: 'WEB',
POST: 'Computer network administrator',
COMMENTS: 'New comment',
OPENED: 'N',
EXPORT: 'Y',
ASSIGNED_BY_ID: 1,
COMPANY_ID: 12,
COMPANY_IDS: [13, 15],
UF_CRM_1720697698689: 'Example new value of a custom field of type "String"',
PARENT_ID_1224: 14,
},
params: {
REGISTER_SONET_EVENT: 'N',
REGISTER_HISTORY_EVENT: 'N',
},
},
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('Contact updated:', result)
}
} 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 updateContact() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'crm.contact.update',
params: {
id: 43,
fields: {
NAME: 'Sergey',
BIRTHDATE: '11.11.1999',
TYPE_ID: 'RECOMMENDATION',
SOURCE_ID: 'WEB',
POST: 'Computer network administrator',
COMMENTS: 'New comment',
OPENED: 'N',
EXPORT: 'Y',
ASSIGNED_BY_ID: 1,
COMPANY_ID: 12,
COMPANY_IDS: [13, 15],
UF_CRM_1720697698689: 'Example new value of a custom field of type "String"',
PARENT_ID_1224: 14,
},
params: {
REGISTER_SONET_EVENT: 'N',
REGISTER_HISTORY_EVENT: 'N',
},
},
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('Contact updated:', result)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', updateContact)
</script>
try {
$contactId = 123; // Example contact ID
$fields = [
'NAME' => 'John',
'LAST_NAME' => 'Doe',
'BIRTHDATE' => (new DateTime('1990-01-01'))->format(DateTime::ATOM),
'PHONE' => '123456789',
'EMAIL' => 'john.doe@example.com',
'ADDRESS' => '123 Main St',
'ADDRESS_CITY' => 'Anytown',
'ADDRESS_COUNTRY' => 'USA',
];
$params = [
'REGISTER_SONET_EVENT' => 'Y',
];
$result = $serviceBuilder
->getCRMScope()
->contact()
->update($contactId, $fields, $params);
if ($result->isSuccess()) {
print($result->getCoreResponse()->getResponseData()->getResult()[0]);
} else {
print('Update failed.');
}
} catch (Throwable $e) {
print('Error: ' . $e->getMessage());
}
BX24.callMethod(
'crm.contact.update',
{
id: 43,
fields: {
NAME: "John",
BIRTHDATE: '11.11.1999',
TYPE_ID: "RECOMMENDATION",
SOURCE_ID: "WEB",
POST: "Network Administrator",
COMMENTS: "New comment",
OPENED: "N",
EXPORT: "Y",
ASSIGNED_BY_ID: 1,
COMPANY_ID: 12,
COMPANY_IDS: [13, 15],
UF_CRM_1720697698689: "Example of a new value for a custom field of type \"String\"",
PARENT_ID_1224: 14,
},
params: {
REGISTER_SONET_EVENT: "N",
REGISTER_HISTORY_EVENT: "N",
},
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data())
;
},
);
require_once('crest.php');
$result = CRest::call(
'crm.contact.update',
[
'ID' => 43,
'FIELDS' => [
'NAME' => 'John',
'BIRTHDATE' => '11.11.1999',
'TYPE_ID' => 'RECOMMENDATION',
'SOURCE_ID' => 'WEB',
'POST' => 'Network Administrator',
'COMMENTS' => 'New comment',
'OPENED' => 'N',
'EXPORT' => 'Y',
'ASSIGNED_BY_ID' => 1,
'COMPANY_ID' => 12,
'COMPANY_IDS' => [13, 15],
'UF_CRM_1720697698689' => 'Example of a new value for a custom field of type "String"',
'PARENT_ID_1224' => 14,
],
'PARAMS' => [
'REGISTER_SONET_EVENT' => 'N',
'REGISTER_HISTORY_EVENT' => 'N',
]
]
);
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.update", b24.Params{
"id": 43,
"fields": b24.Params{
"NAME": "John",
"BIRTHDATE": "11.11.1999",
"TYPE_ID": "RECOMMENDATION",
"SOURCE_ID": "WEB",
"POST": "Network Administrator",
"COMMENTS": "New comment",
"OPENED": "N",
"EXPORT": "Y",
"ASSIGNED_BY_ID": 1,
"COMPANY_ID": 12,
"COMPANY_IDS": []int{13, 15},
"UF_CRM_1720697698689": "Example of a new value for a custom field of type \"String\"",
"PARENT_ID_1224": 14,
},
"params": b24.Params{
"REGISTER_SONET_EVENT": "N",
"REGISTER_HISTORY_EVENT": "N",
},
})
if err != nil {
return fmt.Errorf("crm.contact.update: %w", err)
}
// The response arrives as json.RawMessage — unmarshal it
// into a struct matching the response shape shown below on this page.
fmt.Printf("%s\n", res.Result)
Working with Multiple Fields
Update a Multiple Field
To overwrite an existing value of a multiple field, pass the ID of the field you want to change and its new value/type.
Suppose there are the following values for the PHONE field:
[
{
"ID": "222",
"VALUE_TYPE": "WORK",
"VALUE": "111111",
"TYPE_ID": "PHONE"
},
{
"ID": "223",
"VALUE_TYPE": "WORK",
"VALUE": "222222",
"TYPE_ID": "PHONE"
},
{
"ID": "224",
"VALUE_TYPE": "WORK",
"VALUE": "333333",
"TYPE_ID": "PHONE"
}
]
To change the value of the phone with ID = 223, pass the following fields parameter:
{
"fields": {
"PHONE": [
{
"ID": 223,
"VALUE": "444444",
"VALUE_TYPE": "MOBILE"
}
]
}
}
Delete a Single Value from a Multiple Field
To delete one of the values from a multiple field, pass their identifiers and either the parameter DELETE = 'Y' or an empty VALUE.
Suppose there are the following values for the PHONE field:
[
{
"ID": "222",
"VALUE_TYPE": "WORK",
"VALUE": "111111",
"TYPE_ID": "PHONE"
},
{
"ID": "223",
"VALUE_TYPE": "WORK",
"VALUE": "222222",
"TYPE_ID": "PHONE"
},
{
"ID": "224",
"VALUE_TYPE": "WORK",
"VALUE": "333333",
"TYPE_ID": "PHONE"
},
{
"ID": "225",
"VALUE_TYPE": "WORK",
"VALUE": "44444",
"TYPE_ID": "PHONE"
}
]
Let’s consider ways to delete all values except the phone with ID = 225:
{
"fields": {
"PHONE": [
{
"ID": 222,
"DELETE": "Y"
},
{
"ID": 223,
"VALUE": ""
},
{
"ID": 224
}
]
}
}
As a result, the following will remain:
[
{
"ID": "225",
"VALUE_TYPE": "WORK",
"VALUE": "44444",
"TYPE_ID": "PHONE"
}
]
Add a New Value to a Multiple Field
To add a new value, simply enter it. Existing values will not be changed.
Example of adding a new value 55555:
{
"fields": {
"PHONE": [
{
"VALUE": "55555",
"VALUE_TYPE": "WORK"
}
]
}
}
Response Handling
HTTP status: 200
{
"result": true,
"time": {
"start": 1723820393.459406,
"finish": 1723820396.129949,
"duration": 2.6705431938171387,
"processing": 2.1193439960479736,
"date_start": "2024-08-16T16:59:53+02:00",
"date_finish": "2024-08-16T16:59:56+02:00"
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response, |
|
time |
Information about the execution time of the request |
Error Handling
HTTP status: 400
{
"error": "",
"error_description": "Contact is not found"
}
|
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 |
|
The |
|
Empty value |
|
The |
|
Empty value |
|
The user does not have permission to "Edit" contacts |
|
Empty value |
Disk resource exhausted |
|
|
|
The field |
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 |
|
|
|
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 — |
|
|
|
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 |