{
  "openapi": "3.1.0",
  "info": {
    "title": "Liza Bot API",
    "version": "1.3.0",
    "description": "HTTP API для ботов в Liza. В контракт включены поддерживаемые методы, их фактические параметры и ограничения. Токен всегда передаётся в пути `/bot{token}` и не является Bearer-токеном.\n\nУспех возвращается как `{ ok: true, result: ... }`; ошибка — `{ ok: false, error_code, description }`. Для отправки сообщений бот должен быть приглашён в соответствующий Matrix-чат.\n\nБоты работают только в **незашифрованных** чатах: у ботов нет E2EE, события зашифрованных чатов им не выдаются.\n\nС версии 1.1.0 `message_id` стабилен и растёт в пределах чата (раньше исходящий id менялся после рестарта сервера — сохранённые до 01.10.2026 значения недействительны). По `message_id` работают правка, удаление и ответы.\n\n### Блокировка и хранение\n403 «Forbidden: bot was blocked by the user» — человек ушёл из личного чата с ботом, отклонил приглашение или удалил бота: так отвечают `startChat` и отправки в этот чат, пока человек снова не позовёт бота. 403 «Forbidden: bot was kicked from the group chat» — отправка после изгнания бота из группы. Очередь обновлений хранится 24 часа; сопоставления сообщений, кнопок и callback — 30 дней: более старые сообщения нельзя править и удалять (400), на нажатия их кнопок нельзя ответить, а ответ на них уходит без цитаты.\n\n### Не поддерживается\nМетод, которого нет в справочнике, отвечает 400 `Method '…' not supported in MVP`. Сознательно не реализованы: реакции (`setMessageReaction`), закрепление (`pinChatMessage`), пересылка и копирование (`forwardMessage`, `copyMessage`), inline-режим, ForceReply, запрос телефона и геопозиции кнопкой, медиаальбомы, стикеры, опросы, игры, Telegram Payments и Stars, управление участниками и чатом, темы форумов (`message_thread_id`). Параметр `allowed_updates` игнорируется.\n\n### Изменения для интеграторов\n**1.3.0 (05.10.2026):** `answerCallbackQuery` проверяет `callback_query_id` (выданный этому боту, не старше 15 минут, один раз; раньше любой id → `true`) и показывает ответ только нажавшему — в чат больше ничего не пишется (раньше `show_alert` уходил сообщением, которое видели все); ответ на неизвестное сообщение уходит без цитаты (раньше 400), ответы send* содержат `reply_to_message`; 403 `bot was blocked by the user` / `bot was kicked from the group chat`; `startChat` несуществующему пользователю — 400 `user not found`, getChat* без бота в чате — 400 `chat not found` (раньше 500); правка без изменений — 400 `message is not modified`; повторная отправка по `file_id` сохраняет имя, mimetype и размеры файла (`file_id`, выданные до 1.3, работают как прежде — без метаданных; кривой `file_id` — 400); `chat.type` в ответах send*/edit* — `private`/`group`; `setMyCommands` и `sendChatAction` отвергают невалидные значения (400) вместо исправления; `getChatMember` различает `kicked` и `left`; webhook: 4xx — до 3 повторов, 5xx/сеть — повторы с нарастающей паузой до 24 ч; сопоставления сообщений и кнопок хранятся 30 дней; ответ номером кнопки в чате с несколькими ботами получает только бот с последними кнопками.\n**1.2.0 (02.10.2026):** во входящих — `entities`/`caption_entities` для команд; `chat.type` = `group` для групп (раньше всегда `private`); `from.is_bot = true` для ботов; `from.liza_user_id`; webhook — повторная доставка и заголовок `X-Telegram-Bot-Api-Secret-Token`, `update_id` в webhook — номер очереди (раньше сбрасывался после рестарта); обычная клавиатура присылает текст кнопки; в ответе send* медиа есть `file_id`; `getFile` отдаёт относительный `file_path` (раньше — прямая ссылка на сервер).\n**1.1.0 (01.10.2026):** `getUpdates` держит запрос (long polling) и подтверждает через `offset`; `message_id` стабилен (старые значения недействительны); правка пользователя приходит `edited_message`, а не новым `message`; входящие голосовые/аудио/файлы/видео без поля `text`; `callback_query.id` вида `<chat_id>_<n>`, `callback_query.message` — сообщение бота с кнопкой.",
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://bot.tech.liza.ru",
      "description": "Публичный адрес Liza Bot API."
    }
  ],
  "tags": [
    {
      "name": "Бот и события",
      "description": "Сведения о боте и входящая очередь."
    },
    {
      "name": "Сообщения",
      "description": "Текстовые сообщения и callbacks."
    },
    {
      "name": "Чаты",
      "description": "Сведения о чатах и участниках; начало чата ботом."
    },
    {
      "name": "Медиа",
      "description": "Отправка вложений и совместимая заглушка профиля."
    },
    {
      "name": "Webhook",
      "description": "Настройка доставки обновлений."
    },
    {
      "name": "Файлы",
      "description": "Метаданные и проксирование Matrix-медиа."
    },
    {
      "name": "Платежи",
      "description": "Инвойсы Liza с оплатой через Prodamus."
    }
  ],
  "security": [],
  "paths": {
    "/bot{token}/getMe": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "get": {
        "tags": [
          "Бот и события"
        ],
        "operationId": "getMeGet",
        "x-liza-compatibility": "реализовано",
        "summary": "Получить сведения о боте",
        "responses": {
          "200": {
            "$ref": "#/components/responses/BotResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "post": {
        "tags": [
          "Бот и события"
        ],
        "operationId": "getMePost",
        "x-liza-compatibility": "реализовано",
        "summary": "Получить сведения о боте",
        "description": "Поддержан для клиентов, которые вызывают `getMe` через POST.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/BotResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getUpdates": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "get": {
        "tags": [
          "Бот и события"
        ],
        "operationId": "getUpdatesGet",
        "summary": "Получить ожидающие обновления",
        "x-liza-compatibility": "реализовано",
        "description": "Статус: реализовано (семантика Telegram). Выдача НЕ помечает обновление обработанным: подтверждает его следующий вызов с `offset = последний update_id + 1` (все обновления с меньшим id). Упавший при обработке бот получит то же обновление снова. `offset < 0` — вернуть последние |offset| обновлений, более ранние подтвердить (так работает `drop_pending_updates`). `offset` больше любого выданного id игнорируется. `timeout` (до 50 с) держит запрос до первого обновления — long polling. Неподтверждённые обновления хранятся 24 часа. Одновременно на токен действует один запрос: новый вытесняет старый, тот получает 409. При активном webhook — 409. `update_id` — номер записи серверной очереди. `allowed_updates` игнорируется.",
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "example": 0,
            "description": "Подтверждение: все обновления с id < offset считаются обработанными. Отрицательный — последние |offset|."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "timeout",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 50,
              "default": 0
            },
            "description": "Long polling: сколько секунд ждать первого обновления (не больше 50)."
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/UpdatesResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "409": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "post": {
        "tags": [
          "Бот и события"
        ],
        "operationId": "getUpdatesPost",
        "summary": "Получить ожидающие обновления",
        "x-liza-compatibility": "реализовано",
        "description": "То же поведение, что у GET; тело может быть JSON, form-urlencoded или multipart.",
        "requestBody": {
          "$ref": "#/components/requestBodies/GetUpdates"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/UpdatesResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "409": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/sendMessage": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Сообщения"
        ],
        "operationId": "sendMessage",
        "x-liza-compatibility": "частично реализовано",
        "summary": "Отправить текст",
        "description": "`text` ограничен 4096 символами. Поддерживаются `parse_mode` (`Markdown`, `MarkdownV2`, `HTML`), `reply_markup` и ответ на сообщение (`reply_to_message_id`, `reply_parameters`). Параметры управления уведомлениями и предпросмотром принимаются, но игнорируются. Неизвестный `reply_to_message_id`/`reply_parameters.message_id` — отправка без цитаты (400 «message to be replied not found» только при `allow_sending_without_reply=false`); при цитате в ответе есть `reply_to_message`. 403 — человек заблокировал бота или бота выгнали из группы (см. «Блокировка и хранение»).",
        "requestBody": {
          "$ref": "#/components/requestBodies/SendMessage"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/answerCallbackQuery": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Сообщения"
        ],
        "operationId": "answerCallbackQuery",
        "x-liza-compatibility": "частично реализовано",
        "summary": "Ответить на нажатие кнопки",
        "description": "Ответ на `callback_query`. `callback_query_id` обязателен: принимается только id, выданный этому боту, не старше 15 минут и только один раз — иначе 400 «Bad Request: query is too old and response timeout expired or query ID is invalid». `text` — до 200 символов (иначе 400 «MESSAGE_TOO_LONG»). Ответ видит только нажавший: `text` — всплывающее уведомление, при `show_alert=true` — диалог; `url` открывается как у url-кнопки (в новых версиях приложения). В чат ничего не пишется. Callback приходит, когда пользователь нажимает кнопку в приложении Liza (или отвечает номером/названием кнопки — в чате с несколькими ботами такой ответ получает только бот, чьи кнопки показаны последними); `callback_query.message` — сообщение бота с этой кнопкой. На нажатия по сообщениям старше 30 дней ответить нельзя.",
        "requestBody": {
          "$ref": "#/components/requestBodies/CallbackAnswer"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/BooleanResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/sendPhoto": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Медиа"
        ],
        "operationId": "sendPhoto",
        "summary": "Отправить фотографию",
        "x-liza-compatibility": "частично реализовано",
        "description": "Статус: частично реализовано. Передайте публичный URL в `photo` (JSON/form) или файл в multipart. Можно передать `file_id` (mxc://…) из входящего сообщения или ответа — медиа отправится без перезаливки. При недоступном медиа пытается доставить подпись и кнопки как текст. В ответе — объект медиа с `file_id`; кнопки `reply_markup` показываются под медиа и правятся/удаляются вместе с ним по его `message_id`. `file_id` принимается переиспользуется без перезаливки; для файлов, которые бот получил или отправил после 1.3, сохраняются метаданные исходника, более ранние `file_id` работают как прежде (без метаданных); некорректный `file_id` — 400; имя, mimetype, размер и размеры исходного файла сохраняются. В ответе у медиа — `file_size`, `mime_type`, `file_name` (у фото — `width`/`height`), если известны. Неизвестный `reply_to_message_id`/`reply_parameters.message_id` — отправка без цитаты (400 «message to be replied not found» только при `allow_sending_without_reply=false`); при цитате в ответе есть `reply_to_message`. 403 — человек заблокировал бота или бота выгнали из группы (см. «Блокировка и хранение»).",
        "requestBody": {
          "$ref": "#/components/requestBodies/SendPhoto"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "413": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/sendDocument": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Медиа"
        ],
        "operationId": "sendDocument",
        "summary": "Отправить документ",
        "x-liza-compatibility": "частично реализовано",
        "description": "Статус: частично реализовано. Передайте публичный URL в `document` или файл multipart. Для изображений, в том числе переданных как document, эмулятор может нормализовать формат и отправить inline-картинку. Лимит тела запроса по умолчанию 100 МБ. В ответе — объект медиа с `file_id`; кнопки `reply_markup` показываются под медиа и правятся/удаляются вместе с ним по его `message_id`. `file_id` принимается переиспользуется без перезаливки; для файлов, которые бот получил или отправил после 1.3, сохраняются метаданные исходника, более ранние `file_id` работают как прежде (без метаданных); некорректный `file_id` — 400; имя, mimetype, размер и размеры исходного файла сохраняются. В ответе у медиа — `file_size`, `mime_type`, `file_name` (у фото — `width`/`height`), если известны. Неизвестный `reply_to_message_id`/`reply_parameters.message_id` — отправка без цитаты (400 «message to be replied not found» только при `allow_sending_without_reply=false`); при цитате в ответе есть `reply_to_message`. 403 — человек заблокировал бота или бота выгнали из группы (см. «Блокировка и хранение»).",
        "requestBody": {
          "$ref": "#/components/requestBodies/SendDocument"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "413": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/sendVideo": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Медиа"
        ],
        "operationId": "sendVideo",
        "summary": "Отправить видео",
        "x-liza-compatibility": "частично реализовано",
        "description": "Статус: частично реализовано. Передайте публичный URL в `video` или файл multipart. Лимит тела запроса по умолчанию 100 МБ. В ответе — объект медиа с `file_id`; кнопки `reply_markup` показываются под медиа и правятся/удаляются вместе с ним по его `message_id`. `file_id` принимается переиспользуется без перезаливки; для файлов, которые бот получил или отправил после 1.3, сохраняются метаданные исходника, более ранние `file_id` работают как прежде (без метаданных); некорректный `file_id` — 400; имя, mimetype, размер и размеры исходного файла сохраняются. В ответе у медиа — `file_size`, `mime_type`, `file_name` (у фото — `width`/`height`), если известны. Неизвестный `reply_to_message_id`/`reply_parameters.message_id` — отправка без цитаты (400 «message to be replied not found» только при `allow_sending_without_reply=false`); при цитате в ответе есть `reply_to_message`. 403 — человек заблокировал бота или бота выгнали из группы (см. «Блокировка и хранение»).",
        "requestBody": {
          "$ref": "#/components/requestBodies/SendVideo"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "413": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/sendAudio": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Медиа"
        ],
        "operationId": "sendAudio",
        "summary": "Отправить аудио",
        "x-liza-compatibility": "частично реализовано",
        "description": "Статус: частично реализовано. Передайте публичный URL в `audio` или файл multipart. Лимит тела запроса по умолчанию 100 МБ. В ответе — объект медиа с `file_id`; кнопки `reply_markup` показываются под медиа и правятся/удаляются вместе с ним по его `message_id`. `file_id` принимается переиспользуется без перезаливки; для файлов, которые бот получил или отправил после 1.3, сохраняются метаданные исходника, более ранние `file_id` работают как прежде (без метаданных); некорректный `file_id` — 400; имя, mimetype, размер и размеры исходного файла сохраняются. В ответе у медиа — `file_size`, `mime_type`, `file_name` (у фото — `width`/`height`), если известны. Неизвестный `reply_to_message_id`/`reply_parameters.message_id` — отправка без цитаты (400 «message to be replied not found» только при `allow_sending_without_reply=false`); при цитате в ответе есть `reply_to_message`. 403 — человек заблокировал бота или бота выгнали из группы (см. «Блокировка и хранение»).",
        "requestBody": {
          "$ref": "#/components/requestBodies/SendAudio"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "413": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/sendVoice": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Медиа"
        ],
        "operationId": "sendVoice",
        "summary": "Отправить голосовое сообщение",
        "x-liza-compatibility": "частично реализовано",
        "description": "Статус: частично реализовано. Передайте публичный URL в `voice` или файл multipart. Лимит тела запроса по умолчанию 100 МБ. В ответе — объект медиа с `file_id`; кнопки `reply_markup` показываются под медиа и правятся/удаляются вместе с ним по его `message_id`. `file_id` принимается переиспользуется без перезаливки; для файлов, которые бот получил или отправил после 1.3, сохраняются метаданные исходника, более ранние `file_id` работают как прежде (без метаданных); некорректный `file_id` — 400; имя, mimetype, размер и размеры исходного файла сохраняются. В ответе у медиа — `file_size`, `mime_type`, `file_name` (у фото — `width`/`height`), если известны. Неизвестный `reply_to_message_id`/`reply_parameters.message_id` — отправка без цитаты (400 «message to be replied not found» только при `allow_sending_without_reply=false`); при цитате в ответе есть `reply_to_message`. 403 — человек заблокировал бота или бота выгнали из группы (см. «Блокировка и хранение»).",
        "requestBody": {
          "$ref": "#/components/requestBodies/SendVoice"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "413": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getUserProfilePhotos": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "get": {
        "tags": [
          "Медиа"
        ],
        "operationId": "getUserProfilePhotosGet",
        "summary": "Получить фотографии профиля",
        "x-liza-compatibility": "заглушка",
        "description": "Статус: заглушка. Всегда возвращает пустой список, параметры игнорируются.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/UserProfilePhotosResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "post": {
        "tags": [
          "Медиа"
        ],
        "operationId": "getUserProfilePhotosPost",
        "summary": "Получить фотографии профиля",
        "x-liza-compatibility": "заглушка",
        "description": "Статус: заглушка. Всегда возвращает пустой список, тело и параметры игнорируются.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/UserProfilePhotosResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/setWebhook": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Webhook"
        ],
        "operationId": "setWebhook",
        "x-liza-compatibility": "частично реализовано",
        "summary": "Настроить webhook",
        "description": "Пустой `url` удаляет webhook. Обновления доставляются HTTP POST с JSON; успешны все 2xx. Тайм-аут доставки — 30 секунд. Внутри одной доставки сетевые ошибки и 5xx повторяются до трёх попыток с задержками 1 и 2 секунды, 4xx — нет. `certificate`, `ip_address`, `max_connections`, `drop_pending_updates` принимаются, но игнорируются. Доставка: обновление отправляется POST-ом на `url`; при не-2xx оно остаётся в очереди и отправляется повторно по порядку — доставка «как минимум один раз», дедуплицируйте по `update_id`. Ответ 4xx (кроме 408 и 429) — не больше 3 повторов, затем обновление снимается; 5xx и сетевые ошибки — повторы с паузой 30 с · 2ⁿ (не больше часа) до истечения 24 часов хранения очереди. Если задан `secret_token`, он передаётся в заголовках `X-Telegram-Bot-Api-Secret-Token` (стандарт Telegram, его проверяют python-telegram-bot и aiogram) и `X-Liza-Bot-Api-Secret-Token`.",
        "requestBody": {
          "$ref": "#/components/requestBodies/SetWebhook"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/BooleanResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/deleteWebhook": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Webhook"
        ],
        "operationId": "deleteWebhook",
        "x-liza-compatibility": "реализовано",
        "summary": "Удалить webhook",
        "description": "`drop_pending_updates=true` очищает очередь ожидающих обновлений. Метод без тела также допустим.",
        "requestBody": {
          "$ref": "#/components/requestBodies/DeleteWebhook"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/BooleanResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getWebhookInfo": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "get": {
        "tags": [
          "Webhook"
        ],
        "operationId": "getWebhookInfoGet",
        "summary": "Получить состояние webhook",
        "x-liza-compatibility": "реализовано",
        "description": "Статус: реализовано.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/WebhookInfoResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "post": {
        "tags": [
          "Webhook"
        ],
        "operationId": "getWebhookInfoPost",
        "summary": "Получить состояние webhook",
        "x-liza-compatibility": "реализовано",
        "description": "Статус: реализовано.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/WebhookInfoResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getFile": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "get": {
        "tags": [
          "Файлы"
        ],
        "operationId": "getFileGet",
        "summary": "Получить метаданные Matrix-файла",
        "x-liza-compatibility": "частично реализовано",
        "description": "Статус: частично реализовано. В качестве `file_id` принимается только Matrix MXC URI.",
        "parameters": [
          {
            "name": "file_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^mxc://.+/.+"
            },
            "example": "mxc://matrix.example.org/abc123"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/FileResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      },
      "post": {
        "tags": [
          "Файлы"
        ],
        "operationId": "getFilePost",
        "summary": "Получить метаданные Matrix-файла",
        "x-liza-compatibility": "частично реализовано",
        "description": "Статус: реализовано. `file_id` — Matrix MXC URI (`mxc://…`) из входящего сообщения или ответа send*. `file_path` — относительный путь `сервер/media_id`; скачивание: `GET /file/bot{token}/{file_path}` (как в Telegram).",
        "requestBody": {
          "$ref": "#/components/requestBodies/GetFile"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/FileResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/file/bot{token}/{file_id}": {
      "get": {
        "tags": [
          "Файлы"
        ],
        "operationId": "downloadFileById",
        "x-liza-compatibility": "частично реализовано",
        "summary": "Скачать файл по MXC URI",
        "description": "`file_id` должен быть Matrix MXC URI (`mxc://server/media`). В ответе — исходные байты файла, полученные с Matrix homeserver.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "example": "123456:TEST_TOKEN"
          },
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "allowReserved": true,
            "schema": {
              "type": "string"
            },
            "example": "mxc://matrix.example.org/abc123"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BinaryFile"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/file/{file_path}": {
      "get": {
        "tags": [
          "Файлы"
        ],
        "operationId": "downloadFileByPath",
        "x-liza-compatibility": "частично реализовано",
        "summary": "Скачать файл по пути",
        "description": "`file_path` — `server/media_id` либо полный Matrix URL, возвращённый `getFile`. В пути слеши разрешены.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "example": "123456:TEST_TOKEN"
          },
          {
            "name": "file_path",
            "in": "path",
            "required": true,
            "allowReserved": true,
            "schema": {
              "type": "string"
            },
            "example": "matrix.example.org/abc123"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BinaryFile"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/sendInvoice": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Платежи"
        ],
        "operationId": "sendInvoice",
        "x-liza-compatibility": "частично реализовано",
        "summary": "Выставить инвойс",
        "description": "Создаёт карточку `com.liza.invoice`. Сумма и позиции сохраняются сервером; клиент получает только непрозрачную ссылку на заказ. Оплата проводится отдельным клиентским контуром Liza/Prodamus. `prices` — непустой массив; `amount` — положительное целое в минорных единицах. `quantity` — расширение Liza для отображения позиции и не умножает `amount` при вычислении итога. 403 — человек заблокировал бота или бота выгнали из группы (см. «Блокировка и хранение»).",
        "requestBody": {
          "$ref": "#/components/requestBodies/SendInvoice"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/InvoiceMessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "500": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/editMessageText": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Сообщения"
        ],
        "operationId": "editMessageText",
        "x-liza-compatibility": "реализовано",
        "summary": "Изменить текст сообщения бота",
        "description": "Matrix-правка (m.replace) сообщения, отправленного этим ботом. `reply_markup` заменяет кнопки. Повторного уведомления у пользователя нет. `inline_message_id` не поддержан. Правка с тем же содержимым и кнопками — 400 «Bad Request: message is not modified: …». Сообщения старше 30 дней править нельзя (400).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "message_id",
                  "text"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "message_id": {
                    "type": "integer"
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 4096
                  },
                  "parse_mode": {
                    "type": "string",
                    "enum": [
                      "Markdown",
                      "MarkdownV2",
                      "HTML"
                    ]
                  },
                  "reply_markup": {
                    "type": "object"
                  }
                }
              },
              "example": {
                "chat_id": 42,
                "message_id": 7,
                "text": "Готово ✅"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "message_id",
                  "text"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "message_id": {
                    "type": "integer"
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 4096
                  },
                  "parse_mode": {
                    "type": "string",
                    "enum": [
                      "Markdown",
                      "MarkdownV2",
                      "HTML"
                    ]
                  },
                  "reply_markup": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/editMessageCaption": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Сообщения"
        ],
        "operationId": "editMessageCaption",
        "x-liza-compatibility": "реализовано",
        "summary": "Изменить подпись к медиа",
        "description": "Меняет только подпись: само медиа в Matrix правкой не заменяется (editMessageMedia нет). Правка с тем же содержимым и кнопками — 400 «Bad Request: message is not modified: …». Сообщения старше 30 дней править нельзя (400).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "message_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "message_id": {
                    "type": "integer"
                  },
                  "caption": {
                    "type": "string"
                  },
                  "parse_mode": {
                    "type": "string",
                    "enum": [
                      "Markdown",
                      "MarkdownV2",
                      "HTML"
                    ]
                  }
                }
              },
              "example": {
                "chat_id": 42,
                "message_id": 8,
                "caption": "Новая подпись"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "message_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "message_id": {
                    "type": "integer"
                  },
                  "caption": {
                    "type": "string"
                  },
                  "parse_mode": {
                    "type": "string",
                    "enum": [
                      "Markdown",
                      "MarkdownV2",
                      "HTML"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/editMessageReplyMarkup": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Сообщения"
        ],
        "operationId": "editMessageReplyMarkup",
        "x-liza-compatibility": "реализовано",
        "summary": "Заменить кнопки сообщения",
        "description": "Заменяет inline-кнопки текстового сообщения бота. Правка с тем же содержимым и кнопками — 400 «Bad Request: message is not modified: …». Сообщения старше 30 дней править нельзя (400).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "message_id",
                  "reply_markup"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "message_id": {
                    "type": "integer"
                  },
                  "reply_markup": {
                    "type": "object"
                  }
                }
              },
              "example": {
                "chat_id": 42,
                "message_id": 7,
                "reply_markup": {
                  "inline_keyboard": [
                    [
                      {
                        "text": "Ещё",
                        "callback_data": "more"
                      }
                    ]
                  ]
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "message_id",
                  "reply_markup"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "message_id": {
                    "type": "integer"
                  },
                  "reply_markup": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/deleteMessage": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Сообщения"
        ],
        "operationId": "deleteMessage",
        "x-liza-compatibility": "реализовано",
        "summary": "Удалить сообщение",
        "description": "Matrix redaction. Свои сообщения бот удаляет всегда; чужие — только при достаточных правах в чате, иначе 400 «message can't be deleted». Сообщения старше 30 дней удалить нельзя (400).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "message_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "message_id": {
                    "type": "integer"
                  }
                }
              },
              "example": {
                "chat_id": 42,
                "message_id": 7
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "message_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "message_id": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/BooleanResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/sendChatAction": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Сообщения"
        ],
        "operationId": "sendChatAction",
        "x-liza-compatibility": "реализовано",
        "summary": "Показать «печатает…»",
        "description": "Индикатор набора на 5 секунд (m.typing). `action` — одно из действий Telegram (`typing`, `upload_photo`, `record_video`, `upload_video`, `record_voice`, `upload_voice`, `upload_document`, `choose_sticker`, `find_location`, `record_video_note`, `upload_video_note`), иначе 400 «wrong parameter action in request». Matrix не различает виды действий: любое отображается как «печатает».",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "action"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "action": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "chat_id": 42,
                "action": "typing"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "action"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "action": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/BooleanResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getChat": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Чаты"
        ],
        "operationId": "getChat",
        "x-liza-compatibility": "реализовано",
        "summary": "Сведения о чате",
        "description": "Тип чата (private/group), имя собеседника или название группы. `accent_color_id` и `max_reaction_count` всегда 0 (для совместимости с моделями Bot API). Бота нет в чате — 400 «Bad Request: chat not found».",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  }
                }
              },
              "example": {
                "chat_id": 42
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Чат.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Success"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Chat"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getChatMember": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Чаты"
        ],
        "operationId": "getChatMember",
        "x-liza-compatibility": "реализовано",
        "summary": "Участник чата",
        "description": "Статус по правам в чате: creator (100), administrator (≥50), member; `kicked` — забанен, `left` — вышел или неизвестен. `user_id` — тот же, что во `from.id` входящих. Для администратора права (`can_*`) вычисляются из уровней доступа чата. Бота нет в чате — 400 «Bad Request: chat not found».",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "user_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "user_id": {
                    "type": "integer"
                  }
                }
              },
              "example": {
                "chat_id": 42,
                "user_id": 42
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id",
                  "user_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  },
                  "user_id": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Участник.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Success"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/ChatMember"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getChatMemberCount": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Чаты"
        ],
        "operationId": "getChatMemberCount",
        "x-liza-compatibility": "реализовано",
        "summary": "Число участников",
        "description": "Бота нет в чате — 400 «Bad Request: chat not found».",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  }
                }
              },
              "example": {
                "chat_id": 42
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Число.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Success"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "integer"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getChatAdministrators": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Чаты"
        ],
        "operationId": "getChatAdministrators",
        "x-liza-compatibility": "реализовано",
        "summary": "Администраторы чата",
        "description": "Бота нет в чате — 400 «Bad Request: chat not found».",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  }
                }
              },
              "example": {
                "chat_id": 42
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "chat_id"
                ],
                "properties": {
                  "chat_id": {
                    "$ref": "#/components/schemas/ChatId"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Список.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Success"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ChatMember"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/setMyCommands": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Бот и события"
        ],
        "operationId": "setMyCommands",
        "x-liza-compatibility": "реализовано",
        "summary": "Задать меню «/»",
        "description": "Команды показываются пользователю подсказками при вводе «/» в чате с ботом (в новых версиях приложения). `scope` и `language_code` не различаются — у бота один список. До 100 команд. Параметры `scope` и `language_code` принимаются и игнорируются. `command` — 1–32 символа `a-z`, `0-9`, `_`: заглавные, «/» и пробелы — 400, команда не исправляется молча.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "commands"
                ],
                "properties": {
                  "commands": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "$ref": "#/components/schemas/BotCommand"
                    }
                  }
                }
              },
              "example": {
                "commands": [
                  {
                    "command": "start",
                    "description": "Начать"
                  }
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "commands"
                ],
                "properties": {
                  "commands": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "$ref": "#/components/schemas/BotCommand"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/BooleanResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/getMyCommands": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Бот и события"
        ],
        "operationId": "getMyCommands",
        "x-liza-compatibility": "реализовано",
        "summary": "Текущее меню «/»",
        "description": "",
        "responses": {
          "200": {
            "description": "Команды.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Success"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/BotCommand"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/deleteMyCommands": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Бот и события"
        ],
        "operationId": "deleteMyCommands",
        "x-liza-compatibility": "реализовано",
        "summary": "Удалить меню «/»",
        "description": "",
        "responses": {
          "200": {
            "$ref": "#/components/responses/BooleanResponse"
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/bot{token}/startChat": {
      "parameters": [
        {
          "name": "token",
          "in": "path",
          "required": true,
          "description": "Токен, выданный для бота. Передаётся как часть `/bot{token}`.",
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "example": "123456:TEST_TOKEN"
        }
      ],
      "post": {
        "tags": [
          "Чаты"
        ],
        "operationId": "startChat",
        "x-liza-compatibility": "реализовано (расширение)",
        "summary": "Начать чат с пользователем (расширение Liza)",
        "description": "Нет в Telegram. Создаёт личный чат бота с пользователем Liza и возвращает его `chat_id` — дальше работает sendMessage. Доступно только ботам, которым это разрешила администрация Liza (иначе 403). Адресат — человек (бот → 400). Повторный вызов для того же пользователя возвращает тот же чат. Не больше 50 новых чатов в сутки (429). Человек ушёл из личного чата с ботом, отклонил приглашение или удалил бота — 403 «Forbidden: bot was blocked by the user» (снимается, когда человек снова зовёт бота). Несуществующий пользователь — 400 «Bad Request: user not found».",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "user_id"
                ],
                "properties": {
                  "user_id": {
                    "type": "string",
                    "description": "Matrix ID пользователя, например @user:synapse.liza.laba.prodamus.tech"
                  }
                }
              },
              "example": {
                "user_id": "@user:synapse.liza.laba.prodamus.tech"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "user_id"
                ],
                "properties": {
                  "user_id": {
                    "type": "string",
                    "description": "Matrix ID пользователя, например @user:synapse.liza.laba.prodamus.tech"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Чат.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Success"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/Chat"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "401": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "403": {
            "$ref": "#/components/responses/ErrorResponse"
          },
          "429": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    }
  },
  "components": {
    "x-parameter-note": "Общие параметры определены ниже в components.parameters.",
    "schemas": {
      "Success": {
        "type": "object",
        "required": [
          "ok",
          "result"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "result": {}
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "ok",
          "error_code",
          "description"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "error_code": {
            "type": "integer",
            "examples": [
              400
            ]
          },
          "description": {
            "type": "string",
            "examples": [
              "Missing required parameter: chat_id"
            ]
          }
        }
      },
      "User": {
        "type": "object",
        "required": [
          "id",
          "is_bot",
          "first_name"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "is_bot": {
            "type": "boolean",
            "description": "true, если отправитель — бот Liza."
          },
          "first_name": {
            "type": "string"
          },
          "username": {
            "type": "string"
          },
          "can_join_groups": {
            "type": "boolean"
          },
          "can_read_all_group_messages": {
            "type": "boolean"
          },
          "supports_inline_queries": {
            "type": "boolean"
          },
          "liza_user_id": {
            "type": "string",
            "description": "Расширение Liza: полный Matrix ID пользователя (например `@user:synapse.liza.laba.prodamus.tech`). Его принимает `startChat`."
          }
        }
      },
      "Chat": {
        "type": "object",
        "required": [
          "id",
          "type"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "enum": [
              "private",
              "group"
            ],
            "description": "`private` — чат бота с одним человеком, `group` — три участника и больше. Одинаково во входящих, в getChat и в ответах send*/edit*."
          },
          "title": {
            "type": "string",
            "description": "Название группы."
          },
          "username": {
            "type": "string"
          },
          "first_name": {
            "type": "string"
          }
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "message_id",
          "chat",
          "date"
        ],
        "properties": {
          "message_id": {
            "type": "integer",
            "description": "Стабилен, растёт в пределах чата."
          },
          "from": {
            "$ref": "#/components/schemas/User"
          },
          "chat": {
            "$ref": "#/components/schemas/Chat"
          },
          "date": {
            "type": "integer",
            "description": "Unix-время в секундах."
          },
          "text": {
            "type": "string"
          },
          "invoice": {
            "$ref": "#/components/schemas/Invoice"
          },
          "photo": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PhotoSize"
            }
          },
          "voice": {
            "$ref": "#/components/schemas/Voice"
          },
          "audio": {
            "$ref": "#/components/schemas/Audio"
          },
          "document": {
            "$ref": "#/components/schemas/Document"
          },
          "video": {
            "$ref": "#/components/schemas/Video"
          },
          "caption": {
            "type": "string",
            "description": "Подпись к медиа."
          },
          "reply_to_message": {
            "type": "object",
            "description": "Сообщение, на которое ответили: message_id, chat, date, text (если известен), from (если это бот). Есть и в ответе send* при отправке с цитатой (там `date` = 0).",
            "properties": {
              "message_id": {
                "type": "integer"
              },
              "text": {
                "type": "string"
              },
              "from": {
                "$ref": "#/components/schemas/User"
              },
              "chat": {
                "$ref": "#/components/schemas/Chat"
              },
              "date": {
                "type": "integer"
              }
            }
          },
          "edit_date": {
            "type": "integer",
            "description": "Есть у edited_message и в ответах editMessage*."
          },
          "entities": {
            "type": "array",
            "description": "Разметка текста. Сейчас передаётся `bot_command` для команды в начале текста (`/start`, `/cmd@bot`) — по ней срабатывают обработчики команд библиотек.",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "bot_command"
                  ]
                },
                "offset": {
                  "type": "integer"
                },
                "length": {
                  "type": "integer",
                  "description": "В UTF-16 code units."
                }
              }
            }
          },
          "caption_entities": {
            "type": "array",
            "description": "То же для подписи к медиа.",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "bot_command"
                  ]
                },
                "offset": {
                  "type": "integer"
                },
                "length": {
                  "type": "integer",
                  "description": "В UTF-16 code units."
                }
              }
            }
          }
        }
      },
      "Update": {
        "type": "object",
        "required": [
          "update_id"
        ],
        "properties": {
          "update_id": {
            "type": "integer",
            "description": "Номер записи серверной очереди; монотонно растёт и в polling, и в webhook. Служебное обновление при приглашении бота в чат приходит от `from.id = 777000` (System) — его стоит пропускать."
          },
          "message": {
            "$ref": "#/components/schemas/Message"
          },
          "callback_query": {
            "$ref": "#/components/schemas/CallbackQuery"
          },
          "edited_message": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Message"
              }
            ],
            "description": "Пользователь отредактировал сообщение: тот же message_id, новый текст."
          }
        },
        "oneOf": [
          {
            "required": [
              "message"
            ]
          },
          {
            "required": [
              "callback_query"
            ]
          },
          {
            "required": [
              "edited_message"
            ]
          }
        ]
      },
      "CallbackQuery": {
        "type": "object",
        "required": [
          "id",
          "from",
          "message",
          "chat_instance",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "from": {
            "$ref": "#/components/schemas/User"
          },
          "message": {
            "$ref": "#/components/schemas/Message"
          },
          "chat_instance": {
            "type": "string"
          },
          "data": {
            "type": "string"
          }
        }
      },
      "File": {
        "type": "object",
        "required": [
          "file_id",
          "file_unique_id",
          "file_path"
        ],
        "properties": {
          "file_id": {
            "type": "string",
            "description": "Входящий Matrix MXC URI."
          },
          "file_unique_id": {
            "type": "string"
          },
          "file_size": {
            "type": "integer"
          },
          "file_path": {
            "type": "string",
            "description": "Относительный путь `сервер/media_id` для `GET /file/bot{token}/{file_path}`."
          }
        }
      },
      "WebhookInfo": {
        "type": "object",
        "required": [
          "url",
          "has_custom_certificate",
          "pending_update_count"
        ],
        "properties": {
          "url": {
            "type": "string"
          },
          "has_custom_certificate": {
            "const": false
          },
          "pending_update_count": {
            "type": "integer"
          },
          "last_error_date": {
            "type": "integer"
          },
          "last_error_message": {
            "type": "string"
          },
          "max_connections": {
            "type": "integer"
          },
          "allowed_updates": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "UserProfilePhotos": {
        "type": "object",
        "required": [
          "total_count",
          "photos"
        ],
        "properties": {
          "total_count": {
            "const": 0
          },
          "photos": {
            "type": "array",
            "maxItems": 0,
            "items": {
              "type": "array",
              "items": {
                "type": "object"
              }
            }
          }
        }
      },
      "LabeledPrice": {
        "type": "object",
        "required": [
          "label",
          "amount"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "amount": {
            "type": "integer",
            "minimum": 1,
            "description": "Минорные единицы валюты; итог вычисляется суммированием этих значений."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "default": 1,
            "description": "Расширение Liza только для отображения; не умножает amount."
          }
        }
      },
      "Invoice": {
        "type": "object",
        "required": [
          "currency",
          "total_amount"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "examples": [
              "RUB"
            ]
          },
          "total_amount": {
            "type": "integer"
          }
        }
      },
      "SendMessageRequest": {
        "type": "object",
        "required": [
          "chat_id",
          "text"
        ],
        "properties": {
          "chat_id": {
            "$ref": "#/components/schemas/ChatId"
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096
          },
          "parse_mode": {
            "type": "string",
            "enum": [
              "Markdown",
              "MarkdownV2",
              "HTML"
            ]
          },
          "reply_markup": {
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "string",
                "description": "JSON-строка в form/multipart."
              }
            ],
            "description": "inline_keyboard: кнопки с `callback_data` приходят боту как `callback_query` (нажатие в приложении Liza или ответ номером/названием кнопки), кнопки с `url` открывают ссылку. keyboard (обычная клавиатура): нажатие приходит сообщением с текстом кнопки, как в Telegram."
          },
          "entities": {},
          "disable_web_page_preview": {
            "type": "boolean",
            "description": "Игнорируется."
          },
          "disable_notification": {
            "type": "boolean",
            "description": "Игнорируется."
          },
          "protect_content": {
            "type": "boolean",
            "description": "Игнорируется."
          },
          "reply_to_message_id": {
            "type": "integer",
            "description": "Ответ на сообщение этого чата. Неизвестный id — отправка без цитаты."
          },
          "allow_sending_without_reply": {
            "type": "boolean",
            "description": "`false` — вернуть 400, если сообщения для ответа нет; по умолчанию сообщение уходит без цитаты."
          },
          "reply_parameters": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "message_id": {
                    "type": "integer"
                  },
                  "allow_sending_without_reply": {
                    "type": "boolean"
                  }
                }
              },
              {
                "type": "string"
              }
            ]
          }
        }
      },
      "ChatId": {
        "oneOf": [
          {
            "type": "integer"
          },
          {
            "type": "string",
            "minLength": 1
          }
        ]
      },
      "GetUpdatesRequest": {
        "type": "object",
        "properties": {
          "offset": {
            "type": "integer",
            "description": "Подтверждение через offset (см. getUpdates)."
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 100
          },
          "timeout": {
            "type": "integer",
            "minimum": 0,
            "maximum": 50,
            "description": "Long polling, секунды."
          },
          "allowed_updates": {
            "description": "Принимается и игнорируется."
          }
        }
      },
      "SetWebhookRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Пустая строка удаляет webhook; в production требуется HTTPS."
          },
          "secret_token": {
            "type": "string",
            "description": "Передаётся webhook получателю в `X-Liza-Bot-Api-Secret-Token`."
          },
          "certificate": {
            "description": "Игнорируется."
          },
          "ip_address": {
            "description": "Игнорируется."
          },
          "max_connections": {
            "description": "Игнорируется."
          },
          "drop_pending_updates": {
            "description": "Игнорируется."
          }
        }
      },
      "DeleteWebhookRequest": {
        "type": "object",
        "properties": {
          "drop_pending_updates": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "GetFileRequest": {
        "type": "object",
        "required": [
          "file_id"
        ],
        "properties": {
          "file_id": {
            "type": "string",
            "pattern": "^mxc://.+/.+",
            "description": "Принимается только Matrix MXC URI; произвольные идентификаторы и URL не поддержаны."
          }
        }
      },
      "MediaBase": {
        "type": "object",
        "required": [
          "chat_id"
        ],
        "properties": {
          "chat_id": {
            "$ref": "#/components/schemas/ChatId"
          },
          "caption": {
            "type": "string"
          },
          "parse_mode": {
            "type": "string",
            "enum": [
              "Markdown",
              "MarkdownV2",
              "HTML"
            ]
          },
          "reply_markup": {
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "string",
                "description": "JSON-строка в form/multipart."
              }
            ]
          },
          "reply_to_message_id": {
            "type": "integer"
          },
          "reply_parameters": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "message_id": {
                    "type": "integer"
                  },
                  "allow_sending_without_reply": {
                    "type": "boolean"
                  }
                }
              },
              {
                "type": "string"
              }
            ]
          }
        }
      },
      "InvoiceRequest": {
        "type": "object",
        "required": [
          "chat_id",
          "title",
          "prices"
        ],
        "properties": {
          "chat_id": {
            "$ref": "#/components/schemas/ChatId"
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "payload": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "default": "RUB"
          },
          "prices": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/LabeledPrice"
            }
          }
        }
      },
      "PhotoSize": {
        "type": "object",
        "required": [
          "file_id",
          "file_unique_id",
          "width",
          "height"
        ],
        "properties": {
          "file_id": {
            "type": "string"
          },
          "file_unique_id": {
            "type": "string"
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "file_size": {
            "type": "integer"
          }
        }
      },
      "Voice": {
        "type": "object",
        "description": "Голосовое сообщение (m.audio с признаком голосового).",
        "required": [
          "file_id",
          "file_unique_id"
        ],
        "properties": {
          "file_id": {
            "type": "string",
            "description": "mxc://… — передайте в getFile или повторно в send* этого же бота для отправки без перезаливки (чужой `file_id` — 400)."
          },
          "file_unique_id": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "file_size": {
            "type": "integer"
          },
          "duration": {
            "type": "integer",
            "description": "Секунды."
          }
        }
      },
      "Audio": {
        "type": "object",
        "description": "Аудиофайл.",
        "required": [
          "file_id",
          "file_unique_id"
        ],
        "properties": {
          "file_id": {
            "type": "string",
            "description": "mxc://… — передайте в getFile или повторно в send* этого же бота для отправки без перезаливки (чужой `file_id` — 400)."
          },
          "file_unique_id": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "file_size": {
            "type": "integer"
          },
          "duration": {
            "type": "integer"
          },
          "file_name": {
            "type": "string"
          }
        }
      },
      "Document": {
        "type": "object",
        "description": "Файл.",
        "required": [
          "file_id",
          "file_unique_id"
        ],
        "properties": {
          "file_id": {
            "type": "string",
            "description": "mxc://… — передайте в getFile или повторно в send* этого же бота для отправки без перезаливки (чужой `file_id` — 400)."
          },
          "file_unique_id": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "file_size": {
            "type": "integer"
          },
          "file_name": {
            "type": "string"
          }
        }
      },
      "Video": {
        "type": "object",
        "description": "Видео.",
        "required": [
          "file_id",
          "file_unique_id"
        ],
        "properties": {
          "file_id": {
            "type": "string",
            "description": "mxc://… — передайте в getFile или повторно в send* этого же бота для отправки без перезаливки (чужой `file_id` — 400)."
          },
          "file_unique_id": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "file_size": {
            "type": "integer"
          },
          "duration": {
            "type": "integer"
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "file_name": {
            "type": "string"
          }
        }
      },
      "BotCommand": {
        "type": "object",
        "required": [
          "command",
          "description"
        ],
        "properties": {
          "command": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,32}$"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        }
      },
      "ChatMember": {
        "type": "object",
        "required": [
          "status",
          "user"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "creator",
              "administrator",
              "member",
              "left",
              "kicked"
            ]
          },
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "until_date": {
            "type": "integer",
            "description": "У `kicked` — 0 (бессрочно)."
          }
        }
      }
    },
    "requestBodies": {
      "GetUpdates": {
        "required": false,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/GetUpdatesRequest"
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "$ref": "#/components/schemas/GetUpdatesRequest"
            }
          },
          "multipart/form-data": {
            "schema": {
              "$ref": "#/components/schemas/GetUpdatesRequest"
            }
          }
        }
      },
      "SendMessage": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SendMessageRequest"
            },
            "example": {
              "chat_id": 42,
              "text": "Привет, Liza!",
              "parse_mode": "HTML"
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "$ref": "#/components/schemas/SendMessageRequest"
            }
          },
          "multipart/form-data": {
            "schema": {
              "$ref": "#/components/schemas/SendMessageRequest"
            }
          }
        }
      },
      "CallbackAnswer": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "callback_query_id"
              ],
              "properties": {
                "callback_query_id": {
                  "type": "string",
                  "description": "`callback_query.id` из апдейта."
                },
                "text": {
                  "type": "string",
                  "maxLength": 200,
                  "description": "Всплывающее уведомление нажавшему."
                },
                "show_alert": {
                  "type": "boolean",
                  "description": "Показать `text` диалогом, а не уведомлением."
                },
                "url": {
                  "type": "string",
                  "description": "Ссылка, которую приложение откроет нажавшему."
                }
              }
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "type": "object"
            }
          }
        }
      },
      "SetWebhook": {
        "required": false,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SetWebhookRequest"
            },
            "example": {
              "url": "https://bot.example.org/webhook",
              "secret_token": "test-secret"
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "$ref": "#/components/schemas/SetWebhookRequest"
            }
          },
          "multipart/form-data": {
            "schema": {
              "$ref": "#/components/schemas/SetWebhookRequest"
            }
          }
        }
      },
      "DeleteWebhook": {
        "required": false,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeleteWebhookRequest"
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "$ref": "#/components/schemas/DeleteWebhookRequest"
            }
          },
          "multipart/form-data": {
            "schema": {
              "$ref": "#/components/schemas/DeleteWebhookRequest"
            }
          }
        }
      },
      "GetFile": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/GetFileRequest"
            },
            "example": {
              "file_id": "mxc://matrix.example.org/abc123"
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "$ref": "#/components/schemas/GetFileRequest"
            }
          },
          "multipart/form-data": {
            "schema": {
              "$ref": "#/components/schemas/GetFileRequest"
            }
          }
        }
      },
      "SendPhoto": {
        "$ref": "#/components/requestBodies/MediaPhoto"
      },
      "SendDocument": {
        "$ref": "#/components/requestBodies/MediaDocument"
      },
      "SendVideo": {
        "$ref": "#/components/requestBodies/MediaVideo"
      },
      "SendAudio": {
        "$ref": "#/components/requestBodies/MediaAudio"
      },
      "SendVoice": {
        "$ref": "#/components/requestBodies/MediaVoice"
      },
      "MediaPhoto": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "photo"
                  ],
                  "properties": {
                    "photo": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            },
            "example": {
              "chat_id": 42,
              "photo": "https://example.org/photo.jpg",
              "caption": "Фото"
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "photo"
                  ],
                  "properties": {
                    "photo": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "multipart/form-data": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "photo"
                  ],
                  "properties": {
                    "photo": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "MediaDocument": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "document"
                  ],
                  "properties": {
                    "document": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "document"
                  ],
                  "properties": {
                    "document": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "multipart/form-data": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "document"
                  ],
                  "properties": {
                    "document": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "MediaVideo": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "video"
                  ],
                  "properties": {
                    "video": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "video"
                  ],
                  "properties": {
                    "video": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "multipart/form-data": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "video"
                  ],
                  "properties": {
                    "video": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "MediaAudio": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "audio"
                  ],
                  "properties": {
                    "audio": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "audio"
                  ],
                  "properties": {
                    "audio": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "multipart/form-data": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "audio"
                  ],
                  "properties": {
                    "audio": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "MediaVoice": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "voice"
                  ],
                  "properties": {
                    "voice": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "voice"
                  ],
                  "properties": {
                    "voice": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              ]
            }
          },
          "multipart/form-data": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/MediaBase"
                },
                {
                  "type": "object",
                  "required": [
                    "voice"
                  ],
                  "properties": {
                    "voice": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "SendInvoice": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InvoiceRequest"
            },
            "example": {
              "chat_id": 42,
              "title": "Заказ",
              "currency": "RUB",
              "prices": [
                {
                  "label": "Кофе",
                  "amount": 15000,
                  "quantity": 2
                }
              ]
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "$ref": "#/components/schemas/InvoiceRequest"
            },
            "encoding": {
              "prices": {
                "contentType": "application/json"
              }
            }
          },
          "multipart/form-data": {
            "schema": {
              "$ref": "#/components/schemas/InvoiceRequest"
            },
            "encoding": {
              "prices": {
                "contentType": "application/json"
              }
            }
          }
        }
      }
    },
    "responses": {
      "BotResponse": {
        "description": "Сведения о боте.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Success"
                },
                {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/User"
                    }
                  }
                }
              ]
            },
            "example": {
              "ok": true,
              "result": {
                "id": 1,
                "is_bot": true,
                "first_name": "Demo",
                "username": "demo_bot",
                "can_join_groups": true,
                "can_read_all_group_messages": false,
                "supports_inline_queries": false
              }
            }
          }
        }
      },
      "MessageResponse": {
        "description": "Отправленное сообщение.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Success"
                },
                {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/Message"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "InvoiceMessageResponse": {
        "description": "Созданная карточка инвойса.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Success"
                },
                {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/Message"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "BooleanResponse": {
        "description": "Успешное выполнение.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Success"
                },
                {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "boolean"
                    }
                  }
                }
              ]
            },
            "example": {
              "ok": true,
              "result": true
            }
          }
        }
      },
      "UpdatesResponse": {
        "description": "Массив выданных обновлений.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Success"
                },
                {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Update"
                      }
                    }
                  }
                }
              ]
            },
            "example": {
              "ok": true,
              "result": []
            }
          }
        }
      },
      "WebhookInfoResponse": {
        "description": "Настройки webhook.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Success"
                },
                {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/WebhookInfo"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "FileResponse": {
        "description": "Метаданные файла.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Success"
                },
                {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/File"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "UserProfilePhotosResponse": {
        "description": "Всегда пустой набор фотографий.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Success"
                },
                {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/UserProfilePhotos"
                    }
                  }
                }
              ]
            },
            "example": {
              "ok": true,
              "result": {
                "total_count": 0,
                "photos": []
              }
            }
          }
        }
      },
      "BinaryFile": {
        "description": "Бинарное содержимое; сервер возвращает Content-Type, Content-Length и Content-Disposition.",
        "content": {
          "application/octet-stream": {
            "schema": {
              "type": "string",
              "format": "binary"
            }
          }
        }
      },
      "ErrorResponse": {
        "description": "Ошибка Liza Bot API.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "validation": {
                "value": {
                  "ok": false,
                  "error_code": 400,
                  "description": "Missing required parameter: chat_id"
                }
              },
              "invalidToken": {
                "value": {
                  "ok": false,
                  "error_code": 401,
                  "description": "Invalid bot token"
                }
              }
            }
          }
        }
      }
    }
  }
}
