---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.ru/dev/kit/ru/openapi/Kontekstnye-kollekcii/CreateContextCollection.md
  - href: ru/openapi/Kontekstnye-kollekcii/CreateContextCollection.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/kit/ru/llms.txt

<div class="openapi">

# Создание контекстной коллекции

<!-- markdownlint-disable-file -->

Создает новую контекстную коллекцию с условиями подбора похожих товаров.

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">

<div class="openapi__request">

POST {.openapi__method}
```text translate=no
https://api.kit.yandex.net/v1/context-collections
```

</div>

</div>

</div>

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "title": "Похожие по цвету",
  "comment": "Показывает товары того же цвета",
  "conditions": [
    {
      "type": "CHARACTERISTIC",
      "operator": "EQ",
      "characteristic_slug": "color"
    }
  ],
  "default_sort": "POPULARITY"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_conditions_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [ContextCollectionCondition](#entity-ContextCollectionCondition)[]

Список условий подбора.

_Min items:_{.json-schema-reset .json-schema-assertion} `1`

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  {
    "type": "CHARACTERISTIC",
    "operator": "EQ",
    "characteristic_slug": "color"
  }
]
```

{% endcut %}
{.table-cell}
||
||

_title_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Название контекстной коллекции.

_Min length:_{.json-schema-reset .json-schema-assertion} `1`

_Max length:_{.json-schema-reset .json-schema-assertion} `2000`

_Example:_{.json-schema-reset .json-schema-example} `Похожие по цвету`
{.table-cell}
||
||

_comment_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Внутренний комментарий.

_Max length:_{.json-schema-reset .json-schema-assertion} `5000`

_Example:_{.json-schema-reset .json-schema-example} `Показывает товары того же цвета`
{.table-cell}
||
||

_default_sort_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [ContextCollectionDefaultSort](#entity-ContextCollectionDefaultSort)

Сортировка подобранных товаров по умолчанию:
- `POPULARITY` — по популярности.
- `CHEAPEST` — сначала дешевые.
- `EXPENSIVE` — сначала дорогие.
- `NEWEST` — сначала новые.
- `OLDEST` — сначала старые.

_Default:_{.json-schema-reset .json-schema-value} `POPULARITY`

_Enum:_{.json-schema-reset .json-schema-value} `POPULARITY`, `CHEAPEST`, `EXPENSIVE`, `NEWEST`, `OLDEST`
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### ContextCollectionConditionType {#entity-ContextCollectionConditionType}

Тип условия подбора:
- `CHARACTERISTIC` — сравнение по характеристике.
- `CATEGORY` — сравнение по категории.
- `COLLECTION` — сравнение по коллекции.
- `BRAND` — сравнение по бренду.
- `BADGE` — сравнение по бейджу.

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `CHARACTERISTIC`, `CATEGORY`, `COLLECTION`, `BRAND`, `BADGE`

</div>

<div class="openapi-entity">

### ContextCollectionConditionOperator {#entity-ContextCollectionConditionOperator}

Оператор условия подбора. В External API поддерживается только равенство.

**Type**: string

_Const:_{.json-schema-reset .json-schema-value} `EQ`

_Example:_{.json-schema-reset .json-schema-example} `example`

</div>

<div class="openapi-entity">

### ContextCollectionCondition {#entity-ContextCollectionCondition}

#|
|| **Name** | **Description** ||
||

_operator_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [ContextCollectionConditionOperator](#entity-ContextCollectionConditionOperator)

Оператор условия подбора. В External API поддерживается только равенство.

_Enum:_{.json-schema-reset .json-schema-value} `EQ`
{.table-cell}
||
||

_type_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [ContextCollectionConditionType](#entity-ContextCollectionConditionType)

Тип условия подбора:
- `CHARACTERISTIC` — сравнение по характеристике.
- `CATEGORY` — сравнение по категории.
- `COLLECTION` — сравнение по коллекции.
- `BRAND` — сравнение по бренду.
- `BADGE` — сравнение по бейджу.

_Enum:_{.json-schema-reset .json-schema-value} `CHARACTERISTIC`, `CATEGORY`, `COLLECTION`, `BRAND`, `BADGE`
{.table-cell}
||
||

_characteristic_slug_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Слаг характеристики для сравнения. Обязателен, если type = `CHARACTERISTIC`.

_Example:_{.json-schema-reset .json-schema-example} `color`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "type": "CHARACTERISTIC",
  "operator": "EQ",
  "characteristic_slug": "color"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### ContextCollectionDefaultSort {#entity-ContextCollectionDefaultSort}

Сортировка подобранных товаров по умолчанию:
- `POPULARITY` — по популярности.
- `CHEAPEST` — сначала дешевые.
- `EXPENSIVE` — сначала дорогие.
- `NEWEST` — сначала новые.
- `OLDEST` — сначала старые.

**Type**: string

_Default:_{.json-schema-reset .json-schema-value} `POPULARITY`

_Enum:_{.json-schema-reset .json-schema-value} `POPULARITY`, `CHEAPEST`, `EXPENSIVE`, `NEWEST`, `OLDEST`

</div>

## Responses

<div class="openapi__response__code__201">

## 201 Created

Контекстная коллекция успешно создана.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "id": "0196a577-b86c-7c8f-893d-2f1dfbc57f5d",
  "title": "Похожие по цвету",
  "comment": "Показывает товары того же цвета",
  "conditions": [
    {
      "type": "CHARACTERISTIC",
      "operator": "EQ",
      "characteristic_slug": "color"
    }
  ],
  "default_sort": "POPULARITY",
  "created_at": "2020-01-01T00:00:00Z",
  "updated_at": "2020-01-01T00:00:00Z"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_comment_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Внутренний комментарий.

_Example:_{.json-schema-reset .json-schema-example} `Показывает товары того же цвета`
{.table-cell}
||
||

_conditions_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [ContextCollectionCondition](#entity-ContextCollectionCondition)[]

Список условий подбора.

_Min items:_{.json-schema-reset .json-schema-assertion} `1`

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  {
    "type": "CHARACTERISTIC",
    "operator": "EQ",
    "characteristic_slug": "color"
  }
]
```

{% endcut %}
{.table-cell}
||
||

_created_at_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string&lt;date-time&gt;

Дата создания контекстной коллекции.

_Example:_{.json-schema-reset .json-schema-example} `2020-01-01T00:00:00Z`
{.table-cell}
||
||

_default_sort_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [ContextCollectionDefaultSort](#entity-ContextCollectionDefaultSort)

Сортировка подобранных товаров по умолчанию:
- `POPULARITY` — по популярности.
- `CHEAPEST` — сначала дешевые.
- `EXPENSIVE` — сначала дорогие.
- `NEWEST` — сначала новые.
- `OLDEST` — сначала старые.

_Default:_{.json-schema-reset .json-schema-value} `POPULARITY`

_Enum:_{.json-schema-reset .json-schema-value} `POPULARITY`, `CHEAPEST`, `EXPENSIVE`, `NEWEST`, `OLDEST`
{.table-cell}
||
||

_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: [ContextCollectionID](#entity-ContextCollectionID)

Идентификатор контекстной коллекции.

_Example:_{.json-schema-reset .json-schema-example} `0196a577-b86c-7c8f-893d-2f1dfbc57f5d`
{.table-cell}
||
||

_title_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Название контекстной коллекции.

_Example:_{.json-schema-reset .json-schema-example} `Похожие по цвету`
{.table-cell}
||
||

_updated_at_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string&lt;date-time&gt;

Дата последнего обновления контекстной коллекции.

_Example:_{.json-schema-reset .json-schema-example} `2020-01-01T00:00:00Z`
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### ContextCollectionID {#entity-ContextCollectionID}

Идентификатор контекстной коллекции.

**Type**: string&lt;uuid&gt;

_Example:_{.json-schema-reset .json-schema-example} `0196a577-b86c-7c8f-893d-2f1dfbc57f5d`

</div>

</div>

<div class="openapi__response__code__400">

## 400 Bad Request

Некорректный запрос.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "code": "VALIDATION_ERROR",
  "message": "Invalid input",
  "trace_id": "00000000000000000000000000000000"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_code_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `VALIDATION_ERROR`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `Invalid input`
{.table-cell}
||
||

_trace_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Уникальный идентификатор запроса для отладки.

_Example:_{.json-schema-reset .json-schema-example} `00000000000000000000000000000000`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__401">

## 401 Unauthorized

Не авторизован.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "code": "VALIDATION_ERROR",
  "message": "Invalid input",
  "trace_id": "00000000000000000000000000000000"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_code_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `VALIDATION_ERROR`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `Invalid input`
{.table-cell}
||
||

_trace_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Уникальный идентификатор запроса для отладки.

_Example:_{.json-schema-reset .json-schema-example} `00000000000000000000000000000000`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__500">

## 500 Internal Server Error

Внутренняя ошибка сервера.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "code": "VALIDATION_ERROR",
  "message": "Invalid input",
  "trace_id": "00000000000000000000000000000000"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_code_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `VALIDATION_ERROR`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `Invalid input`
{.table-cell}
||
||

_trace_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Уникальный идентификатор запроса для отладки.

_Example:_{.json-schema-reset .json-schema-example} `00000000000000000000000000000000`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

</div>

[*Deprecated]: No longer supported, please use an alternative and newer version.