catalog.document.update
Изменить документ складского учета
Описание
Метод catalog.document.update изменяет поля существующего документа складского учета.
Параметры
id
catalog_document.id
обязательный
Идентификатор документа, можно получить методом catalog.document.list
fields
object
обязательный
Поля документа (подробное описание)
Параметр fields
responsibleId
user.id
необязательный
Идентификатор ответственного
dateModify
datetime
необязательный
Можно передать собственную дату изменения. По умолчанию — текущая дата
dateDocument
datetime
необязательный
Дата проведения документа
total
double
необязательный
Общая сумма по товарам документа. Пересчитывается автоматически после изменения товарных позиций
commentary
char
необязательный
Комментарий к документу
title
string
необязательный
Название документа
docNumber
string
необязательный
Внутренний номер документа
modifiedBy
user.id
необязательный
Идентификатор пользователя, изменившего документ. Администратор может указать любое значение, по умолчанию заполняется текущим пользователем
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":142,"fields":{"title":"Поступление от Поставщик-1 (корректировка)","commentary":"Обновили ответсвенного","responsibleId":21}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/catalog.document.update
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":142,"fields":{"title":"Поступление от Поставщик-1 (корректировка)","commentary":"Обновили ответсвенного","responsibleId":21},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/catalog.document.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, ISODate } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
// Shape of the payload returned in result (match the "response handling" section of the page)
type DocumentUpdateResult = {
document: {
commentary: string,
createdBy: number,
currency: string,
dateCreate: ISODate,
dateDocument: ISODate | null,
dateModify: ISODate,
dateStatus: ISODate,
docNumber: string,
docType: string,
id: number,
modifiedBy: number,
responsibleId: number,
siteId: string,
status: string,
statusBy: number | null,
title: string,
total: number | null,
},
}
try {
const response = await $b24.actions.v2.call.make<DocumentUpdateResult>({
method: 'catalog.document.update',
params: {
id: 142,
fields: {
title: 'Product receipt from Supplier-1 (adjustment)',
commentary: 'Updated the responsible person',
responsibleId: 21,
},
},
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 document:', result.document.id, result.document.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 updateDocument() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'catalog.document.update',
params: {
id: 142,
fields: {
title: 'Product receipt from Supplier-1 (adjustment)',
commentary: 'Updated the responsible person',
responsibleId: 21,
},
},
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 document:', result.document.id, result.document.title)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', updateDocument)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.catalog.document.update(
bitrix_id=142,
fields={
"title": "Поступление от Поставщик-1 (корректировка)",
"commentary": "Обновили ответсвенного",
"responsibleId": 21,
},
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Ошибка Bitrix API",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Ошибка Bitrix SDK: {error.message}")
except Exception as error:
print(f"Непредвиденная ошибка: {error}")
try {
$response = $b24Service
->core
->call(
'catalog.document.update',
[
'id' => 142,
'fields' => [
'title' => 'Поступление от Поставщик-1 (корректировка)',
'commentary' => 'Обновили ответсвенного',
'responsibleId' => 21
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error updating document: ' . $e->getMessage();
}
BX24.callMethod(
'catalog.document.update',
{
id: 142,
fields: {
title: 'Поступление от Поставщик-1 (корректировка)',
commentary: 'Обновили ответсвенного',
responsibleId: 21
}
},
function(result)
{
if (result.error())
console.error(result.error());
else
console.log(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'catalog.document.update',
[
'id' => 142,
'fields' => [
'title' => 'Поступление от Поставщик-1 (корректировка)',
'commentary' => 'Обновили ответсвенного',
'responsibleId' => 21
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "catalog.document.update", b24.Params{
"id": 142,
"fields": b24.Params{
"title": "Поступление от Поставщик-1 (корректировка)",
"commentary": "Обновили ответсвенного",
"responsibleId": 21,
},
})
if err != nil {
return fmt.Errorf("catalog.document.update: %w", err)
}
// Метод заворачивает ответ в объект с ключом "document".
raw, ok := b24.Unwrap(res.Result, "document")
if !ok {
return fmt.Errorf("в ответе нет ключа document")
}
var item struct {
Commentary string `json:"commentary"`
CreatedBy int `json:"createdBy"`
Currency string `json:"currency"`
DateCreate string `json:"dateCreate"`
DateModify string `json:"dateModify"`
DateStatus string `json:"dateStatus"`
}
if err := json.Unmarshal(raw, &item); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.Commentary, item.CreatedBy)
Ответ
{
"result": {
"document": {
"commentary": "Обновили ответсвенного",
"createdBy": 29,
"currency": "RUB",
"dateCreate": "2025-10-30T11:19:38+03:00",
"dateDocument": null,
"dateModify": "2025-10-30T11:33:42+03:00",
"dateStatus": "2025-10-30T11:19:38+03:00",
"docNumber": "IN-00042",
"docType": "A",
"id": 11,
"modifiedBy": 29,
"responsibleId": 21,
"siteId": "s1",
"status": "N",
"statusBy": null,
"title": "Поступление от Поставщик-1 (корректировка)",
"total": null
}
},
"time": {
"start": 1761806022,
"finish": 1761806022.36133,
"duration": 0.3613300323486328,
"processing": 0,
"date_start": "2025-10-30T09:33:42+03:00",
"date_finish": "2025-10-30T09:33:42+03:00",
"operating_reset_at": 1761806622,
"operating": 0.17665815353393555
}
}
Возвращаемые данные
result
object
Корневой элемент ответа
document
catalog_document
Объект с обновленными данными документа
time
time
Информация о времени выполнения запроса
Обработка ошибок
{
"error": "0",
"error_description": "Документ не найден."
}
| Код | Описание | Значение |
|---|---|---|
0 |
Недостаточно прав для сохранения документа | У пользователя нет права на редактирование документа нужного типа или документ с таким идентификатором не существует |
0 |
Складской учет недоступен на вашем тарифе | Складской учет недоступен на вашем тарифе |

