{ "schemes": [ "http", "https" ], "swagger": "2.0", "info": { "description": "Agrafa backend API for agent ingestion, inventory creation, and read-side observability queries.", "title": "Agrafa API", "contact": {}, "version": "1.0" }, "basePath": "/v1", "paths": { "/agent/config": { "get": { "description": "Returns the authenticated node summary and the node's assigned agent-executed health checks.", "produces": [ "application/json" ], "tags": [ "agent" ], "summary": "Get agent config", "parameters": [ { "type": "string", "description": "Per-node agent token", "name": "X-Agent-Token", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AgentConfigResponseDocument" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/agent/health": { "post": { "description": "Records a health check result for a service and updates service state when needed.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "agent" ], "summary": "Ingest health result", "parameters": [ { "type": "string", "description": "Per-node agent token", "name": "X-Agent-Token", "in": "header", "required": true }, { "description": "Health payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.HealthRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.HealthResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/agent/heartbeat": { "post": { "description": "Records a heartbeat for a node and updates node state when needed.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "agent" ], "summary": "Ingest heartbeat", "parameters": [ { "type": "string", "description": "Per-node agent token", "name": "X-Agent-Token", "in": "header", "required": true }, { "description": "Heartbeat payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.HeartbeatRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.HeartbeatResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/agent/metrics": { "post": { "description": "Records one or more metric samples associated with a node and optionally a service.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "agent" ], "summary": "Ingest metrics", "parameters": [ { "type": "string", "description": "Per-node agent token", "name": "X-Agent-Token", "in": "header", "required": true }, { "description": "Metrics payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.MetricsRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.MetricsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/agent/shutdown": { "post": { "description": "Records an agent shutdown signal so the authenticated node can be marked offline without waiting for heartbeat expiry.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "agent" ], "summary": "Ingest shutdown", "parameters": [ { "type": "string", "description": "Per-node agent token", "name": "X-Agent-Token", "in": "header", "required": true }, { "description": "Shutdown payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AgentShutdownRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.HeartbeatResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/alert-rules": { "get": { "description": "Returns alert rules ordered by newest first. Optionally filters by project_id.", "produces": [ "application/json" ], "tags": [ "alerts" ], "summary": "List alert rules", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AlertRulesResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "post": { "description": "Creates an enabled alert rule for a project, node, or service target.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "alerts" ], "summary": "Create alert rule", "parameters": [ { "description": "Alert rule payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AlertRuleCreateRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/types.AlertRuleResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/alert-rules/{id}": { "get": { "description": "Returns alert rule details for a rule the current user can read.", "produces": [ "application/json" ], "tags": [ "alerts" ], "summary": "Get alert rule", "parameters": [ { "type": "integer", "description": "Alert rule ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AlertRuleResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "delete": { "description": "Deletes an alert rule.", "produces": [ "application/json" ], "tags": [ "alerts" ], "summary": "Delete alert rule", "parameters": [ { "type": "integer", "description": "Alert rule ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "patch": { "description": "Updates the target, threshold, severity, and enabled state of an alert rule.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "alerts" ], "summary": "Update alert rule", "parameters": [ { "type": "integer", "description": "Alert rule ID", "name": "id", "in": "path", "required": true }, { "description": "Alert rule update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AlertRuleUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AlertRuleResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/alerts": { "get": { "security": [ { "CookieAuth": [] } ], "description": "Returns authoritative alert-rule and affected-resource presentation data. status=active is an independent read with no history limit; status=resolved uses keyset pagination ordered by triggered_at and id newest-first.", "produces": [ "application/json" ], "tags": [ "alerts" ], "summary": "List alerts", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query" }, { "enum": [ "active", "resolved" ], "type": "string", "description": "Alert status", "name": "status", "in": "query" }, { "type": "integer", "description": "Affected service ID", "name": "service_id", "in": "query" }, { "type": "integer", "description": "Affected node ID", "name": "node_id", "in": "query" }, { "enum": [ "node_offline", "service_unhealthy", "cpu_above_threshold", "memory_above_threshold", "disk_above_threshold" ], "type": "string", "description": "Alert rule type", "name": "rule_type", "in": "query" }, { "enum": [ "info", "warning", "critical" ], "type": "string", "description": "Alert severity", "name": "severity", "in": "query" }, { "enum": [ "node", "service", "metric" ], "type": "string", "description": "Alert category", "name": "category", "in": "query" }, { "maximum": 100, "minimum": 1, "type": "integer", "default": 50, "description": "Resolved/combined page size (default 50, maximum 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Opaque resolved-history cursor returned as next_cursor; requires status=resolved", "name": "before", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AlertsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/forgot-password": { "post": { "description": "Accepts an email address and, when an account exists, sends a password reset email without revealing account existence.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Forgot password", "parameters": [ { "description": "Password reset request", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AuthForgotPasswordRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthLogoutResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/login": { "post": { "description": "Verifies email/password and sets a session cookie.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Login", "parameters": [ { "description": "Login payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AuthLoginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthSessionResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/logout": { "post": { "description": "Deletes the current session and clears the session cookie.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Logout", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthLogoutResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/logout-all": { "post": { "description": "Deletes all other sessions for the authenticated user and keeps the current session active.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Logout all other sessions", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthLogoutResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/me": { "get": { "description": "Returns the currently authenticated user when the session cookie is valid.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Me", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthMeResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/onboarding/complete": { "post": { "description": "Marks the authenticated user onboarding flow as complete and returns the updated user payload.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Complete onboarding", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthMeResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/register": { "post": { "description": "Creates a user, password credential, and session cookie.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Register", "parameters": [ { "description": "Registration payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AuthRegisterRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/types.AuthSessionResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/reset-password": { "post": { "description": "Validates a password reset token, updates the password hash, invalidates the token, and revokes all sessions for the user.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Reset password", "parameters": [ { "description": "Password reset payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AuthResetPasswordRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthLogoutResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/sessions": { "get": { "description": "Returns all sessions for the authenticated user and marks the current session.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "List auth sessions", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthSessionsResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/sessions/{id}": { "delete": { "description": "Deletes a specific session belonging to the authenticated user. If the current session is deleted, the session cookie is cleared.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Delete auth session", "parameters": [ { "type": "string", "description": "Session ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/verify-email/confirm": { "post": { "description": "Validates an email verification token, marks the user as verified, and invalidates the token.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Confirm email verification", "parameters": [ { "description": "Email verification token", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AuthVerifyEmailConfirmRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthLogoutResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/verify-email/send": { "post": { "description": "Sends an email verification link for the authenticated user unless the email is already verified.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Send email verification", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthLogoutResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/auth/verify-password": { "post": { "description": "Verifies the current password for the authenticated user without creating a new session or changing state.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Verify password", "parameters": [ { "description": "Password verification payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.AuthVerifyPasswordRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthLogoutResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/events": { "get": { "description": "Returns newest events first, with optional project filter and result limit.", "produces": [ "application/json" ], "tags": [ "events" ], "summary": "List events", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query" }, { "minimum": 1, "type": "integer", "default": 50, "description": "Maximum number of events", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.EventsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/instance-settings": { "get": { "description": "Returns email-related DB-capable instance settings with UI metadata, masked sensitive values, and env override indicators.", "produces": [ "application/json" ], "tags": [ "settings" ], "summary": "List instance settings", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.InstanceSettingsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "patch": { "description": "Validates and upserts email-related DB-capable instance settings. Sensitive values are encrypted before storage.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "settings" ], "summary": "Update instance settings", "parameters": [ { "description": "Instance settings update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.InstanceSettingsUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.InstanceSettingsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/nodes": { "get": { "description": "Returns visible nodes ordered by id. Hidden managed nodes are excluded.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "List nodes", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NodesResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "post": { "description": "Creates a node under a project with offline status.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Create node", "parameters": [ { "description": "Node payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.NodeCreateRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/types.NodeResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/nodes/{id}": { "get": { "description": "Returns node details for a node the current user can read.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Get node", "parameters": [ { "type": "integer", "description": "Node ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NodeDetailResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "delete": { "description": "Deletes a node when it has no remaining services.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Delete node", "parameters": [ { "type": "integer", "description": "Node ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "patch": { "description": "Updates the editable node identity fields only.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Update node", "parameters": [ { "type": "integer", "description": "Node ID", "name": "id", "in": "path", "required": true }, { "description": "Node update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.NodeUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NodeResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/nodes/{id}/regenerate-agent-token": { "post": { "description": "Generates a new random agent token for the node, stores only its hash, and returns the raw token once.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Regenerate node agent token", "parameters": [ { "type": "integer", "description": "Node ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NodeAgentTokenResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/nodes/{id}/stream": { "get": { "description": "Streams the current node detail payload over Server-Sent Events for a node the current user can read.", "produces": [ "text/event-stream" ], "tags": [ "inventory" ], "summary": "Stream node detail", "parameters": [ { "type": "integer", "description": "Node ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/notification-deliveries": { "get": { "description": "Returns notification delivery attempts ordered by newest first, with optional project, status, and limit filters.", "produces": [ "application/json" ], "tags": [ "notifications" ], "summary": "List notification deliveries", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query" }, { "enum": [ "sent", "failed" ], "type": "string", "description": "Delivery status", "name": "status", "in": "query" }, { "minimum": 1, "type": "integer", "default": 50, "description": "Maximum number of deliveries", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NotificationDeliveriesResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/notification-recipients": { "get": { "description": "Returns project notification recipients ordered by newest first. Optionally filters by project_id.", "produces": [ "application/json" ], "tags": [ "notifications" ], "summary": "List notification recipients", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NotificationRecipientsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "post": { "description": "Creates a project-scoped notification recipient. Only email is supported for now.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "notifications" ], "summary": "Create notification recipient", "parameters": [ { "description": "Notification recipient payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.NotificationRecipientCreateRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/types.NotificationRecipientsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/notification-recipients/test-email": { "post": { "description": "Verifies that the provided email exists as a project notification recipient before sending a test email.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "notifications" ], "summary": "Send notification recipient test email", "parameters": [ { "description": "Notification recipient test email payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.NotificationRecipientTestEmailRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.AuthLogoutResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/notification-recipients/{id}": { "get": { "description": "Returns notification recipient details for a recipient the current user can read.", "produces": [ "application/json" ], "tags": [ "notifications" ], "summary": "Get notification recipient", "parameters": [ { "type": "integer", "description": "Notification recipient ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NotificationRecipientResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "delete": { "description": "Deletes a notification recipient.", "produces": [ "application/json" ], "tags": [ "notifications" ], "summary": "Delete notification recipient", "parameters": [ { "type": "integer", "description": "Notification recipient ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "patch": { "description": "Updates the enabled state of a notification recipient.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "notifications" ], "summary": "Update notification recipient", "parameters": [ { "type": "integer", "description": "Notification recipient ID", "name": "id", "in": "path", "required": true }, { "description": "Notification recipient update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.NotificationRecipientUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.NotificationRecipientResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/overview": { "get": { "description": "Returns aggregate node and service counts plus recent events, optionally scoped to a project.", "produces": [ "application/json" ], "tags": [ "overview" ], "summary": "Get overview", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.OverviewResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/project-invitations": { "get": { "description": "Returns project invitations for the requested project.", "produces": [ "application/json" ], "tags": [ "project-invitations" ], "summary": "List project invitations", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectInvitationsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "post": { "description": "Creates a project invitation, stores a hashed invite token, and sends the invite email.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project-invitations" ], "summary": "Create project invitation", "parameters": [ { "description": "Project invitation payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.ProjectInvitationCreateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectInvitationCreateResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/project-invitations/accept": { "post": { "description": "Accepts a valid invitation token for the authenticated user when the invite email matches the user email.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project-invitations" ], "summary": "Accept project invitation", "parameters": [ { "description": "Project invitation acceptance payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.ProjectInvitationAcceptRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectInvitationAcceptResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/project-invitations/by-token": { "get": { "description": "Returns safe invitation details when the invite token is valid and not expired or already accepted.", "produces": [ "application/json" ], "tags": [ "project-invitations" ], "summary": "Get project invitation by token", "parameters": [ { "type": "string", "description": "Raw invitation token", "name": "token", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectInvitationLookupResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/project-invitations/{id}": { "delete": { "description": "Deletes a project invitation by id.", "produces": [ "application/json" ], "tags": [ "project-invitations" ], "summary": "Delete project invitation", "parameters": [ { "type": "string", "description": "Project invitation ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/project-members": { "get": { "description": "Returns project members for a project, including joined user summary data.", "produces": [ "application/json" ], "tags": [ "project-members" ], "summary": "List project members", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectMembersResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "post": { "description": "Adds a user to a project with the requested role.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project-members" ], "summary": "Create project member", "parameters": [ { "description": "Project member payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.ProjectMemberCreateRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/types.ProjectMemberResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/project-members/{id}": { "get": { "description": "Returns a project membership with joined user summary data.", "produces": [ "application/json" ], "tags": [ "project-members" ], "summary": "Get project member", "parameters": [ { "type": "string", "description": "Project member ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectMemberResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "delete": { "description": "Deletes an existing project membership when owner safety rules allow it.", "produces": [ "application/json" ], "tags": [ "project-members" ], "summary": "Delete project member", "parameters": [ { "type": "string", "description": "Project member ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "patch": { "description": "Updates the role of an existing project membership.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "project-members" ], "summary": "Update project member", "parameters": [ { "type": "string", "description": "Project member ID", "name": "id", "in": "path", "required": true }, { "description": "Project member update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.ProjectMemberUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectMemberResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/projects": { "get": { "description": "Returns only projects the current authenticated user belongs to.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "List projects", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectsResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "post": { "description": "Creates a project inventory record.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Create project", "parameters": [ { "description": "Project payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.ProjectCreateRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/types.ProjectResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/projects/{id}": { "get": { "description": "Returns project details for a project the current user can read.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Get project", "parameters": [ { "type": "integer", "description": "Project ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectDetailResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "delete": { "description": "Deletes a project and dependent application resources.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Delete project", "parameters": [ { "type": "integer", "description": "Project ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "patch": { "description": "Updates the project name. Ownership and membership are not changed here.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Update project", "parameters": [ { "type": "integer", "description": "Project ID", "name": "id", "in": "path", "required": true }, { "description": "Project update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.ProjectUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ProjectDetailResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/services": { "get": { "description": "Returns newest services first, with execution_mode derived from the attached node and optional project_id, node_id, status, and limit filters.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "List services", "parameters": [ { "type": "integer", "description": "Project ID", "name": "project_id", "in": "query" }, { "type": "integer", "description": "Node ID", "name": "node_id", "in": "query" }, { "enum": [ "healthy", "degraded", "unhealthy" ], "type": "string", "description": "Service status", "name": "status", "in": "query" }, { "minimum": 1, "type": "integer", "description": "Maximum number of services", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ServicesResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "post": { "description": "Creates a service under a project and resolves the execution node from execution_mode.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Create service", "parameters": [ { "description": "Service payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.ServiceCreateRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/types.ServiceDetailResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/services/{id}": { "get": { "description": "Returns service details for a service the current user can read.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Get service", "parameters": [ { "type": "integer", "description": "Service ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ServiceDetailResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "delete": { "description": "Deletes a service and relies on existing schema cleanup for dependent operational records.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Delete service", "parameters": [ { "type": "integer", "description": "Service ID", "name": "id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } }, "patch": { "description": "Updates the editable service definition fields only. Execution mode and attached node are unchanged.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Update service", "parameters": [ { "type": "integer", "description": "Service ID", "name": "id", "in": "path", "required": true }, { "description": "Service update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.ServiceUpdateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ServiceDetailResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/services/{id}/history": { "get": { "description": "Returns append-only HTTP or TCP check observations newest-first. Use next_cursor as before for keyset pagination.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Get service check history", "parameters": [ { "type": "integer", "description": "Service ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "Number of observations (default 100, maximum 500)", "name": "limit", "in": "query" }, { "type": "string", "description": "Opaque cursor returned as next_cursor", "name": "before", "in": "query" }, { "type": "string", "description": "Inclusive range start (RFC3339; requires to; maximum requested history range is 31 days)", "name": "from", "in": "query" }, { "type": "string", "description": "Inclusive range end (RFC3339; requires from; maximum requested history range is 31 days; small future clock skew is clamped to server time)", "name": "to", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ServiceHistoryResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/services/{id}/history/summary": { "get": { "description": "Computes full-range check counts, uptime, average successful-check latency, and latest observation directly in PostgreSQL.", "produces": [ "application/json" ], "tags": [ "inventory" ], "summary": "Summarize service check history", "parameters": [ { "type": "integer", "description": "Service ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "Inclusive range start (RFC3339; paired with to; maximum requested history range is 31 days)", "name": "from", "in": "query", "required": true }, { "type": "string", "description": "Inclusive range end (RFC3339; paired with from; maximum requested history range is 31 days; small future clock skew is clamped to server time)", "name": "to", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/types.ServiceHistorySummaryData" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } }, "/services/{id}/stream": { "get": { "description": "Streams the current service detail payload over Server-Sent Events for a service the current user can read.", "produces": [ "text/event-stream" ], "tags": [ "inventory" ], "summary": "Stream service detail", "parameters": [ { "type": "integer", "description": "Service ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/types.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/types.ErrorResponse" } } } } } }, "definitions": { "types.AgentConfigCheckDocument": { "type": "object", "properties": { "check_target": { "type": "string", "example": "http://internal-api.local/health" }, "check_type": { "type": "string", "example": "http" }, "interval_seconds": { "type": "integer", "example": 30 }, "name": { "type": "string", "example": "internal-api" }, "service_id": { "type": "integer", "example": 101 }, "timeout_seconds": { "type": "integer", "example": 10 } } }, "types.AgentConfigNodeDocument": { "type": "object", "properties": { "id": { "type": "integer", "example": 12 }, "identifier": { "type": "string", "example": "web-01" }, "name": { "type": "string", "example": "web-01" } } }, "types.AgentConfigResponseDocument": { "type": "object", "properties": { "health_checks": { "type": "array", "items": { "$ref": "#/definitions/types.AgentConfigCheckDocument" } }, "node": { "$ref": "#/definitions/types.AgentConfigNodeDocument" } } }, "types.AgentShutdownRequest": { "type": "object", "properties": { "node_id": { "type": "integer", "example": 1 }, "observed_at": { "type": "string", "format": "date-time" }, "payload": { "type": "object" }, "reason": { "type": "string", "example": "user_closed" } } }, "types.AlertDocument": { "type": "object", "properties": { "alert_rule_id": { "type": "integer", "example": 1 }, "closed_at": { "type": "string", "format": "date-time", "x-nullable": true }, "closure_reason": { "type": "string", "enum": [ "rule_disabled", "rule_scope_changed", "target_hidden" ], "x-nullable": true, "example": "rule_disabled" }, "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "example": 1 }, "message": { "type": "string", "example": "Health check returned HTTP 503." }, "node_id": { "type": "integer", "x-nullable": true, "example": 1 }, "node_identifier": { "type": "string", "x-nullable": true, "example": "node_01hxyz" }, "node_name": { "type": "string", "x-nullable": true, "example": "edge-01" }, "project_id": { "type": "integer", "example": 1 }, "resolved_at": { "type": "string", "format": "date-time", "x-nullable": true }, "rule_type": { "type": "string", "example": "service_unhealthy" }, "service_id": { "type": "integer", "x-nullable": true, "example": 1 }, "service_name": { "type": "string", "x-nullable": true, "example": "Public API" }, "severity": { "type": "string", "example": "critical" }, "status": { "type": "string", "example": "active" }, "title": { "type": "string", "example": "Public API is unhealthy" }, "triggered_at": { "type": "string", "format": "date-time" } } }, "types.AlertPaginationDocument": { "type": "object", "properties": { "has_more": { "type": "boolean", "example": true }, "limit": { "type": "integer", "example": 50 }, "next_cursor": { "type": "string", "x-nullable": true, "example": "eyJ0cmlnZ2VyZWRfYXQiOiIyMDI2LTA4LTIzVDEwOjAwOjAwWiIsImlkIjoxfQ" } } }, "types.AlertRuleCreateRequest": { "type": "object", "properties": { "node_id": { "type": "integer", "example": 1 }, "project_id": { "type": "integer", "example": 1 }, "rule_type": { "type": "string", "example": "cpu_above_threshold" }, "service_id": { "type": "integer", "example": 1 }, "severity": { "type": "string", "example": "critical" }, "target_scope": { "type": "string", "enum": [ "all", "specific" ], "example": "all" }, "threshold_value": { "type": "number", "example": 80 } } }, "types.AlertRuleDocument": { "type": "object", "properties": { "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "example": 1 }, "is_enabled": { "type": "boolean", "example": true }, "metric_name": { "type": "string", "example": "cpu_usage" }, "node_id": { "type": "integer", "example": 1 }, "project_id": { "type": "integer", "example": 1 }, "rule_type": { "type": "string", "example": "node_offline" }, "service_id": { "type": "integer", "example": 1 }, "severity": { "type": "string", "example": "critical" }, "target_scope": { "type": "string", "enum": [ "all", "specific" ], "example": "all" }, "threshold_value": { "type": "number", "example": 80 }, "updated_at": { "type": "string", "format": "date-time" } } }, "types.AlertRuleResponse": { "type": "object", "properties": { "alert_rule": { "$ref": "#/definitions/types.AlertRuleDocument" } } }, "types.AlertRuleUpdateRequest": { "type": "object", "properties": { "is_enabled": { "type": "boolean", "example": false }, "node_id": { "type": "integer", "example": 1 }, "service_id": { "type": "integer", "example": 1 }, "severity": { "type": "string", "example": "warning" }, "target_scope": { "type": "string", "enum": [ "all", "specific" ], "example": "specific" }, "threshold_value": { "type": "number", "example": 90 } } }, "types.AlertRulesResponse": { "type": "object", "properties": { "alert_rules": { "type": "array", "items": { "$ref": "#/definitions/types.AlertRuleDocument" } } } }, "types.AlertsResponse": { "type": "object", "properties": { "alerts": { "type": "array", "items": { "$ref": "#/definitions/types.AlertDocument" } }, "pagination": { "$ref": "#/definitions/types.AlertPaginationDocument" } } }, "types.AuthForgotPasswordRequest": { "type": "object", "properties": { "email": { "type": "string", "example": "alice@example.com" } } }, "types.AuthLoginRequest": { "type": "object", "properties": { "email": { "type": "string", "example": "alice@example.com" }, "password": { "type": "string", "example": "supersecretpassword" }, "remember_me": { "type": "boolean", "example": true } } }, "types.AuthLogoutResponse": { "type": "object", "properties": { "status": { "type": "string", "example": "ok" } } }, "types.AuthMeResponse": { "type": "object", "properties": { "user": { "$ref": "#/definitions/types.UserDocument" } } }, "types.AuthRegisterRequest": { "type": "object", "properties": { "email": { "type": "string", "example": "alice@example.com" }, "name": { "type": "string", "example": "Alice Example" }, "password": { "type": "string", "example": "supersecretpassword" } } }, "types.AuthResetPasswordRequest": { "type": "object", "properties": { "password": { "type": "string", "example": "new-supersecretpassword" }, "token": { "type": "string", "example": "raw-reset-token" } } }, "types.AuthSessionResponse": { "type": "object", "properties": { "expires_at": { "type": "string", "format": "date-time" }, "user": { "$ref": "#/definitions/types.UserDocument" } } }, "types.AuthSessionsResponse": { "type": "object", "properties": { "sessions": { "type": "array", "items": { "$ref": "#/definitions/types.AuthUserSessionDocument" } } } }, "types.AuthUserSessionDocument": { "type": "object", "properties": { "created_at": { "type": "string", "format": "date-time" }, "expires_at": { "type": "string", "format": "date-time" }, "id": { "type": "string", "example": "ses_0123456789abcdef" }, "ip_address": { "type": "string", "example": "203.0.113.10" }, "is_current": { "type": "boolean", "example": true }, "updated_at": { "type": "string", "format": "date-time" }, "user_agent": { "type": "string", "example": "Mozilla/5.0" } } }, "types.AuthVerifyEmailConfirmRequest": { "type": "object", "properties": { "token": { "type": "string", "example": "raw-verification-token" } } }, "types.AuthVerifyPasswordRequest": { "type": "object", "properties": { "password": { "type": "string", "example": "current-supersecretpassword" } } }, "types.ErrorResponse": { "type": "object", "properties": { "error": { "type": "string", "example": "invalid request" } } }, "types.EventDocument": { "type": "object", "properties": { "created_at": { "type": "string", "format": "date-time" }, "details": { "type": "object" }, "event_type": { "type": "string", "example": "node_online" }, "id": { "type": "integer", "example": 1 }, "node_id": { "type": "integer", "example": 1 }, "occurred_at": { "type": "string", "format": "date-time" }, "project_id": { "type": "integer", "example": 1 }, "service_id": { "type": "integer", "example": 1 }, "severity": { "type": "string", "example": "info" }, "title": { "type": "string", "example": "Node hetzner-01 is online" } } }, "types.EventsResponse": { "type": "object", "properties": { "events": { "type": "array", "items": { "$ref": "#/definitions/types.EventDocument" } } } }, "types.HealthCheckSummaryDocument": { "type": "object", "properties": { "is_success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "ok" }, "observed_at": { "type": "string", "format": "date-time" }, "response_time_ms": { "type": "integer", "example": 42 }, "status_code": { "type": "integer", "example": 200 } } }, "types.HealthRequest": { "type": "object", "properties": { "is_success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "ok" }, "observed_at": { "type": "string", "format": "date-time" }, "payload": { "type": "object" }, "response_time_ms": { "type": "integer", "example": 42 }, "service_id": { "type": "integer", "example": 1 }, "status_code": { "type": "integer", "example": 200 } } }, "types.HealthResponse": { "type": "object", "properties": { "service": { "$ref": "#/definitions/types.ServiceResponseDocument" }, "status": { "type": "string", "example": "ok" } } }, "types.HeartbeatRequest": { "type": "object", "properties": { "node_id": { "type": "integer", "example": 1 }, "observed_at": { "type": "string", "format": "date-time" }, "payload": { "type": "object" }, "source": { "type": "string", "example": "agent" } } }, "types.HeartbeatResponse": { "type": "object", "properties": { "node": { "$ref": "#/definitions/types.NodeResponseDocument" }, "status": { "type": "string", "example": "ok" } } }, "types.InstanceSettingDocument": { "type": "object", "properties": { "description": { "type": "string", "example": "Enables outbound email delivery when provider config is complete." }, "group": { "type": "string", "example": "email" }, "is_configured": { "type": "boolean", "example": true }, "is_editable": { "type": "boolean", "example": true }, "is_encrypted": { "type": "boolean", "example": false }, "is_env_overridden": { "type": "boolean", "example": false }, "is_sensitive": { "type": "boolean", "example": false }, "key": { "type": "string", "example": "email.enabled" }, "label": { "type": "string", "example": "Email Enabled" }, "type": { "type": "string", "example": "bool" }, "value": { "type": "object" } } }, "types.InstanceSettingsResponse": { "type": "object", "properties": { "settings": { "type": "array", "items": { "$ref": "#/definitions/types.InstanceSettingDocument" } } } }, "types.InstanceSettingsUpdateItemRequest": { "type": "object", "properties": { "key": { "type": "string", "example": "email.enabled" }, "value": { "type": "object" } } }, "types.InstanceSettingsUpdateRequest": { "type": "object", "properties": { "settings": { "type": "array", "items": { "$ref": "#/definitions/types.InstanceSettingsUpdateItemRequest" } } } }, "types.MetricSampleRequest": { "type": "object", "properties": { "metric_name": { "type": "string", "example": "cpu_usage" }, "metric_unit": { "type": "string", "example": "percent" }, "metric_value": { "type": "number", "example": 42.5 }, "observed_at": { "type": "string", "format": "date-time" }, "payload": { "type": "object" }, "value": { "type": "number", "example": 42.5 } } }, "types.MetricValueDocument": { "type": "object", "properties": { "observed_at": { "type": "string", "format": "date-time" }, "unit": { "type": "string", "example": "percent" }, "value": { "type": "number", "example": 84.2 } } }, "types.MetricsRequest": { "type": "object", "properties": { "node_id": { "type": "integer", "example": 1 }, "samples": { "type": "array", "items": { "$ref": "#/definitions/types.MetricSampleRequest" } }, "service_id": { "type": "integer", "example": 1 } } }, "types.MetricsResponse": { "type": "object", "properties": { "status": { "type": "string", "example": "ok" } } }, "types.NodeAgentTokenResponse": { "type": "object", "properties": { "agent_token": { "type": "string", "example": "eHh4YWFhYmJiY2NjZGRkZWVlZmZmZ2dn" }, "node_id": { "type": "integer", "example": 1 } } }, "types.NodeCreateRequest": { "type": "object", "properties": { "name": { "type": "string", "example": "hetzner-01" }, "project_id": { "type": "integer", "example": 1 } } }, "types.NodeDetailResponse": { "type": "object", "properties": { "node": { "$ref": "#/definitions/types.NodeDocument" } } }, "types.NodeDocument": { "type": "object", "properties": { "active_alert_count": { "type": "integer", "example": 1 }, "active_alerts": { "type": "array", "items": { "$ref": "#/definitions/types.AlertDocument" } }, "created_at": { "type": "string", "format": "date-time" }, "current_state": { "type": "string", "example": "offline" }, "id": { "type": "integer", "example": 1 }, "identifier": { "type": "string", "example": "hetzner-01" }, "last_seen_at": { "type": "string", "format": "date-time" }, "latest_cpu": { "$ref": "#/definitions/types.MetricValueDocument" }, "latest_disk": { "$ref": "#/definitions/types.MetricValueDocument" }, "latest_memory": { "$ref": "#/definitions/types.MetricValueDocument" }, "metadata": { "type": "object" }, "name": { "type": "string", "example": "hetzner-01" }, "project_id": { "type": "integer", "example": 1 }, "service_count": { "type": "integer", "example": 2 }, "updated_at": { "type": "string", "format": "date-time" } } }, "types.NodeResponse": { "type": "object", "properties": { "node": { "$ref": "#/definitions/types.NodeResponseDocument" } } }, "types.NodeResponseDocument": { "type": "object", "properties": { "created_at": { "type": "string", "format": "date-time" }, "current_state": { "type": "string", "example": "online" }, "id": { "type": "integer", "example": 1 }, "identifier": { "type": "string", "example": "hetzner-01" }, "last_heartbeat_at": { "type": "string", "format": "date-time" }, "metadata": { "type": "object" }, "name": { "type": "string", "example": "hetzner-01" }, "project_id": { "type": "integer", "example": 1 }, "updated_at": { "type": "string", "format": "date-time" } } }, "types.NodeSummaryDocument": { "type": "object", "properties": { "active_alert_count": { "type": "integer", "example": 0 }, "current_state": { "type": "string", "example": "online" }, "id": { "type": "integer", "example": 1 }, "identifier": { "type": "string", "example": "hetzner-01" }, "last_seen_at": { "type": "string", "format": "date-time" }, "latest_cpu": { "$ref": "#/definitions/types.MetricValueDocument" }, "latest_disk": { "$ref": "#/definitions/types.MetricValueDocument" }, "latest_memory": { "$ref": "#/definitions/types.MetricValueDocument" }, "name": { "type": "string", "example": "hetzner-01" }, "project_id": { "type": "integer", "example": 1 }, "service_count": { "type": "integer", "example": 2 } } }, "types.NodeUpdateRequest": { "type": "object", "properties": { "identifier": { "type": "string", "example": "hetzner-02" }, "name": { "type": "string", "example": "hetzner-02" } } }, "types.NodesResponse": { "type": "object", "properties": { "nodes": { "type": "array", "items": { "$ref": "#/definitions/types.NodeDocument" } } } }, "types.NotificationDeliveriesResponse": { "type": "object", "properties": { "notification_deliveries": { "type": "array", "items": { "$ref": "#/definitions/types.NotificationDeliveryDocument" } } } }, "types.NotificationDeliveryDocument": { "type": "object", "properties": { "alert_instance_id": { "type": "integer", "example": 1 }, "channel_type": { "type": "string", "example": "email" }, "created_at": { "type": "string", "format": "date-time" }, "error_message": { "type": "string", "example": "resend returned status 500" }, "event_type": { "type": "string", "example": "alert_triggered" }, "id": { "type": "integer", "example": 1 }, "notification_recipient_id": { "type": "integer", "example": 1 }, "project_id": { "type": "integer", "example": 1 }, "sent_at": { "type": "string", "format": "date-time" }, "status": { "type": "string", "example": "sent" }, "target": { "type": "string", "example": "ops@example.com" } } }, "types.NotificationRecipientCreateItemRequest": { "type": "object", "properties": { "min_severity": { "type": "string", "example": "warning" }, "target": { "type": "string", "example": "ops@example.com" } } }, "types.NotificationRecipientCreateRequest": { "type": "object", "properties": { "channel_type": { "type": "string", "example": "email" }, "project_id": { "type": "integer", "example": 1 }, "recipients": { "type": "array", "items": { "$ref": "#/definitions/types.NotificationRecipientCreateItemRequest" } } } }, "types.NotificationRecipientDocument": { "type": "object", "properties": { "channel_type": { "type": "string", "example": "email" }, "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "example": 1 }, "is_enabled": { "type": "boolean", "example": true }, "min_severity": { "type": "string", "example": "warning" }, "project_id": { "type": "integer", "example": 1 }, "target": { "type": "string", "example": "ops@example.com" }, "updated_at": { "type": "string", "format": "date-time" } } }, "types.NotificationRecipientResponse": { "type": "object", "properties": { "notification_recipient": { "$ref": "#/definitions/types.NotificationRecipientDocument" } } }, "types.NotificationRecipientTestEmailRequest": { "type": "object", "properties": { "email": { "type": "string", "example": "ops@example.com" }, "project_id": { "type": "integer", "example": 1 } } }, "types.NotificationRecipientUpdateRequest": { "type": "object", "properties": { "is_enabled": { "type": "boolean", "example": false } } }, "types.NotificationRecipientsResponse": { "type": "object", "properties": { "notification_recipients": { "type": "array", "items": { "$ref": "#/definitions/types.NotificationRecipientDocument" } } } }, "types.OverviewResponse": { "type": "object", "properties": { "active_alerts": { "type": "integer", "example": 1 }, "node_summaries": { "type": "array", "items": { "$ref": "#/definitions/types.NodeSummaryDocument" } }, "nodes_offline": { "type": "integer", "example": 0 }, "nodes_online": { "type": "integer", "example": 1 }, "recent_alert_events": { "type": "array", "items": { "$ref": "#/definitions/types.EventDocument" } }, "recent_events": { "type": "array", "items": { "$ref": "#/definitions/types.EventDocument" } }, "resolved_alerts": { "type": "integer", "example": 3 }, "services_degraded": { "type": "integer", "example": 0 }, "services_healthy": { "type": "integer", "example": 1 }, "services_unhealthy": { "type": "integer", "example": 0 }, "total_nodes": { "type": "integer", "example": 1 }, "total_projects": { "type": "integer", "example": 1 }, "total_services": { "type": "integer", "example": 1 } } }, "types.ProjectCreateRequest": { "type": "object", "properties": { "name": { "type": "string", "example": "My Project" } } }, "types.ProjectDetailDocument": { "type": "object", "properties": { "active_alert_count": { "type": "integer", "example": 1 }, "created_at": { "type": "string", "format": "date-time" }, "current_user_role": { "type": "string", "example": "owner" }, "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "My Project" }, "node_count": { "type": "integer", "example": 3 }, "service_count": { "type": "integer", "example": 7 }, "slug": { "type": "string", "example": "my-project" } } }, "types.ProjectDetailResponse": { "type": "object", "properties": { "project": { "$ref": "#/definitions/types.ProjectDetailDocument" } } }, "types.ProjectDocument": { "type": "object", "properties": { "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "My Project" }, "slug": { "type": "string", "example": "my-project" } } }, "types.ProjectInvitationAcceptRequest": { "type": "object", "properties": { "token": { "type": "string", "example": "raw-project-invitation-token" } } }, "types.ProjectInvitationAcceptResponse": { "type": "object", "properties": { "already_member": { "type": "boolean", "example": false }, "status": { "type": "string", "example": "ok" } } }, "types.ProjectInvitationCreateItemRequest": { "type": "object", "properties": { "email": { "type": "string", "example": "teammate@example.com" }, "role": { "type": "string", "example": "viewer" } } }, "types.ProjectInvitationCreateRequest": { "type": "object", "properties": { "email": { "type": "string", "example": "teammate@example.com" }, "invitations": { "type": "array", "items": { "$ref": "#/definitions/types.ProjectInvitationCreateItemRequest" } }, "project_id": { "type": "integer", "example": 1 }, "role": { "type": "string", "example": "viewer" } } }, "types.ProjectInvitationCreateResponse": { "type": "object", "properties": { "project_id": { "type": "integer", "example": 1 }, "results": { "type": "array", "items": { "$ref": "#/definitions/types.ProjectInvitationCreateResultDocument" } } } }, "types.ProjectInvitationCreateResultDocument": { "type": "object", "properties": { "email": { "type": "string", "example": "teammate@example.com" }, "error_code": { "type": "string", "example": "already_invited" }, "error_message": { "type": "string", "example": "An active invitation already exists for this email." }, "invitation": { "$ref": "#/definitions/types.ProjectInvitationDocument" }, "role": { "type": "string", "example": "viewer" }, "status": { "type": "string", "example": "created" } } }, "types.ProjectInvitationDocument": { "type": "object", "properties": { "accepted_at": { "type": "string", "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "email": { "type": "string", "example": "teammate@example.com" }, "expires_at": { "type": "string", "format": "date-time" }, "id": { "type": "string", "example": "pinv_0123456789abcdef" }, "invited_by_user_id": { "type": "string", "example": "usr_0123456789abcdef" }, "project_id": { "type": "integer", "example": 1 }, "role": { "type": "string", "example": "viewer" } } }, "types.ProjectInvitationLookupDocument": { "type": "object", "properties": { "email": { "type": "string", "example": "teammate@example.com" }, "expires_at": { "type": "string", "format": "date-time" }, "id": { "type": "string", "example": "pinv_0123456789abcdef" }, "project_id": { "type": "integer", "example": 1 }, "project_name": { "type": "string", "example": "Agrafa Team" }, "role": { "type": "string", "example": "viewer" } } }, "types.ProjectInvitationLookupResponse": { "type": "object", "properties": { "project_invitation": { "$ref": "#/definitions/types.ProjectInvitationLookupDocument" } } }, "types.ProjectInvitationsResponse": { "type": "object", "properties": { "project_invitations": { "type": "array", "items": { "$ref": "#/definitions/types.ProjectInvitationDocument" } } } }, "types.ProjectMemberCreateRequest": { "type": "object", "properties": { "project_id": { "type": "integer", "example": 1 }, "role": { "type": "string", "example": "viewer" }, "user_id": { "type": "string", "example": "usr_0123456789abcdef" } } }, "types.ProjectMemberDocument": { "type": "object", "properties": { "created_at": { "type": "string", "format": "date-time" }, "id": { "type": "string", "example": "pm_0123456789abcdef" }, "project_id": { "type": "integer", "example": 1 }, "role": { "type": "string", "example": "viewer" }, "user": { "$ref": "#/definitions/types.ProjectMemberUserSummaryDocument" }, "user_id": { "type": "string", "example": "usr_0123456789abcdef" } } }, "types.ProjectMemberResponse": { "type": "object", "properties": { "project_member": { "$ref": "#/definitions/types.ProjectMemberDocument" } } }, "types.ProjectMemberUpdateRequest": { "type": "object", "properties": { "role": { "type": "string", "example": "admin" } } }, "types.ProjectMemberUserSummaryDocument": { "type": "object", "properties": { "email": { "type": "string", "example": "alice@example.com" }, "image": { "type": "string", "example": "https://example.com/avatar.png" }, "name": { "type": "string", "example": "Alice Example" } } }, "types.ProjectMembersResponse": { "type": "object", "properties": { "project_members": { "type": "array", "items": { "$ref": "#/definitions/types.ProjectMemberDocument" } } } }, "types.ProjectResponse": { "type": "object", "properties": { "project": { "$ref": "#/definitions/types.ProjectDocument" } } }, "types.ProjectSummaryDocument": { "type": "object", "properties": { "created_at": { "type": "string", "format": "date-time" }, "current_user_role": { "type": "string", "example": "owner" }, "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "My Project" }, "slug": { "type": "string", "example": "my-project" } } }, "types.ProjectUpdateRequest": { "type": "object", "properties": { "name": { "type": "string", "example": "My Renamed Project" } } }, "types.ProjectsResponse": { "type": "object", "properties": { "projects": { "type": "array", "items": { "$ref": "#/definitions/types.ProjectSummaryDocument" } } } }, "types.ServiceActiveAlertDocument": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "rule_id": { "type": "integer", "example": 12 }, "rule_type": { "type": "string", "example": "service_unhealthy" }, "severity": { "type": "string", "example": "critical" }, "status": { "type": "string", "example": "active" }, "title": { "type": "string", "example": "Service 10 is unhealthy" }, "triggered_at": { "type": "string", "format": "date-time" } } }, "types.ServiceCreateRequest": { "type": "object", "properties": { "check_target": { "type": "string", "example": "https://api.planzi.app/health" }, "check_type": { "type": "string", "example": "http" }, "execution_mode": { "type": "string", "example": "managed" }, "name": { "type": "string", "example": "planzi-api" }, "node_id": { "type": "integer", "example": 1 }, "project_id": { "type": "integer", "example": 1 } } }, "types.ServiceDetailDocument": { "type": "object", "properties": { "active_alert_count": { "type": "integer", "example": 1 }, "active_alerts": { "type": "array", "items": { "$ref": "#/definitions/types.ServiceActiveAlertDocument" } }, "check_target": { "type": "string", "example": "https://api.planzi.app/health" }, "check_type": { "type": "string", "example": "http" }, "consecutive_failures": { "type": "integer", "example": 0 }, "execution_mode": { "type": "string", "example": "agent" }, "id": { "type": "integer", "example": 1 }, "last_checked_at": { "type": "string", "format": "date-time" }, "latest_health_check": { "$ref": "#/definitions/types.HealthCheckSummaryDocument" }, "name": { "type": "string", "example": "planzi-api" }, "node_id": { "type": "integer", "example": 1 }, "project_id": { "type": "integer", "example": 1 }, "status": { "type": "string", "example": "healthy" } } }, "types.ServiceDetailResponse": { "type": "object", "properties": { "service": { "$ref": "#/definitions/types.ServiceDetailDocument" } } }, "types.ServiceDocument": { "type": "object", "properties": { "active_alert_count": { "type": "integer", "example": 1 }, "check_target": { "type": "string", "example": "https://api.planzi.app/health" }, "check_type": { "type": "string", "example": "http" }, "consecutive_failures": { "type": "integer", "example": 0 }, "execution_mode": { "type": "string", "example": "agent" }, "id": { "type": "integer", "example": 1 }, "last_checked_at": { "type": "string", "format": "date-time" }, "latest_health_check": { "$ref": "#/definitions/types.HealthCheckSummaryDocument" }, "name": { "type": "string", "example": "planzi-api" }, "node_id": { "type": "integer", "example": 1 }, "project_id": { "type": "integer", "example": 1 }, "status": { "type": "string", "example": "healthy" } } }, "types.ServiceHistoryEntryDocument": { "type": "object", "properties": { "check_type": { "type": "string", "example": "http" }, "id": { "type": "integer", "example": 301 }, "is_success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "200 OK" }, "metadata": { "type": "object" }, "node_id": { "type": "integer", "example": 12 }, "observed_at": { "type": "string", "format": "date-time" }, "response_time_ms": { "type": "integer", "example": 42 }, "service_id": { "type": "integer", "example": 101 }, "source": { "type": "string", "example": "managed" }, "status_code": { "type": "integer", "example": 200 } } }, "types.ServiceHistoryPaginationDocument": { "type": "object", "properties": { "has_more": { "type": "boolean", "example": true }, "limit": { "type": "integer", "example": 100 }, "next_cursor": { "type": "string", "example": "eyJvYnNlcnZlZF9hdCI6IjIwMjYtMDgtMjNUMTI6MDA6MDBaIiwiaWQiOjMwMX0" } } }, "types.ServiceHistoryResponse": { "type": "object", "properties": { "history": { "type": "array", "items": { "$ref": "#/definitions/types.ServiceHistoryEntryDocument" } }, "pagination": { "$ref": "#/definitions/types.ServiceHistoryPaginationDocument" } } }, "types.ServiceHistorySummaryData": { "type": "object", "properties": { "average_latency_ms": { "type": "number", "x-nullable": true }, "from": { "type": "string", "format": "date-time" }, "last_checked_at": { "type": "string", "format": "date-time", "x-nullable": true }, "successful_checks": { "type": "integer" }, "to": { "type": "string", "format": "date-time" }, "total_checks": { "type": "integer" }, "uptime_percent": { "type": "number", "x-nullable": true } } }, "types.ServiceResponseDocument": { "type": "object", "properties": { "check_target": { "type": "string", "example": "https://api.planzi.app/health" }, "check_type": { "type": "string", "example": "http" }, "consecutive_failures": { "type": "integer", "example": 0 }, "consecutive_successes": { "type": "integer", "example": 0 }, "created_at": { "type": "string", "format": "date-time" }, "current_state": { "type": "string", "example": "healthy" }, "id": { "type": "integer", "example": 1 }, "last_check_at": { "type": "string", "format": "date-time" }, "name": { "type": "string", "example": "planzi-api" }, "node_id": { "type": "integer", "example": 1 }, "project_id": { "type": "integer", "example": 1 }, "updated_at": { "type": "string", "format": "date-time" } } }, "types.ServiceUpdateRequest": { "type": "object", "properties": { "check_target": { "type": "string", "example": "https://api.planzi.app/status" }, "check_type": { "type": "string", "example": "http" }, "name": { "type": "string", "example": "planzi-api-v2" } } }, "types.ServicesResponse": { "type": "object", "properties": { "services": { "type": "array", "items": { "$ref": "#/definitions/types.ServiceDocument" } } } }, "types.UserDocument": { "type": "object", "properties": { "created_at": { "type": "string", "format": "date-time" }, "email": { "type": "string", "example": "alice@example.com" }, "email_verified": { "type": "boolean", "example": false }, "id": { "type": "string", "example": "usr_0123456789abcdef" }, "image": { "type": "string", "example": "https://example.com/avatar.png" }, "name": { "type": "string", "example": "Alice Example" }, "onboarding_completed": { "type": "boolean", "example": false }, "two_factor_enabled": { "type": "boolean", "example": false }, "updated_at": { "type": "string", "format": "date-time" } } } }, "securityDefinitions": { "CookieAuth": { "description": "Agrafa session cookie (`agrafa_session`).", "type": "apiKey", "name": "Cookie", "in": "header" } } }