{
  "openapi": "3.1.1",
  "info": {
    "title": "SMS-Host REST API",
    "description": "Отправка SMS и получение статусов. Аутентификация — API-ключ в заголовке Authorization: Bearer. Каждый ответ — конверт {data, error, meta}; ошибки имеют стабильный error.code.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.sms-host.ru"
    }
  ],
  "paths": {
    "/api/v1/me": {
      "get": {
        "tags": [
          "account"
        ],
        "summary": "Текущий пользователь и баланс",
        "description": "Пользователь ключа, его права, клиент и баланс (money — в рублях десятичной строкой, sms — число сообщений). sandbox — null у боевого клиента; у тестового клиента песочницы срок доступа и суточный лимит.",
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfMeModel"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/messages": {
      "post": {
        "tags": [
          "messages"
        ],
        "summary": "Отправить сообщения",
        "description": "Пакет до 100 сообщений. Каждое проверяется отдельно: accepted — принято, duplicate — такой id уже есть у вас (повтор безопасен), rejected — отказ с кодом. 202, если принято или повторено хотя бы одно; 422, если отказано всем.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessagesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "413": {
            "description": "Payload Too Large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfIReadOnlyListOfSendItemResult"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfIReadOnlyListOfSendItemResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      },
      "get": {
        "tags": [
          "messages"
        ],
        "summary": "Список или выборка по id",
        "description": "Либо ids=<uuid>,<uuid> (до 100, без других параметров; отсутствующие — в meta.missingIds), либо список новыми первыми с фильтрами from, to, status, receiver, sender и курсором (meta.cursor, meta.hasMore).",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "description": "Идентификаторы сообщений через запятую (UUID, от 1 до 100). Нельзя сочетать с другими параметрами; найденные сообщения идут в data, отсутствующие — в meta.missingIds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Начало периода, ISO 8601 (по умолчанию — 24 часа назад). Период from–to не длиннее 31 суток. Допустимы даты с 1753-01-01 по 9999-12-31.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Конец периода, ISO 8601 (по умолчанию — текущий момент). Допустимы даты с 1753-01-01 по 9999-12-31.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Фильтр по статусу сообщения.",
            "schema": {
              "enum": [
                "queued",
                "sending",
                "sent",
                "delivered",
                "delivery_failed",
                "send_failed"
              ],
              "type": "string"
            }
          },
          {
            "name": "receiver",
            "in": "query",
            "description": "Номер получателя: 11 цифр, начинается с 79 или 89.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sender",
            "in": "query",
            "description": "Имя или номер отправителя (точное совпадение).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Размер страницы, от 1 до 100 (по умолчанию 20).",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Курсор следующей страницы из meta.cursor предыдущего ответа.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfIReadOnlyListOfMessageView"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/messages/{id}": {
      "get": {
        "tags": [
          "messages"
        ],
        "summary": "Сообщение по id",
        "description": "Статус, части, стоимость и ошибка одного сообщения вашего клиента.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfMessageView"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/reports/message-states": {
      "get": {
        "tags": [
          "reports"
        ],
        "summary": "Отчёт по статусам",
        "description": "Завершённые сообщения за период, сгруппированные по часам, дням или месяцам (по длине периода) и по статусам. Период — не более 366 суток.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Начало периода, ISO 8601. Допустимы даты с 1753-01-01 по 9999-12-31.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Конец периода, ISO 8601; период from–to не длиннее 366 суток.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "utcOffsetMinutes",
            "in": "query",
            "description": "Сдвиг часового пояса в минутах для группировки по дням и месяцам, от -720 до 840 (по умолчанию 0).",
            "schema": {
              "maximum": 840,
              "minimum": -720,
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfStateReport"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/sender-names": {
      "get": {
        "tags": [
          "sender-names"
        ],
        "summary": "Имена отправителей",
        "description": "Зарегистрированные имена вашего клиента.",
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfIReadOnlyListOfSenderNameView"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      },
      "post": {
        "tags": [
          "sender-names"
        ],
        "summary": "Зарегистрировать имя",
        "description": "Имя — до 15 символов алфавита GSM 03.38. Покупка у оператора и абонплата оформляются администратором.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSenderNameRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "413": {
            "description": "Payload Too Large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfSenderNameView"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/sender-names/{id}": {
      "delete": {
        "tags": [
          "sender-names"
        ],
        "summary": "Снять имя",
        "description": "Удаляет имя вашего клиента по идентификатору.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/templates": {
      "get": {
        "tags": [
          "templates"
        ],
        "summary": "Список шаблонов",
        "description": "Шаблоны вашего клиента, новыми первыми: текущая версия и покрытие операторов. Фильтры status и sender, курсор (meta.cursor, meta.hasMore).",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Фильтр по статусу шаблона.",
            "schema": {
              "enum": [
                "active",
                "pending",
                "rejected",
                "disconnected",
                "archived"
              ],
              "type": "string"
            }
          },
          {
            "name": "sender",
            "in": "query",
            "description": "Имя отправителя (точное совпадение).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Размер страницы, от 1 до 100 (по умолчанию 20).",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Курсор следующей страницы из meta.cursor предыдущего ответа.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfIReadOnlyListOfTemplateSummary"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      },
      "post": {
        "tags": [
          "templates"
        ],
        "summary": "Создать шаблон",
        "description": "Новый шаблон отправляется на согласование каждому оператору тарифного плана клиента (статус pending). trafficType: advertising, service, authentication.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTemplateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "413": {
            "description": "Payload Too Large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfTemplateView"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/templates/{id}": {
      "get": {
        "tags": [
          "templates"
        ],
        "summary": "Шаблон по id",
        "description": "Шаблон со всеми версиями и решениями операторов.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfTemplateView"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/template-tariffs": {
      "get": {
        "tags": [
          "templates"
        ],
        "summary": "Тариф шаблонов",
        "description": "Операторы и месячная плата за шаблон по тарифу вашего клиента.",
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfIReadOnlyListOfTariffView"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/templates/validate": {
      "post": {
        "tags": [
          "templates"
        ],
        "summary": "Проверка текста",
        "description": "Разбирает текст шаблона без записи: valid, переменные и коды ошибок. Модерация и лимит записи не требуются.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateBodyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "413": {
            "description": "Payload Too Large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfTemplateCheckView"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/templates/{id}/versions": {
      "post": {
        "tags": [
          "templates"
        ],
        "summary": "Новая версия",
        "description": "Добавляет версию текста и отправляет её на согласование операторам; прежняя действует, пока у неё есть согласованные операторы.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateBodyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "413": {
            "description": "Payload Too Large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfTemplateView"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    },
    "/api/v1/templates/{id}/archive": {
      "post": {
        "tags": [
          "templates"
        ],
        "summary": "Архивировать шаблон",
        "description": "Необратимо и идемпотентно: повторный вызов тоже даёт 204.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          },
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestEnvelopeOfObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "CreateSenderNameRequest": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateTemplateRequest": {
        "required": [
          "name",
          "senderName",
          "trafficType",
          "body"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "senderName": {
            "type": [
              "null",
              "string"
            ]
          },
          "trafficType": {
            "type": [
              "null",
              "string"
            ]
          },
          "body": {
            "type": [
              "null",
              "string"
            ]
          }
        },
        "additionalProperties": false
      },
      "MeBalance": {
        "required": [
          "money",
          "currency",
          "sms"
        ],
        "type": "object",
        "properties": {
          "money": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "sms": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "MeModel": {
        "required": [
          "user",
          "customerId",
          "permissions",
          "balance",
          "sandbox"
        ],
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/MeUser"
          },
          "customerId": {
            "type": "string",
            "format": "uuid"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "balance": {
            "$ref": "#/components/schemas/MeBalance"
          },
          "sandbox": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MeSandbox"
              }
            ]
          }
        }
      },
      "MeSandbox": {
        "required": [
          "expiresUtc",
          "dailyLimit"
        ],
        "type": "object",
        "properties": {
          "expiresUtc": {
            "type": "string",
            "format": "date-time"
          },
          "dailyLimit": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "MessageParts": {
        "required": [
          "total",
          "sent",
          "delivered",
          "failed"
        ],
        "type": "object",
        "properties": {
          "total": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "sent": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "delivered": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "failed": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "MessageView": {
        "required": [
          "id",
          "to",
          "from",
          "text",
          "status",
          "createdAt",
          "startedAt",
          "endedAt",
          "parts",
          "cost",
          "error"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "to": {
            "type": [
              "null",
              "string"
            ]
          },
          "from": {
            "type": [
              "null",
              "string"
            ]
          },
          "text": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "type": "string"
          },
          "createdAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "startedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "endedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "parts": {
            "$ref": "#/components/schemas/MessageParts"
          },
          "cost": {
            "type": [
              "null",
              "string"
            ]
          },
          "error": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "MeUser": {
        "required": [
          "id",
          "login",
          "displayName",
          "email",
          "timeZone"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "login": {
            "type": "string"
          },
          "displayName": {
            "type": [
              "null",
              "string"
            ]
          },
          "email": {
            "type": [
              "null",
              "string"
            ]
          },
          "timeZone": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "RestEnvelopeOfIReadOnlyListOfMessageView": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/MessageView"
            }
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfIReadOnlyListOfSenderNameView": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/SenderNameView"
            }
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfIReadOnlyListOfSendItemResult": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/SendItemResult"
            }
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfIReadOnlyListOfTariffView": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/TariffView"
            }
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfIReadOnlyListOfTemplateSummary": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/TemplateSummary"
            }
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfMeModel": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MeModel"
              }
            ]
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfMessageView": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MessageView"
              }
            ]
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfObject": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": { },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfSenderNameView": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SenderNameView"
              }
            ]
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfStateReport": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/StateReport"
              }
            ]
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfTemplateCheckView": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TemplateCheckView"
              }
            ]
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestEnvelopeOfTemplateView": {
        "required": [
          "data",
          "error",
          "meta"
        ],
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TemplateView"
              }
            ]
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "RestErrorBody": {
        "required": [
          "code",
          "message",
          "details"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/RestErrorDetail"
            }
          }
        }
      },
      "RestErrorDetail": {
        "required": [
          "field",
          "issue"
        ],
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "issue": {
            "type": "string"
          }
        }
      },
      "SenderNameView": {
        "required": [
          "id",
          "name",
          "npi",
          "ton"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "npi": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "ton": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "SendItemResult": {
        "required": [
          "id",
          "to",
          "status",
          "parts",
          "error"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "to": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "type": "string"
          },
          "parts": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/RestErrorBody"
              }
            ]
          }
        }
      },
      "SendMessagesRequest": {
        "required": [
          "messages"
        ],
        "type": "object",
        "properties": {
          "messages": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "required": [
                "id",
                "to",
                "from",
                "text",
                "validityMinutes"
              ],
              "type": "object",
              "properties": {
                "id": {
                  "type": [
                    "null",
                    "string"
                  ],
                  "format": "uuid"
                },
                "to": {
                  "type": [
                    "null",
                    "string"
                  ]
                },
                "from": {
                  "type": [
                    "null",
                    "string"
                  ]
                },
                "text": {
                  "type": [
                    "null",
                    "string"
                  ]
                },
                "validityMinutes": {
                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                  "type": [
                    "null",
                    "integer",
                    "string"
                  ],
                  "format": "int32"
                }
              }
            }
          }
        }
      },
      "StateBucket": {
        "required": [
          "start",
          "queued",
          "sending",
          "sent",
          "delivered",
          "deliveryFailed",
          "sendFailed",
          "unknown"
        ],
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "queued": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "sending": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "sent": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "delivered": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "deliveryFailed": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "sendFailed": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "unknown": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "StateReport": {
        "required": [
          "interval",
          "buckets"
        ],
        "type": "object",
        "properties": {
          "interval": {
            "type": [
              "null",
              "string"
            ]
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StateBucket"
            }
          }
        }
      },
      "TariffView": {
        "required": [
          "operator",
          "monthlyFee"
        ],
        "type": "object",
        "properties": {
          "operator": {
            "type": "string"
          },
          "monthlyFee": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "TemplateBodyRequest": {
        "required": [
          "body"
        ],
        "type": "object",
        "properties": {
          "body": {
            "type": [
              "null",
              "string"
            ]
          }
        },
        "additionalProperties": false
      },
      "TemplateCheckError": {
        "required": [
          "code",
          "message"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "TemplateCheckView": {
        "required": [
          "valid",
          "variables",
          "errors"
        ],
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TemplateCheckError"
            }
          }
        }
      },
      "TemplateCoverage": {
        "required": [
          "approved",
          "total"
        ],
        "type": "object",
        "properties": {
          "approved": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "total": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "TemplateCurrent": {
        "required": [
          "version",
          "body",
          "variables"
        ],
        "type": "object",
        "properties": {
          "version": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "body": {
            "type": "string"
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "TemplateOperatorView": {
        "required": [
          "operator",
          "status",
          "unitPrice",
          "rejectionReason",
          "decidedAt"
        ],
        "type": "object",
        "properties": {
          "operator": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "unitPrice": {
            "type": [
              "null",
              "string"
            ]
          },
          "rejectionReason": {
            "type": [
              "null",
              "string"
            ]
          },
          "decidedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "TemplateSummary": {
        "required": [
          "id",
          "name",
          "senderName",
          "trafficType",
          "status",
          "createdAt",
          "archivedAt",
          "current",
          "coverage"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "senderName": {
            "type": "string"
          },
          "trafficType": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "archivedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "current": {
            "$ref": "#/components/schemas/TemplateCurrent"
          },
          "coverage": {
            "$ref": "#/components/schemas/TemplateCoverage"
          }
        }
      },
      "TemplateVersionView": {
        "required": [
          "version",
          "body",
          "variables",
          "createdAt",
          "status",
          "operators"
        ],
        "type": "object",
        "properties": {
          "version": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "body": {
            "type": "string"
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string"
          },
          "operators": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TemplateOperatorView"
            }
          }
        }
      },
      "TemplateView": {
        "required": [
          "id",
          "name",
          "senderName",
          "trafficType",
          "status",
          "createdAt",
          "archivedAt",
          "currentVersion",
          "versions"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "senderName": {
            "type": "string"
          },
          "trafficType": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "archivedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "currentVersion": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "versions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TemplateVersionView"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "API-ключ вида smsh_<prefix>_<secret>, выданный администратором.",
        "scheme": "bearer"
      }
    }
  },
  "tags": [
    {
      "name": "account"
    },
    {
      "name": "messages"
    },
    {
      "name": "reports"
    },
    {
      "name": "sender-names"
    },
    {
      "name": "templates"
    }
  ]
}