Set Products in Lead crm.lead.productrows.set
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: user with "edit" access permission for the lead
DEPRECATED
The development of this method has been halted. Please use crm.item.productrow.*.
The method crm.lead.productrows.set creates or updates the product rows of a lead. Existing rows that are not passed to the method will be removed from the lead.
To modify only a single row, use the methods crm.item.productrow.*.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
Lead identifier. Can be obtained using the method to retrieve the list of leads: |
|
rows |
Product rows An array of objects in the following format:
where
The list of available fields is described below |
List of Available Fields for Product Rows
|
Name |
Description |
|
PRODUCT_ID |
Identifier of the product in the catalog. You can get the list of products using the method Default - |
|
PRODUCT_NAME |
Name of the product row. If If both |
|
PRICE |
Final cost of the product per unit Default - |
|
PRICE_EXCLUSIVE |
Cost per unit considering discounts, excluding taxes |
|
PRICE_NETTO |
Cost per unit excluding discounts and taxes |
|
PRICE_BRUTTO |
Cost per unit excluding discounts but including taxes |
|
QUANTITY |
Quantity of the product Default - |
|
DISCOUNT_TYPE_ID |
Discount type
Default - |
|
DISCOUNT_RATE |
Discount value in percentage (if percentage discount type is used) Default - |
|
DISCOUNT_SUM |
Absolute discount value (if absolute discount type is used) Default - |
|
TAX_RATE |
Tax rate in percentage |
|
TAX_INCLUDED |
Indicator of whether tax is included in the price
Default - |
|
MEASURE_CODE |
Unit of measure code If |
|
MEASURE_NAME |
Text representation of the unit of measure (e.g., pcs, kg, m, l, etc.) If |
|
SORT |
Sorting Default - |
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":5,"rows":[{"PRODUCT_ID":456,"PRICE":1000,"QUANTITY":10,"DISCOUNT_TYPE_ID":1,"DISCOUNT_SUM":100,"TAX_RATE":13,"MEASURE_CODE":796,"MEASURE_NAME":"pcs","SORT":10},{"PRODUCT_NAME":"Product #2","PRICE":500,"QUANTITY":5,"DISCOUNT_TYPE_ID":2,"DISCOUNT_RATE":10,"TAX_RATE":10,"MEASURE_CODE":166,"MEASURE_NAME":"kg","SORT":20}]}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.lead.productrows.set
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":5,"rows":[{"PRODUCT_ID":456,"PRICE":1000,"QUANTITY":10,"DISCOUNT_TYPE_ID":1,"DISCOUNT_SUM":100,"TAX_RATE":13,"MEASURE_CODE":796,"MEASURE_NAME":"pcs","SORT":10},{"PRODUCT_NAME":"Product #2","PRICE":500,"QUANTITY":5,"DISCOUNT_TYPE_ID":2,"DISCOUNT_RATE":10,"TAX_RATE":10,"MEASURE_CODE":166,"MEASURE_NAME":"kg","SORT":20}],"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.lead.productrows.set
try
{
const response = await $b24.callMethod(
'crm.lead.productrows.set',
{
id: 5,
rows: [
{
PRODUCT_ID: 456,
PRICE: 1000,
QUANTITY: 10,
DISCOUNT_TYPE_ID: 1,
DISCOUNT_SUM: 100,
TAX_RATE: 13,
MEASURE_CODE: 796,
MEASURE_NAME: "pcs",
SORT: 10,
},
{
PRODUCT_NAME: "Product #2",
PRICE: 500,
QUANTITY: 5,
DISCOUNT_TYPE_ID: 2,
DISCOUNT_RATE: 10,
TAX_RATE: 10,
MEASURE_CODE: 166,
MEASURE_NAME: "kg",
SORT: 20,
},
],
}
);
const result = response.getData().result;
result.error()
? console.error(result.error())
: console.info(result)
;
}
catch( error )
{
console.error('Error:', error);
}
try {
$response = $b24Service
->core
->call(
'crm.lead.productrows.set',
[
'id' => 5,
'rows' => [
[
'PRODUCT_ID' => 456,
'PRICE' => 1000,
'QUANTITY' => 10,
'DISCOUNT_TYPE_ID' => 1,
'DISCOUNT_SUM' => 100,
'TAX_RATE' => 13,
'MEASURE_CODE' => 796,
'MEASURE_NAME' => "pcs",
'SORT' => 10,
],
[
'PRODUCT_NAME' => "Product #2",
'PRICE' => 500,
'QUANTITY' => 5,
'DISCOUNT_TYPE_ID' => 2,
'DISCOUNT_RATE' => 10,
'TAX_RATE' => 10,
'MEASURE_CODE' => 166,
'MEASURE_NAME' => "kg",
'SORT' => 20,
],
],
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
error_log($result->error());
echo 'Error: ' . $result->error();
} else {
echo 'Success: ' . print_r($result->data(), true);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error setting lead product rows: ' . $e->getMessage();
}
BX24.callMethod(
'crm.lead.productrows.set',
{
id: 5,
rows: [
{
PRODUCT_ID: 456,
PRICE: 1000,
QUANTITY: 10,
DISCOUNT_TYPE_ID: 1,
DISCOUNT_SUM: 100,
TAX_RATE: 13,
MEASURE_CODE: 796,
MEASURE_NAME: "pcs",
SORT: 10,
},
{
PRODUCT_NAME: "Product #2",
PRICE: 500,
QUANTITY: 5,
DISCOUNT_TYPE_ID: 2,
DISCOUNT_RATE: 10,
TAX_RATE: 10,
MEASURE_CODE: 166,
MEASURE_NAME: "kg",
SORT: 20,
},
],
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data())
;
},
);
require_once('crest.php');
$result = CRest::call(
'crm.lead.productrows.set',
[
'id' => 5,
'rows' => [
[
'PRODUCT_ID' => 456,
'PRICE' => 1000,
'QUANTITY' => 10,
'DISCOUNT_TYPE_ID' => 1,
'DISCOUNT_SUM' => 100,
'TAX_RATE' => 13,
'MEASURE_CODE' => 796,
'MEASURE_NAME' => "pcs",
'SORT' => 10,
],
[
'PRODUCT_NAME' => "Product #2",
'PRICE' => 500,
'QUANTITY' => 5,
'DISCOUNT_TYPE_ID' => 2,
'DISCOUNT_RATE' => 10,
'TAX_RATE' => 10,
'MEASURE_CODE' => 166,
'MEASURE_NAME' => "kg",
'SORT' => 20,
],
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP Status: 200
{
"result": true,
"time": {
"start": 1772549200,
"finish": 1772549200.281883,
"duration": 0.28188300132751465,
"processing": 0,
"date_start": "2026-03-03T17:46:40+01:00",
"date_finish": "2026-03-03T17:46:40+01:00",
"operating_reset_at": 1772549800,
"operating": 0.9811058044433594
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response, contains |
|
time |
Information about the execution time of the request |
Error Handling
HTTP Status: 400
{
"error": "ERROR_CORE",
"error_description": "Discount Sum (DISCOUNT_SUM) is required if Percentage Discount Type (DISCOUNT_TYPE_ID) is defined and Discount Rate (DISCOUNT_RATE) is 100%<br>"
}
|
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
|
Description |
Value |
|
The parameter id is invalid or not defined |
An incorrect value was passed to the |
|
The parameter rows must be array |
A non-array value was passed to the |
|
Access denied |
The user does not have permission to "edit" the lead |
|
Not found |
The lead with the provided |
|
Discount Rate ( |
|
|
Discount Sum ( |
|
|
Discount Sum ( |
|
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 |