# tasks.api.scrum.epic.add

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

Добавить эпик в Скрам
Scope: `task`
Кто может выполнять метод: любой пользователь, имеющий доступ к Скраму

## Описание

Метод добавляет эпик в Скрам.

## Параметры

- `fields` `object` — обязательный. Значения полей (подробное описание приведено [ниже](#parametr-fields)) для добавления нового эпика в виде структуры:
  ```js
  fields: {
      name: 'значение',
      groupId: 'значение',
      description: 'значение',
      color: 'значение',
      files: [
          'файл1',
          'файл2',
          ...
      ]
  }
  ```

### Параметр fields

- `name` `string` — обязательный. Название эпика
- `description` `string` — необязательный. Описание эпика
- `groupId` `integer` — обязательный. Идентификатор группы (скрама), к которой относится эпик
- `color` `string` — необязательный. Цвет эпика
- `files` `array` — необязательный. Массив файлов, привязанных к эпику.
  В `files` можно передать массив значений с идентификаторами файлов, указав префикс `n` для каждого идентификатора
- `createdBy` `integer` — необязательный. Кем создан
- `modifiedBy` `integer` — необязательный. Кем изменен

## Ответ

```json
{
    "id": 4,
    "groupId": 1,
    "name": "Epic 1",
    "description": "Description text",
    "createdBy": 1,
    "modifiedBy": 1,
    "color": "#69dafc"
}
```

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

- `id` `integer`. Идентификатор эпика
- `groupId` `integer`. Идентификатор группы (скрама), к которой привязан эпик
- `name` `string`. Название эпика
- `description` `string`. Описание эпика
- `createdBy` `integer`. Идентификатор пользователя, создавшего эпик
- `modifiedBy` `integer`. Идентификатор пользователя, который последним изменял эпик
- `color` `string`. Цвет эпика в формате HEX

## Ошибки

HTTP-статус: 400

```json
{
    "error": 0,
    "error_description": "Group is not found"
}
```

- `0` — Access denied. Нет доступа к скраму
- `0` — Epic not created. Не удалось создать эпик
- `0` — createdBy user not found. Пользователь в поле «создатель» не найден
- `0` — modifiedBy user not found. Пользователь в поле «последний изменивший» не найден
- `0` — Group is not found. Не указан параметр `GROUP_ID` или группы с таким `ID` не существует
- `0` — Name is not found. Не указан параметр `NAME`

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

### cURL (Webhook)

```bash
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"fields": {
    "name": "Epic 1",
    "groupId": 1,
    "description": "Description text",
    "color": "#69dafc",
    "files": ["n428", "n345"]
}
}' \
https://your-domain.bitrix24.com/rest/_USER_ID_/_CODE_/tasks.api.scrum.epic.add
```

### cURL (OAuth)

```bash
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: YOUR_ACCESS_TOKEN" \
-d '{
"fields": {
    "name": "Epic 1",
    "groupId": 1,
    "description": "Description text",
    "color": "#69dafc",
    "files": ["n428", "n345"]
}
}' \
https://your-domain.bitrix24.com/rest/tasks.api.scrum.epic.add
```

### 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

// Shape of the payload returned in result (match the "response handling" section of the page)
type EpicAddResult = {
  id: number
  groupId: number
  name: string
  description: string
  createdBy: number
  modifiedBy: number
  color: string
}

try {
  const response = await $b24.actions.v2.call.make<EpicAddResult>({
    method: 'tasks.api.scrum.epic.add',
    params: {
      fields: {
        name: 'Epic 1',
        groupId: 1,
        description: 'Description text',
        color: '#69dafc',
        files: ['n428', 'n345'],
      },
    },
    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('Added epic:', result.id, result.name)
  }
} 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 addEpic() {
    try {
      // Initialize the SDK inside a Bitrix24 frame
      const $b24 = await B24Js.initializeB24Frame()

      const response = await $b24.actions.v2.call.make({
        method: 'tasks.api.scrum.epic.add',
        params: {
          fields: {
            name: 'Epic 1',
            groupId: 1,
            description: 'Description text',
            color: '#69dafc',
            files: ['n428', 'n345'],
          },
        },
        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('Added epic:', result.id, result.name)
    } catch (error) {
      // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
      console.error(error)
    }
  }

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

### Python

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

try:
    bitrix_response = client.tasks.api.scrum.epic.add(
        fields={
            "name": "Epic 1",
            "groupId": 1,
            "description": "Description text",
            "color": "#69dafc",
            "files": [
                "n428",
                "n345",
            ],
        },
    ).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(
            'tasks.api.scrum.epic.add',
            [
                'fields' => [
                    'name'        => $name,
                    'groupId'     => $groupId,
                    'description' => $description,
                    'color'       => $color,
                    'files'       => $files,
                ],
            ]
        );

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

    echo 'Success: ' . print_r($result, true);
    // Нужная вам логика обработки данных
    processData($result);

} catch (Throwable $e) {
    error_log($e->getMessage());
    echo 'Error adding epic: ' . $e->getMessage();
}
```

### BX24.js

```js
const groupId = 1;
const name = 'Epic 1';
const description = 'Description text';
const color = '#69dafc';
const files = ['n428', 'n345'];

BX24.callMethod(
    'tasks.api.scrum.epic.add',
    {
        fields: {
            name: name,
            groupId: groupId,
            description: description,
            color: color,
            files: files
        }
    },
    function(res)
    {
        console.log(res);
    }
);
```

### PHP CRest

```php
require_once('crest.php'); // подключение CRest PHP SDK

$groupId = 1;
$name = 'Epic 1';
$description = 'Description text';
$color = '#69dafc';
$files = ['n428', 'n345'];

// выполнение запроса к REST API
$result = CRest::call(
    'tasks.api.scrum.epic.add',
    [
        'fields' => [
            'name' => $name,
            'groupId' => $groupId,
            'description' => $description,
            'color' => $color,
            'files' => $files
        ]
    ]
);

// Обработка ответа от Битрикс24
if (isset($result['error'])) {
    echo 'Error: '.$result['error_description'];
}
else {
    print_r($result['result']);
}
```

### Go

```go
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "tasks.api.scrum.epic.add", b24.Params{
	"fields": b24.Params{
		"name":        "Epic 1",
		"groupId":     1,
		"description": "Description text",
		"color":       "#69dafc",
		"files":       []string{"n428", "n345"},
	},
})
if err != nil {
	return fmt.Errorf("tasks.api.scrum.epic.add: %w", err)
}

// Ответ приходит как json.RawMessage — разберите его
// в структуру под форму ответа, показанную ниже на этой странице.
fmt.Printf("%s\n", res.Result)
```

Оригинал в официальной документации: https://apidocs.bitrix24.ru/api-reference/sonet-group/scrum/epic/tasks-api-scrum-epic-add.html
