{
  "openapi": "3.0.3",
  "info": {
    "title": "AppsMax REST API",
    "version": "1.0.0",
    "description": "Публичный server-to-server контракт REST API AppsMax v1. Это API платформы AppsMax, а не официальный API MAX или Telegram. Проверено по production-маршрутам и валидации 2026-07-25.",
    "contact": {
      "name": "AppsMax",
      "url": "https://appsmax.ru/contacts/",
      "email": "info@appsmax.ru"
    }
  },
  "externalDocs": {
    "description": "Документация и ограничения",
    "url": "https://appsmax.ru/developers/"
  },
  "servers": [
    {
      "url": "https://telegram.appsmax.ru/api/v1",
      "description": "Production API v1"
    }
  ],
  "security": [
    { "bearerAuth": [] },
    { "apiTokenHeader": [] }
  ],
  "tags": [
    { "name": "Access", "description": "Проверка токена и контекста организации." },
    { "name": "Organizations" },
    { "name": "Bots" },
    { "name": "Miniapps" },
    { "name": "Funnels" },
    { "name": "Interactive menu" },
    { "name": "Applications" },
    { "name": "Campaigns" },
    { "name": "Subscribers" }
  ],
  "paths": {
    "/ping": {
      "get": {
        "operationId": "ping",
        "tags": ["Access"],
        "summary": "Проверить API-токен",
        "description": "Требует действующий токен, но не требует отдельного scope.",
        "responses": {
          "200": {
            "description": "Токен принят.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PingResponse" } } }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/me": {
      "get": {
        "operationId": "getCurrentApiContext",
        "tags": ["Access"],
        "summary": "Получить токен и организацию",
        "description": "Возвращает scopes и фактический rate limit токена. Отдельный scope не требуется.",
        "responses": {
          "200": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/organizations": {
      "get": {
        "operationId": "listOrganizations",
        "tags": ["Organizations"],
        "summary": "Получить текущую организацию",
        "x-required-scope": "organizations:read",
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/bots": {
      "get": {
        "operationId": "listBots",
        "tags": ["Bots"],
        "summary": "Получить ботов",
        "x-required-scope": "bots:read",
        "parameters": [
          { "$ref": "#/components/parameters/Driver" },
          { "$ref": "#/components/parameters/StatusSingle" },
          { "$ref": "#/components/parameters/PerPage100" },
          { "$ref": "#/components/parameters/Page" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/bots/{bot}": {
      "get": {
        "operationId": "getBot",
        "tags": ["Bots"],
        "summary": "Получить бота",
        "x-required-scope": "bots:read",
        "parameters": [{ "$ref": "#/components/parameters/BotPath" }],
        "responses": {
          "200": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/bots/{bot}/connections": {
      "get": {
        "operationId": "listBotConnections",
        "tags": ["Bots"],
        "summary": "Получить подключения бота",
        "x-required-scope": "connections:read",
        "parameters": [{ "$ref": "#/components/parameters/BotPath" }],
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/miniapps": {
      "get": {
        "operationId": "listMiniapps",
        "tags": ["Miniapps"],
        "summary": "Получить мини-приложения",
        "x-required-scope": "miniapps:read",
        "parameters": [
          { "$ref": "#/components/parameters/BotIdQuery" },
          { "$ref": "#/components/parameters/StatusSingle" },
          { "$ref": "#/components/parameters/PerPage100" },
          { "$ref": "#/components/parameters/Page" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/funnels": {
      "get": {
        "operationId": "listFunnels",
        "tags": ["Funnels"],
        "summary": "Получить сценарии",
        "x-required-scope": "funnels:read",
        "parameters": [
          { "$ref": "#/components/parameters/BotIdQuery" },
          { "$ref": "#/components/parameters/Active" },
          { "$ref": "#/components/parameters/PerPage100" },
          { "$ref": "#/components/parameters/Page" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/interactive-menu": {
      "get": {
        "operationId": "listInteractiveMenuItems",
        "tags": ["Interactive menu"],
        "summary": "Получить элементы интерактивного меню",
        "x-required-scope": "interactive_menu:read",
        "parameters": [
          { "$ref": "#/components/parameters/BotIdQuery" },
          { "$ref": "#/components/parameters/Active" },
          { "$ref": "#/components/parameters/PerPage200" },
          { "$ref": "#/components/parameters/Page" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/applications": {
      "get": {
        "operationId": "listApplications",
        "tags": ["Applications"],
        "summary": "Получить заявки",
        "x-required-scope": "applications:read",
        "parameters": [
          { "$ref": "#/components/parameters/BotIdQuery" },
          { "$ref": "#/components/parameters/StatusArray" },
          { "$ref": "#/components/parameters/SourceArray" },
          { "$ref": "#/components/parameters/CreatedFrom" },
          { "$ref": "#/components/parameters/CreatedTo" },
          { "$ref": "#/components/parameters/Tag" },
          { "$ref": "#/components/parameters/PerPage100" },
          {
            "name": "sort",
            "in": "query",
            "schema": { "type": "string", "enum": ["created_at", "submitted_at"], "default": "created_at" }
          },
          { "$ref": "#/components/parameters/Direction" },
          { "$ref": "#/components/parameters/Page" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      },
      "post": {
        "operationId": "createApplication",
        "tags": ["Applications"],
        "summary": "Создать заявку",
        "description": "bot_id обязателен. Верхнеуровневое поле status не поддерживается; AppsMax назначает новой заявке начальный статус.",
        "x-required-scope": "applications:write",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApplicationCreateRequest" } } }
        },
        "responses": {
          "201": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/applications/{id}": {
      "get": {
        "operationId": "getApplication",
        "tags": ["Applications"],
        "summary": "Получить заявку",
        "x-required-scope": "applications:read",
        "parameters": [{ "$ref": "#/components/parameters/IdPath" }],
        "responses": {
          "200": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/applications/{application}/tags": {
      "post": {
        "operationId": "syncApplicationTags",
        "tags": ["Applications"],
        "summary": "Синхронизировать теги заявки",
        "x-required-scope": "applications:write",
        "parameters": [{ "$ref": "#/components/parameters/ApplicationPath" }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApplicationTagsRequest" } } }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/campaigns": {
      "get": {
        "operationId": "listCampaigns",
        "tags": ["Campaigns"],
        "summary": "Получить кампании",
        "x-required-scope": "campaigns:read",
        "parameters": [
          { "$ref": "#/components/parameters/BotIdQuery" },
          { "$ref": "#/components/parameters/StatusArray" },
          { "$ref": "#/components/parameters/TypeArray" },
          { "$ref": "#/components/parameters/CreatedFrom" },
          { "$ref": "#/components/parameters/CreatedTo" },
          { "$ref": "#/components/parameters/Search" },
          { "$ref": "#/components/parameters/PerPage100" },
          { "$ref": "#/components/parameters/Direction" },
          { "$ref": "#/components/parameters/Page" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      },
      "post": {
        "operationId": "createCampaign",
        "tags": ["Campaigns"],
        "summary": "Создать кампанию",
        "description": "Создаёт черновик или запланированную запись. Для запуска используется отдельный POST /campaigns/{id}/run.",
        "x-required-scope": "campaigns:write",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CampaignCreateRequest" } } }
        },
        "responses": {
          "201": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/campaigns/{campaign}": {
      "get": {
        "operationId": "getCampaign",
        "tags": ["Campaigns"],
        "summary": "Получить кампанию",
        "x-required-scope": "campaigns:read",
        "parameters": [{ "$ref": "#/components/parameters/CampaignPath" }],
        "responses": {
          "200": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/campaigns/{id}/run": {
      "post": {
        "operationId": "runCampaign",
        "tags": ["Campaigns"],
        "summary": "Запустить кампанию",
        "description": "Переводит черновик в состояние запуска/планирования. Перед вызовом интегратор отвечает за аудиторию, согласия, содержание и правила канала.",
        "x-required-scope": "campaigns:write",
        "parameters": [{ "$ref": "#/components/parameters/IdPath" }],
        "responses": {
          "200": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/subscribers": {
      "get": {
        "operationId": "listSubscribers",
        "tags": ["Subscribers"],
        "summary": "Получить подписчиков",
        "x-required-scope": "subscribers:read",
        "parameters": [
          { "$ref": "#/components/parameters/ChannelArray" },
          { "$ref": "#/components/parameters/StatusArray" },
          { "$ref": "#/components/parameters/BotIdQuery" },
          { "$ref": "#/components/parameters/Tag" },
          { "$ref": "#/components/parameters/GroupId" },
          { "$ref": "#/components/parameters/Search" },
          { "$ref": "#/components/parameters/CreatedFrom" },
          { "$ref": "#/components/parameters/CreatedTo" },
          { "$ref": "#/components/parameters/PerPage100" },
          { "$ref": "#/components/parameters/Direction" },
          { "$ref": "#/components/parameters/Page" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Collection" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      },
      "post": {
        "operationId": "upsertSubscriber",
        "tags": ["Subscribers"],
        "summary": "Создать или обновить подписчика",
        "description": "Операция выполняет upsert по bot_id и external_id.",
        "x-required-scope": "subscribers:write",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SubscriberCreateRequest" } } }
        },
        "responses": {
          "201": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/subscribers/{id}": {
      "get": {
        "operationId": "getSubscriber",
        "tags": ["Subscribers"],
        "summary": "Получить подписчика",
        "x-required-scope": "subscribers:read",
        "parameters": [{ "$ref": "#/components/parameters/IdPath" }],
        "responses": {
          "200": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      },
      "patch": {
        "operationId": "updateSubscriber",
        "tags": ["Subscribers"],
        "summary": "Обновить подписчика",
        "x-required-scope": "subscribers:write",
        "parameters": [{ "$ref": "#/components/parameters/IdPath" }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SubscriberUpdateRequest" } } }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Resource" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "422": { "$ref": "#/components/responses/ValidationFailed" },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "AppsMax API token",
        "description": "Рекомендуемый вариант: Authorization: Bearer YOUR_API_TOKEN"
      },
      "apiTokenHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Token",
        "description": "Fallback для клиентов без Bearer auth. Не передавайте токен в URL."
      }
    },
    "parameters": {
      "IdPath": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": { "type": "integer", "minimum": 1 }
      },
      "BotPath": {
        "name": "bot",
        "in": "path",
        "required": true,
        "schema": { "type": "integer", "minimum": 1 }
      },
      "ApplicationPath": {
        "name": "application",
        "in": "path",
        "required": true,
        "schema": { "type": "integer", "minimum": 1 }
      },
      "CampaignPath": {
        "name": "campaign",
        "in": "path",
        "required": true,
        "schema": { "type": "integer", "minimum": 1 }
      },
      "BotIdQuery": {
        "name": "bot_id",
        "in": "query",
        "schema": { "type": "integer", "minimum": 1 }
      },
      "Driver": {
        "name": "driver",
        "in": "query",
        "schema": { "type": "string" }
      },
      "StatusSingle": {
        "name": "status",
        "in": "query",
        "schema": { "type": "string" }
      },
      "StatusArray": {
        "name": "status[]",
        "in": "query",
        "style": "form",
        "explode": true,
        "schema": { "type": "array", "items": { "type": "string" } }
      },
      "SourceArray": {
        "name": "source[]",
        "in": "query",
        "style": "form",
        "explode": true,
        "schema": { "type": "array", "items": { "type": "string" } }
      },
      "TypeArray": {
        "name": "type[]",
        "in": "query",
        "style": "form",
        "explode": true,
        "schema": { "type": "array", "items": { "type": "string" } }
      },
      "ChannelArray": {
        "name": "channel[]",
        "in": "query",
        "style": "form",
        "explode": true,
        "schema": { "type": "array", "items": { "type": "string" } }
      },
      "Active": {
        "name": "active",
        "in": "query",
        "schema": { "type": "boolean" }
      },
      "Tag": {
        "name": "tag",
        "in": "query",
        "schema": { "type": "string", "maxLength": 80 }
      },
      "GroupId": {
        "name": "group_id",
        "in": "query",
        "schema": { "type": "integer", "minimum": 1 }
      },
      "Search": {
        "name": "q",
        "in": "query",
        "schema": { "type": "string", "maxLength": 255 }
      },
      "CreatedFrom": {
        "name": "created_from",
        "in": "query",
        "schema": { "type": "string", "format": "date" }
      },
      "CreatedTo": {
        "name": "created_to",
        "in": "query",
        "schema": { "type": "string", "format": "date" }
      },
      "Direction": {
        "name": "direction",
        "in": "query",
        "schema": { "type": "string", "enum": ["asc", "desc"], "default": "desc" }
      },
      "Page": {
        "name": "page",
        "in": "query",
        "schema": { "type": "integer", "minimum": 1 }
      },
      "PerPage100": {
        "name": "per_page",
        "in": "query",
        "schema": { "type": "integer", "minimum": 1, "maximum": 100 }
      },
      "PerPage200": {
        "name": "per_page",
        "in": "query",
        "schema": { "type": "integer", "minimum": 1, "maximum": 200 }
      }
    },
    "schemas": {
      "PingResponse": {
        "type": "object",
        "required": ["status", "organization_id"],
        "properties": {
          "status": { "type": "string", "example": "ok" },
          "organization_id": { "type": "integer", "nullable": true }
        }
      },
      "ResourceEnvelope": {
        "type": "object",
        "required": ["data"],
        "properties": {
          "data": { "type": "object", "additionalProperties": true }
        }
      },
      "CollectionEnvelope": {
        "type": "object",
        "required": ["data"],
        "properties": {
          "data": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "links": { "type": "object", "additionalProperties": true },
          "meta": { "type": "object", "additionalProperties": true }
        }
      },
      "ApplicationCreateRequest": {
        "type": "object",
        "required": ["bot_id"],
        "additionalProperties": false,
        "properties": {
          "bot_id": { "type": "integer", "minimum": 1 },
          "source": { "type": "string", "nullable": true, "description": "Поддерживаемый источник AppsMax; при отсутствии используется rest_api." },
          "title": { "type": "string", "maxLength": 255, "nullable": true },
          "contact": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "properties": {
              "name": { "type": "string", "maxLength": 255, "nullable": true },
              "phone": { "type": "string", "maxLength": 255, "nullable": true },
              "email": { "type": "string", "format": "email", "maxLength": 255, "nullable": true }
            }
          },
          "channel": { "type": "string", "maxLength": 191, "nullable": true },
          "payload": { "type": "object", "additionalProperties": true, "nullable": true }
        }
      },
      "ApplicationTagsRequest": {
        "type": "object",
        "required": ["tags"],
        "additionalProperties": false,
        "properties": {
          "tags": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": { "type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[\\p{L}\\p{M}\\p{N} _-]+$" }
          }
        }
      },
      "CampaignCreateRequest": {
        "type": "object",
        "required": ["bot_id", "title", "content", "channel"],
        "additionalProperties": false,
        "properties": {
          "bot_id": { "type": "integer", "minimum": 1 },
          "title": { "type": "string", "maxLength": 255 },
          "content": { "type": "string", "maxLength": 4096 },
          "channel": { "type": "string", "maxLength": 191 },
          "scheduled_at": { "type": "string", "format": "date-time", "nullable": true }
        }
      },
      "SubscriberCreateRequest": {
        "type": "object",
        "required": ["bot_id", "channel", "external_id"],
        "additionalProperties": false,
        "properties": {
          "bot_id": { "type": "integer", "minimum": 1 },
          "channel": { "type": "string", "maxLength": 191 },
          "external_id": { "type": "string", "maxLength": 255 },
          "status": { "type": "string", "maxLength": 50, "nullable": true },
          "name": { "type": "string", "maxLength": 255, "nullable": true },
          "username": { "type": "string", "maxLength": 255, "nullable": true },
          "tags": { "type": "array", "nullable": true, "items": { "type": "string", "maxLength": 64 } }
        }
      },
      "SubscriberUpdateRequest": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "channel": { "type": "string", "maxLength": 191 },
          "status": { "type": "string", "maxLength": 50 },
          "name": { "type": "string", "maxLength": 255, "nullable": true },
          "username": { "type": "string", "maxLength": 255, "nullable": true },
          "tags": { "type": "array", "nullable": true, "items": { "type": "string", "maxLength": 64 } }
        }
      },
      "ApiError": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": { "type": "string" },
              "message": { "type": "string" },
              "details": { "type": "object", "additionalProperties": true },
              "meta": { "type": "object", "additionalProperties": true }
            }
          }
        }
      }
    },
    "responses": {
      "Resource": {
        "description": "Один ресурс.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResourceEnvelope" } } }
      },
      "Collection": {
        "description": "Коллекция; для пагинируемых методов содержит links и meta.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CollectionEnvelope" } } }
      },
      "Unauthorized": {
        "description": "Токен отсутствует, недействителен или отозван.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } }
      },
      "Forbidden": {
        "description": "Нет нужного scope или доступа к организации.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } }
      },
      "NotFound": {
        "description": "Ресурс не найден в доступном контуре.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } }
      },
      "ValidationFailed": {
        "description": "Поля запроса не прошли валидацию.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } }
      },
      "RateLimited": {
        "description": "Превышен rate limit токена или операции.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } }
      }
    }
  },
  "x-appsmax-verified-at": "2026-07-25",
  "x-appsmax-default-rate-limit-per-minute": 60,
  "x-appsmax-public-sdk": false,
  "x-appsmax-webhooks-covered": false
}
