Update Deal crm.deal.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 deals
DEPRECATED
The development of this method has been halted. Please use crm.item.update.
The method crm.deal.update updates an existing deal.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
The identifier of the deal. The identifier can be obtained using the methods crm.deal.list or crm.deal.add |
|
fields |
An object in the following format:
where:
The list of available fields is described below. An incorrect field in Only those fields that need to be changed should be passed in |
|
params |
A set of additional parameters (detailed description) |
Fields Parameter
|
Name |
Description |
|
TITLE |
The title of the deal |
|
TYPE_ID |
The string identifier of the deal type. The list of available deal types can be found using the method crm.status.list with the filter |
|
STAGE_ID |
The stage of the deal. The list of available stages can be found using the method crm.status.list with the filter:
If you need to change the Sales Funnel of the deal, use the method crm.item.update, with the |
|
IS_RECURRING |
Indicates whether the deal is a template for a recurring deal. Possible values:
|
|
IS_RETURN_CUSTOMER |
Indicates whether the deal is a repeat. Possible values:
|
|
IS_REPEATED_APPROACH |
Indicates whether the deal is a repeated approach. Possible values:
|
|
PROBABILITY |
Probability, % |
|
CURRENCY_ID |
Currency. The list of available currencies can be found using the method crm.currency.list |
|
OPPORTUNITY |
Amount |
|
IS_MANUAL_OPPORTUNITY |
Indicates whether manual calculation of the amount is enabled. Possible values:
|
|
TAX_VALUE |
Tax amount |
|
COMPANY_ID |
The identifier of the company associated with the deal. The list of companies can be found using the method crm.item.list by passing |
|
CONTACT_ID |
Contact. Deprecated |
|
CONTACT_IDS |
A list of contacts associated with the deal. The field is completely replaced. To change individual related contacts, use the methods crm.deal.contact.items.*. |
|
BEGINDATE |
Start date |
|
CLOSEDATE |
End date |
|
OPENED |
Is the deal available to everyone? Possible values:
|
|
CLOSED |
Is the deal closed? Possible values:
|
|
COMMENTS |
Comment. Supports BB codes |
|
ASSIGNED_BY_ID |
Responsible person |
|
SOURCE_ID |
The string identifier of the source type. The list of available sources can be found using the method crm.status.list with the filter |
|
SOURCE_DESCRIPTION |
Additional information about the source |
|
ADDITIONAL_INFO |
Additional information |
|
LOCATION_ID |
Client's location. System field |
|
ORIGINATOR_ID |
Identifier of the data source. Used only for linking to an external source |
|
ORIGIN_ID |
Identifier of the element in the data source. Used only for linking to an external source |
|
UTM_SOURCE |
Advertising system (Google-Adwords and others) |
|
UTM_MEDIUM |
Type of traffic. Possible values:
|
|
UTM_CAMPAIGN |
Advertising campaign designation |
|
UTM_CONTENT |
Content of the campaign. For example, for contextual ads |
|
UTM_TERM |
Search term of the campaign. For example, keywords for contextual advertising |
|
UF_CRM_... |
Custom fields. For example, Depending on the portal settings, deals may have a set of custom fields of specific types. Values of multiple fields are passed as an array. To change file fields, it is recommended to use the method crm.item.update. You can add a custom field to a deal using the method crm.deal.userfield.add |
|
PARENT_ID_... |
Relationship fields. If there are smart processes associated with deals on the portal, there is a field for each such smart process that stores the link between this smart process and the deal. The field itself stores the identifier of the element of that smart process. For example, the field |
Params Parameter
|
Name |
Description |
|
REGISTER_SONET_EVENT |
Should the event of the deal change be registered in the live feed? Possible values:
|
|
REGISTER_HISTORY_EVENT |
Should a record be created in the history? Possible values:
|
Related Methods and Topics
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":123,"FIELDS":{"TITLE":"New Deal Title!","TYPE_ID":"GOODS","STAGE_ID":"WON","IS_RECCURING":"Y","IS_RETURN_CUSTOMER":"Y","OPPORTUNITY":9999.99,"IS_MANUAL_OPPORTUNITY":"Y","ASSIGNED_BY_ID":1,"UF_CRM_1725365197310":"String","PARENT_ID_1032":1},"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.deal.update
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":123,"FIELDS":{"TITLE":"New Deal Title!","TYPE_ID":"GOODS","STAGE_ID":"WON","IS_RECCURING":"Y","IS_RETURN_CUSTOMER":"Y","OPPORTUNITY":9999.99,"IS_MANUAL_OPPORTUNITY":"Y","ASSIGNED_BY_ID":1,"UF_CRM_1725365197310":"String","PARENT_ID_1032":1},"PARAMS":{"REGISTER_SONET_EVENT":"N","REGISTER_HISTORY_EVENT":"N"},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.deal.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.deal.update',
params: {
id: 123,
fields: {
TITLE: 'New deal title!',
TYPE_ID: 'GOODS',
STAGE_ID: 'WON',
IS_RECCURING: 'Y',
IS_RETURN_CUSTOMER: 'Y',
OPPORTUNITY: 9999.99,
IS_MANUAL_OPPORTUNITY: 'Y',
ASSIGNED_BY_ID: 1,
UF_CRM_1725365197310: 'String',
PARENT_ID_1032: 1,
},
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('Deal 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 updateDeal() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'crm.deal.update',
params: {
id: 123,
fields: {
TITLE: 'New deal title!',
TYPE_ID: 'GOODS',
STAGE_ID: 'WON',
IS_RECCURING: 'Y',
IS_RETURN_CUSTOMER: 'Y',
OPPORTUNITY: 9999.99,
IS_MANUAL_OPPORTUNITY: 'Y',
ASSIGNED_BY_ID: 1,
UF_CRM_1725365197310: 'String',
PARENT_ID_1032: 1,
},
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('Deal updated:', result)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', updateDeal)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.crm.deal.update(
bitrix_id=123,
fields={
"TITLE": "Enterprise License Renewal - Negotiation",
"STAGE_ID": "PREPARATION",
"OPPORTUNITY": 28000,
"COMMENTS": "Updated after discovery call",
"ASSIGNED_BY_ID": 1,
},
params={"REGISTER_SONET_EVENT": "Y", "REGISTER_HISTORY_EVENT": "Y"},
).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.deal.update',
[
'id' => 123,
'fields' => [
'TITLE' => "New Deal Title!",
'TYPE_ID' => "GOODS",
'STAGE_ID' => "WON",
'IS_RECCURING' => "Y",
'IS_RETURN_CUSTOMER' => "Y",
'OPPORTUNITY' => 9999.99,
'IS_MANUAL_OPPORTUNITY' => "Y",
'ASSIGNED_BY_ID' => 1,
'UF_CRM_1725365197310' => "String",
'PARENT_ID_1032' => 1,
],
'params' => [
'REGISTER_SONET_EVENT' => "N",
'REGISTER_HISTORY_EVENT' => "N",
],
]
);
$result = $response
->getResponseData()
->getResult();
if ($response->getError()) {
echo 'Error: ' . $response->getError();
} else {
echo 'Success: ' . print_r($result, true);
// Your logic for processing data
processData($result);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error updating deal: ' . $e->getMessage();
}
BX24.callMethod(
'crm.deal.update',
{
id: 123,
fields: {
TITLE: "New Deal Title!",
TYPE_ID: "GOODS",
STAGE_ID: "WON",
IS_RECCURING: "Y",
IS_RETURN_CUSTOMER: "Y",
OPPORTUNITY: 9999.99,
IS_MANUAL_OPPORTUNITY: "Y",
ASSIGNED_BY_ID: 1,
UF_CRM_1725365197310: "String",
PARENT_ID_1032: 1,
},
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.deal.update',
[
'ID' => 123,
'FIELDS' => [
'TITLE' => 'New Deal Title!',
'TYPE_ID' => 'GOODS',
'STAGE_ID' => 'WON',
'IS_RECCURING' => 'Y',
'IS_RETURN_CUSTOMER' => 'Y',
'OPPORTUNITY' => 9999.99,
'IS_MANUAL_OPPORTUNITY' => 'Y',
'ASSIGNED_BY_ID' => 1,
'UF_CRM_1725365197310' => 'String',
'PARENT_ID_1032' => 1,
],
'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.deal.update", b24.Params{
"id": 123,
"fields": b24.Params{
"TITLE": "New Deal Title!",
"TYPE_ID": "GOODS",
"STAGE_ID": "WON",
"IS_RECCURING": "Y",
"IS_RETURN_CUSTOMER": "Y",
"OPPORTUNITY": 9999.99,
"IS_MANUAL_OPPORTUNITY": "Y",
"ASSIGNED_BY_ID": 1,
"UF_CRM_1725365197310": "String",
"PARENT_ID_1032": 1,
},
"params": b24.Params{
"REGISTER_SONET_EVENT": "N",
"REGISTER_HISTORY_EVENT": "N",
},
})
if err != nil {
return fmt.Errorf("crm.deal.update: %w", err)
}
var ok bool
if err := json.Unmarshal(res.Result, &ok); err != nil {
return fmt.Errorf("parse response: %w", err)
}
fmt.Println("done:", ok)
Method Explanation
For managing deal contacts, it is not recommended to use the fields CONTACT_IDS and CONTACT_ID.
Use the methods crm.deal.contact.* for working with a single contact, and the methods crm.deal.contact.items.* for working with a group of deal contacts.
Response Handling
HTTP Status: 200
{
"result": true,
"time": {
"start": 1725365418.056843,
"finish": 1725365419.671506,
"duration": 1.6146628856658936,
"processing": 1.3475170135498047,
"date_start": "2024-09-03T14:10:18+02:00",
"date_finish": "2024-09-03T14:10:19+02:00",
"operating": 0
}
}
Returned Data
|
Name |
Description |
|
result |
The root element of the response, contains |
|
time |
Information about the execution time of the request |
Error Handling
HTTP Status: 400
{
"error": "",
"error_description": "Parameter 'fields' must be array."
}
|
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 parameter |
|
Empty value |
|
The deal with the provided |
|
Empty value |
|
The parameter |
|
Empty value |
|
The parameter |
|
Empty value |
|
The user does not have permission to "edit" deals |
|
Empty value |
Disk resource exhausted |
|
|
Empty value |
Invalid value for the "Currency" 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 |