{
    "openapi": "3.1.0",
    "info": {
        "title": "API Фид2Б",
        "version": "1.0.0",
        "summary": "Каталоги товаров, запись и полная замена, фиды, вебхуки",
        "description": "Документация с примерами — https://feed2b.ru/developers. Ответы — JSON, ошибки — {message, code[, errors]}.",
        "contact": {
            "name": "Поддержка Фид2Б",
            "url": "https://feed2b.ru/cabinet/support"
        }
    },
    "servers": [
        {
            "url": "https://feed2b.ru/api/v1"
        }
    ],
    "security": [
        {
            "bearer": []
        }
    ],
    "tags": [
        {
            "name": "Ключ",
            "description": "Проверка ключа, тариф и лимиты"
        },
        {
            "name": "Каталоги",
            "description": "Каталоги и колонки"
        },
        {
            "name": "Товары",
            "description": "Чтение, запись и удаление товаров"
        },
        {
            "name": "Полная замена",
            "description": "Сеанс полной замены каталога"
        },
        {
            "name": "Задачи",
            "description": "Итог записи"
        },
        {
            "name": "Фиды",
            "description": "Фиды и пересборка"
        },
        {
            "name": "Вебхук",
            "description": "Входящий вебхук каталога (Бизнес)"
        }
    ],
    "paths": {
        "/me": {
            "get": {
                "tags": [
                    "Ключ"
                ],
                "summary": "Ключ, тариф и лимиты",
                "operationId": "getMe",
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Me"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs": {
            "get": {
                "tags": [
                    "Каталоги"
                ],
                "summary": "Каталоги, которые видит ключ",
                "operationId": "listCatalogs",
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Catalog"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Каталоги"
                ],
                "summary": "Создать каталог из API",
                "description": "Колонка «Ид» создаётся сама. Нужен ключ с правом записи и доступом ко всем каталогам.",
                "operationId": "createCatalog",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CatalogCreate"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "catalog": {
                                            "$ref": "#/components/schemas/CatalogFull"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "token_limited — ключ к выбранным каталогам",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Проверка: название, колонки, предел каталогов тарифа",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs/{catalog}": {
            "get": {
                "tags": [
                    "Каталоги"
                ],
                "summary": "Каталог и колонки",
                "operationId": "getCatalog",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "catalog": {
                                            "$ref": "#/components/schemas/CatalogFull"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Нет каталога или ключу недоступен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "tags": [
                    "Каталоги"
                ],
                "summary": "Переименовать каталог",
                "operationId": "renameCatalog",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "name"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 100
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "catalog": {
                                            "$ref": "#/components/schemas/CatalogFull"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs/{catalog}/columns": {
            "post": {
                "tags": [
                    "Каталоги"
                ],
                "summary": "Добавить колонки",
                "description": "Только в каталог из API. Поле с этим названием снова пишется в новую колонку, даже если раньше её удалили.",
                "operationId": "addColumns",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "columns"
                                ],
                                "properties": {
                                    "columns": {
                                        "type": "array",
                                        "minItems": 1,
                                        "items": {
                                            "$ref": "#/components/schemas/ColumnInput"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "catalog": {
                                            "$ref": "#/components/schemas/CatalogFull"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "not_api_catalog — каталог не из API; catalog_busy — идёт загрузка",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Колонка с таким названием есть или колонок больше предела",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs/{catalog}/items": {
            "get": {
                "tags": [
                    "Товары"
                ],
                "summary": "Товары страницами",
                "description": "Порядок — по добавлению в каталог; next_cursor = null — страниц больше нет.",
                "operationId": "listItems",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 500,
                            "default": 100
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "description": "next_cursor из прошлого ответа",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "description": "Только изменённые после этого момента",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Item"
                                            }
                                        },
                                        "next_cursor": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Неверный cursor, limit или updated_since",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "tags": [
                    "Товары"
                ],
                "summary": "Добавить и обновить товары",
                "description": "До 1000 товаров. Товар ищется по id: нет — добавляется, есть — меняются только присланные поля (null или \"\" — очистить). Запись в фоне — итог в задаче.",
                "operationId": "upsertItems",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ItemsUpsert"
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Принято: задача поставлена",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "task": {
                                            "$ref": "#/components/schemas/Task"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "sync_not_found — сеанс полной замены истёк или не этого каталога",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "not_api_catalog — писать можно только в каталог из API",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "too_large — тело больше лимита",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Товар неверен — не записан весь запрос",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "too_many_requests или queue_full — повторить через Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Товары"
                ],
                "summary": "Удалить товары по Ид",
                "operationId": "deleteItems",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ids"
                                ],
                                "properties": {
                                    "ids": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 1000,
                                        "items": {
                                            "$ref": "#/components/schemas/ItemId"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Принято: задача поставлена",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "task": {
                                            "$ref": "#/components/schemas/Task"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "not_api_catalog",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Неверный Ид",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs/{catalog}/items/{id}": {
            "get": {
                "tags": [
                    "Товары"
                ],
                "summary": "Один товар по Ид",
                "operationId": "getItem",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Ид товара (закодированный в адресе)",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "item": {
                                            "$ref": "#/components/schemas/Item"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Нет такого товара",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs/{catalog}/syncs": {
            "post": {
                "tags": [
                    "Полная замена"
                ],
                "summary": "Начать сеанс полной замены",
                "description": "Сеанс живёт 60 минут с последнего запроса.",
                "operationId": "startSync",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "sync": {
                                            "$ref": "#/components/schemas/Sync"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "not_api_catalog",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs/{catalog}/syncs/{sync}/finish": {
            "post": {
                "tags": [
                    "Полная замена"
                ],
                "summary": "Завершить сеанс",
                "description": "Удаляет строки каталога, которых не было ни в одной записи сеанса — после всех записей сеанса. Были ошибки записи или нет товаров — каталог не трогаем (status failed).",
                "operationId": "finishSync",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "sync",
                        "in": "path",
                        "required": true,
                        "description": "sync.id из POST /syncs",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Принято: задача поставлена",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "task": {
                                            "$ref": "#/components/schemas/Task"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "sync_not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs/{catalog}/syncs/{sync}": {
            "delete": {
                "tags": [
                    "Полная замена"
                ],
                "summary": "Отменить сеанс",
                "operationId": "cancelSync",
                "parameters": [
                    {
                        "name": "catalog",
                        "in": "path",
                        "required": true,
                        "description": "Номер каталога",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "sync",
                        "in": "path",
                        "required": true,
                        "description": "sync.id из POST /syncs",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "cancelled": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "sync_not_found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tasks/{task}": {
            "get": {
                "tags": [
                    "Задачи"
                ],
                "summary": "Задача записи",
                "operationId": "getTask",
                "parameters": [
                    {
                        "name": "task",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "task": {
                                            "$ref": "#/components/schemas/Task"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Нет задачи (хранятся 7 дней) или ключу недоступна",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/feeds": {
            "get": {
                "tags": [
                    "Фиды"
                ],
                "summary": "Фиды из каталогов, которые видит ключ",
                "operationId": "listFeeds",
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Feed"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/feeds/{feed}": {
            "get": {
                "tags": [
                    "Фиды"
                ],
                "summary": "Фид: ссылка, состояние, последняя сборка",
                "operationId": "getFeed",
                "parameters": [
                    {
                        "name": "feed",
                        "in": "path",
                        "required": true,
                        "description": "Номер фида",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "feed": {
                                            "$ref": "#/components/schemas/Feed"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Нет фида или ключу недоступен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/feeds/{feed}/build": {
            "post": {
                "tags": [
                    "Фиды"
                ],
                "summary": "Пересобрать фид",
                "operationId": "buildFeed",
                "parameters": [
                    {
                        "name": "feed",
                        "in": "path",
                        "required": true,
                        "description": "Номер фида",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "build": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "queued"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "feed_building — фид уже собирается",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/hooks/{secret}": {
            "servers": [
                {
                    "url": "https://feed2b.ru/api"
                }
            ],
            "post": {
                "tags": [
                    "Вебхук"
                ],
                "summary": "Входящий вебхук каталога (Бизнес)",
                "description": "Полный адрес — https://feed2b.ru/api/hooks/{secret}. Без ключа: секрет — в адресе.",
                "operationId": "incomingHook",
                "parameters": [
                    {
                        "name": "secret",
                        "in": "path",
                        "required": true,
                        "description": "Секрет адреса — из кабинета",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9]{40}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "items": {
                                        "type": "array",
                                        "maxItems": 1000,
                                        "items": {
                                            "$ref": "#/components/schemas/ItemInput"
                                        }
                                    },
                                    "delete": {
                                        "type": "array",
                                        "maxItems": 1000,
                                        "items": {
                                            "$ref": "#/components/schemas/ItemId"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Готово",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "task": {
                                            "$ref": "#/components/schemas/Task"
                                        },
                                        "delete_task": {
                                            "$ref": "#/components/schemas/Task"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "plan_required — нужен тариф Бизнес",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Адрес перевыпустили или вебхук отключили",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Нет items и delete или товар неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "429": {
                        "description": "too_many_requests — лимит запросов в минуту; заголовок Retry-After",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "security": []
            }
        }
    },
    "webhooks": {
        "feed.built": {
            "post": {
                "summary": "Фид собран",
                "description": "POST JSON на адрес вебхука (Бизнес). Ответ 2xx за 10 с — дошло, иначе повторы: 1 мин, 5 мин, 30 мин, 2 ч, 6 ч.",
                "parameters": [
                    {
                        "name": "X-Feed2B-Event",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Событие"
                    },
                    {
                        "name": "X-Feed2B-Delivery",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        },
                        "description": "Номер доставки"
                    },
                    {
                        "name": "X-Feed2B-Timestamp",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Время отправки, Unix"
                    },
                    {
                        "name": "X-Feed2B-Signature",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=hex(HMAC-SHA256(секрет, \"{timestamp}.{тело}\"))"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookEvent"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "event": {
                                                "const": "feed.built"
                                            },
                                            "data": {
                                                "type": "object",
                                                "properties": {
                                                    "feed": {
                                                        "$ref": "#/components/schemas/Feed"
                                                    },
                                                    "build": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Принято"
                    }
                }
            }
        },
        "feed.failed": {
            "post": {
                "summary": "Сборка фида не удалась",
                "description": "POST JSON на адрес вебхука (Бизнес). Ответ 2xx за 10 с — дошло, иначе повторы: 1 мин, 5 мин, 30 мин, 2 ч, 6 ч.",
                "parameters": [
                    {
                        "name": "X-Feed2B-Event",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Событие"
                    },
                    {
                        "name": "X-Feed2B-Delivery",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        },
                        "description": "Номер доставки"
                    },
                    {
                        "name": "X-Feed2B-Timestamp",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Время отправки, Unix"
                    },
                    {
                        "name": "X-Feed2B-Signature",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=hex(HMAC-SHA256(секрет, \"{timestamp}.{тело}\"))"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookEvent"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "event": {
                                                "const": "feed.failed"
                                            },
                                            "data": {
                                                "type": "object",
                                                "properties": {
                                                    "feed": {
                                                        "$ref": "#/components/schemas/Feed"
                                                    },
                                                    "build": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Принято"
                    }
                }
            }
        },
        "catalog.updated": {
            "post": {
                "summary": "Каталог обновлён загрузкой (Эксель, ссылка, 1С, Куп2Б)",
                "description": "POST JSON на адрес вебхука (Бизнес). Ответ 2xx за 10 с — дошло, иначе повторы: 1 мин, 5 мин, 30 мин, 2 ч, 6 ч.",
                "parameters": [
                    {
                        "name": "X-Feed2B-Event",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Событие"
                    },
                    {
                        "name": "X-Feed2B-Delivery",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        },
                        "description": "Номер доставки"
                    },
                    {
                        "name": "X-Feed2B-Timestamp",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Время отправки, Unix"
                    },
                    {
                        "name": "X-Feed2B-Signature",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=hex(HMAC-SHA256(секрет, \"{timestamp}.{тело}\"))"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookEvent"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "event": {
                                                "const": "catalog.updated"
                                            },
                                            "data": {
                                                "type": "object",
                                                "properties": {
                                                    "catalog": {
                                                        "$ref": "#/components/schemas/Catalog"
                                                    },
                                                    "import": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Принято"
                    }
                }
            }
        },
        "catalog.failed": {
            "post": {
                "summary": "Загрузка в каталог не удалась",
                "description": "POST JSON на адрес вебхука (Бизнес). Ответ 2xx за 10 с — дошло, иначе повторы: 1 мин, 5 мин, 30 мин, 2 ч, 6 ч.",
                "parameters": [
                    {
                        "name": "X-Feed2B-Event",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Событие"
                    },
                    {
                        "name": "X-Feed2B-Delivery",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        },
                        "description": "Номер доставки"
                    },
                    {
                        "name": "X-Feed2B-Timestamp",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Время отправки, Unix"
                    },
                    {
                        "name": "X-Feed2B-Signature",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=hex(HMAC-SHA256(секрет, \"{timestamp}.{тело}\"))"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookEvent"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "event": {
                                                "const": "catalog.failed"
                                            },
                                            "data": {
                                                "type": "object",
                                                "properties": {
                                                    "catalog": {
                                                        "$ref": "#/components/schemas/Catalog"
                                                    },
                                                    "import": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Принято"
                    }
                }
            }
        },
        "task.finished": {
            "post": {
                "summary": "Задача записи по API закончилась",
                "description": "POST JSON на адрес вебхука (Бизнес). Ответ 2xx за 10 с — дошло, иначе повторы: 1 мин, 5 мин, 30 мин, 2 ч, 6 ч.",
                "parameters": [
                    {
                        "name": "X-Feed2B-Event",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Событие"
                    },
                    {
                        "name": "X-Feed2B-Delivery",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        },
                        "description": "Номер доставки"
                    },
                    {
                        "name": "X-Feed2B-Timestamp",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Время отправки, Unix"
                    },
                    {
                        "name": "X-Feed2B-Signature",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=hex(HMAC-SHA256(секрет, \"{timestamp}.{тело}\"))"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookEvent"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "event": {
                                                "const": "task.finished"
                                            },
                                            "data": {
                                                "type": "object",
                                                "properties": {
                                                    "task": {
                                                        "$ref": "#/components/schemas/Task"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Принято"
                    }
                }
            }
        },
        "ping": {
            "post": {
                "summary": "Проверка из кабинета",
                "description": "POST JSON на адрес вебхука (Бизнес). Ответ 2xx за 10 с — дошло, иначе повторы: 1 мин, 5 мин, 30 мин, 2 ч, 6 ч.",
                "parameters": [
                    {
                        "name": "X-Feed2B-Event",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Событие"
                    },
                    {
                        "name": "X-Feed2B-Delivery",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        },
                        "description": "Номер доставки"
                    },
                    {
                        "name": "X-Feed2B-Timestamp",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Время отправки, Unix"
                    },
                    {
                        "name": "X-Feed2B-Signature",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "sha256=hex(HMAC-SHA256(секрет, \"{timestamp}.{тело}\"))"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "allOf": [
                                    {
                                        "$ref": "#/components/schemas/WebhookEvent"
                                    },
                                    {
                                        "type": "object",
                                        "properties": {
                                            "event": {
                                                "const": "ping"
                                            },
                                            "data": {
                                                "type": "object",
                                                "properties": {
                                                    "message": {
                                                        "type": "string"
                                                    },
                                                    "webhook_id": {
                                                        "type": "integer"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Принято"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "Ключ API из кабинета: «17|f2b_…» целиком"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "message"
                ],
                "properties": {
                    "message": {
                        "type": "string",
                        "description": "Текст по-русски"
                    },
                    "code": {
                        "type": "string",
                        "description": "Код для программы — docs: /developers/errors"
                    }
                }
            },
            "ValidationError": {
                "type": "object",
                "required": [
                    "message",
                    "errors"
                ],
                "properties": {
                    "message": {
                        "type": "string"
                    },
                    "code": {
                        "type": "string",
                        "const": "validation"
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "description": "Путь до поля (items.3.id) → тексты ошибок"
                    }
                }
            },
            "Me": {
                "type": "object",
                "properties": {
                    "token": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string"
                            },
                            "abilities": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "enum": [
                                        "read",
                                        "write"
                                    ]
                                }
                            },
                            "catalog_ids": {
                                "type": [
                                    "array",
                                    "null"
                                ],
                                "items": {
                                    "type": "integer"
                                },
                                "description": "null — все каталоги"
                            }
                        }
                    },
                    "plan": {
                        "type": "object",
                        "properties": {
                            "key": {
                                "type": "string",
                                "enum": [
                                    "free",
                                    "pro",
                                    "business"
                                ]
                            },
                            "name": {
                                "type": "string"
                            },
                            "limits": {
                                "type": "object",
                                "properties": {
                                    "catalogs": {
                                        "type": "integer"
                                    },
                                    "catalog_items": {
                                        "type": "integer"
                                    },
                                    "requests_per_minute": {
                                        "type": "integer"
                                    },
                                    "items_per_request": {
                                        "type": "integer"
                                    },
                                    "push": {
                                        "type": "boolean",
                                        "description": "Мгновенные обновления и вебхуки (Бизнес)"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "Catalog": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                    "source": {
                        "type": "string",
                        "enum": [
                            "upload",
                            "url",
                            "onec",
                            "kup2b",
                            "api",
                            "insales",
                            "bitrix24"
                        ]
                    },
                    "writable": {
                        "type": "boolean",
                        "description": "Можно ли писать по API (source = api)"
                    },
                    "items_count": {
                        "type": "integer"
                    },
                    "id_column": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Название колонки-идентификатора"
                    },
                    "changed_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "CatalogFull": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Catalog"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "columns": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Column"
                                }
                            }
                        }
                    }
                ]
            },
            "Column": {
                "type": "object",
                "properties": {
                    "key": {
                        "type": "string",
                        "description": "Внутренний ключ (c1, c2…), не меняется при переименовании"
                    },
                    "label": {
                        "type": "string",
                        "description": "Название — по нему передаются поля товара"
                    },
                    "type": {
                        "$ref": "#/components/schemas/ColumnType"
                    },
                    "id": {
                        "type": "boolean",
                        "description": "Колонка-идентификатор"
                    }
                }
            },
            "ColumnType": {
                "type": "string",
                "enum": [
                    "text",
                    "number",
                    "url",
                    "urls"
                ],
                "description": "Текст, Число, Ссылка, Список ссылок"
            },
            "ColumnInput": {
                "type": "object",
                "required": [
                    "label"
                ],
                "properties": {
                    "label": {
                        "type": "string",
                        "maxLength": 100
                    },
                    "type": {
                        "$ref": "#/components/schemas/ColumnType",
                        "default": "text"
                    }
                }
            },
            "CatalogCreate": {
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 100
                    },
                    "columns": {
                        "type": "array",
                        "maxItems": 200,
                        "items": {
                            "$ref": "#/components/schemas/ColumnInput"
                        }
                    }
                }
            },
            "ItemId": {
                "oneOf": [
                    {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                    },
                    {
                        "type": "integer"
                    }
                ],
                "description": "Ид товара — значение колонки-идентификатора"
            },
            "Item": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "fields": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Название колонки → значение: «Число» — числом, «Список ссылок» — списком, остальное — строкой"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "ItemInput": {
                "type": "object",
                "required": [
                    "id"
                ],
                "properties": {
                    "id": {
                        "$ref": "#/components/schemas/ItemId"
                    },
                    "fields": {
                        "type": "object",
                        "maxProperties": 200,
                        "additionalProperties": {
                            "description": "Строка, число, true/false («да»/«нет»), null или \"\" — очистить, список строк и чисел (ссылки — списком)",
                            "oneOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "number"
                                },
                                {
                                    "type": "boolean"
                                },
                                {
                                    "type": "null"
                                },
                                {
                                    "type": "array",
                                    "items": {
                                        "type": [
                                            "string",
                                            "number"
                                        ]
                                    }
                                }
                            ]
                        },
                        "description": "Название колонки (без учёта регистра) → значение; нет поля — не трогать"
                    }
                }
            },
            "ItemsUpsert": {
                "type": "object",
                "required": [
                    "items"
                ],
                "properties": {
                    "items": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 1000,
                        "items": {
                            "$ref": "#/components/schemas/ItemInput"
                        }
                    },
                    "sync_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Сеанс полной замены"
                    }
                }
            },
            "Sync": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "expires_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "Task": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "catalog_id": {
                        "type": "integer"
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "upsert",
                            "delete",
                            "finish"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "pending",
                            "running",
                            "done",
                            "failed"
                        ]
                    },
                    "items": {
                        "type": "integer"
                    },
                    "sync_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "result": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "upsert: created, updated, import_id; delete: deleted, not_found; finish: deleted, kept",
                        "additionalProperties": {
                            "type": "integer"
                        }
                    },
                    "warnings": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Warning"
                        }
                    },
                    "error": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "finished_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "Warning": {
                "type": "object",
                "properties": {
                    "index": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Номер товара в запросе с нуля; null — ко всему запросу"
                    },
                    "id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "field": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "message": {
                        "type": "string"
                    }
                }
            },
            "Feed": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                    "platform": {
                        "type": "string",
                        "enum": [
                            "yandex",
                            "direct",
                            "vk",
                            "ozon",
                            "avito",
                            "google"
                        ]
                    },
                    "platform_name": {
                        "type": "string"
                    },
                    "catalog_id": {
                        "type": "integer"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Постоянная ссылка для площадки"
                    },
                    "state": {
                        "type": "string",
                        "enum": [
                            "ready",
                            "building",
                            "error",
                            "draft",
                            "disabled"
                        ]
                    },
                    "served": {
                        "type": "boolean"
                    },
                    "disabled_reason": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "items_count": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "size": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "built_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "fetched_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "last_build": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Build"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                }
            },
            "Build": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "queued",
                            "running",
                            "done",
                            "failed"
                        ]
                    },
                    "trigger": {
                        "type": "string",
                        "enum": [
                            "manual",
                            "schedule",
                            "api",
                            "push",
                            "refresh",
                            "support"
                        ]
                    },
                    "error": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "warnings_count": {
                        "type": "integer"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "finished_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "WebhookEvent": {
                "type": "object",
                "required": [
                    "id",
                    "event",
                    "created_at",
                    "data"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Номер доставки = X-Feed2B-Delivery; повтор — тот же"
                    },
                    "event": {
                        "type": "string",
                        "enum": [
                            "feed.built",
                            "feed.failed",
                            "catalog.updated",
                            "catalog.failed",
                            "task.finished",
                            "ping"
                        ]
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "data": {
                        "type": "object"
                    }
                }
            }
        },
        "responses": {
            "Unauthenticated": {
                "description": "unauthenticated — нет ключа, неверный или отозван",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "plan_required — тариф без API; read_only — ключ только для чтения",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        }
    }
}