{
  "openapi": "3.1.0",
  "info": {
    "title": "Gptalk AI API",
    "summary": "Управление ИИ-агентами Gptalk AI",
    "description": "\nREST API платформы **Gptalk AI**: создание и настройка ИИ-агентов, база знаний,\nинструменты, каналы, интеграции, диалоги и исправления ответов.\n\nТе же операции доступны ИИ-ассистентам через **MCP-сервер** — см. [документацию MCP](https://docs.gptalkai.ru/mcp/).\n\n## Быстрый старт\n\n1. В Telegram-боте отправьте `/api` или откройте **Подключения → API и MCP** и создайте ключ.\n2. Передавайте ключ в заголовке `Authorization`:\n\n```bash\ncurl https://api.gptalkai.ru/v1/agents \\\n  -H \"Authorization: Bearer gtk_live_...\"\n```\n\n3. Добавьте текст в базу знаний агента:\n\n```bash\ncurl -X POST https://api.gptalkai.ru/v1/agents/42/knowledge \\\n  -H \"Authorization: Bearer gtk_live_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: 6f1c2f9e-price-2026\" \\\n  -d '{\"title\": \"Прайс\", \"content\": \"Стрижка — 1500 ₽, окрашивание — от 4000 ₽\"}'\n```\n\n## Авторизация\n\nВсе запросы требуют заголовок `Authorization: Bearer <токен>`. Токен бывает двух видов:\n\n* **API-ключ** `gtk_live_…` — для скриптов, серверов и MCP-клиентов с заголовками\n  (Claude Code, Codex, Cursor). Выпускается в Mini App, показывается один раз, отзывается там же.\n* **OAuth 2.1 access token** `gto_at_…` — для приложений, которые подключаются от имени\n  пользователя (коннекторы claude.ai и ChatGPT). Authorization Code + PKCE (S256),\n  динамическая регистрация клиентов (RFC 7591), метаданные сервера —\n  `https://api.gptalkai.ru/.well-known/oauth-authorization-server` (RFC 8414), ресурса —\n  `https://api.gptalkai.ru/.well-known/oauth-protected-resource` (RFC 9728).\n\nТокен действует от имени пользователя: доступны его агенты и агенты, в команду которых\nон входит. Сотрудник ограничен правами своей роли.\n\n### Права (scopes)\n\n| Scope | Что разрешает |\n|---|---|\n| `agents:read` | Читать агентов, их настройки, системный промпт и журнал |\n| `agents:write` | Создавать агентов, менять настройки, останавливать и запускать |\n| `knowledge:read` | Читать базу знаний и материалы |\n| `knowledge:write` | Добавлять, менять и удалять документы и материалы |\n| `tools:read` | Читать инструменты и переменные |\n| `tools:write` | Создавать, менять, проверять и удалять инструменты и переменные |\n| `channels:read` | Читать подключённые каналы |\n| `channels:write` | Подключать, настраивать и отключать каналы |\n| `integrations:read` | Читать интеграции (CRM, календарь, встречи) |\n| `integrations:write` | Подключать, настраивать, проверять и отключать интеграции |\n| `dialogs:read` | Читать диалоги агента с клиентами |\n| `corrections:read` | Читать исправления ответов агента |\n| `corrections:write` | Создавать, менять и удалять исправления ответов |\n\n## Ошибки\n\nОшибки возвращаются в формате [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)\n`application/problem+json`. Поле `code` стабильно — используйте его в коде, а `detail`\nпоказывайте человеку. Ошибки валидации перечислены в `errors[]` с JSON Pointer в `pointer`.\n\n```json\n{\n  \"type\": \"https://docs.gptalkai.ru/api/#error-not_found\",\n  \"title\": \"Не найдено\",\n  \"status\": 404,\n  \"detail\": \"Агент не найден.\",\n  \"code\": \"not_found\",\n  \"instance\": \"/v1/agents/7\"\n}\n```\n\n| code | Значение |\n|---|---|\n| <a id=\"error-bad_request\"></a>`bad_request` | Некорректный запрос |\n| <a id=\"error-validation_error\"></a>`validation_error` | Ошибка валидации |\n| <a id=\"error-unauthorized\"></a>`unauthorized` | Требуется авторизация |\n| <a id=\"error-invalid_token\"></a>`invalid_token` | Недействительный токен |\n| <a id=\"error-insufficient_scope\"></a>`insufficient_scope` | Недостаточно прав токена |\n| <a id=\"error-forbidden\"></a>`forbidden` | Доступ запрещён |\n| <a id=\"error-access_expired\"></a>`access_expired` | Доступ закончился |\n| <a id=\"error-draft_agent\"></a>`draft_agent` | Агент — черновик |\n| <a id=\"error-not_found\"></a>`not_found` | Не найдено |\n| <a id=\"error-conflict\"></a>`conflict` | Конфликт |\n| <a id=\"error-idempotency_conflict\"></a>`idempotency_conflict` | Повтор с другим телом запроса |\n| <a id=\"error-payload_too_large\"></a>`payload_too_large` | Слишком большой запрос |\n| <a id=\"error-unsupported\"></a>`unsupported` | Операция не поддерживается |\n| <a id=\"error-rate_limited\"></a>`rate_limited` | Слишком много запросов |\n| <a id=\"error-upstream_error\"></a>`upstream_error` | Ошибка внешнего сервиса |\n| <a id=\"error-unavailable\"></a>`unavailable` | Сервис временно недоступен |\n| <a id=\"error-internal_error\"></a>`internal_error` | Внутренняя ошибка |\n\n## Пагинация\n\nСписки возвращают `{\"data\": [...], \"next_cursor\": \"...\"}`. Чтобы получить следующую\nстраницу, передайте `cursor=<next_cursor>`. `next_cursor: null` — страниц больше нет.\nРазмер страницы — `limit`, от 1 до 200, по умолчанию 50.\n\n## Идемпотентность\n\nПередайте в POST-запросе заголовок `Idempotency-Key` (до 255 символов, например UUID).\nПовтор с тем же ключом и телом в течение 24 часов вернёт сохранённый ответ\nс заголовком `Idempotent-Replayed: true` и не повторит действие. Тот же ключ с другим\nтелом — ошибка `idempotency_conflict`. PUT, PATCH и DELETE идемпотентны сами по себе.\n\n## Лимиты\n\n300 запросов чтения и 60 запросов записи в минуту на ключ.\nОстаток — в заголовках `RateLimit` и `RateLimit-Policy`. При превышении — `429`\nи заголовок `Retry-After` в секундах.\n\n## Форматы\n\nJSON в UTF-8. Даты — ISO 8601 в UTC. `PATCH` меняет только переданные поля.\nСекреты (токены каналов, ключи CRM, секретные переменные) никогда не возвращаются.\n\n## Версионирование\n\nВерсия — в пути (`/v1`). В рамках версии добавляются только новые поля и методы.\nНесовместимые изменения выйдут в `/v2`.\n",
    "contact": {
      "name": "Поддержка Gptalk AI",
      "url": "https://t.me/dotendev"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.gptalkai.ru",
      "description": "Production"
    }
  ],
  "paths": {
    "/v1/me": {
      "get": {
        "tags": [
          "Аккаунт"
        ],
        "summary": "Текущий аккаунт и токен",
        "description": "Аккаунт владельца токена: тариф, AI-бюджет, доступы и права токена.",
        "operationId": "get_me_v1_me_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/me/usage": {
      "get": {
        "tags": [
          "Аккаунт"
        ],
        "summary": "Расход AI-бюджета",
        "description": "Запросы, токены и стоимость по агентам. По умолчанию — последние 30 дней.",
        "operationId": "get_usage_v1_me_usage_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "date_from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Начало периода, ISO 8601",
              "title": "Date From"
            },
            "description": "Начало периода, ISO 8601"
          },
          {
            "name": "date_to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Конец периода, ISO 8601",
              "title": "Date To"
            },
            "description": "Конец периода, ISO 8601"
          },
          {
            "name": "agent_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents": {
      "get": {
        "tags": [
          "Агенты"
        ],
        "summary": "Список агентов",
        "description": "Ваши агенты и агенты, в команду которых вы входите (поле `role`).",
        "operationId": "list_agents_v1_agents_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "maximum": 200,
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "description": "Размер страницы, до 200",
              "title": "Limit"
            },
            "description": "Размер страницы, до 200"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 512
                },
                {
                  "type": "null"
                }
              ],
              "description": "next_cursor предыдущей страницы",
              "title": "Cursor"
            },
            "description": "next_cursor предыдущей страницы"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_AgentSummary_"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Агенты"
        ],
        "summary": "Создать агента",
        "description": "Создаёт агента в вашем аккаунте. Требует доступа к конструктору (тариф, триал или режим разработчика).",
        "operationId": "create_agent_v1_agents_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}": {
      "get": {
        "tags": [
          "Агенты"
        ],
        "summary": "Настройки агента",
        "operationId": "get_agent_v1_agents__agent_id__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Агенты"
        ],
        "summary": "Изменить настройки агента",
        "description": "Частичное обновление: меняются только переданные поля. `follow_up` тоже сливается с текущими настройками.",
        "operationId": "update_agent_v1_agents__agent_id__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/pause": {
      "post": {
        "tags": [
          "Агенты"
        ],
        "summary": "Остановить агента",
        "description": "Агент перестаёт отвечать во всех каналах. Подключения сохраняются. Только владелец.",
        "operationId": "pause_agent_v1_agents__agent_id__pause_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/resume": {
      "post": {
        "tags": [
          "Агенты"
        ],
        "summary": "Запустить агента",
        "description": "Возвращает агента в каналы. Требует оплаченного доступа. Только владелец.",
        "operationId": "resume_agent_v1_agents__agent_id__resume_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/overview": {
      "get": {
        "tags": [
          "Агенты"
        ],
        "summary": "Сводка по агенту",
        "description": "Настройки, база знаний, инструменты, переменные, каналы, интеграции, исправления, диалоги и подсказки — одним запросом.",
        "operationId": "get_overview_v1_agents__agent_id__overview_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentOverview"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/system-prompt": {
      "get": {
        "tags": [
          "Агенты"
        ],
        "summary": "Системный промпт",
        "operationId": "get_system_prompt_v1_agents__agent_id__system_prompt_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemPrompt"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/team": {
      "get": {
        "tags": [
          "Агенты"
        ],
        "summary": "Команда агента",
        "description": "Сотрудники и права ролей. Только владелец.",
        "operationId": "get_team_v1_agents__agent_id__team_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Team"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/activity": {
      "get": {
        "tags": [
          "Агенты"
        ],
        "summary": "Журнал действий",
        "description": "Вызовы инструментов, ответы модели и изменения настроек — новые сначала.",
        "operationId": "get_activity_v1_agents__agent_id__activity_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "maximum": 200,
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "description": "Размер страницы, до 200",
              "title": "Limit"
            },
            "description": "Размер страницы, до 200"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 512
                },
                {
                  "type": "null"
                }
              ],
              "description": "next_cursor предыдущей страницы",
              "title": "Cursor"
            },
            "description": "next_cursor предыдущей страницы"
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 30
                },
                {
                  "type": "null"
                }
              ],
              "description": "agent, owner, api, mcp",
              "title": "Source"
            },
            "description": "agent, owner, api, mcp"
          },
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 50
                },
                {
                  "type": "null"
                }
              ],
              "title": "Event Type"
            }
          },
          {
            "name": "conversation_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "title": "Conversation Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ActivityEvent_"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/knowledge": {
      "get": {
        "tags": [
          "База знаний"
        ],
        "summary": "Документы базы знаний",
        "description": "Общая база агента, новые сначала. Частые вопросы хранятся в поле агента `frequently_asked_questions`.",
        "operationId": "list_documents_v1_agents__agent_id__knowledge_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "maximum": 200,
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "title": "Limit"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 512
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_KnowledgeDocument_"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "База знаний"
        ],
        "summary": "Добавить текст",
        "description": "Добавляет текст (до 100 000 символов): цены, условия, описание услуг.",
        "operationId": "add_text_v1_agents__agent_id__knowledge_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeTextCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeWriteResult"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/knowledge/files": {
      "post": {
        "tags": [
          "База знаний"
        ],
        "summary": "Загрузить файл",
        "description": "Извлекает текст из файла и индексирует его. Изображения внутри распознаются в фоне (`images_pending`).",
        "operationId": "add_file_v1_agents__agent_id__knowledge_files_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_add_file_v1_agents__agent_id__knowledge_files_post"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeWriteResult"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/knowledge/{document_id}": {
      "get": {
        "tags": [
          "База знаний"
        ],
        "summary": "Документ с текстом",
        "operationId": "get_document_v1_agents__agent_id__knowledge__document_id__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Document Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDocumentDetail"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "База знаний"
        ],
        "summary": "Изменить документ",
        "description": "Новый `content` заменяет текст и переиндексирует документ; `title` меняет заголовок.",
        "operationId": "update_document_v1_agents__agent_id__knowledge__document_id__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Document Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeWriteResult"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "База знаний"
        ],
        "summary": "Удалить документ",
        "operationId": "delete_document_v1_agents__agent_id__knowledge__document_id__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Document Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/knowledge/search": {
      "post": {
        "tags": [
          "База знаний"
        ],
        "summary": "Поиск по базе знаний",
        "description": "Тот же гибридный поиск (векторы + слова), которым пользуется агент.",
        "operationId": "search_v1_agents__agent_id__knowledge_search_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeSearch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeSearchResult"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/materials": {
      "get": {
        "tags": [
          "База знаний",
          "Материалы"
        ],
        "summary": "Файлы для клиентов",
        "description": "Файлы, которые агент может отправлять клиентам (прайсы, презентации, фото).",
        "operationId": "list_materials_v1_agents__agent_id__materials_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Material"
                  },
                  "title": "Response List Materials V1 Agents  Agent Id  Materials Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "База знаний",
          "Материалы"
        ],
        "summary": "Загрузить файл для клиентов и/или для ответов",
        "description": "`clients` — агент отправляет файл клиентам; `answers` — текст файла в базу знаний; `both` — оба.",
        "operationId": "add_material_v1_agents__agent_id__materials_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_add_material_v1_agents__agent_id__materials_post"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaterialCreated"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/materials/{material_id}": {
      "patch": {
        "tags": [
          "База знаний",
          "Материалы"
        ],
        "summary": "Изменить описание файла",
        "operationId": "update_material_v1_agents__agent_id__materials__material_id__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "material_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Material Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MaterialUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Material"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "База знаний",
          "Материалы"
        ],
        "summary": "Удалить файл",
        "operationId": "delete_material_v1_agents__agent_id__materials__material_id__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "material_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Material Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tools/builtin": {
      "get": {
        "tags": [
          "Инструменты"
        ],
        "summary": "Встроенные инструменты",
        "description": "Инструменты платформы, доступные каждому агенту: поиск по базе, отправка файлов, передача менеджеру и др.",
        "operationId": "builtin_tools_v1_tools_builtin_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/BuiltinTool"
                  },
                  "type": "array",
                  "title": "Response Builtin Tools V1 Tools Builtin Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/agents/{agent_id}/tools": {
      "get": {
        "tags": [
          "Инструменты"
        ],
        "summary": "Свои инструменты агента",
        "operationId": "list_tools_v1_agents__agent_id__tools_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Tool"
                  },
                  "title": "Response List Tools V1 Agents  Agent Id  Tools Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Инструменты"
        ],
        "summary": "Создать инструмент",
        "description": "HTTP-запрос к внешнему API или Python-функция в песочнице. После создания выполните проверку (`/check`).",
        "operationId": "create_tool_v1_agents__agent_id__tools_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToolCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tool"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/tools/{tool_id}": {
      "get": {
        "tags": [
          "Инструменты"
        ],
        "summary": "Инструмент",
        "operationId": "get_tool_v1_agents__agent_id__tools__tool_id__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "tool_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Tool Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tool"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Инструменты"
        ],
        "summary": "Изменить инструмент",
        "description": "Без `config` конфигурация не меняется. Новый `config` передаётся целиком. Изменение сбрасывает проверку.",
        "operationId": "update_tool_v1_agents__agent_id__tools__tool_id__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "tool_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Tool Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToolUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tool"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Инструменты"
        ],
        "summary": "Удалить инструмент",
        "operationId": "delete_tool_v1_agents__agent_id__tools__tool_id__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "tool_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Tool Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/tools/{tool_id}/check": {
      "post": {
        "tags": [
          "Инструменты"
        ],
        "summary": "Проверить инструмент",
        "description": "Реальный запуск с тестовыми `arguments`. Внешний сервис действительно выполнит действие.",
        "operationId": "check_tool_v1_agents__agent_id__tools__tool_id__check_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "tool_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Tool Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResult"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/variables": {
      "get": {
        "tags": [
          "Инструменты",
          "Переменные"
        ],
        "summary": "Переменные",
        "description": "Глобальные значения агента для инструментов (`{{NAME}}`). Секретные значения не возвращаются.",
        "operationId": "list_variables_v1_agents__agent_id__variables_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Variable"
                  },
                  "title": "Response List Variables V1 Agents  Agent Id  Variables Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Инструменты",
          "Переменные"
        ],
        "summary": "Создать переменную",
        "operationId": "create_variable_v1_agents__agent_id__variables_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VariableCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Variable"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/variables/{variable_id}": {
      "patch": {
        "tags": [
          "Инструменты",
          "Переменные"
        ],
        "summary": "Изменить переменную",
        "description": "Имя менять нельзя: на него ссылаются инструменты. `clear_value: true` стирает значение.",
        "operationId": "update_variable_v1_agents__agent_id__variables__variable_id__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "variable_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Variable Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VariableUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Variable"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Инструменты",
          "Переменные"
        ],
        "summary": "Удалить переменную",
        "operationId": "delete_variable_v1_agents__agent_id__variables__variable_id__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "variable_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Variable Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/channel-types": {
      "get": {
        "tags": [
          "Каналы"
        ],
        "summary": "Типы каналов",
        "description": "Какие каналы бывают, какие поля нужны для подключения и можно ли подключить канал через API.",
        "operationId": "channel_types_v1_channel_types_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ChannelType"
                  },
                  "type": "array",
                  "title": "Response Channel Types V1 Channel Types Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/agents/{agent_id}/channels": {
      "get": {
        "tags": [
          "Каналы"
        ],
        "summary": "Каналы агента",
        "operationId": "list_channels_v1_agents__agent_id__channels_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Channel"
                  },
                  "title": "Response List Channels V1 Agents  Agent Id  Channels Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/channels/{channel_type}": {
      "get": {
        "tags": [
          "Каналы"
        ],
        "summary": "Канал",
        "operationId": "get_channel_v1_agents__agent_id__channels__channel_type__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "channel_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Channel Type"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Channel"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Каналы"
        ],
        "summary": "Подключить канал",
        "description": "Проверяет данные у провайдера, сохраняет их зашифрованными и запускает канал. Повторный вызов заменяет данные. Требует оплаченного доступа.",
        "operationId": "connect_channel_v1_agents__agent_id__channels__channel_type__put",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "channel_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Channel Type"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelConnect"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelConnected"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Каналы"
        ],
        "summary": "Настроить канал",
        "description": "Пауза (`enabled`), обработка фото и голосовых (`media_enabled`), строка подтверждения ВКонтакте.",
        "operationId": "update_channel_v1_agents__agent_id__channels__channel_type__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "channel_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Channel Type"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Channel"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Каналы"
        ],
        "summary": "Отключить канал",
        "operationId": "disconnect_channel_v1_agents__agent_id__channels__channel_type__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "channel_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Channel Type"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/channels/wazzup/inspect": {
      "post": {
        "tags": [
          "Каналы"
        ],
        "summary": "Каналы Wazzup по ключу",
        "description": "Перед подключением Wazzup: какие каналы доступны по ключу и чей вебхук уже настроен.",
        "operationId": "inspect_wazzup_v1_agents__agent_id__channels_wazzup_inspect_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WazzupInspect"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Inspect Wazzup V1 Agents  Agent Id  Channels Wazzup Inspect Post"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integration-types": {
      "get": {
        "tags": [
          "Интеграции"
        ],
        "summary": "Типы интеграций",
        "operationId": "integration_types_v1_integration_types_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/IntegrationType"
                  },
                  "type": "array",
                  "title": "Response Integration Types V1 Integration Types Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/agents/{agent_id}/integrations": {
      "get": {
        "tags": [
          "Интеграции"
        ],
        "summary": "Интеграции агента",
        "operationId": "list_integrations_v1_agents__agent_id__integrations_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Integration"
                  },
                  "title": "Response List Integrations V1 Agents  Agent Id  Integrations Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/integrations/{integration_type}": {
      "get": {
        "tags": [
          "Интеграции"
        ],
        "summary": "Интеграция",
        "operationId": "get_integration_v1_agents__agent_id__integrations__integration_type__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "integration_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Integration Type"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Integration"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Интеграции"
        ],
        "summary": "Подключить интеграцию",
        "description": "Проверяет доступ у сервиса и сохраняет данные. Агент работает только с одной CRM.",
        "operationId": "connect_integration_v1_agents__agent_id__integrations__integration_type__put",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "integration_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Integration Type"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationConnect"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Integration"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Интеграции"
        ],
        "summary": "Настроить интеграцию",
        "description": "Уровень доступа агента и настройки CRM: воронка, этап, ответственный, разрешённые поля.",
        "operationId": "update_integration_v1_agents__agent_id__integrations__integration_type__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "integration_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Integration Type"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Integration"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Интеграции"
        ],
        "summary": "Отключить интеграцию",
        "operationId": "disconnect_integration_v1_agents__agent_id__integrations__integration_type__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "integration_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Integration Type"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/integrations/{integration_type}/options": {
      "get": {
        "tags": [
          "Интеграции"
        ],
        "summary": "Варианты настроек CRM",
        "description": "Воронки, этапы, пользователи и поля сделок из CRM — для `settings`.",
        "operationId": "integration_options_v1_agents__agent_id__integrations__integration_type__options_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "integration_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Integration Type"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Integration Options V1 Agents  Agent Id  Integrations  Integration Type  Options Get"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/integrations/{integration_type}/check": {
      "post": {
        "tags": [
          "Интеграции"
        ],
        "summary": "Проверить интеграцию",
        "description": "Реальный запрос к сервису. Для встреч создаётся тестовая встреча (`arguments`: topic, start, end).",
        "operationId": "check_integration_v1_agents__agent_id__integrations__integration_type__check_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "integration_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Integration Type"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResult"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/conversations": {
      "get": {
        "tags": [
          "Диалоги"
        ],
        "summary": "Диалоги агента",
        "description": "Сначала диалоги с последней активностью.",
        "operationId": "list_conversations_v1_agents__agent_id__conversations_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "maximum": 200,
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "title": "Limit"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 512
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "clients",
                "test",
                "all"
              ],
              "type": "string",
              "description": "clients — с клиентами, test — тестовый чат",
              "default": "clients",
              "title": "Kind"
            },
            "description": "clients — с клиентами, test — тестовый чат"
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 50
                },
                {
                  "type": "null"
                }
              ],
              "title": "Channel"
            }
          },
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO 8601",
              "title": "Updated Since"
            },
            "description": "ISO 8601"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 120
                },
                {
                  "type": "null"
                }
              ],
              "description": "Текст в сообщениях или имени клиента",
              "title": "Search"
            },
            "description": "Текст в сообщениях или имени клиента"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_Conversation_"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/conversations/{conversation_id}": {
      "get": {
        "tags": [
          "Диалоги"
        ],
        "summary": "Диалог",
        "description": "Диалог с данными клиента, которые собрал агент (`metadata`).",
        "operationId": "get_conversation_v1_agents__agent_id__conversations__conversation_id__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "conversation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Conversation Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/conversations/{conversation_id}/messages": {
      "get": {
        "tags": [
          "Диалоги"
        ],
        "summary": "Сообщения диалога",
        "operationId": "list_messages_v1_agents__agent_id__conversations__conversation_id__messages_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "conversation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Conversation Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "maximum": 200,
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "title": "Limit"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 512
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string",
              "default": "asc",
              "title": "Order"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_Message_"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/corrections": {
      "get": {
        "tags": [
          "Исправления"
        ],
        "summary": "Исправления ответов",
        "operationId": "list_corrections_v1_agents__agent_id__corrections_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "maximum": 200,
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "title": "Limit"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 512
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_Correction_"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Исправления"
        ],
        "summary": "Добавить исправление",
        "description": "Как агенту ответить правильно. С `message_id` вопрос клиента и неверный ответ берутся из диалога.",
        "operationId": "create_correction_v1_agents__agent_id__corrections_post",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CorrectionCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Correction"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{agent_id}/corrections/{correction_id}": {
      "get": {
        "tags": [
          "Исправления"
        ],
        "summary": "Исправление",
        "operationId": "get_correction_v1_agents__agent_id__corrections__correction_id__get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "correction_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Correction Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Correction"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Исправления"
        ],
        "summary": "Изменить исправление",
        "operationId": "update_correction_v1_agents__agent_id__corrections__correction_id__patch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "correction_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Correction Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CorrectionUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Correction"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Исправления"
        ],
        "summary": "Удалить исправление",
        "operationId": "delete_correction_v1_agents__agent_id__corrections__correction_id__delete",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Agent Id"
            }
          },
          {
            "name": "correction_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Correction Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "400": {
            "description": "Некорректный запрос",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Нет токена или он недействителен",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Не хватает прав токена, роли в команде или доступ по тарифу закончился",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден или нет доступа",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Конфликт с текущим состоянием",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Ошибка валидации",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Превышен лимит запросов",
            "content": {
              "application/problem+json": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Account": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id",
            "description": "Telegram ID пользователя"
          },
          "username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Username"
          },
          "account_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "business",
                  "developer"
                ]
              },
              {
                "type": "string"
              }
            ],
            "title": "Account Type"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "trial_active": {
            "type": "boolean",
            "title": "Trial Active"
          },
          "trial_ends_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trial Ends At"
          },
          "has_full_access": {
            "type": "boolean",
            "title": "Has Full Access",
            "description": "Можно подключать каналы клиентам"
          },
          "has_build_access": {
            "type": "boolean",
            "title": "Has Build Access",
            "description": "Можно создавать и настраивать агентов"
          },
          "subscription": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SubscriptionInfo"
              },
              {
                "type": "null"
              }
            ]
          },
          "agents_owned": {
            "type": "integer",
            "title": "Agents Owned"
          },
          "agents_in_team": {
            "type": "integer",
            "title": "Agents In Team"
          },
          "token": {
            "additionalProperties": true,
            "type": "object",
            "title": "Token",
            "description": "Текущий токен: тип, название, права"
          }
        },
        "type": "object",
        "required": [
          "id",
          "username",
          "account_type",
          "created_at",
          "trial_active",
          "trial_ends_at",
          "has_full_access",
          "has_build_access",
          "subscription",
          "agents_owned",
          "agents_in_team",
          "token"
        ],
        "title": "Account"
      },
      "ActivityEvent": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "source": {
            "type": "string",
            "title": "Source"
          },
          "event_type": {
            "type": "string",
            "title": "Event Type"
          },
          "summary": {
            "type": "string",
            "title": "Summary"
          },
          "details": {
            "additionalProperties": true,
            "type": "object",
            "title": "Details"
          },
          "conversation_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conversation Id"
          }
        },
        "type": "object",
        "required": [
          "id",
          "created_at",
          "source",
          "event_type",
          "summary",
          "details",
          "conversation_id"
        ],
        "title": "ActivityEvent"
      },
      "AgentCreate": {
        "properties": {
          "company_name": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "Company Name"
          },
          "company_description": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Company Description"
          },
          "persona_name": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "Persona Name",
            "description": "Имя агента для клиентов"
          },
          "job_title": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "Job Title",
            "description": "Должность агента"
          },
          "goal": {
            "type": "string",
            "maxLength": 4000,
            "minLength": 1,
            "title": "Goal",
            "description": "Конечная цель диалога"
          },
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "Название в списке агентов"
          },
          "instructions": {
            "type": "string",
            "maxLength": 40000,
            "title": "Instructions",
            "description": "Инструкции: как вести диалог",
            "default": ""
          },
          "limitations": {
            "type": "string",
            "maxLength": 12000,
            "title": "Limitations",
            "default": ""
          },
          "tone": {
            "type": "string",
            "maxLength": 12000,
            "title": "Tone",
            "default": ""
          },
          "frequently_asked_questions": {
            "type": "string",
            "maxLength": 24000,
            "title": "Frequently Asked Questions",
            "default": ""
          },
          "client_data_fields": {
            "items": {
              "type": "string",
              "enum": [
                "name",
                "phone",
                "email",
                "telegram",
                "delivery_address",
                "city",
                "age"
              ]
            },
            "type": "array",
            "maxItems": 7,
            "title": "Client Data Fields"
          },
          "work_schedule": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/WorkDay"
                },
                "type": "array",
                "maxItems": 7,
                "minItems": 7
              },
              {
                "type": "null"
              }
            ],
            "title": "Work Schedule"
          },
          "follow_up": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Follow Up"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "company_name",
          "company_description",
          "persona_name",
          "job_title",
          "goal"
        ],
        "title": "AgentCreate",
        "description": "A new agent. ``name`` defaults to «persona_name — company_name»."
      },
      "AgentDetail": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "owner_id": {
            "type": "integer",
            "title": "Owner Id"
          },
          "role": {
            "type": "string",
            "title": "Role"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "persona_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Persona Name"
          },
          "job_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Title"
          },
          "company_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Company Name"
          },
          "company_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Company Description"
          },
          "goal": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Goal"
          },
          "instructions": {
            "type": "string",
            "title": "Instructions"
          },
          "limitations": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limitations"
          },
          "tone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tone"
          },
          "frequently_asked_questions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Frequently Asked Questions"
          },
          "client_data_fields": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Client Data Fields"
          },
          "work_schedule": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Work Schedule",
            "description": "7 дней с понедельника: enabled, from, to (МСК)"
          },
          "follow_up": {
            "additionalProperties": true,
            "type": "object",
            "title": "Follow Up",
            "description": "Настройки дожима молчащих клиентов"
          },
          "is_paused": {
            "type": "boolean",
            "title": "Is Paused"
          },
          "setup_complete": {
            "type": "boolean",
            "title": "Setup Complete"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "owner_id",
          "role",
          "name",
          "persona_name",
          "job_title",
          "company_name",
          "company_description",
          "goal",
          "instructions",
          "limitations",
          "tone",
          "frequently_asked_questions",
          "client_data_fields",
          "work_schedule",
          "follow_up",
          "is_paused",
          "setup_complete",
          "created_at"
        ],
        "title": "AgentDetail"
      },
      "AgentOverview": {
        "properties": {
          "agent": {
            "$ref": "#/components/schemas/AgentDetail"
          },
          "knowledge": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "Knowledge"
          },
          "tools": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Tools"
          },
          "variables": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Variables"
          },
          "channels": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Channels"
          },
          "integrations": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Integrations"
          },
          "corrections": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "Corrections"
          },
          "conversations": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "Conversations"
          },
          "hints": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Hints",
            "description": "Что стоит настроить дальше"
          }
        },
        "type": "object",
        "required": [
          "agent",
          "knowledge",
          "tools",
          "variables",
          "channels",
          "integrations",
          "corrections",
          "conversations",
          "hints"
        ],
        "title": "AgentOverview"
      },
      "AgentSummary": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "company_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Company Name"
          },
          "persona_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Persona Name"
          },
          "is_paused": {
            "type": "boolean",
            "title": "Is Paused"
          },
          "role": {
            "type": "string",
            "title": "Role",
            "description": "owner — ваш агент, иначе ваша роль в команде"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "company_name",
          "persona_name",
          "is_paused",
          "role",
          "created_at"
        ],
        "title": "AgentSummary"
      },
      "AgentUpdate": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "company_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Company Name"
          },
          "company_description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Company Description"
          },
          "persona_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "Persona Name"
          },
          "job_title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Title"
          },
          "goal": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 4000,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Goal"
          },
          "instructions": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40000
              },
              {
                "type": "null"
              }
            ],
            "title": "Instructions"
          },
          "limitations": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 12000
              },
              {
                "type": "null"
              }
            ],
            "title": "Limitations"
          },
          "tone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 12000
              },
              {
                "type": "null"
              }
            ],
            "title": "Tone"
          },
          "frequently_asked_questions": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 24000
              },
              {
                "type": "null"
              }
            ],
            "title": "Frequently Asked Questions"
          },
          "client_data_fields": {
            "anyOf": [
              {
                "items": {
                  "type": "string",
                  "enum": [
                    "name",
                    "phone",
                    "email",
                    "telegram",
                    "delivery_address",
                    "city",
                    "age"
                  ]
                },
                "type": "array",
                "maxItems": 7
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Data Fields"
          },
          "work_schedule": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/WorkDay"
                },
                "type": "array",
                "maxItems": 7,
                "minItems": 7
              },
              {
                "type": "null"
              }
            ],
            "title": "Work Schedule"
          },
          "follow_up": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Follow Up"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "AgentUpdate",
        "description": "Partial update: only the fields present are changed (JSON Merge Patch)."
      },
      "Body_add_file_v1_agents__agent_id__knowledge_files_post": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File",
            "description": "PDF, DOCX, XLSX, PPTX, TXT, MD, RTF и др., до 200 МБ"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_add_file_v1_agents__agent_id__knowledge_files_post"
      },
      "Body_add_material_v1_agents__agent_id__materials_post": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          },
          "description": {
            "type": "string",
            "maxLength": 4000,
            "title": "Description",
            "description": "Когда агенту отправлять файл",
            "default": ""
          },
          "purpose": {
            "type": "string",
            "enum": [
              "clients",
              "answers",
              "both"
            ],
            "title": "Purpose",
            "default": "clients"
          },
          "media_type": {
            "type": "string",
            "maxLength": 30,
            "title": "Media Type",
            "description": "auto, document, photo, video, audio",
            "default": "auto"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_add_material_v1_agents__agent_id__materials_post"
      },
      "BuiltinTool": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "display_name": {
            "type": "string",
            "title": "Display Name"
          },
          "description": {
            "type": "string",
            "title": "Description"
          }
        },
        "type": "object",
        "required": [
          "name",
          "display_name",
          "description"
        ],
        "title": "BuiltinTool"
      },
      "CRMSettings": {
        "properties": {
          "pipeline_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Pipeline Id"
          },
          "initial_stage_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 128
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Stage Id"
          },
          "responsible_user_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Responsible User Id"
          },
          "allowed_fields": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "maxItems": 100,
            "title": "Allowed Fields"
          },
          "can_close_deals": {
            "type": "boolean",
            "title": "Can Close Deals",
            "default": false
          },
          "auto_sync_handoff": {
            "type": "boolean",
            "title": "Auto Sync Handoff",
            "default": true
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "CRMSettings"
      },
      "Channel": {
        "properties": {
          "type": {
            "type": "string",
            "title": "Type"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "connected": {
            "type": "boolean",
            "title": "Connected"
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled"
          },
          "paused": {
            "type": "boolean",
            "title": "Paused"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "account_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Name"
          },
          "account_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id"
          },
          "media_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Media Enabled"
          },
          "details": {
            "additionalProperties": true,
            "type": "object",
            "title": "Details",
            "description": "Данные для настройки: код виджета, адрес вебхука VK и т. п."
          }
        },
        "type": "object",
        "required": [
          "type",
          "label",
          "connected",
          "enabled",
          "paused",
          "status",
          "account_name",
          "account_id",
          "media_enabled"
        ],
        "title": "Channel"
      },
      "ChannelConnect": {
        "properties": {
          "token": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 4096
              },
              {
                "type": "null"
              }
            ],
            "title": "Token",
            "description": "telegram_bot, max_bot, wazzup"
          },
          "group_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Group Id",
            "description": "vk_community"
          },
          "access_token": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 4096
              },
              {
                "type": "null"
              }
            ],
            "title": "Access Token",
            "description": "vk_community"
          },
          "origin": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2048
              },
              {
                "type": "null"
              }
            ],
            "title": "Origin",
            "description": "website_chat: https://ваш-сайт"
          },
          "client_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Id",
            "description": "avito"
          },
          "client_secret": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1024
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Secret",
            "description": "avito"
          },
          "channel_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array",
                "maxItems": 100
              },
              {
                "type": "null"
              }
            ],
            "title": "Channel Ids",
            "description": "wazzup"
          },
          "replace_webhook": {
            "type": "boolean",
            "title": "Replace Webhook",
            "description": "wazzup",
            "default": false
          },
          "pause_on_external": {
            "type": "boolean",
            "title": "Pause On External",
            "description": "wazzup",
            "default": true
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "ChannelConnect",
        "description": "Credentials of a channel; which fields are required depends on its type."
      },
      "ChannelConnected": {
        "properties": {
          "channel": {
            "$ref": "#/components/schemas/Channel"
          },
          "warning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Warning"
          }
        },
        "type": "object",
        "required": [
          "channel"
        ],
        "title": "ChannelConnected"
      },
      "ChannelType": {
        "properties": {
          "type": {
            "type": "string",
            "title": "Type"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "description": {
            "type": "string",
            "title": "Description"
          },
          "api_connectable": {
            "type": "boolean",
            "title": "Api Connectable",
            "description": "false — подключается только в Mini App (вход по коду)"
          },
          "available": {
            "type": "boolean",
            "title": "Available",
            "description": "Подключение настроено на сервере"
          },
          "media_supported": {
            "type": "boolean",
            "title": "Media Supported"
          },
          "credential_fields": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Credential Fields"
          }
        },
        "type": "object",
        "required": [
          "type",
          "label",
          "description",
          "api_connectable",
          "available",
          "media_supported",
          "credential_fields"
        ],
        "title": "ChannelType"
      },
      "ChannelUpdate": {
        "properties": {
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled",
            "description": "false — поставить канал на паузу"
          },
          "media_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Media Enabled"
          },
          "confirmation_token": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ],
            "title": "Confirmation Token",
            "description": "vk_community"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "ChannelUpdate"
      },
      "CheckRequest": {
        "properties": {
          "confirmed_real_execution": {
            "type": "boolean",
            "const": true,
            "title": "Confirmed Real Execution",
            "description": "Проверка выполняет реальный вызов внешнего сервиса. Передайте true."
          },
          "arguments": {
            "additionalProperties": true,
            "type": "object",
            "title": "Arguments"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "confirmed_real_execution"
        ],
        "title": "CheckRequest"
      },
      "CheckResult": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "verification": {
            "$ref": "#/components/schemas/Verification"
          },
          "result": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Result"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "verification",
          "result"
        ],
        "title": "CheckResult"
      },
      "Conversation": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "agent_id": {
            "type": "integer",
            "title": "Agent Id"
          },
          "channel": {
            "type": "string",
            "title": "Channel"
          },
          "channel_label": {
            "type": "string",
            "title": "Channel Label"
          },
          "contact_name": {
            "type": "string",
            "title": "Contact Name"
          },
          "external_chat_id": {
            "type": "string",
            "title": "External Chat Id"
          },
          "is_test": {
            "type": "boolean",
            "title": "Is Test"
          },
          "ai_enabled": {
            "type": "boolean",
            "title": "Ai Enabled"
          },
          "reply_mode": {
            "type": "string",
            "title": "Reply Mode",
            "description": "agent, human (ведёт оператор) или paused"
          },
          "message_count": {
            "type": "integer",
            "title": "Message Count"
          },
          "last_message": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MessagePreview"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "agent_id",
          "channel",
          "channel_label",
          "contact_name",
          "external_chat_id",
          "is_test",
          "ai_enabled",
          "reply_mode",
          "message_count",
          "last_message",
          "created_at",
          "updated_at"
        ],
        "title": "Conversation"
      },
      "ConversationDetail": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "agent_id": {
            "type": "integer",
            "title": "Agent Id"
          },
          "channel": {
            "type": "string",
            "title": "Channel"
          },
          "channel_label": {
            "type": "string",
            "title": "Channel Label"
          },
          "contact_name": {
            "type": "string",
            "title": "Contact Name"
          },
          "external_chat_id": {
            "type": "string",
            "title": "External Chat Id"
          },
          "is_test": {
            "type": "boolean",
            "title": "Is Test"
          },
          "ai_enabled": {
            "type": "boolean",
            "title": "Ai Enabled"
          },
          "reply_mode": {
            "type": "string",
            "title": "Reply Mode",
            "description": "agent, human (ведёт оператор) или paused"
          },
          "message_count": {
            "type": "integer",
            "title": "Message Count"
          },
          "last_message": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MessagePreview"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "metadata": {
            "additionalProperties": true,
            "type": "object",
            "title": "Metadata",
            "description": "Данные клиента и диалога, собранные агентом"
          }
        },
        "type": "object",
        "required": [
          "id",
          "agent_id",
          "channel",
          "channel_label",
          "contact_name",
          "external_chat_id",
          "is_test",
          "ai_enabled",
          "reply_mode",
          "message_count",
          "last_message",
          "created_at",
          "updated_at",
          "metadata"
        ],
        "title": "ConversationDetail"
      },
      "Correction": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "customer_message": {
            "type": "string",
            "title": "Customer Message"
          },
          "incorrect_agent_response": {
            "type": "string",
            "title": "Incorrect Agent Response"
          },
          "expected_agent_response": {
            "type": "string",
            "title": "Expected Agent Response"
          },
          "context": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context"
          },
          "is_enabled": {
            "type": "boolean",
            "title": "Is Enabled"
          },
          "indexed": {
            "type": "boolean",
            "title": "Indexed"
          },
          "source_message_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Message Id"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "customer_message",
          "incorrect_agent_response",
          "expected_agent_response",
          "context",
          "is_enabled",
          "indexed",
          "source_message_id",
          "created_at",
          "updated_at"
        ],
        "title": "Correction"
      },
      "CorrectionCreate": {
        "properties": {
          "expected_agent_response": {
            "type": "string",
            "maxLength": 10000,
            "minLength": 1,
            "title": "Expected Agent Response"
          },
          "customer_message": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "title": "Customer Message"
          },
          "incorrect_agent_response": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "title": "Incorrect Agent Response"
          },
          "context": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "title": "Context"
          },
          "message_id": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Message Id",
            "description": "ID ответа агента в диалоге"
          },
          "is_enabled": {
            "type": "boolean",
            "title": "Is Enabled",
            "default": true
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "expected_agent_response"
        ],
        "title": "CorrectionCreate",
        "description": "Either give the texts, or ``message_id`` of the agent's reply in a dialog:\nthe client's message and the wrong reply are then taken from the dialog."
      },
      "CorrectionUpdate": {
        "properties": {
          "customer_message": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Customer Message"
          },
          "incorrect_agent_response": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "title": "Incorrect Agent Response"
          },
          "expected_agent_response": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Agent Response"
          },
          "context": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "title": "Context"
          },
          "is_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Enabled"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "CorrectionUpdate"
      },
      "Integration": {
        "properties": {
          "type": {
            "type": "string",
            "title": "Type"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "configured": {
            "type": "boolean",
            "title": "Configured"
          },
          "connected": {
            "type": "boolean",
            "title": "Connected"
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled"
          },
          "access_mode": {
            "type": "string",
            "title": "Access Mode"
          },
          "account_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Name"
          },
          "settings": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Settings"
          },
          "verification": {
            "$ref": "#/components/schemas/Verification"
          }
        },
        "type": "object",
        "required": [
          "type",
          "label",
          "configured",
          "connected",
          "enabled",
          "access_mode",
          "account_name",
          "settings",
          "verification"
        ],
        "title": "Integration"
      },
      "IntegrationConnect": {
        "properties": {
          "access_mode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "read",
                  "write"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Access Mode"
          },
          "account_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512
              },
              {
                "type": "null"
              }
            ],
            "title": "Account Id",
            "description": "zoom"
          },
          "client_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Id",
            "description": "zoom, yandex_telemost"
          },
          "client_secret": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2048
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Secret",
            "description": "zoom"
          },
          "access_token": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 4096
              },
              {
                "type": "null"
              }
            ],
            "title": "Access Token",
            "description": "yandex_telemost"
          },
          "login": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "Login",
            "description": "yandex_calendar"
          },
          "app_password": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ],
            "title": "App Password",
            "description": "yandex_calendar"
          },
          "address": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "Address",
            "description": "amocrm: адрес аккаунта"
          },
          "token": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 8192
              },
              {
                "type": "null"
              }
            ],
            "title": "Token",
            "description": "amocrm: долгосрочный токен"
          },
          "webhook_url": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url",
            "description": "bitrix24: входящий вебхук"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "IntegrationConnect",
        "description": "Credentials; which fields are required depends on the integration type."
      },
      "IntegrationType": {
        "properties": {
          "type": {
            "type": "string",
            "title": "Type"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "description": {
            "type": "string",
            "title": "Description"
          },
          "default_access_mode": {
            "type": "string",
            "title": "Default Access Mode"
          },
          "credential_fields": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Credential Fields"
          },
          "has_settings": {
            "type": "boolean",
            "title": "Has Settings"
          }
        },
        "type": "object",
        "required": [
          "type",
          "label",
          "description",
          "default_access_mode",
          "credential_fields",
          "has_settings"
        ],
        "title": "IntegrationType"
      },
      "IntegrationUpdate": {
        "properties": {
          "access_mode": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "read",
                  "write"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Access Mode"
          },
          "settings": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CRMSettings"
              },
              {
                "type": "null"
              }
            ],
            "description": "Только для amocrm и bitrix24"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "IntegrationUpdate"
      },
      "KnowledgeDocument": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "title": {
            "type": "string",
            "title": "Title"
          },
          "file_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "File Name"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "characters": {
            "type": "integer",
            "title": "Characters"
          },
          "size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Size Bytes"
          },
          "has_original_file": {
            "type": "boolean",
            "title": "Has Original File"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "title",
          "file_name",
          "status",
          "characters",
          "size_bytes",
          "has_original_file",
          "created_at"
        ],
        "title": "KnowledgeDocument"
      },
      "KnowledgeDocumentDetail": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "title": {
            "type": "string",
            "title": "Title"
          },
          "file_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "File Name"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "characters": {
            "type": "integer",
            "title": "Characters"
          },
          "size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Size Bytes"
          },
          "has_original_file": {
            "type": "boolean",
            "title": "Has Original File"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          }
        },
        "type": "object",
        "required": [
          "id",
          "title",
          "file_name",
          "status",
          "characters",
          "size_bytes",
          "has_original_file",
          "created_at",
          "content"
        ],
        "title": "KnowledgeDocumentDetail"
      },
      "KnowledgeSearch": {
        "properties": {
          "query": {
            "type": "string",
            "maxLength": 500,
            "minLength": 1,
            "title": "Query"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "query"
        ],
        "title": "KnowledgeSearch"
      },
      "KnowledgeSearchResult": {
        "properties": {
          "query": {
            "type": "string",
            "title": "Query"
          },
          "result": {
            "type": "string",
            "title": "Result",
            "description": "Ровно то, что получит агент из search_knowledge_base"
          }
        },
        "type": "object",
        "required": [
          "query",
          "result"
        ],
        "title": "KnowledgeSearchResult"
      },
      "KnowledgeTextCreate": {
        "properties": {
          "content": {
            "type": "string",
            "maxLength": 100000,
            "minLength": 1,
            "title": "Content"
          },
          "title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "Title",
            "description": "Заголовок документа"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "content"
        ],
        "title": "KnowledgeTextCreate"
      },
      "KnowledgeUpdate": {
        "properties": {
          "content": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100000,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          },
          "title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "KnowledgeUpdate"
      },
      "KnowledgeWriteResult": {
        "properties": {
          "document": {
            "$ref": "#/components/schemas/KnowledgeDocument"
          },
          "indexed": {
            "type": "boolean",
            "title": "Indexed",
            "description": "Построены векторы для семантического поиска"
          },
          "images_pending": {
            "type": "integer",
            "title": "Images Pending",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "document",
          "indexed"
        ],
        "title": "KnowledgeWriteResult"
      },
      "Material": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "file_name": {
            "type": "string",
            "title": "File Name"
          },
          "mime_type": {
            "type": "string",
            "title": "Mime Type"
          },
          "media_type": {
            "type": "string",
            "title": "Media Type"
          },
          "size_bytes": {
            "type": "integer",
            "title": "Size Bytes"
          },
          "description": {
            "type": "string",
            "title": "Description"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "file_name",
          "mime_type",
          "media_type",
          "size_bytes",
          "description",
          "created_at"
        ],
        "title": "Material"
      },
      "MaterialCreated": {
        "properties": {
          "purpose": {
            "type": "string",
            "enum": [
              "answers",
              "clients",
              "both"
            ],
            "title": "Purpose"
          },
          "material": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Material"
              },
              {
                "type": "null"
              }
            ]
          },
          "document": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/KnowledgeDocument"
              },
              {
                "type": "null"
              }
            ]
          },
          "indexed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Indexed"
          },
          "images_pending": {
            "type": "integer",
            "title": "Images Pending",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "purpose",
          "material",
          "document",
          "indexed"
        ],
        "title": "MaterialCreated"
      },
      "MaterialUpdate": {
        "properties": {
          "description": {
            "type": "string",
            "maxLength": 4000,
            "minLength": 1,
            "title": "Description"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "description"
        ],
        "title": "MaterialUpdate"
      },
      "Message": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "conversation_id": {
            "type": "integer",
            "title": "Conversation Id"
          },
          "role": {
            "type": "string",
            "title": "Role",
            "description": "user — клиент, assistant — агент или оператор"
          },
          "author_kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author Kind",
            "description": "agent, human, follow_up или null"
          },
          "content": {
            "type": "string",
            "title": "Content"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "conversation_id",
          "role",
          "author_kind",
          "content",
          "created_at"
        ],
        "title": "Message"
      },
      "MessagePreview": {
        "properties": {
          "role": {
            "type": "string",
            "title": "Role"
          },
          "author_kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author Kind"
          },
          "content": {
            "type": "string",
            "title": "Content"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "role",
          "author_kind",
          "content",
          "created_at"
        ],
        "title": "MessagePreview"
      },
      "Page_ActivityEvent_": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/ActivityEvent"
            },
            "type": "array",
            "title": "Data"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor",
            "description": "Курсор следующей страницы; null — страниц больше нет."
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Page[ActivityEvent]"
      },
      "Page_AgentSummary_": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/AgentSummary"
            },
            "type": "array",
            "title": "Data"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor",
            "description": "Курсор следующей страницы; null — страниц больше нет."
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Page[AgentSummary]"
      },
      "Page_Conversation_": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/Conversation"
            },
            "type": "array",
            "title": "Data"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor",
            "description": "Курсор следующей страницы; null — страниц больше нет."
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Page[Conversation]"
      },
      "Page_Correction_": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/Correction"
            },
            "type": "array",
            "title": "Data"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor",
            "description": "Курсор следующей страницы; null — страниц больше нет."
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Page[Correction]"
      },
      "Page_KnowledgeDocument_": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/KnowledgeDocument"
            },
            "type": "array",
            "title": "Data"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor",
            "description": "Курсор следующей страницы; null — страниц больше нет."
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Page[KnowledgeDocument]"
      },
      "Page_Message_": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "type": "array",
            "title": "Data"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor",
            "description": "Курсор следующей страницы; null — страниц больше нет."
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "Page[Message]"
      },
      "Problem": {
        "properties": {
          "type": {
            "type": "string",
            "title": "Type"
          },
          "title": {
            "type": "string",
            "title": "Title"
          },
          "status": {
            "type": "integer",
            "title": "Status"
          },
          "detail": {
            "type": "string",
            "title": "Detail"
          },
          "code": {
            "type": "string",
            "title": "Code"
          },
          "instance": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instance"
          },
          "errors": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Errors"
          }
        },
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code"
        ],
        "title": "Problem",
        "description": "RFC 9457 problem details."
      },
      "SubscriptionInfo": {
        "properties": {
          "tariff_code": {
            "type": "string",
            "title": "Tariff Code"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "ends_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ends At"
          },
          "budget_limit_rub": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Budget Limit Rub",
            "description": "AI-бюджет периода, ₽"
          },
          "budget_remaining_rub": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Budget Remaining Rub",
            "description": "Остаток AI-бюджета, ₽"
          }
        },
        "type": "object",
        "required": [
          "tariff_code",
          "status",
          "started_at",
          "ends_at",
          "budget_limit_rub",
          "budget_remaining_rub"
        ],
        "title": "SubscriptionInfo"
      },
      "SystemPrompt": {
        "properties": {
          "agent_id": {
            "type": "integer",
            "title": "Agent Id"
          },
          "system_prompt": {
            "type": "string",
            "title": "System Prompt",
            "description": "Системный промпт из настроек агента. Инструкции к инструментам и найденные исправления добавляются в каждом ходе отдельно."
          }
        },
        "type": "object",
        "required": [
          "agent_id",
          "system_prompt"
        ],
        "title": "SystemPrompt"
      },
      "Team": {
        "properties": {
          "roles": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Roles"
          },
          "permissions": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Permissions"
          },
          "members": {
            "items": {
              "$ref": "#/components/schemas/TeamMember"
            },
            "type": "array",
            "title": "Members"
          }
        },
        "type": "object",
        "required": [
          "roles",
          "permissions",
          "members"
        ],
        "title": "Team"
      },
      "TeamMember": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "user_id": {
            "type": "integer",
            "title": "User Id"
          },
          "display_name": {
            "type": "string",
            "title": "Display Name"
          },
          "username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Username"
          },
          "role": {
            "type": "string",
            "title": "Role"
          }
        },
        "type": "object",
        "required": [
          "id",
          "user_id",
          "display_name",
          "username",
          "role"
        ],
        "title": "TeamMember"
      },
      "Tool": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "display_name": {
            "type": "string",
            "title": "Display Name"
          },
          "description": {
            "type": "string",
            "title": "Description"
          },
          "type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "http",
                  "python"
                ]
              },
              {
                "type": "string"
              }
            ],
            "title": "Type"
          },
          "verification": {
            "$ref": "#/components/schemas/Verification"
          },
          "config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config",
            "description": "Конфигурация; значения секретных заголовков скрыты как [REDACTED]"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "display_name",
          "description",
          "type",
          "verification",
          "config",
          "created_at",
          "updated_at"
        ],
        "title": "Tool"
      },
      "ToolCreate": {
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "http",
              "python"
            ],
            "title": "Type"
          },
          "name": {
            "type": "string",
            "maxLength": 64,
            "minLength": 1,
            "title": "Name",
            "description": "snake_case, уникально у агента"
          },
          "display_name": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1,
            "title": "Display Name"
          },
          "description": {
            "type": "string",
            "maxLength": 4000,
            "minLength": 1,
            "title": "Description",
            "description": "Когда и зачем агенту вызывать инструмент"
          },
          "config": {
            "additionalProperties": true,
            "type": "object",
            "title": "Config"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "type",
          "name",
          "display_name",
          "description",
          "config"
        ],
        "title": "ToolCreate",
        "description": "``config`` follows the HTTP or Python tool schema, see the documentation."
      },
      "ToolUpdate": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 4000,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "config": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config",
            "description": "Полная новая конфигурация (заменяет прежнюю)"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "ToolUpdate"
      },
      "Usage": {
        "properties": {
          "date_from": {
            "type": "string",
            "format": "date-time",
            "title": "Date From"
          },
          "date_to": {
            "type": "string",
            "format": "date-time",
            "title": "Date To"
          },
          "requests": {
            "type": "integer",
            "title": "Requests"
          },
          "input_tokens": {
            "type": "integer",
            "title": "Input Tokens"
          },
          "output_tokens": {
            "type": "integer",
            "title": "Output Tokens"
          },
          "cost_rub": {
            "type": "string",
            "title": "Cost Rub"
          },
          "by_agent": {
            "items": {
              "$ref": "#/components/schemas/UsageByAgent"
            },
            "type": "array",
            "title": "By Agent"
          }
        },
        "type": "object",
        "required": [
          "date_from",
          "date_to",
          "requests",
          "input_tokens",
          "output_tokens",
          "cost_rub",
          "by_agent"
        ],
        "title": "Usage"
      },
      "UsageByAgent": {
        "properties": {
          "agent_id": {
            "type": "integer",
            "title": "Agent Id"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name"
          },
          "requests": {
            "type": "integer",
            "title": "Requests"
          },
          "input_tokens": {
            "type": "integer",
            "title": "Input Tokens"
          },
          "output_tokens": {
            "type": "integer",
            "title": "Output Tokens"
          },
          "cost_rub": {
            "type": "string",
            "title": "Cost Rub"
          }
        },
        "type": "object",
        "required": [
          "agent_id",
          "agent_name",
          "requests",
          "input_tokens",
          "output_tokens",
          "cost_rub"
        ],
        "title": "UsageByAgent"
      },
      "Variable": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "description": {
            "type": "string",
            "title": "Description"
          },
          "is_secret": {
            "type": "boolean",
            "title": "Is Secret"
          },
          "has_value": {
            "type": "boolean",
            "title": "Has Value"
          },
          "value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Value",
            "description": "Значение несекретной переменной; секреты не выдаются"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "is_secret",
          "has_value",
          "value",
          "updated_at"
        ],
        "title": "Variable"
      },
      "VariableCreate": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 64,
            "minLength": 1,
            "title": "Name",
            "description": "Заглавная латиница, цифры и _"
          },
          "description": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Description"
          },
          "is_secret": {
            "type": "boolean",
            "title": "Is Secret",
            "default": true
          },
          "value": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "title": "Value"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "name",
          "description"
        ],
        "title": "VariableCreate"
      },
      "VariableUpdate": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "is_secret": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Secret"
          },
          "value": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "title": "Value"
          },
          "clear_value": {
            "type": "boolean",
            "title": "Clear Value",
            "default": false
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "VariableUpdate"
      },
      "Verification": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "description": "verified, check_failed или requires_setup"
          },
          "checked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Checked At"
          },
          "check_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Check Message"
          }
        },
        "type": "object",
        "required": [
          "status",
          "checked_at",
          "check_message"
        ],
        "title": "Verification"
      },
      "WazzupInspect": {
        "properties": {
          "token": {
            "type": "string",
            "maxLength": 4096,
            "minLength": 1,
            "title": "Token"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "token"
        ],
        "title": "WazzupInspect"
      },
      "WorkDay": {
        "properties": {
          "enabled": {
            "type": "boolean",
            "title": "Enabled"
          },
          "from": {
            "type": "string",
            "pattern": "^\\d{2}:\\d{2}$",
            "title": "From"
          },
          "to": {
            "type": "string",
            "pattern": "^\\d{2}:\\d{2}$",
            "title": "To"
          }
        },
        "type": "object",
        "required": [
          "enabled",
          "from",
          "to"
        ],
        "title": "WorkDay",
        "description": "One day of the week, Monday first, in Moscow time (HH:MM)."
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "description": "Персональный API-ключ из Mini App «API и MCP» или OAuth 2.1 access token.",
        "scheme": "bearer",
        "bearerFormat": "API-ключ gtk_live_… или OAuth access token gto_at_…"
      },
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.1 Authorization Code + PKCE (S256).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://api.gptalkai.ru/oauth/authorize",
            "tokenUrl": "https://api.gptalkai.ru/oauth/token",
            "refreshUrl": "https://api.gptalkai.ru/oauth/token",
            "scopes": {
              "agents:read": "Читать агентов, их настройки, системный промпт и журнал",
              "agents:write": "Создавать агентов, менять настройки, останавливать и запускать",
              "knowledge:read": "Читать базу знаний и материалы",
              "knowledge:write": "Добавлять, менять и удалять документы и материалы",
              "tools:read": "Читать инструменты и переменные",
              "tools:write": "Создавать, менять, проверять и удалять инструменты и переменные",
              "channels:read": "Читать подключённые каналы",
              "channels:write": "Подключать, настраивать и отключать каналы",
              "integrations:read": "Читать интеграции (CRM, календарь, встречи)",
              "integrations:write": "Подключать, настраивать, проверять и отключать интеграции",
              "dialogs:read": "Читать диалоги агента с клиентами",
              "corrections:read": "Читать исправления ответов агента",
              "corrections:write": "Создавать, менять и удалять исправления ответов"
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Аккаунт",
      "description": "Владелец токена, тариф и расход AI-бюджета."
    },
    {
      "name": "Агенты",
      "description": "Создание и настройка агентов, сводка, промпт, журнал."
    },
    {
      "name": "База знаний",
      "description": "Тексты и документы, по которым агент отвечает клиентам."
    },
    {
      "name": "Материалы",
      "description": "Файлы, которые агент отправляет клиентам."
    },
    {
      "name": "Инструменты",
      "description": "Свои HTTP- и Python-инструменты агента."
    },
    {
      "name": "Переменные",
      "description": "Глобальные значения и секреты для инструментов."
    },
    {
      "name": "Каналы",
      "description": "Где агент общается с клиентами: Telegram, MAX, ВКонтакте, сайт, Avito, Wazzup."
    },
    {
      "name": "Интеграции",
      "description": "amoCRM, Битрикс24, Яндекс Календарь, Zoom, Телемост."
    },
    {
      "name": "Диалоги",
      "description": "Переписка агента с клиентами (только чтение)."
    },
    {
      "name": "Исправления",
      "description": "Правильные ответы на ситуации, где агент ошибся."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "oauth2": []
    }
  ],
  "externalDocs": {
    "description": "MCP-сервер Gptalk AI",
    "url": "https://docs.gptalkai.ru/mcp/"
  }
}