Update Item crm.item.update

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 "change" permissions for the CRM object items

Updates an item of a specific CRM object type by assigning it 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
  • mandatory field completion is checked if the item stage was changed within the same pipeline
  • stage-dependent mandatory field completion is checked if the item stage was changed within the same pipeline
  • field data validity is checked
  • default values are assigned to fields
  • if it is determined before saving that no field values have changed, the save is not performed
  • automation rules are triggered after saving

Method Parameters

Required parameters are marked with *

Name
type

Description

entityTypeId*
integer

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*
integer

Identifier of the item we want to modify.

Can be obtained using the crm.item.list or crm.item.add methods

fields*
object

Object in the format

{
            field_1: value_1,
            field_2: value_2,
            ...,
            field_n: value_n,
        }
        

where

  • field_n — field name
  • value_n — new field value

Each CRM entity 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 fields will be ignored.

Note

Only those fields that need to be changed should be passed in fields.

useOriginalUfNames
boolean

Parameter to control the format of custom field names in the request and response.
Possible values:

  • Y — original names of custom fields, e.g., UF_CRM_2_1639669411830
  • N — custom field names in camelCase, e.g., ufCrm2_1639669411830

Default is N

Parameter fields

Required parameters are marked with *

CRM object identifier entityTypeId: 1

Name
type

Description

title
string

Name of the item

honorific
crm_status

String identifier of the lead request (e.g., 'HNR_DE_1' = 'Mr.').

A list of available requests can be obtained using crm.status.list by applying the { ENTITY_ID: "HONOFIRIC" } filter

name
string

First Name

secondName
string

Middle Name

lastName
string

Last Name

birthdate
date

Date of birth

companyTitle
string

Company name

sourceId
crm_status

String identifier of the source.

For example, 'CALL' = 'Call'.

A list of available sources can be obtained using crm.status.list by applying the { ENTITY_ID: "SOURCE" } filter

sourceDescription
text

Additional information about the source

stageId
crm_status

String identifier of the item stage.

For example, 'NEW' = 'Unprocessed'.

A list of available stages can be obtained using crm.status.list by applying the { ENTITY_ID: "STATUS" } filter

statusDescription
text

Additional information about the stage

post
string

Job Title

currencyId
crm_currency

Item currency identifier

isManualOpportunity
boolean

Amount calculation mode. Possible values:

  • Y — manual
  • N — automatic

opportunity
double

Amount

opened
boolean

Whether the item is available to everyone. Possible values:

  • Y — yes
  • N — no

comments
text

Comment

assignedById
user

Identifier of the person responsible for the item

companyId
crm_company

Company identifier linked to the item.

A list of companies can be obtained using the crm.item.list method by entityTypeId = 4

contactId
crm_contact

Contact identifier linked to the item.

A list of contacts can be obtained using the crm.item.list method by entityTypeId = 3

contactIds
crm_contact[]

List of contact identifiers linked to the item.

A list of contacts can be obtained using the crm.item.list method by entityTypeId = 3

originatorId
string

External source

originId
string

Identifier of the element in the external source

webformId
integer

CRM Form identifier

observers
user[]

Array of user identifiers who will be Observers in the item

utmSource
string

Ad system. For example: Search Ads, Display Ads, etc.

utmMedium
string

Traffic type. Possible values:

  • CPC — ads
  • CPM — banners

utmCampaign
string

Advertising campaign designation

utmContent
string

Campaign content. For example, for contextual ads

utmTerm
string

Campaign search term. For example, keywords for contextual advertising

ufCrm...
crm_userfield

Custom field.

Read the Custom Fields in CRM: Overview of Methods section for information about custom fields.

Values for multiple fields are passed as an array.

To upload a file, you must pass an array as the custom field value, where the first item is the filename and the second is the file content encoded in base64

parentId...
crm_entity

Parent field. An item of another CRM object type that is linked to this item.

Each such field has a parentId + {parentEntityTypeId} code

fm
multifield[]

Array of multipools.

You can read more about multipools in the crm_multifield section.

Multipool structure:

  • id — Unique multipool identifier. If no multipool exists with this id, a new multipool will be created.
  • typeId — Multipool type
  • valueType — Value type
  • value — Value

Example:

  fm: {
              "15": {
                  "valueType": "WORK",
                  "value": "+79999999",
                  "typeId": "PHONE"
              },
              "16": {
                  "valueType": "WORK",
                  "value": "bitrix@bitrix.com",
                  "typeId": "EMAIL"
              }
          }
        

Default — null

CRM object identifier entityTypeId: 2

Name
type

Description

title
string

Name of the item

typeId
crm_status

String identifier of the entity type.

For example, for a deal: 'SALE' = 'Sale'

A list of available entity types can be obtained using crm.status.list by applying the { ENTITY_ID: "DEAL_TYPE" } filter

categoryId
integer

Identifier of the deal direction (pipeline)

stageId
crm_status

String identifier of the item stage.

For example, 'NEW' = 'Unprocessed'.

A list of available stages can be obtained using crm.status.list by applying the following filter:

  • If the deal is in the general pipeline (direction) — { ENTITY_ID: "DEAL_STAGE" }
  • If the deal is not in the general pipeline (direction) — { ENTITY_ID: "DEAL_STAGE_{categoryId}" }, where
    categoryId is the identifier of the deal pipeline (direction)

isRecurring
boolean

Whether the deal is recurring. Possible values:

  • Y — yes
  • N — no

probability
integer

Probability %

currencyId
crm_currency

Item currency identifier

isManualOpportunity
boolean

Amount calculation mode. Possible values:

  • Y — manual
  • N — automatic

opportunity
double

Amount

taxValue
double

Tax amount

companyId
crm_company

Company identifier linked to the item.

A list of companies can be obtained using the crm.item.list method by entityTypeId = 4

contactId
crm_contact

Contact identifier linked to the item.

A list of contacts can be obtained using the crm.item.list method by entityTypeId = 3

contactIds
crm_contact[]

List of contact identifiers linked to the item.

A list of contacts can be obtained using the crm.item.list method by entityTypeId = 3

quoteId
crm_quote

Offer identifier that will be linked to the deal

begindate
date

Item start date

closedate
date

Item end date

opened
boolean

Whether the item is available to everyone. Possible values:

  • Y — yes
  • N — no

comments
text

Comment

assignedById
user

Identifier of the person responsible for the item

sourceId
crm_status

String identifier of the source.

For example, 'CALL' = 'Call'.

A list of available sources can be obtained using crm.status.list by applying the { ENTITY_ID: "SOURCE" } filter

sourceDescription
text

Additional information about the source

leadId
crm_lead

Lead identifier on the basis of which the item is created

additionalInfo
string

Additional information

originatorId
string

External source

originId
string

Identifier of the element in the external source

observers
user[]

Array of user identifiers who will be Observers in the item

locationId
location

Location identifier. Service field

utmSource
string

Advertising system. Google Ads, Facebook Ads, etc.

utmMedium
string

Traffic type. Possible values:

  • CPC — ads
  • CPM — banners

utmCampaign string

Advertising campaign designation

utmContent
string

Campaign content. For example, for contextual ads

utmTerm
string

Campaign search term. For example, keywords for contextual advertising

ufCrm...
crm_userfield

Custom field. See section Custom Fields in CRM: Overview of Methods

  • Values for multiple fields are passed as an array
  • To upload a file, you must pass an array as the custom field value, where the first item is the filename and the second is the file content encoded in base64

parentId...
crm_entity

Parent field. An item of another CRM object type that is linked to this item.

Each such field has a parentId + {parentEntityTypeId} code

CRM object identifier entityTypeId: 3

Name
type

Description

honorific
crm_status

String identifier of the contact request.

For example, 'HNR_DE_1' = 'Mr.'.

A list of available requests can be obtained using crm.status.list by applying the { ENTITY_ID: "HONOFIRIC" } filter

name
string

First Name

secondName
string

Middle Name

lastName
string

Last Name

photo
file

Photograph

birthdate
date

Date of birth

typeId
crm_status

String identifier of the entity type.

For example, for a deal: 'SALE' = 'Sale'.

A list of available entity types can be obtained using crm.status.list by applying the { ENTITY_ID: "CONTACT_TYPE" } filter

sourceId
crm_status

String identifier of the source.

For example, 'CALL' = 'Call'.

A list of available sources can be obtained using crm.status.list by applying the { ENTITY_ID: "SOURCE" } filter

sourceDescription
text

Additional information about the source

post
string

Job Title

comments
text

Comment

opened
boolean

Whether the item is available to everyone. Possible values:

  • Y — yes
  • N — no

export
boolean

Whether the contact is included in the export

assignedById
user

Identifier of the person responsible for the item

companyId
crm_company

Company identifier linked to the item.

A list of companies can be obtained using the crm.item.list method via entityTypeId = 4

companyIds
crm_company

Array of company identifiers that will be linked to the item

leadId
crm_lead

Lead identifier on the basis of which the item is created

originatorId
string

External source

originId
string

Identifier of the element in the external source

originVersion
string

Original version

observers
user[]

Array of user identifiers who will be Observers in the item

utmSource
string

Advertising system. Google Ads, Facebook Ads, etc.

utmMedium
string

Traffic type. Possible values:

  • CPC — ads
  • CPM — banners

utmCampaign
string

Advertising campaign designation

utmContent
string

Campaign content. For example, for contextual ads

utmTerm
string

Campaign search term. For example, keywords for contextual advertising

ufCrm...
crm_userfield

Custom field. See section Custom Fields in CRM: Overview of Methods

  • Values for multiple fields are passed as an array
  • To upload a file, you must pass an array as the custom field value, where the first item is the filename and the second is the file content encoded in base64

parentId...
crm_entity

Parent field. An item of another CRM object type that is linked to this item.

Each such field has a parentId + {parentEntityTypeId} code

fm
multifield[]

Array of multi-fields (phones, e-mail, messengers).

Structure of each item:

  • typeId — multi-field type: PHONE, EMAIL, WEB, IM
  • valueType — value subtype: WORK, MOBILE, HOME, MAILING, OTHER
  • value — value

The item key in the object determines the operation:

Add a new value — use keys n0, n1, n2 ...:

"fm": {
            "n0": { "typeId": "PHONE", "valueType": "WORK", "value": "+499991234567" },
            "n1": { "typeId": "EMAIL", "valueType": "WORK", "value": "new@example.com" }
        }
        

Update an existing value — use the numeric id of the record (taken from the crm.item.get response in the fm field):

"fm": {
            "15": { "typeId": "PHONE", "valueType": "MOBILE", "value": "+499990000000" }
        }
        

Delete a value — pass the numeric id of the record with an empty value:

"fm": {
            "16": { "typeId": "EMAIL", "value": "" }
        }
        

Operations can be combined in a single request.

By default — null

CRM object identifier entityTypeId: 4

Name
type

Description

title
string

Name of the item

typeId
crm_status

String identifier of the entity type.

For example, for a deal: 'SALE' = 'Sale'.

A list of available entity types can be obtained using crm.status.list by applying the { ENTITY_ID: "COMPANY_TYPE" } filter

logo
file

Logo

bankingDetails
string

Banking Details

industry
crm_status

String identifier of the industry type.

For example 'IT' = 'Information Technology'.

A list of available industry types can be obtained using the crm.status.list method by applying the { ENTITY_ID: "INDUSTRY"} filter

employees
crm_status

String identifier of the employee count type.

The value is taken from the list of available values, for example 'EMPLOYEES_1' = 'less than 50'.

A list of available employee count types can be obtained using the crm.status.list method by applying the { ENTITY_ID: "EMPLOYEES" } filter

currencyId
crm_currency

Item currency identifier

revenue
double

Annual revenue

opened
boolean

Whether the item is available to everyone. Possible values:

  • Y — yes
  • N — no

comments
text

Comment

isMyCompany
boolean

Whether the company is my company

assignedById
user

Identifier of the person responsible for the item

contactIds
crm_contact[]

List of contact identifiers linked to the item.

A list of contacts can be obtained using the crm.item.list method via entityTypeId = 3

leadId
crm_lead

Lead identifier on the basis of which the item is created

originatorId
string

External source

originId
string

Identifier of the element in the external source

originVersion
string

Original version

observers
user[]

Array of user identifiers who will be Observers in the item

utmSource
string

Advertising system. Google Ads, Facebook Ads, etc.

utmMedium
string

Traffic type. Possible values:

  • CPC — ads
  • CPM — banners

utmCampaign
string

Advertising campaign designation

utmContent
string

Campaign content. For example, for contextual ads

utmTerm
string

Campaign search term. For example, keywords for contextual advertising

ufCrm...
crm_userfield

Custom field. See section Custom Fields in CRM: Overview of Methods

  • Values for multiple fields are passed as an array
  • To upload a file, you must pass an array as the custom field value, where the first item is the filename and the second is the file content encoded in base64

parentId...
crm_entity

Parent field. An item of another CRM object type that is linked to this item.

Each such field has a parentId + {parentEntityTypeId} code

fm
multifield[]

Array of multi-fields (phones, e-mail, messengers).

Structure of each item:

  • typeId — multi-field type: PHONE, EMAIL, WEB, IM
  • valueType — value subtype: WORK, MOBILE, HOME, MAILING, OTHER
  • value — value

The item key in the object determines the operation:

Add a new value — use keys n0, n1, n2 ...:

"fm": {
            "n0": { "typeId": "PHONE", "valueType": "WORK", "value": "+499991234567" },
            "n1": { "typeId": "EMAIL", "valueType": "WORK", "value": "new@example.com" }
        }
        

Update an existing value — use the numeric id of the record (taken from the crm.item.get response in the fm field):

"fm": {
            "15": { "typeId": "PHONE", "valueType": "MOBILE", "value": "+499990000000" }
        }
        

Delete a value — pass the numeric id of the record with an empty value:

"fm": {
            "16": { "typeId": "EMAIL", "value": "" }
        }
        

Operations can be combined in a single request.

By default — null

CRM object identifier entityTypeId: 7

Name
type

Description

title
string

Name of the item

assignedById
user

Identifier of the person responsible for the item

opened
boolean

Whether the item is available to everyone. Possible values:

  • Y — yes
  • N — no

content
text

Content

terms
text

Conditions

comments
text

Comment

dealId
crm_deal

Linked deal identifier

leadId
crm_lead

Lead identifier on the basis of which the item is created

storageTypeId
integer

Storage type identifier. Possible values:

  • 1 — file
  • 2 — WebDAV
  • 3 — Drive

storageElementIds
integer

Files array

webformId
integer

CRM Form identifier

companyId
crm_company

Company identifier linked to the item.

A list of companies can be obtained using the crm.item.list method by entityTypeId = 4

contactId
crm_contact

Contact identifier linked to the item.

A list of contacts can be obtained using the crm.item.list method by entityTypeId = 3

contactIds
crm_contact[]

List of contact identifiers linked to the item.

A list of contacts can be obtained using the crm.item.list method by entityTypeId = 3

locationId
location

Location identifier. Service field

currencyId
crm_currency

Item currency identifier

isManualOpportunity
boolean

Amount calculation mode.

  • Y — manual
  • N — automatic

opportunity
double

Amount

taxValue
double

Tax amount

stageId
crm_status

String identifier of the item stage.

For example 'DRAFT' = 'New'.

A list of available stages can be obtained using crm.status.list by applying the { ENTITY_ID: "QUOTE_STATUS" } filter

begindate
date

Item start date

closedate
date

Item end date

actualDate
date

Valid until

mycompanyId
crm_company

My company identifier

utmSource
string

Advertising system. Google Ads, Facebook Ads, etc.

utmMedium
string

Traffic type.

  • CPC — ads
  • CPM — banners

utmCampaign
string

Advertising campaign designation

utmContent
string

Campaign content. For example, for contextual ads

utmTerm
string

Campaign search term. For example, keywords for contextual advertising

ufCrm...
crm_userfield

Custom field. See section Custom Fields in CRM: Overview of Methods.

  • Values for multiple fields are passed as an array
  • To upload a file, you must pass an array as the custom field value, where the first item is the filename and the second is the file content encoded in base64

parentId...
crm_entity

Parent field. An item of another CRM object type that is linked to this item.

Each such field has a parentId + {parentEntityTypeId} code

CRM object identifier entityTypeId: 31

Name
type

Description

title
string

Name of the item

xmlId
string

External code

assignedById
user

Identifier of the person responsible for the item

opened
boolean

Whether the item is available to everyone. Possible values:

  • Y — yes
  • N — no

webformId
integer

CRM Form identifier

begindate
date

Item start date

closedate
date

Item end date

companyId
crm_company

Company identifier linked to the item.

A list of companies can be obtained using the crm.item.list method by entityTypeId = 4

contactId
crm_contact

Contact identifier linked to the item.

A list of contacts can be obtained using the crm.item.list method by entityTypeId = 3

contactIds
crm_contact[]

List of contact identifiers linked to the item.

A list of contacts can be obtained using the crm.item.list method by entityTypeId = 3

observers
user[]

Array of user identifiers who will be Observers in the item

stageId
crm_status

String identifier of the item stage.

For example 'DT31_13:N' = 'New'.

A list of available stages can be obtained using crm.status.list by applying the filter: { ENTITY_ID: "SMART_INVOICE_STAGE_{categoryId}" }, where
categoryId — the default invoice pipeline identifier. It can be found using crm.category.list via entityTypeId = 31

sourceId
crm_status

String identifier of the source.

For example 'CALL' = 'Call'.

A list of available sources can be obtained using crm.status.list by applying the { ENTITY_ID: "SOURCE" } filter

sourceDescription
text

Additional information about the source

currencyId
crm_currency

Item currency identifier

isManualOpportunity
boolean

Amount calculation mode. Possible values:

  • Y — manual
  • N — automatic

opportunity
double

Amount

taxValue
double

Tax amount

mycompanyId
crm_company

My company identifier

comments
text

Comment

locationId
location

Location identifier. Service field

ufCrm...
crm_userfield

Custom field. See section Custom Fields in CRM: Overview of Methods.

  • Values for multiple fields are passed as an array
  • To upload a file, you must pass an array as the custom field value, where the first item is the filename and the second is the file content encoded in base64

parentId...
crm_entity

Parent field. An item of another CRM object type that is linked to this item.

Each such field has a parentId + {parentEntityTypeId} code

CRM object identifier entityTypeId: can be retrieved via the crm.type.list method or created via the crm.type.add method

Name
type

Description

title
string

Name of the item

xmlId
string

External code

assignedById
user

Identifier of the person responsible for the item

opened
boolean

Whether the item is available to everyone.

  • Y — yes
  • N — no

webformId
integer

CRM Form identifier

begindate
date

Item start date.

Only available if the isBeginCloseDatesEnabled setting is enabled for the corresponding SPA

closedate
date

Item end date.

Only available if the isBeginCloseDatesEnabled setting is enabled for the corresponding SPA

companyId
crm_company

Company identifier linked to the item.

The company list can be obtained using the crm.item.list method via entityTypeId = 4.

Only available if the isClientEnabled setting is enabled for the corresponding SPA

contactId
crm_contact

Contact identifier linked to the item.

The list of contacts can be obtained using the crm.item.list method by entityTypeId = 3.

Available only if the isClientEnabled setting is enabled for the corresponding SPA

contactIds
crm_contact[]

List of contact identifiers linked to the item.

The list of contacts can be obtained using the crm.item.list method by entityTypeId = 3.

Available only if the isClientEnabled setting is enabled for the corresponding SPA

observers
user[]

An array of user identifiers who will be Observers in the item.

Available only if the isObserversEnabled setting is enabled for the corresponding SPA

categoryId
crm_category

SPA item pipeline identifier.

If the identifier is not specified, the SPA will be moved to the main pipeline.

The list of available pipelines can be found using crm.category.list by applying the corresponding entityTypeId

stageId
crm_status

String identifier of the item stage.

For example, 'DT1220_30:NEW' = 'Start'.

The list of available stages can be found using crm.status.list by applying the { ENTITY_ID: "DYNAMIC_{entityTypeId}_STAGE_{categoryId}" } filter, where:

  • entityTypeId — SPA type identifier
  • categoryId — SPA item pipeline (direction) identifier

More details about pipelines (directions).

Available only if the isStagesEnabled setting is enabled for the corresponding SPA

sourceId
crm_status

String identifier of the source. (for example 'CALL' = 'Call').

The list of available sources can be found using crm.status.list by applying the { ENTITY_ID: "SOURCE" } filter.

Available only if the isSourceEnabled setting is enabled for the corresponding SPA

sourceDescription
text

Additional information about the source.

Available only if the isSourceEnabled setting is enabled for the corresponding SPA

currencyId
crm_currency

Item currency identifier.

Available only if the isLinkWithProductsEnabled setting is enabled for the corresponding SPA

isManualOpportunity
boolean

Amount calculation mode. Possible values:

  • Y — manual
  • N — automatic

Available only if the isLinkWithProductsEnabled setting is enabled for the corresponding SPA

opportunity
double

Amount.

Available only if the isLinkWithProductsEnabled setting is enabled for the corresponding SPA

taxValue
double

Tax amount.

Available only if the isLinkWithProductsEnabled setting is enabled for the corresponding SPA

mycompanyId
crm_company

My company identifier.

ufCrm...
crm_userfield

Custom field. See section Custom Fields in CRM: Overview of Methods.

  • Values for multiple fields are passed as an array
  • To upload a file, you must pass an array as the custom field value, where the first item is the filename and the second is the file content encoded in base64

parentId...
crm_entity

Parent field. An item of another CRM object type that is linked to this item.

Each such field has a parentId + {parentEntityTypeId} code

SPA settings

You can read more about managing SPA configurations in Smart Processes: Overview of Methods and Events

How to Update a File Type Custom Field

  1. Upload a new file to replace 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 deleted automatically.

    {
                "fields": {
                    "ufCrm1617027453943": [
                        "myfile.pdf",
                        "...base64_encoded_file_content..."
                    ]
                }
            }
            
  2. Remove the value of a custom file field

    To do this, simply pass an empty string ('') instead of a value.

  3. Keep the value of a non-multiple file field unchanged

    The simplest option is to not include the key for this field in fields.

    However, if you need to pass the key without changing the value, you must pass a list where the file ID is provided under the id key.

    {
                "fields": {
                    "ufCrm1617027453943": {
                        "id": 433
                    }
                }
            }
            

    Warning

    If you pass a value different from the current one in id, the field value will be reset and the file will be deleted.

  4. Working with a multiple file field

    The value of a multiple field is an array. Each array element follows the same rules as non-multiple values.

    How to partially overwrite values in a multiple file field

    For example, the multiple file field currently contains the values [12, 255, 44].

    You need to keep files 12 and 44, and instead of 255, upload a new one.

    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>
        
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());
        }
        
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>';
        

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}")
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "crm.item.update", b24.Params{
        	"entityTypeId": 2,
        	"id":           351,
        	"fields": b24.Params{
        		"title":               "REST Deal #1",
        		"stageId":             "C9:UC_NYL06U",
        		"assignedById":        6,
        		"observers":           []int{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,
        	},
        })
        if err != nil {
        	return fmt.Errorf("crm.item.update: %w", err)
        }
        
        // The method wraps the response in an object with the "item" key.
        raw, ok := b24.Unwrap(res.Result, "item")
        if !ok {
        	return fmt.Errorf("no item key in the response")
        }
        
        var item struct {
        	ID           b24.ID `json:"id"`
        	CreatedTime  string `json:"createdTime"`
        	UpdatedTime  string `json:"updatedTime"`
        	CreatedBy    int    `json:"createdBy"`
        	UpdatedBy    int    `json:"updatedBy"`
        	AssignedByID b24.ID `json:"assignedById"`
        }
        if err := json.Unmarshal(raw, &item); err != nil {
        	return fmt.Errorf("parse response: %w", err)
        }
        fmt.Println(item.ID, item.CreatedTime)
        

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 EUR Not Invented Not Invented Sale Name2134234233 23.07.2024 31.07.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
type

Description

result
object

Root element of the response, contains a single key item

item
item

Information about the updated item, description of fields

time
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 useOriginalUfNames parameter 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
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
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

403

allowed_only_intranet_user

Action is allowed only for intranet users

User is not an intranet user

400

NOT_FOUND

SPA not found

Occurs when an invalid entityTypeId is passed

400

ACCESS_DENIED

Access denied

User does not have permission to modify items of type entityTypeId

400

CRM_FIELD_ERROR_VALUE_NOT_VALID

Invalid value for field "field"

Incorrect value passed for field field

400

100

Expected iterable value for multiple field, but got type instead

One of the multiple fields received a value of type type, while an iterable type was expected

400

-

Insufficient permissions to change the stage

If the user tries to change the stage of the item while lacking sufficient rights

400

UPDATE_DYNAMIC_ITEM_RESTRICTED

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
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred. Please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred. Please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not permitted for calls using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The HTTPS protocol is required for method calls

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block; please contact Bitrix24 technical support to lift it

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is only available on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user associated with the access token or webhook used to call the method lacks the necessary permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires higher privileges than those provided by the webhook token

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

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

500

PORTAL_DELETED
Portal was deleted

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

Continue Learning