Update CRM Item
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 the "modify" access permission for CRM object items
This method updates an item of a specific type in the CRM by assigning new values from the fields parameter.
When updating an item, a standard series of checks, modifications, and automatic actions are performed:
- access permissions are checked
- Required fields are checked for completion if the item's stage has changed within the same direction.
- Required fields dependent on stages are checked for completion if the item's stage has changed within the same direction.
- field values are checked for correctness
- default values are assigned to fields
- If it turns out that no field values have been changed before saving, the save is not performed.
- automation rules are triggered after saving
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
entityTypeId* |
Identifier of the system or custom type whose item we want to modify. Numerical values for system types (Lead — 1, Deal — 2, Contact — 3, Company — 4, Invoice — 31, etc.) are listed in the CRM object types reference. The identifier of the smart process can be obtained using the crm.type.list method. |
|
id* |
Identifier of the item we want to modify. Can be obtained using the |
|
fields* |
Object in the format
where
Each CRM object type has its own set of fields. This means that the set of fields for modifying a Lead does not have to match the set of fields for modifying a Contact or Smart Process. The list of available fields for each entity type is described below. An incorrect field in Note Only those fields that need to be changed should be passed in |
|
useOriginalUfNames |
Parameter to control the format of custom field names in the request and response.
Default is |
Parameter fields
Required parameters are marked with *
CRM object identifier entityTypeId: 1
|
Name |
Description |
|
title |
Item name |
|
honorific |
String identifier of the lead's salutation (e.g., A list of available salutations can be obtained using |
|
name |
First name |
|
secondName |
Middle name |
|
lastName |
Last name |
|
birthdate |
Date of birth |
|
companyTitle |
Company name |
|
sourceId |
String identifier of the source. For example, A list of available sources can be obtained using |
|
sourceDescription |
Additional information about the source |
|
stageId |
String identifier of the item stage. For example, A list of available stages can be obtained using |
|
statusDescription |
Additional information about the stage |
|
post |
Job title |
|
currencyId |
Item currency identifier |
|
isManualOpportunity |
Amount calculation mode. Possible values:
|
|
opportunity |
Amount |
|
opened |
Whether the item is available to everyone. Possible values:
|
|
comments |
Comment |
|
assignedById |
Identifier of the person responsible for the item |
|
companyId |
|
|
contactId |
|
|
contactIds |
|
|
originatorId |
|
|
originId |
|
|
webformId |
|
|
observers |
|
|
utmSource |
|
|
utmMedium |
|
|
utmCampaign |
|
|
utmContent |
|
|
utmTerm |
|
|
ufCrm... |
|
|
parentId... |
|
|
fm |
CRM object identifier entityTypeId: 2
|
Name |
Description |
|
title |
|
|
typeId |
|
|
categoryId |
|
|
stageId |
|
|
isRecurring |
Whether the deal is recurring. Possible values:
|
|
probability |
Probability % |
|
currencyId |
item currency identifier |
|
isManualOpportunity |
Amount calculation mode. Possible values:
|
|
opportunity |
Amount |
|
taxValue |
Tax amount |
|
companyId |
|
|
contactId |
|
|
contactIds |
|
|
quoteId |
Quote identifier that will be linked to the deal |
|
begindate |
item start date |
|
closedate |
item end date |
|
opened |
Whether the item is available to everyone. Possible values:
|
|
comments |
Comment |
|
assignedById |
Identifier of the person responsible for the item |
|
sourceId |
String identifier of the source. For example, A list of available sources can be obtained using |
|
sourceDescription |
Additional information about the source |
|
leadId |
Lead identifier on the basis of which the item is created |
|
additionalInfo |
Additional information |
|
originatorId |
|
|
originId |
|
|
observers |
|
|
locationId |
Location identifier. Service field |
|
utmSource |
Ad system. Search Ads, Display Ads, and others |
|
utmMedium |
Traffic type. Possible values: |
|
utmCampaign |
Advertising campaign designation |
|
utmContent |
|
|
utmTerm |
|
|
ufCrm... |
Custom field. See the Custom Fields in CRM: Overview of Methods section
|
|
parentId... |
CRM object identifier entityTypeId: 3
|
Name |
Description |
|
honorific |
String identifier of the contact request. For example A list of available salutations can be obtained using |
|
name |
First name |
|
secondName |
Middle name |
|
lastName |
Last name |
|
photo |
Photograph |
|
birthdate |
Date of birth |
|
typeId |
|
|
sourceId |
String identifier of the source. For example, A list of available sources can be obtained using |
|
sourceDescription |
Additional information about the source |
|
post |
Job title |
|
comments |
Comment |
|
opened |
Whether the item is available to everyone. Possible values:
|
|
export |
Whether the contact is included in the export |
|
assignedById |
Identifier of the person responsible for the item |
|
companyId |
|
|
companyIds |
An array of company IDs that will be linked to the item |
|
leadId |
Lead identifier on the basis of which the item is created |
|
originatorId |
|
|
originId |
|
|
originVersion |
Original version |
|
observers |
|
|
utmSource |
Ad system. Search Ads, Display Ads, and others |
|
utmMedium |
|
|
utmCampaign |
|
|
utmContent |
|
|
utmTerm |
|
|
ufCrm... |
Custom field. See the Custom Fields in CRM: Overview of Methods section
|
|
parentId... |
|
|
fm |
An array of multi-fields (phones, e-mail, messengers). Structure of each item:
The item key in the object determines the operation: Add a new value — use keys
|
CRM object identifier entityTypeId: 4
|
Name |
Description |
|
title |
|
|
typeId |
|
|
logo |
|
|
bankingDetails |
|
|
industry |
|
|
employees |
|
|
currencyId |
item currency identifier |
|
revenue |
|
|
opened |
Whether the item is available to everyone. Possible values:
|
|
comments |
Comment |
|
isMyCompany |
|
|
assignedById |
Identifier of the person responsible for the item |
|
contactIds |
|
|
leadId |
|
|
originatorId |
|
|
originId |
|
|
originVersion |
|
|
observers |
|
|
utmSource |
Ad system. Search Ads, Display Ads, and others |
|
utmMedium |
|
|
utmCampaign |
|
|
utmContent |
|
|
utmTerm |
|
|
ufCrm... |
Custom field. See the Custom Fields in CRM: Overview of Methods section
|
|
parentId... |
|
|
fm |
An array of multi-fields (phones, e-mail, messengers). Structure of each item:
The item key in the object determines the operation: Add a new value — use keys
|
CRM object identifier entityTypeId: 7
|
Name |
Description |
|
title |
|
|
assignedById |
Identifier of the person responsible for the item |
|
opened |
Whether the item is available to everyone. Possible values:
|
|
content |
Content |
|
terms |
Conditions |
|
comments |
Comment |
|
dealId |
Linked deal identifier |
|
leadId |
Lead identifier on the basis of which the item is created |
|
storageTypeId |
Storage type identifier. Possible values:
|
|
storageElementIds |
File array |
|
webformId |
|
|
companyId |
|
|
contactId |
|
|
contactIds |
|
|
locationId |
Location identifier. Service field |
|
currencyId |
item currency identifier |
|
isManualOpportunity |
Amount calculation mode.
|
|
opportunity |
Amount |
|
taxValue |
Tax amount |
|
stageId |
|
|
begindate |
item start date |
|
closedate |
item end date |
|
actualDate |
Valid until |
|
mycompanyId |
My company identifier |
|
utmSource |
Ad system. Search Ads, Display Ads, and others |
|
utmMedium |
Traffic type. |
|
utmCampaign |
|
|
utmContent |
|
|
utmTerm |
|
|
ufCrm... |
Custom field. See section Custom Fields in CRM: Overview of Methods.
|
|
parentId... |
CRM object identifier entityTypeId: 31
|
Name |
Description |
|
title |
Item name |
|
xmlId |
External code |
|
assignedById |
Identifier of the person responsible for the item |
|
opened |
Whether the item is available to everyone. Possible values:
|
|
webformId |
|
|
begindate |
item start date |
|
closedate |
item end date |
|
companyId |
|
|
contactId |
|
|
contactIds |
|
|
observers |
|
|
stageId |
|
|
sourceId |
String identifier of the source. For example, A list of available sources can be obtained using |
|
sourceDescription |
Additional information about the source |
|
currencyId |
item currency identifier |
|
isManualOpportunity |
Amount calculation mode. Possible values:
|
|
opportunity |
Amount |
|
taxValue |
Tax amount |
|
mycompanyId |
My company identifier |
|
comments |
Comment |
|
locationId |
Location identifier. Service field |
|
ufCrm... |
Custom field. See section Custom Fields in CRM: Overview of Methods.
|
|
parentId... |
CRM object identifier entityTypeId: can be obtained using the crm.type.list method or created using the crm.type.add method.
|
Name |
Description |
|
title |
Item name |
|
xmlId |
External code |
|
assignedById |
Identifier of the person responsible for the item |
|
opened |
|
|
webformId |
|
|
begindate |
|
|
closedate |
|
|
companyId |
|
|
contactId |
|
|
contactIds |
|
|
observers |
|
|
categoryId |
|
|
stageId |
|
|
sourceId |
|
|
sourceDescription |
|
|
currencyId |
|
|
isManualOpportunity |
Amount calculation mode. Possible values:
|
|
opportunity |
|
|
taxValue |
|
|
mycompanyId |
|
|
ufCrm... |
Custom field. See section Custom Fields in CRM: Overview of Methods.
|
|
parentId... |
SPA settings
For more information on managing SPA settings, you can read in Smart Processes: Overview of Methods
How to Update a File Type Custom Field
-
Upload a new file instead of the old one (non-multiple field)
To replace a file in a non-multiple field, simply upload a new file. The old one will be automatically deleted.
{ "fields": { "ufCrm1617027453943": [ "myfile.pdf", "...base64_encoded_file_content..." ] } } -
Remove the value of the file type custom field
To do this, simply pass an empty string (
'') instead of the value. -
Leave the value of the non-multiple file type field unchanged
The simplest option is to not add the key with this field in
fields.But if you need to pass it and not change it, then the value should be passed as a list, where the key
idwill be the identifier of the file.{ "fields": { "ufCrm1617027453943": { "id": 433 } } }Warning
If a value different from the current one is passed in
id, the field value will be reset and the file will be deleted. -
Working with a multiple file type field
The value of a multiple field is an array. Each element of the array is subject to the same rules as for non-multiple values.
How to partially overwrite the values of a multiple file type field
For example, currently, the multiple file type field contains values
[12, 255, 44].You need to keep files
12and44, and upload a new one instead of255.The request should look as follows:
{ "fields": { "ufCrm1617027453943": [ { "id": 12 }, { "id": 44 }, [ "myNewFile.pdf", "...base64_encoded_file_content..." ] ] } }
Code Examples
Update a deal with id = 351
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"entityTypeId":2,"id":351,"fields":{"title":"REST Deal #1","stageId":"C9:UC_NYL06U","assignedById":6,"observers":[1,2,3],"opened":"N","typeId":"SERVICE","opportunity":10000,"currencyId":"USD","additionalInfo":"Changing a deal via REST","isManualOpportunity":"N","utmSource":"google","ufCrm_1721244707107":200.05,"parentId1220":2}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.item.update
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"entityTypeId":2,"id":351,"fields":{"title":"REST Deal #1","stageId":"C9:UC_NYL06U","assignedById":6,"observers":[1,2,3],"opened":"N","typeId":"SERVICE","opportunity":10000,"currencyId":"USD","additionalInfo":"Changing a deal via REST","isManualOpportunity":"N","utmSource":"google","ufCrm_1721244707107":200.05,"parentId1220":2},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.item.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
type CrmItem = {
id: number
title: string
}
// Shape of the payload returned in result (match the "response handling" section of the page)
type ItemUpdateResult = {
item: CrmItem
}
try {
const response = await $b24.actions.v2.call.make<ItemUpdateResult>({
method: 'crm.item.update',
params: {
entityTypeId: 2,
id: 351,
fields: {
title: 'REST Deal #1',
stageId: 'C9:UC_NYL06U',
assignedById: 6,
observers: [1, 2, 3],
opened: 'N',
typeId: 'SERVICE',
opportunity: 10000,
currencyId: 'USD',
additionalInfo: 'Update a deal via REST',
isManualOpportunity: 'N',
utmSource: 'google',
ufCrm_1721244707107: 200.05,
parentId1220: 2,
},
},
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(`Updated item #${result.item.id} (${result.item.title})`)
}
} 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 updateCrmItem() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'crm.item.update',
params: {
entityTypeId: 2,
id: 351,
fields: {
title: 'REST Deal #1',
stageId: 'C9:UC_NYL06U',
assignedById: 6,
observers: [1, 2, 3],
opened: 'N',
typeId: 'SERVICE',
opportunity: 10000,
currencyId: 'USD',
additionalInfo: 'Update a deal via REST',
isManualOpportunity: 'N',
utmSource: 'google',
ufCrm_1721244707107: 200.05,
parentId1220: 2,
},
},
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(`Updated item #${result.item.id} (${result.item.title})`)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', updateCrmItem)
</script>
require_once('crest.php');
$result = CRest::call(
'crm.item.update',
[
'entityTypeId' => 2,
'id' => 351,
'fields' => [
'title' => "REST Deal #1",
'stageId' => "C9:UC_NYL06U",
'assignedById' => 6,
'observers' => [1, 2, 3],
'opened' => "N",
'typeId' => "SERVICE",
'opportunity' => 10000,
'currencyId' => "USD",
'additionalInfo' => "Changing a deal via REST",
'isManualOpportunity' => "N",
'utmSource' => "google",
'ufCrm_1721244707107' => 200.05,
'parentId1220' => 2,
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
try {
$entityTypeId = 1; // Set your entity type ID
$id = 123; // Set the ID of the item to update
$fields = [
'TITLE' => 'Updated Title',
'DATE_MODIFIED' => (new DateTime())->format(DateTime::ATOM), // Example DateTime field
// Add other fields as necessary
];
$itemService = $serviceBuilder->getCRMScope()->item();
$updateResult = $itemService->update($entityTypeId, $id, $fields);
if ($updateResult->isSuccess()) {
print("Item updated successfully: " . json_encode($updateResult));
} else {
print("Failed to update item.");
}
} catch (Throwable $e) {
print("An error occurred: " . $e->getMessage());
}
Example
from b24pysdk.client import BaseClient
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
client: BaseClient
try:
bitrix_response = client.crm.item.update(
entity_type_id=2,
bitrix_id=351,
fields={
"title": "REST Deal #1",
"stageId": "C9:UC_NYL06U",
"assignedById": 6,
"observers": [1, 2, 3],
"opened": "N",
"typeId": "SERVICE",
"opportunity": 10000,
"currencyId": "USD",
"additionalInfo": "Changing a deal via REST",
"isManualOpportunity": "N",
"utmSource": "google",
"ufCrm_1721244707107": 200.05,
"parentId1220": 2,
},
).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}")
Response Handling
HTTP status: 200
{
"result": {
"item": {
"id": 351,
"createdTime": "2024-07-23T19:10:26+02:00",
"dateCreateShort": null,
"updatedTime": "2024-07-23T18:19:21+02:00",
"dateModifyShort": null,
"createdBy": 1,
"updatedBy": 1,
"assignedById": 6,
"opened": "N",
"leadId": null,
"companyId": 0,
"contactId": 0,
"quoteId": null,
"title": "REST Deal #1",
"productId": null,
"categoryId": 9,
"stageId": "C9:UC_NYL06U",
"stageSemanticId": "P",
"isNew": "N",
"isRecurring": "N",
"isReturnCustomer": "N",
"isRepeatedApproach": "N",
"closed": "N",
"typeId": "SERVICE",
"opportunity": 10000,
"isManualOpportunity": "N",
"taxValue": 0,
"currencyId": "USD",
"probability": null,
"comments": "",
"begindate": "2024-07-23T02:00:00+02:00",
"begindateShort": null,
"closedate": "2024-07-31T02:00:00+02:00",
"closedateShort": null,
"eventDate": null,
"eventDateShort": null,
"eventId": null,
"eventDescription": null,
"locationId": null,
"webformId": 0,
"sourceId": "",
"sourceDescription": "",
"originatorId": null,
"originId": null,
"additionalInfo": "Changing a deal via REST",
"searchContent": "351 Deal #351 10200.00 US Dollar John Doe John Doe Sale Name2134234233 07/23/2024 07/31/2024",
"orderStage": null,
"movedBy": 1,
"movedTime": "2024-07-23T18:19:21+02:00",
"lastActivityBy": 1,
"lastActivityTime": "2024-07-23T18:10:26+02:00",
"isWork": null,
"isWon": null,
"isLose": null,
"receivedAmount": null,
"lostAmount": null,
"hasProducts": null,
"ufCrm_1721244707107": 200.05,
"parentId1220": 2,
"utmSource": "google",
"utmMedium": null,
"utmCampaign": null,
"utmContent": null,
"utmTerm": null,
"observers": [
1,
2,
3
],
"contactIds": [],
"entityTypeId": 2
}
},
"time": {
"start": 1721751560.824475,
"finish": 1721751564.481578,
"duration": 3.6571030616760254,
"processing": 3.1893951892852783,
"date_start": "2024-07-23T18:19:20+02:00",
"date_finish": "2024-07-23T18:19:24+02:00",
"operating": 3.1893470287323
}
}
Returned Values
|
Name |
Description |
|
result |
Root element of the response, contains a single key |
|
item |
Information about the updated item, description of fields |
|
time |
Information about the request execution time |
By default, custom field names are passed and returned in camelCase, for example ufCrm2_1639669411830.
When passing the parameter useOriginalUfNames with the value Y, custom fields will be returned with their original names, for example UF_CRM_2_1639669411830.
Error Handling
HTTP status: 400, 403
{
"error": "NOT_FOUND",
"error_description": "Smart process not found"
}
|
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
|
Status |
Code |
Description |
Value |
|
|
|
Action is allowed only for intranet users |
User is not an intranet user |
|
|
|
SPA not found |
Occurs when an invalid |
|
|
|
Access denied |
User does not have permission to modify items of type |
|
|
|
Invalid value for field " |
Incorrect value passed for field |
|
|
|
Expected iterable value for multiple field, but got |
One of the multiple fields received a value of type |
|
|
|
Insufficient permissions to change stage |
If the user tries to change the stage of the item while lacking sufficient rights |
|
|
|
You cannot change the item due to your plan restrictions |
Plan restrictions do not allow modifying smart process items |
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 |