{"openapi": "3.1.0", "info": {"title": "Red Node API для хостингов", "version": "1.0", "description": "Проверка пулов адресов из России, мониторинг подсетей, события и страница статуса. RedLine Studio.", "contact": {"name": "Поддержка Red Node", "email": "support@redstudio.site"}}, "servers": [{"url": "https://redstudio.site/rednode/api/v1"}], "security": [{"apiKey": []}], "tags": [{"name": "Аккаунт"}, {"name": "Ключи"}, {"name": "Пулы"}, {"name": "Проверки"}, {"name": "Мониторинг"}, {"name": "События и вебхуки"}, {"name": "Страница статуса"}], "paths": {"/account": {"get": {"summary": "Аккаунт, тариф, лимиты и расход", "description": "Работает с любым действующим ключом.", "responses": {"200": {"description": "Аккаунт", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Account"}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Аккаунт"]}}, "/overview": {"get": {"summary": "Сводка для главного экрана", "description": "Аккаунт, пулы, адреса по состояниям, плохие подсети, последние проверки и события одним ответом.\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Сводка", "content": {"application/json": {"schema": {"type": "object"}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Аккаунт"]}}, "/me": {"get": {"summary": "Кто вошёл (панель и бот)", "description": "Для сессии панели Red Node и для бота: доступна ли линия для хостингов, аккаунты, тарифы. API-ключом не вызывается.", "responses": {"200": {"description": "Сведения", "content": {"application/json": {"schema": {"type": "object"}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Аккаунт"]}}, "/onboard": {"post": {"summary": "Завести хостинг (панель и бот)", "description": "Создаёт аккаунт хостинга с пробной неделей для того, кто вошёл в панель или пишет боту.", "responses": {"201": {"description": "Аккаунт", "content": {"application/json": {"schema": {"type": "object", "properties": {"account": {"$ref": "#/components/schemas/Account"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Аккаунт"], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"name": {"type": "string", "example": "Северная Стойка"}}, "required": ["name"]}}}}}}, "/keys": {"get": {"summary": "Список ключей", "description": "\n\nНужно право ключа `keys:write`.", "responses": {"200": {"description": "Ключи", "content": {"application/json": {"schema": {"type": "object", "properties": {"keys": {"type": "array", "items": {"$ref": "#/components/schemas/Key"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Ключи"]}, "post": {"summary": "Выпустить ключ", "description": "Полный ключ приходит один раз в поле `secret`. Ключ не может получить прав больше, чем у ключа, которым его выпускают.\n\nНужно право ключа `keys:write`.", "responses": {"201": {"description": "Ключ", "content": {"application/json": {"schema": {"type": "object", "properties": {"key": {"$ref": "#/components/schemas/Key"}, "secret": {"type": "string"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Ключи"], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/KeyCreate"}}}}}}, "/keys/{kid}/rotate": {"post": {"summary": "Заменить ключ", "description": "Выпускает новый ключ с теми же правами. Старый работает ещё `grace_hours` часов (по умолчанию 24, от 0 до 168), чтобы вы успели обновить биллинг.\n\nНужно право ключа `keys:write`.", "responses": {"201": {"description": "Новый ключ", "content": {"application/json": {"schema": {"type": "object", "properties": {"key": {"$ref": "#/components/schemas/Key"}, "secret": {"type": "string"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Ключи"], "parameters": [{"name": "kid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"grace_hours": {"type": "integer", "default": 24}}}}}}}}, "/keys/{kid}": {"delete": {"summary": "Отозвать ключ", "description": "\n\nНужно право ключа `keys:write`.", "responses": {"200": {"description": "OK"}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Ключи"], "parameters": [{"name": "kid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}]}}, "/pools": {"get": {"summary": "Пулы", "description": "\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Пулы", "content": {"application/json": {"schema": {"type": "object", "properties": {"pools": {"type": "array", "items": {"$ref": "#/components/schemas/Pool"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Пулы"]}, "post": {"summary": "Добавить пул", "description": "Пул это набор ваших адресов с общим портом проверки, например стойка или локация. Диапазоны шире /22 и больше 1024 адресов без подтверждения принимаем только после подтверждения сети.\n\nНужно право ключа `pools:write`.", "responses": {"201": {"description": "Пул", "content": {"application/json": {"schema": {"type": "object", "properties": {"pool": {"$ref": "#/components/schemas/Pool"}, "notes": {"type": "array", "items": {"type": "string"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Пулы"], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PoolCreate"}}}}}}, "/pools/{pool}": {"get": {"summary": "Пул", "description": "\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Пул", "content": {"application/json": {"schema": {"type": "object", "properties": {"pool": {"$ref": "#/components/schemas/Pool"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Пулы"], "parameters": [{"name": "pool", "in": "path", "required": true, "schema": {"type": "string"}, "description": "id или slug пула"}]}, "patch": {"summary": "Изменить пул", "description": "Поля как при создании, кроме targets.\n\nНужно право ключа `pools:write`.", "responses": {"200": {"description": "Пул", "content": {"application/json": {"schema": {"type": "object", "properties": {"pool": {"$ref": "#/components/schemas/Pool"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Пулы"], "parameters": [{"name": "pool", "in": "path", "required": true, "schema": {"type": "string"}, "description": "id или slug пула"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PoolCreate"}}}}}, "delete": {"summary": "Удалить пул", "description": "\n\nНужно право ключа `pools:write`.", "responses": {"200": {"description": "OK"}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Пулы"], "parameters": [{"name": "pool", "in": "path", "required": true, "schema": {"type": "string"}, "description": "id или slug пула"}]}}, "/pools/{pool}/subnets": {"get": {"summary": "Состояние каждой /24 пула", "description": "\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Подсети", "content": {"application/json": {"schema": {"type": "object", "properties": {"subnets": {"type": "array", "items": {"$ref": "#/components/schemas/Subnet"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Мониторинг"], "parameters": [{"name": "pool", "in": "path", "required": true, "schema": {"type": "string"}, "description": "id или slug пула"}]}}, "/pools/{pool}/ips": {"get": {"summary": "Состояние адресов пула", "description": "Страницами по 500 (до 5000), дальше `after`.\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Адреса", "content": {"application/json": {"schema": {"type": "object", "properties": {"ips": {"type": "array", "items": {"$ref": "#/components/schemas/IpState"}}, "next_after": {"type": ["integer", "null"]}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Мониторинг"], "parameters": [{"name": "pool", "in": "path", "required": true, "schema": {"type": "string"}, "description": "id или slug пула"}, {"name": "state", "in": "query", "required": false, "schema": {"type": "string", "enum": ["clean", "blocked", "partial", "down", "unknown"], "description": "clean: открывается из России; blocked: из России не открывается, из Европы открывается; partial: не открывается из части российских точек; down: не отвечает ниоткуда; unknown: данных нет"}, "description": ""}, {"name": "after", "in": "query", "required": false, "schema": {"type": "integer"}, "description": ""}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer"}, "description": ""}]}}, "/pools/{pool}/priority": {"post": {"summary": "Отметить выданные клиентам адреса", "description": "Эти адреса попадают в каждую выборку мониторинга первыми. `priority: false` снимает отметку.\n\nНужно право ключа `pools:write`.", "responses": {"200": {"description": "Сколько адресов отмечено", "content": {"application/json": {"schema": {"type": "object", "properties": {"updated": {"type": "integer"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Мониторинг"], "parameters": [{"name": "pool", "in": "path", "required": true, "schema": {"type": "string"}, "description": "id или slug пула"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"ips": {"type": "array", "items": {"type": "string"}}, "priority": {"type": "boolean", "default": true}}, "required": ["ips"]}}}}}}, "/pools/{pool}/check": {"post": {"summary": "Проверить весь пул", "description": "Разовая проверка всех адресов пула. Результаты обновляют состояние пула. Когда закончится, придёт событие `pool_check.done`.\n\nНужно право ключа `checks:write`.", "responses": {"202": {"description": "Проверка поставлена в очередь", "content": {"application/json": {"schema": {"type": "object", "properties": {"check": {"$ref": "#/components/schemas/Check"}, "eta_minutes": {"type": "integer"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Проверки"], "parameters": [{"name": "pool", "in": "path", "required": true, "schema": {"type": "string"}, "description": "id или slug пула"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"port": {"type": "integer"}, "sni": {"type": "string"}, "tls": {"type": "boolean"}, "label": {"type": "string"}}}}}}}}, "/pools/{pool}/verify": {"post": {"summary": "Подтвердить сеть", "description": "Проверяет TXT-запись в обратной зоне (`method: txt`) или одобренный ASN (`method: asn`) для всех неподтверждённых диапазонов пула или для одного (`range_id`).\n\nНужно право ключа `pools:write`.", "responses": {"200": {"description": "Результаты", "content": {"application/json": {"schema": {"type": "object", "properties": {"results": {"type": "array", "items": {"type": "object", "properties": {"range_id": {"type": "integer"}, "range": {"type": "string"}, "verified": {"type": "boolean"}, "text": {"type": "string"}}}}, "pool": {"$ref": "#/components/schemas/Pool"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Пулы"], "parameters": [{"name": "pool", "in": "path", "required": true, "schema": {"type": "string"}, "description": "id или slug пула"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"method": {"type": "string", "enum": ["txt", "asn"]}, "range_id": {"type": "integer"}}}}}}}}, "/verification": {"get": {"summary": "Что добавить в DNS для подтверждения", "description": "\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Значение TXT и имена записей", "content": {"application/json": {"schema": {"type": "object", "properties": {"txt_value": {"type": "string", "example": "rednode-verify=3f9a1c0d2b7e4a51c8d6e0f1"}, "unverified": {"type": "array", "items": {"type": "object", "properties": {"range_id": {"type": "integer"}, "range": {"type": "string"}, "pool_id": {"type": "integer"}, "txt_names": {"type": "array", "items": {"type": "string"}}}}}, "trusted_asns": {"type": "array", "items": {"type": "object"}}, "limits": {"type": "object"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Пулы"]}}, "/checks": {"get": {"summary": "Последние проверки", "description": "\n\nНужно право ключа `checks:read`.", "responses": {"200": {"description": "Проверки", "content": {"application/json": {"schema": {"type": "object", "properties": {"checks": {"type": "array", "items": {"$ref": "#/components/schemas/Check"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Проверки"], "parameters": [{"name": "limit", "in": "query", "required": false, "schema": {"type": "integer"}, "description": ""}]}, "post": {"summary": "Проверить список адресов", "description": "Разовая проверка списка. Адреса из ваших пулов можно проверять в пределах тарифа; адреса вне пулов считаются новым заявлением: не шире /22 и не больше 1024 без подтверждения сети. Чужие подтверждённые сети проверить нельзя.\n\nНужно право ключа `checks:write`.", "responses": {"202": {"description": "Проверка поставлена в очередь", "content": {"application/json": {"schema": {"type": "object", "properties": {"check": {"$ref": "#/components/schemas/Check"}, "notes": {"type": "array", "items": {"type": "string"}}, "eta_minutes": {"type": "integer"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Проверки"], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CheckCreate"}}}}}}, "/checks/{cid}": {"get": {"summary": "Проверка и сводка по /24", "description": "\n\nНужно право ключа `checks:read`.", "responses": {"200": {"description": "Проверка", "content": {"application/json": {"schema": {"type": "object", "properties": {"check": {"$ref": "#/components/schemas/Check"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Проверки"], "parameters": [{"name": "cid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}]}}, "/checks/{cid}/results": {"get": {"summary": "Результат по каждому адресу", "description": "`format=csv` отдаёт CSV с колонками ip, verdict, stage, subnet, ru_tcp, ru_tls, eu_tcp, eu_tls, note, finished.\n\nНужно право ключа `checks:read`.", "responses": {"200": {"description": "Результаты", "content": {"application/json": {"schema": {"type": "object", "properties": {"check": {"$ref": "#/components/schemas/Check"}, "results": {"type": "array", "items": {"$ref": "#/components/schemas/Result"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Проверки"], "parameters": [{"name": "cid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}, {"name": "format", "in": "query", "required": false, "schema": {"type": "string", "enum": ["json", "csv"]}, "description": ""}, {"name": "verdict", "in": "query", "required": false, "schema": {"type": "string", "enum": ["clean", "blocked", "partial", "down", "unknown"], "description": "clean: открывается из России; blocked: из России не открывается, из Европы открывается; partial: не открывается из части российских точек; down: не отвечает ниоткуда; unknown: данных нет"}, "description": ""}]}}, "/ips/check": {"post": {"summary": "Проверить адреса сейчас", "description": "До 50 адресов вне очереди, например перед выдачей IP новому клиенту. С `wait` (до 60 секунд) ответ ждёт результата: 200 с вердиктами или 202, если проверка ещё идёт.\n\nНужно право ключа `checks:write`.", "responses": {"200": {"description": "Результаты", "content": {"application/json": {"schema": {"type": "object", "properties": {"done": {"type": "boolean"}, "results": {"type": "array", "items": {"type": "object", "properties": {"ip": {"type": "string"}, "verdict": {"type": "string", "enum": ["clean", "blocked", "partial", "down", "unknown"], "description": "clean: открывается из России; blocked: из России не открывается, из Европы открывается; partial: не открывается из части российских точек; down: не отвечает ниоткуда; unknown: данных нет"}, "stage": {"type": ["string", "null"]}, "note": {"type": ["string", "null"]}, "check_id": {"type": "string"}}}}, "checks": {"type": "array", "items": {"$ref": "#/components/schemas/Check"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Проверки"], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"ips": {"type": "array", "items": {"type": "string"}}, "port": {"type": "integer"}, "sni": {"type": "string"}, "tls": {"type": "boolean"}, "wait": {"type": "integer", "default": 0}}, "required": ["ips"]}}}}}}, "/ips/lookup": {"post": {"summary": "Последнее известное состояние адресов", "description": "Без новой проверки: что мы знаем о каждом адресе сейчас. До 1000 адресов.\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Состояния", "content": {"application/json": {"schema": {"type": "object", "properties": {"ips": {"type": "array", "items": {"$ref": "#/components/schemas/IpState"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Мониторинг"], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"ips": {"type": "array", "items": {"type": "string"}}}, "required": ["ips"]}}}}}}, "/ips/{ip}": {"get": {"summary": "Состояние одного адреса", "description": "\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Состояние", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/IpState"}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Мониторинг"], "parameters": [{"name": "ip", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}]}}, "/events": {"get": {"summary": "Лента событий", "description": "Те же события, что уходят в вебхуки. Читайте с `after=<next_after>` прошлого ответа.\n\nНужно право ключа `events:read`.", "responses": {"200": {"description": "События", "content": {"application/json": {"schema": {"type": "object", "properties": {"events": {"type": "array", "items": {"$ref": "#/components/schemas/Event"}}, "next_after": {"type": "integer"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"], "parameters": [{"name": "after", "in": "query", "required": false, "schema": {"type": "integer"}, "description": ""}, {"name": "types", "in": "query", "required": false, "schema": {"type": "string", "description": "Через запятую"}, "description": ""}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer"}, "description": ""}]}}, "/webhooks": {"get": {"summary": "Вебхуки", "description": "\n\nНужно право ключа `webhooks:read`.", "responses": {"200": {"description": "Вебхуки", "content": {"application/json": {"schema": {"type": "object", "properties": {"webhooks": {"type": "array", "items": {"$ref": "#/components/schemas/Webhook"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"]}, "post": {"summary": "Добавить вебхук", "description": "Только https и только публичные адреса. Секрет приходит один раз.\n\nНужно право ключа `webhooks:write`.", "responses": {"201": {"description": "Вебхук", "content": {"application/json": {"schema": {"type": "object", "properties": {"webhook": {"$ref": "#/components/schemas/Webhook"}, "secret": {"type": "string"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WebhookCreate"}}}}}}, "/webhooks/{hid}": {"patch": {"summary": "Изменить вебхук", "description": "\n\nНужно право ключа `webhooks:write`.", "responses": {"200": {"description": "Вебхук", "content": {"application/json": {"schema": {"type": "object", "properties": {"webhook": {"$ref": "#/components/schemas/Webhook"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"], "parameters": [{"name": "hid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"url": {"type": "string"}, "events": {"type": "array", "items": {"type": "string"}}, "active": {"type": "boolean"}, "description": {"type": "string"}}}}}}}, "delete": {"summary": "Удалить вебхук", "description": "\n\nНужно право ключа `webhooks:write`.", "responses": {"200": {"description": "OK"}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"], "parameters": [{"name": "hid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}]}}, "/webhooks/{hid}/rotate-secret": {"post": {"summary": "Новый секрет подписи", "description": "\n\nНужно право ключа `webhooks:write`.", "responses": {"200": {"description": "Секрет", "content": {"application/json": {"schema": {"type": "object", "properties": {"secret": {"type": "string"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"], "parameters": [{"name": "hid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}]}}, "/webhooks/{hid}/test": {"post": {"summary": "Отправить тестовое событие ping", "description": "\n\nНужно право ключа `webhooks:write`.", "responses": {"202": {"description": "Поставлено в очередь", "content": {"application/json": {"schema": {"type": "object", "properties": {"delivery_id": {"type": "string"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"], "parameters": [{"name": "hid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}]}}, "/webhooks/{hid}/deliveries": {"get": {"summary": "Журнал доставок", "description": "\n\nНужно право ключа `webhooks:read`.", "responses": {"200": {"description": "Доставки", "content": {"application/json": {"schema": {"type": "object", "properties": {"deliveries": {"type": "array", "items": {"$ref": "#/components/schemas/Delivery"}}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"], "parameters": [{"name": "hid", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer"}, "description": ""}]}}, "/deliveries/{did}/redeliver": {"post": {"summary": "Отправить доставку ещё раз", "description": "\n\nНужно право ключа `webhooks:write`.", "responses": {"200": {"description": "OK"}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["События и вебхуки"], "parameters": [{"name": "did", "in": "path", "required": true, "schema": {"type": "string"}, "description": ""}]}}, "/status-page": {"get": {"summary": "Настройки страницы статуса", "description": "\n\nНужно право ключа `pools:read`.", "responses": {"200": {"description": "Страница", "content": {"application/json": {"schema": {"type": "object", "properties": {"status_page": {"$ref": "#/components/schemas/StatusPage"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Страница статуса"]}, "patch": {"summary": "Изменить страницу статуса", "description": "title, subtitle, accent и accent_dark (#RRGGBB), site_url, support_url, show_ranges, enabled, slug, custom_domain (тарифы Сеть и Оператор).\n\nНужно право ключа `status:write`.", "responses": {"200": {"description": "Страница", "content": {"application/json": {"schema": {"type": "object", "properties": {"status_page": {"$ref": "#/components/schemas/StatusPage"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Страница статуса"], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"title": {"type": "string"}, "subtitle": {"type": "string"}, "accent": {"type": "string"}, "accent_dark": {"type": "string"}, "site_url": {"type": "string"}, "support_url": {"type": "string"}, "show_ranges": {"type": "boolean"}, "enabled": {"type": "boolean"}, "slug": {"type": "string"}, "custom_domain": {"type": "string"}}}}}}}}, "/status-page/logo": {"put": {"summary": "Загрузить логотип", "description": "Тело запроса: сам файл PNG, JPEG или WebP до 256 КБ. `?theme=dark` для логотипа тёмной темы.\n\nНужно право ключа `status:write`.", "responses": {"200": {"description": "Страница", "content": {"application/json": {"schema": {"type": "object", "properties": {"status_page": {"$ref": "#/components/schemas/StatusPage"}}}}}}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Страница статуса"], "parameters": [{"name": "theme", "in": "query", "required": false, "schema": {"type": "string", "enum": ["dark"]}, "description": ""}], "requestBody": {"required": true, "content": {"image/png": {"schema": {"type": "string", "format": "binary"}}, "image/jpeg": {"schema": {"type": "string", "format": "binary"}}, "image/webp": {"schema": {"type": "string", "format": "binary"}}}}}, "delete": {"summary": "Убрать логотип", "description": "\n\nНужно право ключа `status:write`.", "responses": {"200": {"description": "OK"}, "4XX": {"description": "Ошибка", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "tags": ["Страница статуса"], "parameters": [{"name": "theme", "in": "query", "required": false, "schema": {"type": "string", "enum": ["dark"]}, "description": ""}]}}}, "webhooks": {"ip.blocked": {"post": {"summary": "ip.blocked", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Event"}, "example": {"id": "evt_3f9a1c0d2b7e4a51", "type": "ip.blocked", "created": 1795171482, "org": "severny-host", "data": {"ip": "185.12.40.17", "port": 443, "stage": "tcp", "verdict": "blocked", "pool": {"id": 3, "slug": "msk-2", "name": "Москва, стойка 2"}, "subnet": "185.12.40.0/24", "since": 1795171200, "first_seen": false}}}}}, "responses": {"2XX": {"description": "Любой ответ 2xx засчитываем как доставку"}}}}, "ip.unblocked": {"post": {"summary": "ip.unblocked", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Event"}, "example": {"id": "evt_3f9a1c0d2b7e4a51", "type": "ip.unblocked", "created": 1795171482, "org": "severny-host", "data": {"ip": "185.12.40.17", "port": 443, "pool": {"id": 3, "slug": "msk-2", "name": "Москва, стойка 2"}, "subnet": "185.12.40.0/24", "blocked_for": 5400}}}}}, "responses": {"2XX": {"description": "Любой ответ 2xx засчитываем как доставку"}}}}, "subnet.degraded": {"post": {"summary": "subnet.degraded", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Event"}, "example": {"id": "evt_3f9a1c0d2b7e4a51", "type": "subnet.degraded", "created": 1795171482, "org": "severny-host", "data": {"subnet": "185.12.40.0/24", "level": "degraded", "blocked": 37, "partial": 2, "live": 120, "declared": 254, "pool": {"id": 3, "slug": "msk-2", "name": "Москва, стойка 2"}, "asn": 64500}}}}}, "responses": {"2XX": {"description": "Любой ответ 2xx засчитываем как доставку"}}}}, "subnet.recovered": {"post": {"summary": "subnet.recovered", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Event"}, "example": {"id": "evt_3f9a1c0d2b7e4a51", "type": "subnet.recovered", "created": 1795171482, "org": "severny-host", "data": {"subnet": "185.12.40.0/24", "pool": {"id": 3, "slug": "msk-2", "name": "Москва, стойка 2"}, "was": "degraded", "duration": 8100}}}}}, "responses": {"2XX": {"description": "Любой ответ 2xx засчитываем как доставку"}}}}, "asn.degraded": {"post": {"summary": "asn.degraded", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Event"}, "example": {"id": "evt_3f9a1c0d2b7e4a51", "type": "asn.degraded", "created": 1795171482, "org": "severny-host", "data": {"asn": 64500, "holder": "EXAMPLE-AS", "subnets_bad": 5, "subnets_known": 8}}}}}, "responses": {"2XX": {"description": "Любой ответ 2xx засчитываем как доставку"}}}}, "asn.recovered": {"post": {"summary": "asn.recovered", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Event"}, "example": {"id": "evt_3f9a1c0d2b7e4a51", "type": "asn.recovered", "created": 1795171482, "org": "severny-host", "data": {"asn": 64500, "holder": "EXAMPLE-AS", "duration": 14400}}}}}, "responses": {"2XX": {"description": "Любой ответ 2xx засчитываем как доставку"}}}}, "pool_check.done": {"post": {"summary": "pool_check.done", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Event"}, "example": {"id": "evt_3f9a1c0d2b7e4a51", "type": "pool_check.done", "created": 1795171482, "org": "severny-host", "data": {"check_id": "chk_5b1f0c2a9e", "kind": "pool", "pool": null, "total": 254, "clean": 210, "blocked": 37, "partial": 2, "down": 5, "unknown": 0, "subnets": [{"subnet": "185.12.40.0/24", "declared": 254, "blocked": 37, "clean": 210, "partial": 2, "down": 5, "unknown": 0}]}}}}}, "responses": {"2XX": {"description": "Любой ответ 2xx засчитываем как доставку"}}}}}, "components": {"schemas": {"Error": {"type": "object", "properties": {"error": {"type": "string", "description": "Код ошибки"}, "text": {"type": "string", "description": "Что случилось и что делать"}}, "required": ["error", "text"]}, "Totals": {"type": "object", "properties": {"clean": {"type": "integer"}, "blocked": {"type": "integer"}, "partial": {"type": "integer"}, "down": {"type": "integer"}, "unknown": {"type": "integer"}}}, "SubnetSummary": {"type": "object", "properties": {"subnet": {"type": "string", "example": "185.12.40.0/24"}, "declared": {"type": "integer"}, "clean": {"type": "integer"}, "blocked": {"type": "integer"}, "partial": {"type": "integer"}, "down": {"type": "integer"}, "unknown": {"type": "integer"}}}, "Check": {"type": "object", "properties": {"id": {"type": "string", "example": "chk_5b1f0c2a9e"}, "kind": {"type": "string", "enum": ["pool", "ips"]}, "status": {"type": "string", "enum": ["queued", "running", "done"]}, "pool_id": {"type": ["integer", "null"]}, "label": {"type": ["string", "null"]}, "port": {"type": "integer"}, "sni": {"type": ["string", "null"]}, "tls": {"type": "boolean"}, "total": {"type": "integer"}, "done": {"type": "integer"}, "created": {"type": "integer"}, "finished": {"type": ["integer", "null"]}, "totals": {"$ref": "#/components/schemas/Totals"}, "subnets": {"type": "array", "items": {"$ref": "#/components/schemas/SubnetSummary"}}}}, "CheckCreate": {"type": "object", "properties": {"targets": {"oneOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}], "description": "Адреса, подсети CIDR и диапазоны: 185.12.40.17, 185.12.40.0/24, 185.12.40.10-185.12.40.50 или 185.12.40.10-50. Через перевод строки, запятую или пробел; CSV тоже подходит"}, "port": {"type": "integer", "default": 443, "description": "Порт, на который идёт рукопожатие. Один на проверку"}, "sni": {"type": "string", "description": "SNI для ClientHello; пусто значит без SNI"}, "tls": {"type": "boolean", "default": true, "description": "false: только TCP-рукопожатие"}, "label": {"type": "string", "description": "Подпись для отчёта"}}, "required": ["targets"]}, "Result": {"type": "object", "properties": {"ip": {"type": "string"}, "verdict": {"type": "string", "enum": ["clean", "blocked", "partial", "down", "unknown"], "description": "clean: открывается из России; blocked: из России не открывается, из Европы открывается; partial: не открывается из части российских точек; down: не отвечает ниоткуда; unknown: данных нет"}, "stage": {"type": ["string", "null"], "enum": ["tcp", "tls", "rst"]}, "subnet": {"type": "string"}, "probes": {"type": "object", "properties": {"ru": {"type": "array", "items": {"type": "object"}}, "eu": {"type": "array", "items": {"type": "object"}}}}, "note": {"type": ["string", "null"]}, "finished": {"type": ["integer", "null"]}}}, "Range": {"type": "object", "properties": {"id": {"type": "integer"}, "range": {"type": "string", "example": "185.12.40.0/24"}, "size": {"type": "integer"}, "verified": {"type": ["string", "null"], "enum": ["txt", "asn", "admin", "inherit"]}, "asn": {"type": ["integer", "null"]}}}, "Pool": {"type": "object", "properties": {"id": {"type": "integer"}, "slug": {"type": "string"}, "name": {"type": "string"}, "location": {"type": ["string", "null"]}, "port": {"type": "integer"}, "sni": {"type": ["string", "null"]}, "tls": {"type": "boolean"}, "monitor": {"type": "boolean"}, "public": {"type": "boolean", "description": "Показывать на странице статуса"}, "size": {"type": "integer"}, "ranges": {"oneOf": [{"type": "integer"}, {"type": "array", "items": {"$ref": "#/components/schemas/Range"}}]}, "addresses": {"type": "object", "properties": {"clean": {"type": "integer"}, "blocked": {"type": "integer"}, "partial": {"type": "integer"}, "down": {"type": "integer"}}}, "subnets": {"type": "object", "properties": {"ok": {"type": "integer"}, "degraded": {"type": "integer"}, "dark": {"type": "integer"}, "unknown": {"type": "integer"}}}, "created": {"type": "integer"}}}, "PoolCreate": {"type": "object", "properties": {"name": {"type": "string", "example": "Москва, стойка 2"}, "targets": {"type": "string", "example": "185.12.40.0/24\n185.12.41.0/25"}, "location": {"type": "string", "example": "Москва, DataLine"}, "port": {"type": "integer", "default": 443}, "sni": {"type": "string"}, "tls": {"type": "boolean", "default": true}, "monitor": {"type": "boolean", "default": true}, "public": {"type": "boolean", "default": true}, "slug": {"type": "string"}}, "required": ["name", "targets"]}, "IpState": {"type": "object", "properties": {"ip": {"type": "string"}, "state": {"oneOf": [{"type": "string", "enum": ["clean", "blocked", "partial", "down", "unknown"], "description": "clean: открывается из России; blocked: из России не открывается, из Европы открывается; partial: не открывается из части российских точек; down: не отвечает ниоткуда; unknown: данных нет"}, {"type": "string", "enum": ["not_declared"]}]}, "stage": {"type": ["string", "null"]}, "since": {"type": ["integer", "null"]}, "checked": {"type": ["integer", "null"]}, "answers": {"type": ["boolean", "null"], "description": "Отвечает ли адрес хоть откуда-то"}, "unconfirmed": {"type": ["string", "null"], "description": "Новое состояние, которое ждёт повторной проверки"}, "priority": {"type": "boolean"}, "subnet": {"type": "string"}, "pool": {"type": ["object", "null"], "properties": {"id": {"type": "integer"}, "slug": {"type": "string"}}}}}, "Subnet": {"type": "object", "properties": {"subnet": {"type": "string"}, "declared": {"type": "integer"}, "state": {"type": "string", "enum": ["ok", "degraded", "dark", "unknown"]}, "since": {"type": ["integer", "null"]}, "answering": {"type": "integer"}, "blocked": {"type": "integer"}, "partial": {"type": "integer"}, "down": {"type": "integer"}, "asn": {"type": ["integer", "null"]}, "last_sample": {"type": ["integer", "null"]}, "next_sample": {"type": ["integer", "null"]}}}, "Event": {"type": "object", "properties": {"id": {"type": "string"}, "type": {"type": "string", "enum": ["ip.blocked", "ip.unblocked", "subnet.degraded", "subnet.recovered", "asn.degraded", "asn.recovered", "pool_check.done"]}, "created": {"type": "integer"}, "data": {"type": "object"}}}, "Key": {"type": "object", "properties": {"id": {"type": "string"}, "name": {"type": "string"}, "prefix": {"type": "string", "example": "rnh_3f9a1c0d2b_Xk2p"}, "scopes": {"type": "array", "items": {"type": "string", "enum": ["pools:read", "pools:write", "checks:read", "checks:write", "events:read", "webhooks:read", "webhooks:write", "status:write", "keys:write"]}}, "created": {"type": "integer"}, "last_used": {"type": ["integer", "null"]}, "expires": {"type": ["integer", "null"]}, "revoked": {"type": "boolean"}, "rotated_to": {"type": ["string", "null"]}}}, "KeyCreate": {"type": "object", "properties": {"name": {"type": "string", "example": "billing"}, "scopes": {"type": "array", "items": {"type": "string", "enum": ["pools:read", "pools:write", "checks:read", "checks:write", "events:read", "webhooks:read", "webhooks:write", "status:write", "keys:write", "read", "all"]}, "default": ["read"]}, "expires_days": {"type": "integer"}}}, "Webhook": {"type": "object", "properties": {"id": {"type": "string"}, "url": {"type": "string"}, "events": {"type": "array", "items": {"type": "string"}}, "active": {"type": "boolean"}, "description": {"type": "string"}, "created": {"type": "integer"}, "last_ok": {"type": ["integer", "null"]}, "last_error": {"type": ["string", "null"]}, "fails_in_row": {"type": "integer"}}}, "WebhookCreate": {"type": "object", "properties": {"url": {"type": "string", "example": "https://billing.example.ru/rednode/hook"}, "events": {"type": "array", "items": {"type": "string", "enum": ["ip.blocked", "ip.unblocked", "subnet.degraded", "subnet.recovered", "asn.degraded", "asn.recovered", "pool_check.done", "*"]}, "default": ["*"]}, "description": {"type": "string"}}, "required": ["url"]}, "Delivery": {"type": "object", "properties": {"id": {"type": "string"}, "event_id": {"type": "string"}, "type": {"type": "string"}, "status": {"type": "string", "enum": ["pending", "delivered", "failed", "cancelled"]}, "attempts": {"type": "integer"}, "code": {"type": ["integer", "null"]}, "error": {"type": ["string", "null"]}, "created": {"type": "integer"}, "next_at": {"type": ["integer", "null"]}, "done_at": {"type": ["integer", "null"]}}}, "StatusPage": {"type": "object", "properties": {"slug": {"type": "string"}, "url": {"type": "string"}, "title": {"type": "string"}, "subtitle": {"type": ["string", "null"]}, "accent": {"type": "string", "example": "#0A66FF"}, "accent_dark": {"type": ["string", "null"]}, "logo": {"type": "boolean"}, "logo_dark": {"type": "boolean"}, "site_url": {"type": ["string", "null"]}, "support_url": {"type": ["string", "null"]}, "show_ranges": {"type": "boolean"}, "enabled": {"type": "boolean"}, "badge": {"type": "string"}, "json": {"type": "string"}, "custom_domain": {"type": ["string", "null"]}, "custom_domain_ready": {"type": "boolean"}}}, "Account": {"type": "object", "properties": {"slug": {"type": "string"}, "name": {"type": "string"}, "plan": {"type": "string"}, "plan_title": {"type": "string"}, "plan_active": {"type": "boolean"}, "plan_until": {"type": ["integer", "null"]}, "limits": {"type": "object"}, "usage": {"type": "object"}, "probes": {"type": "object"}, "status_page": {"type": ["string", "null"]}, "alerts": {"type": "object"}, "demo": {"type": "boolean"}}}}, "securitySchemes": {"apiKey": {"type": "http", "scheme": "bearer", "bearerFormat": "rnh_<id>_<secret>", "description": "Ключ из панели или из POST /keys"}}}}