# landing.block.updatecontent

URL: https://chugunov.pro/api-bitrix24/landing/block/methods/landing-block-update-content/
Проверено на Битрикс24 REST API, обновлено 11.09.2026 (ревизия источника fb39d6c).
Источник: официальная документация Битрикс24 (bitrix-tools/b24-rest-docs, лицензия MIT, © Bitrix). Справочник независимый, официальной документацией не является.

Изменить контент блока
Scope: `landing`
Кто может выполнять метод: пользователь с правом «редактирование» сайта

## Описание

Метод `landing.block.updatecontent` полностью заменяет HTML-содержимое блока в черновике страницы.

Если нужно изменить только отдельные ноды, атрибуты или стили блока, используйте методы [landing.block.updatenodes](https://chugunov.pro/api-bitrix24/landing/block/methods/landing-block-update-nodes/), [landing.block.updateattrs](https://chugunov.pro/api-bitrix24/landing/block/methods/landing-block-update-attrs/) и [landing.block.updateStyles](https://chugunov.pro/api-bitrix24/landing/block/methods/landing-block-update-styles/).

## Параметры

- `scope` `string` — необязательный. Внутренний скоуп лендингов. Он не связан с REST-скоупом `landing` в названии метода.
  Значение `scope` должно соответствовать типу сайта [(подробное описание)](https://apidocs.bitrix24.ru/api-reference/landing/types.html)
- `lid` `integer` — обязательный. Идентификатор страницы.
  Идентификатор страницы можно получить методом [landing.landing.getList](https://chugunov.pro/api-bitrix24/landing/page/methods/landing-landing-get-list/)
- `block` `integer` — обязательный. Идентификатор блока в черновике страницы.
  Идентификатор блока можно получить методом [landing.block.getlist](https://chugunov.pro/api-bitrix24/landing/block/methods/landing-block-get-list/) с параметром `params.edit_mode = 1`.
  Если передать идентификатор блока из опубликованной версии страницы, метод может вернуть ошибку
- `content` `string` — обязательный. Новый HTML блока целиком.
  Метод полностью заменяет текущее содержимое блока. Текущий HTML блока можно получить методом [landing.block.getcontent](https://chugunov.pro/api-bitrix24/landing/block/methods/landing-block-get-content/) или методом [landing.block.getlist](https://chugunov.pro/api-bitrix24/landing/block/methods/landing-block-get-list/) с параметром `params.get_content = true`
- `designed` `boolean` — необязательный. Помечает блок как измененный вручную.
  Чтобы включить этот признак, передайте `true`, `"true"` или `1`. Любое другое значение его не включает. По умолчанию — `false`
- `preventHistory` `boolean` — необязательный. Не добавлять изменение в историю страницы. По умолчанию — `false`

## Ответ

HTTP-статус: 200

```json
{
    "result": true,
    "time": {
        "start": 1774524519,
        "finish": 1774524519.331829,
        "duration": 0.3318290710449219,
        "processing": 0,
        "date_start": "2026-03-26T14:28:39+03:00",
        "date_finish": "2026-03-26T14:28:39+03:00",
        "operating_reset_at": 1774525119,
        "operating": 0
    }
}
```

### Возвращаемые данные

- `result` `boolean`. Результат обновления блока. Метод возвращает `true`, если вызов выполнен успешно. 
  Если вызвать метод с `designed = true` для блока, в котором недоступен пользовательский дизайн, вернется `null`
- `time` `time`. Информация о времени выполнения запроса

## Ошибки

HTTP-статус: 400

```json
{
    "error": "BLOCK_NOT_FOUND",
    "error_description": "Блок не найден"
}
```

- `MISSING_PARAMS` — Не передан обязательный параметр `lid`, `block` или `content`
- `LANDING_NOT_EXIST` — Страница с идентификатором `lid` не найдена или недоступна текущему пользователю
- `BLOCK_NOT_FOUND` — Блок с идентификатором `block` не найден на странице `lid` или недоступен в черновике
- `ACCESS_DENIED` — Недостаточно прав для редактирования сайта

## Примеры запроса

### cURL (Webhook)

```bash
curl -X POST \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "lid": 311,
    "block": 6058,
    "content": "<section class=\"g-pt-60 g-pb-60\"><div class=\"container\"><h2 class=\"landing-block-node-title\">Весенняя акция</h2><p class=\"landing-block-node-text\" bxstyle=\"color:#1d1d1d;\">Скидка 15% до конца месяца</p></div></section>",
    "preventHistory": true
  }' \
  "https://**put.your-domain-here**/rest/**user_id**/**webhook_code**/landing.block.updatecontent.json"
```

### cURL (OAuth)

```bash
curl -X POST \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "lid": 311,
    "block": 6058,
    "content": "<section class=\"g-pt-60 g-pb-60\"><div class=\"container\"><h2 class=\"landing-block-node-title\">Весенняя акция</h2><p class=\"landing-block-node-text\" bxstyle=\"color:#1d1d1d;\">Скидка 15% до конца месяца</p></div></section>",
    "preventHistory": true,
    "auth": "**put_access_token_here**"
  }' \
  "https://**put.your-domain-here**/rest/landing.block.updatecontent.json"
```

### JS (TS)

```ts
// 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 | null>({
    method: 'landing.block.updatecontent',
    params: {
      lid: 311,
      block: 6058,
      content: '<section class="g-pt-60 g-pb-60"><div class="container"><h2 class="landing-block-node-title">Spring Sale</h2><p class="landing-block-node-text" bxstyle="color:#1d1d1d;">15% discount until the end of the month</p></div></section>',
      preventHistory: true,
    },
    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('Block content update result:', result)
  }
} catch (error) {
  // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
  console.error(error)
}
```

### JS (UMD)

```html
<!-- 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 updateBlockContent() {
    try {
      // Initialize the SDK inside a Bitrix24 frame
      const $b24 = await B24Js.initializeB24Frame()

      const response = await $b24.actions.v2.call.make({
        method: 'landing.block.updatecontent',
        params: {
          lid: 311,
          block: 6058,
          content: '<section class="g-pt-60 g-pb-60"><div class="container"><h2 class="landing-block-node-title">Spring Sale</h2><p class="landing-block-node-text" bxstyle="color:#1d1d1d;">15% discount until the end of the month</p></div></section>',
          preventHistory: true,
        },
        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('Block content update result:', result)
    } catch (error) {
      // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
      console.error(error)
    }
  }

  document.addEventListener('DOMContentLoaded', updateBlockContent)
</script>
```

### Python

```python
from b24pysdk.errors import BitrixAPIError, BitrixSDKException

try:
    bitrix_response = client.landing.block.updatecontent(
        lid=311,
        block=6058,
        content='<section class="landing-block"><div class="container"><h2>About us</h2><p>New block content</p></div></section>',
        prevent_history=True,
    ).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}")
```

### PHP

```php
try {
    $response = $b24Service
        ->core
        ->call(
            'landing.block.updatecontent',
            [
                'lid' => 311,
                'block' => 6058,
                'content' => '<section class="g-pt-60 g-pb-60"><div class="container"><h2 class="landing-block-node-title">Весенняя акция</h2><p class="landing-block-node-text" bxstyle="color:#1d1d1d;">Скидка 15% до конца месяца</p></div></section>',
                'preventHistory' => true,
            ]
        );

    $result = $response
        ->getResponseData()
        ->getResult();

    echo 'Результат обновления блока: ' . var_export($result, true);
} catch (Throwable $e) {
    error_log($e->getMessage());
    echo 'Error updating block content: ' . $e->getMessage();
}
```

### BX24.js

```js
BX24.callMethod(
    'landing.block.updatecontent',
    {
        lid: 311,
        block: 6058,
        content: '<section class="g-pt-60 g-pb-60"><div class="container"><h2 class="landing-block-node-title">Весенняя акция</h2><p class="landing-block-node-text" bxstyle="color:#1d1d1d;">Скидка 15% до конца месяца</p></div></section>',
        preventHistory: true
    },
    function(result)
    {
        if (result.error())
        {
            console.error(result.error());
        }
        else
        {
            console.info('Результат обновления блока:', result.data());
        }
    }
);
```

### PHP CRest

```php
require_once('crest.php');

$result = CRest::call(
    'landing.block.updatecontent',
    [
        'lid' => 311,
        'block' => 6058,
        'content' => '<section class="g-pt-60 g-pb-60"><div class="container"><h2 class="landing-block-node-title">Весенняя акция</h2><p class="landing-block-node-text" bxstyle="color:#1d1d1d;">Скидка 15% до конца месяца</p></div></section>',
        'preventHistory' => true,
    ]
);

echo '<PRE>';
print_r($result);
echo '</PRE>';
```

### Go

```go
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "landing.block.updatecontent", b24.Params{
	"lid":            311,
	"block":          6058,
	"content":        "<section class=\"g-pt-60 g-pb-60\"><div class=\"container\"><h2 class=\"landing-block-node-title\">Весенняя акция</h2><p class=\"landing-block-node-text\" bxstyle=\"color:#1d1d1d;\">Скидка 15% до конца месяца</p></div></section>",
	"preventHistory": true,
})
if err != nil {
	return fmt.Errorf("landing.block.updatecontent: %w", err)
}

var ok bool
if err := json.Unmarshal(res.Result, &ok); err != nil {
	return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println("выполнено:", ok)
```

Оригинал в официальной документации: https://apidocs.bitrix24.ru/api-reference/landing/block/methods/landing-block-update-content.html
