{
    "openapi": "3.0.3",
    "info": {
        "title": "WabaDO API",
        "version": "1.0.0",
        "description": "API для отправки и приёма сообщений через WhatsApp, Telegram, MAX, ботов и сообщества ВКонтакте. Канал в кабинете соответствует `profile_id` в API. Токен передаётся в заголовке `Authorization`."
    },
    "servers": [
        {
            "url": "https://api.wabado.ru"
        }
    ],
    "security": [
        {
            "token": []
        }
    ],
    "tags": [
        {
            "name": "Каналы"
        },
        {
            "name": "Подключение аккаунта"
        },
        {
            "name": "Сообщения"
        },
        {
            "name": "Уведомления"
        },
        {
            "name": "Каскады"
        }
    ],
    "paths": {
        "/api/async/message/file/send": {
            "post": {
                "operationId": "send_file_async",
                "tags": [
                    "Сообщения"
                ],
                "summary": "Поставить файл в очередь",
                "description": "Как очередь для текста. Файлы больше 2 МБ передавайте ссылкой в `url`.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "ttl",
                        "in": "query",
                        "required": false,
                        "description": "Сколько секунд задача может ждать, от 1 до 86400, по умолчанию 600",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "timeout_from",
                        "in": "query",
                        "required": false,
                        "description": "Пауза перед отправкой, от, секунд. По умолчанию 1",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "timeout_to",
                        "in": "query",
                        "required": false,
                        "description": "Пауза перед отправкой, до, секунд. Берётся случайное значение из диапазона",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient": {
                                        "type": "string",
                                        "description": "Номер получателя. Telegram принимает и `@username` (обязательно: да, или chat_id)"
                                    },
                                    "chat_id": {
                                        "type": "string",
                                        "description": "ID чата из уведомления, используйте для ответа (обязательно: да, или recipient)"
                                    },
                                    "url": {
                                        "type": "string",
                                        "description": "Публичная ссылка на файл (обязательно: да, или b64_file)"
                                    },
                                    "b64_file": {
                                        "type": "string",
                                        "description": "Файл в base64 (обязательно: да, или url)"
                                    },
                                    "caption": {
                                        "type": "string",
                                        "description": "Подпись"
                                    },
                                    "file_name": {
                                        "type": "string",
                                        "description": "Имя файла"
                                    },
                                    "mimetype": {
                                        "type": "string",
                                        "description": "Тип файла"
                                    },
                                    "as_document": {
                                        "type": "boolean",
                                        "description": "Отправить документом, а не картинкой или видео"
                                    }
                                }
                            },
                            "example": {
                                "recipient": "79110000000",
                                "url": "https://example.ru/invoice.pdf"
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "task_id": {
                                            "type": "string",
                                            "description": "ID задачи"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "queued",
                                    "task_id": "b1946ac92492d2347c6235b4d2611185",
                                    "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "`file_too_large`: В очереди файл через b64_file не больше 2 МБ",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "`queue_full`: Очередь канала заполнена",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/async/message/send": {
            "post": {
                "operationId": "send_async",
                "tags": [
                    "Сообщения"
                ],
                "summary": "Поставить текст в очередь",
                "description": "Сразу принимает задачу, отправка идёт с паузами. Итог приходит событием `delivery_status` с тем же `task_id`. Очередь хранится только в памяти и не переживает перезапуск сервиса.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "ttl",
                        "in": "query",
                        "required": false,
                        "description": "Сколько секунд задача может ждать, от 1 до 86400, по умолчанию 600",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "timeout_from",
                        "in": "query",
                        "required": false,
                        "description": "Пауза перед отправкой, от, секунд. По умолчанию 1",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "timeout_to",
                        "in": "query",
                        "required": false,
                        "description": "Пауза перед отправкой, до, секунд. Берётся случайное значение из диапазона",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient": {
                                        "type": "string",
                                        "description": "Номер получателя. Telegram принимает и `@username` (обязательно: да, или chat_id)"
                                    },
                                    "chat_id": {
                                        "type": "string",
                                        "description": "ID чата из уведомления, используйте для ответа (обязательно: да, или recipient)"
                                    },
                                    "body": {
                                        "type": "string",
                                        "description": "Текст сообщения"
                                    }
                                },
                                "required": [
                                    "body"
                                ]
                            },
                            "example": {
                                "recipient": "79110000000",
                                "body": "Заказ готов"
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "task_id": {
                                            "type": "string",
                                            "description": "ID задачи"
                                        },
                                        "profile_id": {
                                            "type": "string",
                                            "description": "ID канала"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "queued",
                                    "task_id": "b1946ac92492d2347c6235b4d2611184",
                                    "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`profile_not_connected`: Канал не подключён",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "`queue_full`: Очередь канала заполнена",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "`queue_unavailable`: Очередь недоступна, сообщение не принято",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/auth/code/confirm": {
            "post": {
                "operationId": "auth_code_confirm",
                "tags": [
                    "Подключение аккаунта"
                ],
                "summary": "Подтвердить вход",
                "description": "Для Telegram и MAX: передаёт код или пароль двухэтапной проверки. Если `need_password` равно `true`, повторите запрос с паролем.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "code": {
                                        "type": "string",
                                        "description": "Код из приложения"
                                    },
                                    "password": {
                                        "type": "string",
                                        "description": "Пароль двухэтапной проверки"
                                    }
                                }
                            },
                            "example": {
                                "code": "12345"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "need_password": {
                                            "type": "boolean",
                                            "description": "Нужен ещё пароль"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "need_password": false,
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_code`: Неверный код\n`bad_password`: Неверный пароль\n`unsupported_by_messenger`: WhatsApp подтверждает код на телефоне",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "`worker_unavailable`: Канал сейчас запускается, повторите позже",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/auth/code/request": {
            "post": {
                "operationId": "auth_code_request",
                "tags": [
                    "Подключение аккаунта"
                ],
                "summary": "Запросить код",
                "description": "Вход по номеру для WhatsApp и Telegram. WhatsApp возвращает код в ответе: его нужно ввести на телефоне. Telegram присылает код в приложение.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "phone": {
                                        "type": "string",
                                        "description": "Номер аккаунта"
                                    }
                                },
                                "required": [
                                    "phone"
                                ]
                            },
                            "example": {
                                "phone": "79110000000"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "code": {
                                            "type": "string",
                                            "description": "Код для ввода на телефоне, только WhatsApp"
                                        },
                                        "time_left": {
                                            "type": "integer",
                                            "description": "Сколько секунд действует код"
                                        },
                                        "sent": {
                                            "type": "boolean",
                                            "description": "Код отправлен в приложение"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "code": "ABCD-EFGH",
                                    "time_left": 60,
                                    "sent": false,
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_phone`: Неверный номер\n`unsupported_by_messenger`: Канал не поддерживает вход по коду",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "`worker_unavailable`: Канал сейчас запускается, повторите позже",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/auth/history": {
            "get": {
                "operationId": "auth_history",
                "tags": [
                    "Подключение аккаунта"
                ],
                "summary": "История входов",
                "description": "Последние 100 входов и выходов канала.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "history": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "type": {
                                                        "type": "string",
                                                        "description": "`login` или `logout`"
                                                    },
                                                    "reason": {
                                                        "type": "string",
                                                        "description": "Причина выхода"
                                                    },
                                                    "created_at": {
                                                        "type": "string",
                                                        "description": "Время"
                                                    }
                                                }
                                            }
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "history": [
                                        {
                                            "type": "login",
                                            "reason": "",
                                            "created_at": "2026-11-05T09:00:00Z"
                                        }
                                    ],
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/auth/qr": {
            "get": {
                "operationId": "auth_qr",
                "tags": [
                    "Подключение аккаунта"
                ],
                "summary": "Получить QR",
                "description": "Возвращает QR как картинку в формате data-URL. Код меняется, поэтому запрашивайте его заново раз в несколько секунд, пока статус не станет `connected`.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "qr": {
                                            "type": "string",
                                            "description": "Картинка, подходит для `src` тега img"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "qr": "data:image/png;base64,iVBORw0KGgo…",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`qr_not_ready`: QR ещё не готов\n`already_authorized`: Канал уже подключён\n`password_required`: Нужен пароль двухэтапной проверки",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/capabilities": {
            "get": {
                "operationId": "capabilities",
                "tags": [
                    "Каналы"
                ],
                "summary": "Возможности канала",
                "description": "Показывает, как канал входит в аккаунт и кому может писать.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "messenger": {
                                            "type": "string",
                                            "description": "Тип канала"
                                        },
                                        "capabilities": {
                                            "type": "object",
                                            "properties": {
                                                "auth": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Способы входа: `qr`, `code`, `pairing_code`, `password`, `bot_token`"
                                                },
                                                "recipient": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "Как указать получателя"
                                                },
                                                "write_first": {
                                                    "type": "boolean",
                                                    "description": "`false`, если канал не может писать первым"
                                                }
                                            }
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "messenger": "whatsapp",
                                    "capabilities": {
                                        "auth": [
                                            "qr",
                                            "pairing_code"
                                        ],
                                        "media_download": "by_token",
                                        "recipient": [
                                            "phone",
                                            "chat_id"
                                        ],
                                        "send_text": true,
                                        "send_file": true,
                                        "history": false,
                                        "search": false,
                                        "reply": false,
                                        "reaction": false,
                                        "edit": false,
                                        "delete": false
                                    },
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/cascades": {
            "post": {
                "operationId": "cascades_create",
                "tags": [
                    "Каскады"
                ],
                "summary": "Создать шаблон",
                "description": "Сохраняет цепочку каналов и текст. Переменные пишутся как `{{имя}}`.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Название, до 100 символов"
                                    },
                                    "steps": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "profile_id"
                                            ],
                                            "properties": {
                                                "profile_id": {
                                                    "type": "string",
                                                    "description": "Канал, без повторов в цепочке"
                                                },
                                                "body": {
                                                    "type": "string",
                                                    "description": "Текст до 4000 символов. Пусто: как в первом шаге (обязательно: в шаге 1)"
                                                },
                                                "wait_minutes": {
                                                    "type": "integer",
                                                    "description": "Ждать подтверждение, от 0 до 10080 минут"
                                                }
                                            }
                                        },
                                        "description": "От 1 до 5 шагов"
                                    }
                                },
                                "required": [
                                    "name",
                                    "steps"
                                ]
                            },
                            "example": {
                                "name": "Заказ готов",
                                "steps": [
                                    {
                                        "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                        "body": "Привет, {{имя}}! Заказ готов",
                                        "wait_minutes": 0
                                    },
                                    {
                                        "profile_id": "1b7d9e24-6c3f-4a15-8e02-c4f8a1d07e33",
                                        "body": "Привет, {{имя}}! Заказ готов",
                                        "wait_minutes": 0
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "id": 12,
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_steps`: Ошибка в шагах\n`bad_name`: Неверное название",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "cascades_list",
                "tags": [
                    "Каскады"
                ],
                "summary": "Список шаблонов",
                "description": "Возвращает шаблоны аккаунта.",
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "cascades": [
                                        {
                                            "id": 12,
                                            "name": "Заказ готов",
                                            "steps": [
                                                {
                                                    "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                                    "body": "Привет, {{имя}}! Заказ готов",
                                                    "wait_minutes": 0
                                                },
                                                {
                                                    "profile_id": "1b7d9e24-6c3f-4a15-8e02-c4f8a1d07e33",
                                                    "body": "Привет, {{имя}}! Заказ готов",
                                                    "wait_minutes": 0
                                                }
                                            ],
                                            "created_at": "2026-11-05T09:00:00Z"
                                        }
                                    ],
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "cascades_delete",
                "tags": [
                    "Каскады"
                ],
                "summary": "Удалить шаблон",
                "description": "Запущенные каскады продолжат работу.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "required": true,
                        "description": "ID шаблона",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`cascade_not_found`: Шаблон не найден",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/cascades/send": {
            "post": {
                "operationId": "cascades_send",
                "tags": [
                    "Каскады"
                ],
                "summary": "Запустить каскад",
                "description": "Запускает каскад на одного получателя. Итог приходит событием `cascade_status`: в `data` будут `broadcast_id`, `recipient_id`, `phone`, `status`, `step`, `code`. Статусы: `sent`, `delivered`, `failed`, `unknown`. `unknown` значит, что сообщение могло уйти, но подтверждения нет. Незапущенный каскад истекает через час. Поддерживает `Idempotency-Key`.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient": {
                                        "type": "string",
                                        "description": "Номер получателя"
                                    },
                                    "cascade_id": {
                                        "type": "integer",
                                        "description": "ID шаблона (обязательно: да, или steps)"
                                    },
                                    "steps": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Шаги, как при создании шаблона (обязательно: да, или cascade_id)"
                                    },
                                    "vars": {
                                        "type": "object",
                                        "description": "Значения переменных (обязательно: если есть переменные)"
                                    }
                                },
                                "required": [
                                    "recipient"
                                ]
                            },
                            "example": {
                                "cascade_id": 12,
                                "recipient": "79110000000",
                                "vars": {
                                    "имя": "Анна"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "broadcast_id": {
                                            "type": "integer",
                                            "description": "ID запуска"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "queued",
                                    "broadcast_id": 345,
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "`insufficient_funds`: Каналы отключены за неоплату",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`cascade_not_found`: Шаблон не найден",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_recipient`: Неверный номер\n`missing_vars`: Не хватает значений в `vars`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "`queue_full`: Больше 2000 незавершённых получателей",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/cascades/status": {
            "get": {
                "operationId": "cascades_status",
                "tags": [
                    "Каскады"
                ],
                "summary": "Ход каскада",
                "description": "Показывает состояние запуска. Данные хранятся 7 дней после завершения.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "required": true,
                        "description": "ID запуска",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "run_status": {
                                            "type": "string",
                                            "description": "`running`, `done`, `cancelled`"
                                        },
                                        "recipients": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "state": {
                                                        "type": "string",
                                                        "description": "`pending`, `sending`, `waiting`, `sent`, `delivered`, `failed`, `cancelled`, `unknown`"
                                                    },
                                                    "step": {
                                                        "type": "integer",
                                                        "description": "Номер шага с нуля"
                                                    },
                                                    "error_code": {
                                                        "type": "string",
                                                        "description": "Код последней ошибки"
                                                    }
                                                }
                                            }
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "run_status": "running",
                                    "recipients": [
                                        {
                                            "phone": "79110000000",
                                            "state": "waiting",
                                            "step": 0,
                                            "error_code": null
                                        }
                                    ],
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`not_found`: Запуск не найден",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/events/missed": {
            "get": {
                "operationId": "missed",
                "tags": [
                    "Уведомления"
                ],
                "summary": "Недоставленные события",
                "description": "Если адрес не ответил на все попытки, текст удаляется, а служебные данные хранятся 30 дней. Сам текст можно посмотреть в телефоне.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": false,
                        "description": "Только этот канал",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "От 1 до 500, по умолчанию 100",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "events": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "event_id": {
                                                        "type": "string",
                                                        "description": "ID события"
                                                    },
                                                    "event_type": {
                                                        "type": "string",
                                                        "description": "Тип"
                                                    },
                                                    "chat_id": {
                                                        "type": "string",
                                                        "description": "Чат"
                                                    },
                                                    "message_id": {
                                                        "type": "string",
                                                        "description": "Сообщение"
                                                    },
                                                    "has_media": {
                                                        "type": "boolean",
                                                        "description": "Был файл"
                                                    },
                                                    "occurred_at": {
                                                        "type": "string",
                                                        "description": "Время события"
                                                    },
                                                    "failed_at": {
                                                        "type": "string",
                                                        "description": "Время последней неудачи"
                                                    }
                                                }
                                            }
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "events": [
                                        {
                                            "event_id": "evt_359c83c6bc0f2a377e34758d",
                                            "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                            "messenger": "telegram",
                                            "message_id": "36210860",
                                            "chat_id": "1985011953",
                                            "event_type": "incoming_message",
                                            "has_media": false,
                                            "occurred_at": "2026-11-05T09:00:00Z",
                                            "failed_at": "2026-11-05T09:04:20Z"
                                        }
                                    ],
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/events/missed/ack": {
            "post": {
                "operationId": "missed_ack",
                "tags": [
                    "Уведомления"
                ],
                "summary": "Отметить обработанными",
                "description": "Убирает события из списка недоставленных.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "event_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "От 1 до 500 значений"
                                    }
                                },
                                "required": [
                                    "event_ids"
                                ]
                            },
                            "example": {
                                "event_ids": [
                                    "evt_359c83c6bc0f2a377e34758d"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "acknowledged": {
                                            "type": "integer",
                                            "description": "Сколько событий отмечено"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "acknowledged": 1,
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_event_ids`: Неверный список",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/media/{token}": {
            "get": {
                "operationId": "media_download",
                "tags": [
                    "Сообщения"
                ],
                "summary": "Скачать входящий файл",
                "description": "Ссылка приходит в поле `data.media_url` уведомления. Работает 7 дней или пока файл есть у мессенджера.",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "description": "Токен файла из ссылки",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Содержимое файла",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/profiles": {
            "post": {
                "operationId": "profiles_create",
                "tags": [
                    "Каналы"
                ],
                "summary": "Создать канал",
                "description": "Создаёт канал и начинает начисление за него. Нужен токен на все каналы и подтверждённая почта.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Название, до 100 символов"
                                    },
                                    "messenger": {
                                        "type": "string",
                                        "description": "`whatsapp`, `telegram`, `max`, `telegram_bot`, `max_bot`, `vk_group`. По умолчанию `whatsapp`"
                                    },
                                    "webhook_url": {
                                        "type": "string",
                                        "description": "Сразу добавить адрес для событий этого канала"
                                    },
                                    "api_id": {
                                        "type": "string",
                                        "description": "Ключ приложения с my.telegram.org (обязательно: для telegram)"
                                    },
                                    "api_hash": {
                                        "type": "string",
                                        "description": "Ключ приложения с my.telegram.org (обязательно: для telegram)"
                                    },
                                    "bot_token": {
                                        "type": "string",
                                        "description": "Токен бота или ключ сообщества (обязательно: для ботов и VK)"
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            },
                            "example": {
                                "name": "Продажи",
                                "messenger": "whatsapp"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "profile": {
                                            "type": "object",
                                            "description": "Канал, поля описаны в разделе статус канала"
                                        },
                                        "webhook": {
                                            "type": "object",
                                            "description": "Адрес с секретом, если передан `webhook_url`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "profile": {
                                        "status": "starting",
                                        "authorized": false,
                                        "phone": null,
                                        "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                        "name": "Продажи",
                                        "messenger": "whatsapp",
                                        "send_limit_per_min": 20,
                                        "last_seen_at": "2026-11-05T09:00:00Z",
                                        "possible_gap_from": null,
                                        "possible_gap_to": null,
                                        "created_at": "2026-11-01T10:00:00Z"
                                    },
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "`insufficient_funds`: Каналы отключены за неоплату",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_api_keys`: Неверные ключи или токен\n`bad_webhook_url`: Адрес webhook не подходит",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "profiles_list",
                "tags": [
                    "Каналы"
                ],
                "summary": "Список каналов",
                "description": "Возвращает каналы аккаунта. Токен с ограничением видит только свои.",
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "profiles": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            },
                                            "description": "Список каналов"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "profiles": [
                                        {
                                            "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                            "name": "Продажи",
                                            "messenger": "whatsapp",
                                            "status": "connected",
                                            "authorized": true,
                                            "phone": "79110000000",
                                            "send_limit_per_min": 20,
                                            "last_seen_at": "2026-11-05T09:00:00Z",
                                            "possible_gap_from": null,
                                            "possible_gap_to": null,
                                            "created_at": "2026-11-01T10:00:00Z"
                                        }
                                    ],
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "profiles_delete",
                "tags": [
                    "Каналы"
                ],
                "summary": "Удалить канал",
                "description": "Удаляет канал и его сессию. Начисления прекращаются. Отменить нельзя.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "detail": "Профиль и его сессия будут удалены",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`profile_not_found`: Канала нет или он чужой",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/profiles/credentials": {
            "post": {
                "operationId": "profiles_credentials",
                "tags": [
                    "Каналы"
                ],
                "summary": "Заменить ключи Telegram",
                "description": "Сохраняет новые ключи приложения и перезапускает канал. Ключи хранятся зашифрованными и в ответах не возвращаются.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "api_id": {
                                        "type": "string",
                                        "description": "Новый api_id"
                                    },
                                    "api_hash": {
                                        "type": "string",
                                        "description": "Новый api_hash"
                                    }
                                },
                                "required": [
                                    "api_id",
                                    "api_hash"
                                ]
                            },
                            "example": {
                                "api_id": "12345",
                                "api_hash": "0123456789abcdef0123456789abcdef"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "detail": "Ключи сохранены, профиль перезапускается",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_api_keys`: Неверные ключи\n`unsupported_by_messenger`: Канал не Telegram",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/profiles/logout": {
            "post": {
                "operationId": "profiles_logout",
                "tags": [
                    "Каналы"
                ],
                "summary": "Выйти из аккаунта",
                "description": "Выходит из аккаунта мессенджера и удаляет сессию. Канал остаётся и продолжает оплачиваться, пока вы его не удалите.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "detail": "Выход выполнен, сессия удалена",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "`worker_unavailable`: Канал сейчас запускается, повторите позже",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/profiles/restart": {
            "post": {
                "operationId": "profiles_restart",
                "tags": [
                    "Каналы"
                ],
                "summary": "Перезапустить канал",
                "description": "Перезапускает соединение. Вход в аккаунт сохраняется.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "detail": "Профиль будет перезапущен в течение нескольких секунд",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`profile_not_found`: Канала нет или он чужой",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/profiles/status": {
            "get": {
                "operationId": "profiles_status",
                "tags": [
                    "Каналы"
                ],
                "summary": "Статус канала",
                "description": "Возвращает состояние канала.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "profile_id": {
                                            "type": "string",
                                            "description": "ID канала"
                                        },
                                        "name": {
                                            "type": "string",
                                            "description": "Название"
                                        },
                                        "messenger": {
                                            "type": "string",
                                            "description": "Тип канала"
                                        },
                                        "authorized": {
                                            "type": "boolean",
                                            "description": "Канал подключён"
                                        },
                                        "phone": {
                                            "type": "string",
                                            "description": "Номер аккаунта, если известен"
                                        },
                                        "send_limit_per_min": {
                                            "type": "integer",
                                            "description": "Скорость отправки"
                                        },
                                        "last_seen_at": {
                                            "type": "string",
                                            "description": "Последний сигнал от канала"
                                        },
                                        "possible_gap_from": {
                                            "type": "string",
                                            "description": "Начало периода, когда события могли потеряться из-за перезапуска"
                                        },
                                        "possible_gap_to": {
                                            "type": "string",
                                            "description": "Конец этого периода"
                                        },
                                        "created_at": {
                                            "type": "string",
                                            "description": "Дата создания"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "profile": {
                                        "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                        "name": "Продажи",
                                        "messenger": "whatsapp",
                                        "status": "connected",
                                        "authorized": true,
                                        "phone": "79110000000",
                                        "send_limit_per_min": 20,
                                        "last_seen_at": "2026-11-05T09:00:00Z",
                                        "possible_gap_from": null,
                                        "possible_gap_to": null,
                                        "created_at": "2026-11-01T10:00:00Z"
                                    },
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`profile_not_found`: Канала нет или он чужой",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/sync/message/file/send": {
            "post": {
                "operationId": "send_file_sync",
                "tags": [
                    "Сообщения"
                ],
                "summary": "Отправить файл",
                "description": "Отправляет файл и ждёт результата.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient": {
                                        "type": "string",
                                        "description": "Номер получателя. Telegram принимает и `@username` (обязательно: да, или chat_id)"
                                    },
                                    "chat_id": {
                                        "type": "string",
                                        "description": "ID чата из уведомления, используйте для ответа (обязательно: да, или recipient)"
                                    },
                                    "url": {
                                        "type": "string",
                                        "description": "Публичная ссылка на файл (обязательно: да, или b64_file)"
                                    },
                                    "b64_file": {
                                        "type": "string",
                                        "description": "Файл в base64 (обязательно: да, или url)"
                                    },
                                    "caption": {
                                        "type": "string",
                                        "description": "Подпись"
                                    },
                                    "file_name": {
                                        "type": "string",
                                        "description": "Имя файла"
                                    },
                                    "mimetype": {
                                        "type": "string",
                                        "description": "Тип файла"
                                    },
                                    "as_document": {
                                        "type": "boolean",
                                        "description": "Отправить документом, а не картинкой или видео"
                                    }
                                }
                            },
                            "example": {
                                "recipient": "79110000000",
                                "url": "https://example.ru/invoice.pdf",
                                "caption": "Ваш счёт"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "message_id": {
                                            "type": "string",
                                            "description": "ID сообщения в мессенджере"
                                        },
                                        "chat_id": {
                                            "type": "string",
                                            "description": "ID чата, используйте для ответа"
                                        },
                                        "profile_id": {
                                            "type": "string",
                                            "description": "ID канала"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "message_id": "3EB0C431A3",
                                    "chat_id": "79110000000@s.whatsapp.net",
                                    "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "`insufficient_funds`: Каналы отключены за неоплату",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`profile_not_connected`: Канал не подключён\n`profile_restricted`: Канал ограничен мессенджером",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "`file_too_large`: Файл слишком большой",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_recipient`: Получателя нет в мессенджере\n`no_recipient`: Не указан получатель\n`no_file`: Не указан файл\n`bad_file_url`: Файл по ссылке недоступен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "`send_limit`: Превышена скорость канала, см. `retry_after`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "`worker_unavailable`: Канал сейчас запускается, повторите позже",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/sync/message/send": {
            "post": {
                "operationId": "send_sync",
                "tags": [
                    "Сообщения"
                ],
                "summary": "Отправить текст",
                "description": "Отправляет сообщение и ждёт результата до 30 секунд. Подходит для единичных сообщений.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": true,
                        "description": "ID канала",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient": {
                                        "type": "string",
                                        "description": "Номер получателя. Telegram принимает и `@username` (обязательно: да, или chat_id)"
                                    },
                                    "chat_id": {
                                        "type": "string",
                                        "description": "ID чата из уведомления, используйте для ответа (обязательно: да, или recipient)"
                                    },
                                    "body": {
                                        "type": "string",
                                        "description": "Текст сообщения"
                                    },
                                    "with_preview": {
                                        "type": "boolean",
                                        "description": "Показывать предпросмотр ссылок"
                                    }
                                },
                                "required": [
                                    "body"
                                ]
                            },
                            "example": {
                                "recipient": "79110000000",
                                "body": "Заказ готов"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "message_id": {
                                            "type": "string",
                                            "description": "ID сообщения в мессенджере"
                                        },
                                        "chat_id": {
                                            "type": "string",
                                            "description": "ID чата, используйте для ответа"
                                        },
                                        "profile_id": {
                                            "type": "string",
                                            "description": "ID канала"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "message_id": "3EB0C431A2",
                                    "chat_id": "79110000000@s.whatsapp.net",
                                    "profile_id": "8f2c1a70-4d3e-4b6a-9c11-2f7e5d90ab12",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "`insufficient_funds`: Каналы отключены за неоплату",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`profile_not_connected`: Канал не подключён\n`profile_restricted`: Канал ограничен мессенджером",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_recipient`: Получателя нет в мессенджере\n`no_recipient`: Не указан получатель",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "`send_limit`: Превышена скорость канала, см. `retry_after`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "`worker_unavailable`: Канал сейчас запускается, повторите позже",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "504": {
                        "description": "`worker_timeout`: Нет ответа за 30 секунд. Сообщение могло уйти, проверьте чат перед повтором",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/webhooks": {
            "post": {
                "operationId": "webhooks_create",
                "tags": [
                    "Уведомления"
                ],
                "summary": "Добавить адрес",
                "description": "Добавляет адрес, на который приходят события. Адрес должен быть публичным и работать по `https`. Секрет показывается один раз. С параметром `profile_id` адрес получает события только этого канала.",
                "parameters": [
                    {
                        "name": "profile_id",
                        "in": "query",
                        "required": false,
                        "description": "Ограничить одним каналом",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "description": "Адрес вашего сервера"
                                    },
                                    "events": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Типы событий. По умолчанию все"
                                    },
                                    "chat_types": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "`private`, `group`, `channel`. По умолчанию только `private`"
                                    }
                                },
                                "required": [
                                    "url"
                                ]
                            },
                            "example": {
                                "url": "https://example.ru/hook",
                                "chat_types": [
                                    "private",
                                    "group"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "webhook": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "ID адреса"
                                                },
                                                "secret": {
                                                    "type": "string",
                                                    "description": "Секрет для проверки подписи"
                                                }
                                            }
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "webhook": {
                                        "id": 7,
                                        "url": "https://example.ru/hook",
                                        "secret": "9f86d081884c7d659a2feaa0c55ad015",
                                        "profile_id": null,
                                        "events": "*",
                                        "chat_types": "private,group"
                                    },
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_webhook_url`: Адрес не подходит\n`bad_chat_types`: Неверный тип чата",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "webhooks_list",
                "tags": [
                    "Уведомления"
                ],
                "summary": "Список адресов",
                "description": "Возвращает адреса без секретов.",
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "webhooks": [
                                        {
                                            "id": 7,
                                            "profile_id": null,
                                            "url": "https://example.ru/hook",
                                            "events": "*",
                                            "chat_types": "private",
                                            "created_at": "2026-11-05 09:00:00"
                                        }
                                    ],
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "webhooks_delete",
                "tags": [
                    "Уведомления"
                ],
                "summary": "Удалить адрес",
                "description": "Удаляет адрес.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "required": true,
                        "description": "ID адреса",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`webhook_not_found`: Адрес не найден",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/webhooks/chat_types": {
            "post": {
                "operationId": "webhooks_chats",
                "tags": [
                    "Уведомления"
                ],
                "summary": "Выбрать типы чатов",
                "description": "Определяет, сообщения каких чатов приходят на адрес. Отправки через API фильтр не затрагивает. В личных сессиях MAX тип чата неизвестен, поэтому оттуда приходят все сообщения.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "integer",
                                        "description": "ID адреса"
                                    },
                                    "chat_types": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "`private`, `group`, `channel`"
                                    }
                                },
                                "required": [
                                    "id",
                                    "chat_types"
                                ]
                            },
                            "example": {
                                "id": 7,
                                "chat_types": [
                                    "private",
                                    "channel"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Успешно",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "description": "`done` или `queued`"
                                        },
                                        "timestamp": {
                                            "type": "integer",
                                            "description": "Время ответа, секунды Unix"
                                        }
                                    }
                                },
                                "example": {
                                    "status": "done",
                                    "id": 7,
                                    "chat_types": "private,channel",
                                    "timestamp": 1793800000
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Нет токена или токен неверен",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`webhook_not_found`: Адрес не найден",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`bad_chat_types`: Неверный тип чата",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Слишком много запросов",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "token": {
                "type": "apiKey",
                "in": "header",
                "name": "Authorization",
                "description": "Токен из раздела «Токены API»"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "status",
                    "code",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": [
                            "error"
                        ]
                    },
                    "code": {
                        "type": "string",
                        "description": "Код ошибки, не меняется"
                    },
                    "message": {
                        "type": "string",
                        "description": "Текст для человека, может меняться"
                    },
                    "retry_after": {
                        "type": "integer",
                        "nullable": true,
                        "description": "Через сколько секунд повторить"
                    },
                    "timestamp": {
                        "type": "integer"
                    }
                }
            },
            "WebhookEvent": {
                "type": "object",
                "description": "Событие, которое мы отправляем POST-запросом на ваш адрес. Подпись: заголовок `X-Signature`, значение `sha256=` и HMAC-SHA256 от строки `X-Timestamp.тело`, ключ это секрет адреса.",
                "required": [
                    "event_type",
                    "profile_id",
                    "event_id",
                    "sequence"
                ],
                "properties": {
                    "event_type": {
                        "type": "string",
                        "enum": [
                            "incoming_message",
                            "outgoing_message_phone",
                            "outgoing_message_api",
                            "delivery_status",
                            "authorization_status",
                            "profile_status",
                            "restriction_status",
                            "incoming_call",
                            "cascade_status"
                        ]
                    },
                    "profile_id": {
                        "type": "string"
                    },
                    "messenger": {
                        "type": "string"
                    },
                    "occurred_at": {
                        "type": "integer"
                    },
                    "chat_id": {
                        "type": "string",
                        "nullable": true
                    },
                    "chat_phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "message_id": {
                        "type": "string",
                        "nullable": true
                    },
                    "data": {
                        "type": "object",
                        "description": "Зависит от типа события, см. документацию"
                    },
                    "event_id": {
                        "type": "string",
                        "description": "Отбрасывайте дубли по этому полю"
                    },
                    "sequence": {
                        "type": "integer",
                        "description": "Порядок событий канала"
                    }
                }
            }
        }
    }
}