lists.section.add
Создать раздел универсального списка
Описание
Метод lists.section.add создает раздел списка.
Параметры
IBLOCK_TYPE_ID
string
обязательный
Идентификатор типа инфоблока.
Стандартные типы:
- lists — универсальные списки
- bitrix_processes — процессы
- lists_socnet — списки групп
В коробочной версии можно также указать идентификатор произвольного существующего типа инфоблоков. IBLOCK_ID или IBLOCK_CODE должен указывать на инфоблок этого типа. Доступ к операции определяется стандартными правами пользователя на инфоблок, раздел или элемент
IBLOCK_ID
integer
обязательный
Идентификатор инфоблока.
Идентификатор можно получить с помощью метода lists.get
IBLOCK_CODE
string
обязательный
Cимвольный код инфоблока.
Код можно получить с помощью метода lists.get
Необходимо указать хотя бы один из параметров: IBLOCK_ID или IBLOCK_CODE
IBLOCK_SECTION_ID
integer
необязательный
Идентификатор родительского раздела.
Если параметр не передается, раздел создается в корне списка. Значение по умолчанию — 0.
Идентификатор можно получить с помощью метода lists.section.get
SECTION_CODE
string
обязательный
Символьный код раздела
FIELDS
array
обязательный
Массив полей.
Параметр FIELDS
NAME
string
обязательный
Название раздела
EXTERNAL_ID
string
необязательный
Внешний идентификатор раздела
XML_ID
string
необязательный
Внешний идентификатор (XML ID)
SORT
integer
необязательный
Сортировка
ACTIVE
string
необязательный
Признак активности. Возможные значения:
- Y — да
- N — нет
PICTURE
array
необязательный
Устаревший.
Картинка. Объект в формате {fileData: [value1, value2]}, где value1 — название файла картинки с расширением, value2 — картинка в формате base64.
Для удаления картинки используется объект в формате {remove: 'Y'}
DESCRIPTION
string
необязательный
Устаревший.
Описание
DESCRIPTION_TYPE
string
необязательный
Устаревший.
Тип описания. Возможные значения:
- text — текст
- html — HTML
По умолчанию устанавливается text
DETAIL_PICTURE
array
необязательный
Устаревший.
Детальная картинка. Объект в формате {fileData: [value1, value2]}, где value1 — название файла картинки с расширением, value2 — картинка в формате base64.
Для удаления картинки используется объект в формате {remove: 'Y'}
SECTION_PROPERTY
array
необязательный
Устаревший.
Пользовательские свойства
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"IBLOCK_TYPE_ID":"lists","IBLOCK_ID":95,"IBLOCK_SECTION_ID":0,"SECTION_CODE":"marketing_documents","FIELDS":{"NAME":"Документы отдела маркетинга","EXTERNAL_ID":"ext_marketing_docs_001","XML_ID":"xml_marketing_docs_001","SORT":500,"ACTIVE":"Y"}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/lists.section.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"IBLOCK_TYPE_ID":"lists","IBLOCK_ID":95,"IBLOCK_SECTION_ID":0,"SECTION_CODE":"marketing_documents","FIELDS":{"NAME":"Документы отдела маркетинга","EXTERNAL_ID":"ext_marketing_docs_001","XML_ID":"xml_marketing_docs_001","SORT":500,"ACTIVE":"Y"},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/lists.section.add
// 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<number>({
method: 'lists.section.add',
params: {
IBLOCK_TYPE_ID: 'lists',
IBLOCK_ID: 95,
IBLOCK_SECTION_ID: 0,
SECTION_CODE: 'marketing_documents',
FIELDS: {
NAME: 'Marketing department documents',
EXTERNAL_ID: 'ext_marketing_docs_001',
XML_ID: 'xml_marketing_docs_001',
SORT: 500,
ACTIVE: 'Y',
},
},
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('Created section ID:', 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 addListsSection() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'lists.section.add',
params: {
IBLOCK_TYPE_ID: 'lists',
IBLOCK_ID: 95,
IBLOCK_SECTION_ID: 0,
SECTION_CODE: 'marketing_documents',
FIELDS: {
NAME: 'Marketing department documents',
EXTERNAL_ID: 'ext_marketing_docs_001',
XML_ID: 'xml_marketing_docs_001',
SORT: 500,
ACTIVE: 'Y',
},
},
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('Created section ID:', result)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', addListsSection)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
fields = {
"NAME": "Документы отдела маркетинга",
"EXTERNAL_ID": "ext_marketing_docs_001",
"XML_ID": "xml_marketing_docs_001",
"SORT": 500,
"ACTIVE": "Y",
}
try:
bitrix_response = client.lists.section.add(
iblock_type_id='lists',
iblock_id=95,
iblock_section_id=0,
section_code='marketing_documents',
fields=fields,
).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(
'lists.section.add',
[
'IBLOCK_TYPE_ID' => 'lists',
'IBLOCK_ID' => 95,
'IBLOCK_SECTION_ID' => 0,
'SECTION_CODE' => 'marketing_documents',
'FIELDS' => [
'NAME' => 'Документы отдела маркетинга',
'EXTERNAL_ID' => 'ext_marketing_docs_001',
'XML_ID' => 'xml_marketing_docs_001',
'SORT' => 500,
'ACTIVE' => 'Y',
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error adding section: ' . $e->getMessage();
}
BX24.callMethod(
'lists.section.add',
{
IBLOCK_TYPE_ID: 'lists',
IBLOCK_ID: 95,
IBLOCK_SECTION_ID: 0,
SECTION_CODE: 'marketing_documents',
FIELDS: {
NAME: 'Документы отдела маркетинга',
EXTERNAL_ID: 'ext_marketing_docs_001',
XML_ID: 'xml_marketing_docs_001',
SORT: 500,
ACTIVE: 'Y',
}
},
function(result) {
if (result.error()) {
console.error(result.error());
} else {
console.log(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call(
'lists.section.add',
[
'IBLOCK_TYPE_ID' => 'lists',
'IBLOCK_ID' => 95,
'IBLOCK_SECTION_ID' => 0,
'SECTION_CODE' => 'marketing_documents',
'FIELDS' => [
'NAME' => 'Документы отдела маркетинга',
'EXTERNAL_ID' => 'ext_marketing_docs_001',
'XML_ID' => 'xml_marketing_docs_001',
'SORT' => 500,
'ACTIVE' => 'Y',
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "lists.section.add", b24.Params{
"IBLOCK_TYPE_ID": "lists",
"IBLOCK_ID": 95,
"IBLOCK_SECTION_ID": 0,
"SECTION_CODE": "marketing_documents",
"FIELDS": b24.Params{
"NAME": "Документы отдела маркетинга",
"EXTERNAL_ID": "ext_marketing_docs_001",
"XML_ID": "xml_marketing_docs_001",
"SORT": 500,
"ACTIVE": "Y",
},
})
if err != nil {
return fmt.Errorf("lists.section.add: %w", err)
}
var newID b24.ID
if err := json.Unmarshal(res.Result, &newID); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println("идентификатор:", newID)
Ответ
HTTP-статус: 200
{
"result": 169,
"time": {
"start": 1761554216,
"finish": 1761554216.280577,
"duration": 0.2805769443511963,
"processing": 0,
"date_start": "2025-10-27T11:36:56+03:00",
"date_finish": "2025-10-27T11:36:56+03:00",
"operating_reset_at": 1761554816,
"operating": 0
}
}
Возвращаемые данные
result
integer
Идентификатор созданного раздела
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error":"ERROR_REQUIRED_PARAMETERS_MISSING",
"error_description":"Required parameter is missing"
}
| Код | Описание | Значение |
|---|---|---|
ERROR_REQUIRED_PARAMETERS_MISSING |
Required parameter X is missing |
Обязательный параметр не передан |
ERROR_ADD_SECTION |
— | Ошибка при добавлении раздела |
ACCESS_DENIED |
Access denied | Недостаточно прав для добавления раздела |

