{ "openapi": "3.1.0", "info": { "title": "Ignis Core API", "version": "0.1.0" }, "paths": { "/devices": { "get": { "tags": [ "Devices & Groups" ], "summary": "Get All Devices", "operationId": "get_all_devices_devices_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/devices/groups": { "get": { "tags": [ "Devices & Groups" ], "summary": "Get Groups", "operationId": "get_groups_devices_groups_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } }, "security": [ { "APIKeyHeader": [] } ] }, "post": { "tags": [ "Devices & Groups" ], "summary": "Create Group", "operationId": "create_group_devices_groups_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GroupCreateSchema" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/devices/scenes": { "get": { "tags": [ "Devices & Groups" ], "summary": "Get Scenes", "operationId": "get_scenes_devices_scenes_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/devices/groups/{group_id}": { "delete": { "tags": [ "Devices & Groups" ], "summary": "Delete Group", "operationId": "delete_group_devices_groups__group_id__delete", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "group_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Group Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/devices/rescan": { "post": { "tags": [ "Devices & Groups" ], "summary": "Rescan Network", "operationId": "rescan_network_devices_rescan_post", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/control/device/{device_id}": { "post": { "tags": [ "Control" ], "summary": "Control Device", "operationId": "control_device_control_device__device_id__post", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "device_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Device Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CommandRequest" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeviceControlResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/control/group/{group_id}": { "post": { "tags": [ "Control" ], "summary": "Control Group", "operationId": "control_group_control_group__group_id__post", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "group_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Group Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CommandRequest" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GroupControlResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/control/device/{device_id}/blink": { "post": { "tags": [ "Control" ], "summary": "Blink Device", "operationId": "blink_device_control_device__device_id__blink_post", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "device_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Device Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BlinkResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/control/device/{device_id}/status": { "get": { "tags": [ "Control" ], "summary": "Get Device Status", "description": "Опрос реального состояния конкретной лампы.", "operationId": "get_device_status_control_device__device_id__status_get", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "device_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Device Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeviceStatusResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/control/group/{group_id}/status": { "get": { "tags": [ "Control" ], "summary": "Get Group Status", "description": "Опрос состояния всей группы (возвращает список статусов).", "operationId": "get_group_status_control_group__group_id__status_get", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "group_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Group Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GroupStatusResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/schedules/once": { "post": { "tags": [ "Schedules" ], "summary": "Schedule Once", "operationId": "schedule_once_schedules_once_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScheduleOnceRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScheduleCreateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/schedules/cron": { "post": { "tags": [ "Schedules" ], "summary": "Add Cron Task", "operationId": "add_cron_task_schedules_cron_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScheduleCronRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScheduleCreateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/schedules/tasks": { "get": { "tags": [ "Schedules" ], "summary": "Get All Tasks", "operationId": "get_all_tasks_schedules_tasks_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ScheduleTasksResponse" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/schedules/{job_id}": { "delete": { "tags": [ "Schedules" ], "summary": "Cancel Task", "operationId": "cancel_task_schedules__job_id__delete", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "job_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Job Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteStatusResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api-keys": { "get": { "tags": [ "API Keys" ], "summary": "List Keys", "description": "Список всех гостевых ключей.\n\nВ ответе поле `key` содержит публичный идентификатор, а не сам секрет.\nЭто сохраняет совместимость с текущим UI и не раскрывает токены повторно.", "operationId": "list_keys_api_keys_get", "security": [ { "APIKeyHeader": [] } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } }, "post": { "tags": [ "API Keys" ], "summary": "Create Key", "description": "Создать гостевой ключ. Возвращает сгенерированный токен.", "operationId": "create_key_api_keys_post", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "name", "in": "query", "required": true, "schema": { "type": "string", "title": "Name" } }, { "name": "is_admin", "in": "query", "required": false, "schema": { "type": "boolean", "default": false, "title": "Is Admin" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api-keys/revoke": { "post": { "tags": [ "API Keys" ], "summary": "Revoke Key", "description": "Деактивировать (отозвать) гостевой ключ. Ключ передаётся в body, не в URL.", "operationId": "revoke_key_api_keys_revoke_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/KeyActionRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/api-keys/activate": { "post": { "tags": [ "API Keys" ], "summary": "Activate Key", "description": "Повторно активировать ключ. Ключ передаётся в body, не в URL.", "operationId": "activate_key_api_keys_activate_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/KeyActionRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/stats/summary": { "get": { "tags": [ "Stats" ], "summary": "Get Summary", "description": "Сводная статистика за последние N дней.\nВозвращает по каждой группе/устройству:\n- total_commands -- общее количество команд\n- toggles_on / toggles_off -- включений / выключений\n- estimated_hours -- оценка часов работы (по парам on/off)", "operationId": "get_summary_stats_summary_get", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "days", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 365, "minimum": 1, "default": 7, "title": "Days" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/stats/log": { "get": { "tags": [ "Stats" ], "summary": "Get Log", "description": "Последние N событий (для просмотра лога).", "operationId": "get_log_stats_log_get", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 500, "minimum": 1, "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/": { "get": { "summary": "Read Index", "operationId": "read_index__get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/auth/me": { "get": { "summary": "Auth Me", "operationId": "auth_me_auth_me_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } }, "security": [ { "APIKeyHeader": [] } ] } } }, "components": { "schemas": { "BlinkResponse": { "properties": { "status": { "const": "blink_done", "title": "Status" }, "original": { "type": "boolean", "title": "Original" } }, "type": "object", "required": [ "status", "original" ], "title": "BlinkResponse" }, "CommandRequest": { "properties": { "state": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "State" }, "brightness": { "anyOf": [ { "type": "integer", "maximum": 100.0, "minimum": 10.0 }, { "type": "null" } ], "title": "Brightness" }, "scene": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Scene" }, "temp": { "anyOf": [ { "type": "integer", "maximum": 6500.0, "minimum": 2200.0 }, { "type": "null" } ], "title": "Temp" }, "r": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "R" }, "g": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "G" }, "b": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "B" } }, "additionalProperties": false, "type": "object", "title": "CommandRequest" }, "DeleteStatusResponse": { "properties": { "status": { "const": "deleted", "title": "Status" } }, "type": "object", "required": [ "status" ], "title": "DeleteStatusResponse" }, "DeviceControlResponse": { "properties": { "device_id": { "type": "string", "title": "Device Id" }, "applied": { "type": "object", "title": "Applied" }, "result": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "title": "Result" }, "status": { "const": "ok", "title": "Status" } }, "type": "object", "required": [ "device_id", "applied", "status" ], "title": "DeviceControlResponse" }, "DeviceStatusResponse": { "properties": { "device_id": { "type": "string", "title": "Device Id" }, "status": { "type": "object", "title": "Status" } }, "type": "object", "required": [ "device_id", "status" ], "title": "DeviceStatusResponse" }, "GroupCommandResult": { "properties": { "ip": { "type": "string", "title": "Ip" }, "ok": { "type": "boolean", "title": "Ok" }, "kind": { "type": "string", "title": "Kind" }, "result": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "title": "Result" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error" } }, "type": "object", "required": [ "ip", "ok", "kind" ], "title": "GroupCommandResult" }, "GroupControlResponse": { "properties": { "status": { "type": "string", "enum": [ "ok", "partial" ], "title": "Status" }, "applied": { "type": "object", "title": "Applied" }, "sent_to": { "items": { "type": "string" }, "type": "array", "title": "Sent To" }, "success_count": { "type": "integer", "title": "Success Count" }, "failure_count": { "type": "integer", "title": "Failure Count" }, "results": { "items": { "$ref": "#/components/schemas/GroupCommandResult" }, "type": "array", "title": "Results" } }, "type": "object", "required": [ "status", "applied", "sent_to", "success_count", "failure_count", "results" ], "title": "GroupControlResponse" }, "GroupCreateSchema": { "properties": { "id": { "type": "string", "title": "Id" }, "name": { "type": "string", "title": "Name" }, "macs": { "items": { "type": "string" }, "type": "array", "title": "Macs" } }, "type": "object", "required": [ "id", "name", "macs" ], "title": "GroupCreateSchema" }, "GroupStatusItem": { "properties": { "ip": { "type": "string", "title": "Ip" }, "status": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "title": "Status" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error" }, "kind": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Kind" } }, "type": "object", "required": [ "ip" ], "title": "GroupStatusItem" }, "GroupStatusResponse": { "properties": { "group_id": { "type": "string", "title": "Group Id" }, "results": { "items": { "$ref": "#/components/schemas/GroupStatusItem" }, "type": "array", "title": "Results" } }, "type": "object", "required": [ "group_id", "results" ], "title": "GroupStatusResponse" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "KeyActionRequest": { "properties": { "key": { "type": "string", "title": "Key" } }, "type": "object", "required": [ "key" ], "title": "KeyActionRequest", "description": "Тело запроса для операций с ключом (чтобы токен не летел в URL)." }, "ScheduleCreateResponse": { "properties": { "status": { "type": "string", "title": "Status" }, "job_id": { "type": "string", "title": "Job Id" }, "run_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Run At" } }, "type": "object", "required": [ "status", "job_id" ], "title": "ScheduleCreateResponse" }, "ScheduleCronRequest": { "properties": { "state": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "State" }, "brightness": { "anyOf": [ { "type": "integer", "maximum": 100.0, "minimum": 10.0 }, { "type": "null" } ], "title": "Brightness" }, "scene": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Scene" }, "temp": { "anyOf": [ { "type": "integer", "maximum": 6500.0, "minimum": 2200.0 }, { "type": "null" } ], "title": "Temp" }, "r": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "R" }, "g": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "G" }, "b": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "B" }, "target_id": { "type": "string", "minLength": 1, "title": "Target Id" }, "hour": { "type": "string", "minLength": 1, "title": "Hour" }, "minute": { "type": "string", "minLength": 1, "title": "Minute" }, "day_of_week": { "type": "string", "title": "Day Of Week", "default": "*" }, "is_group": { "type": "boolean", "title": "Is Group", "default": true } }, "additionalProperties": false, "type": "object", "required": [ "target_id", "hour", "minute" ], "title": "ScheduleCronRequest" }, "ScheduleOnceRequest": { "properties": { "state": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "State" }, "brightness": { "anyOf": [ { "type": "integer", "maximum": 100.0, "minimum": 10.0 }, { "type": "null" } ], "title": "Brightness" }, "scene": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Scene" }, "temp": { "anyOf": [ { "type": "integer", "maximum": 6500.0, "minimum": 2200.0 }, { "type": "null" } ], "title": "Temp" }, "r": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "R" }, "g": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "G" }, "b": { "anyOf": [ { "type": "integer", "maximum": 255.0, "minimum": 0.0 }, { "type": "null" } ], "title": "B" }, "target_id": { "type": "string", "minLength": 1, "title": "Target Id" }, "run_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Run At" }, "hours_from_now": { "anyOf": [ { "type": "integer", "minimum": 0.0 }, { "type": "null" } ], "title": "Hours From Now" }, "is_group": { "type": "boolean", "title": "Is Group", "default": true } }, "additionalProperties": false, "type": "object", "required": [ "target_id" ], "title": "ScheduleOnceRequest" }, "ScheduleTaskItem": { "properties": { "id": { "type": "string", "title": "Id" }, "target_id": { "type": "string", "title": "Target Id" }, "is_group": { "type": "boolean", "title": "Is Group" }, "state": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "State" }, "action_params": { "type": "object", "title": "Action Params" }, "trigger_type": { "type": "string", "title": "Trigger Type" }, "next_run": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Next Run" }, "hour": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Hour" }, "minute": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Minute" }, "day_of_week": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Day Of Week" }, "job_present": { "type": "boolean", "title": "Job Present" } }, "type": "object", "required": [ "id", "target_id", "is_group", "action_params", "trigger_type", "job_present" ], "title": "ScheduleTaskItem" }, "ScheduleTasksResponse": { "properties": { "tasks": { "items": { "$ref": "#/components/schemas/ScheduleTaskItem" }, "type": "array", "title": "Tasks" } }, "type": "object", "required": [ "tasks" ], "title": "ScheduleTasksResponse" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } }, "securitySchemes": { "APIKeyHeader": { "type": "apiKey", "in": "header", "name": "X-API-Key" } } } }