{ "openapi": "3.0.3", "info": { "title": "AegisOS AI Workstation Admin Console API", "description": "Enterprise Governance and Management API specifications for the local-first, privacy-preserving AI Workstation Console.", "version": "1.0.0" }, "servers": [ { "url": "http://localhost:3000/api/v1", "description": "Localhost development loopback interface" } ], "paths": { "/auth/login": { "post": { "summary": "Authenticate user session", "description": "Verifies username and password credentials against configurations, managing brute-force login lockouts.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["username", "password"], "properties": { "username": { "type": "string" }, "password": { "type": "string" } } } } } }, "responses": { "200": { "description": "Authentication successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "user": { "type": "object", "properties": { "id": { "type": "string" }, "username": { "type": "string" }, "email": { "type": "string" }, "role": { "type": "string" } } }, "token": { "type": "string" } } } } } }, "401": { "description": "Invalid credentials", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } }, "429": { "description": "IP locked out due to excessive failed attempts", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } } } }, "/mobile/auth/pair": { "get": { "summary": "Retrieve new pairing challenge", "description": "Serves a temporary token, human-readable code, and list of workstation network interface endpoints.", "responses": { "200": { "description": "Pairing challenge generated", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string" }, "code": { "type": "string" }, "expiresAt": { "type": "string" }, "endpoints": { "type": "array", "items": { "type": "object", "properties": { "ip": { "type": "string" }, "httpUrl": { "type": "string" }, "httpsUrl": { "type": "string" } } } } } } } } } } }, "post": { "summary": "Register mobile device pairing", "description": "Registers device public keys in PENDING status using the pairing token or manual pairing code.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "pairingToken": { "type": "string" }, "pairingCode": { "type": "string" }, "publicKey": { "type": "string" }, "deviceName": { "type": "string" }, "metadata": { "type": "object" } } } } } }, "responses": { "201": { "description": "Device pairing registered as pending", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "deviceId": { "type": "string" }, "status": { "type": "string" } } } } } }, "401": { "description": "Pairing challenge expired or invalid" } } } }, "/mobile/auth/approve": { "post": { "summary": "Approve pending companion device", "description": "Allows console admin session to approve pending companion devices for cryptographic signing.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["deviceId"], "properties": { "deviceId": { "type": "string" } } } } } }, "responses": { "200": { "description": "Device approved", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "status": { "type": "string" } } } } } }, "403": { "description": "Forbidden - Administrator role required" } } } }, "/mobile/auth/session": { "post": { "summary": "Establish or refresh mobile session", "description": "Authenticates approved devices via signature verification over dynamic challenge or rotates refresh tokens.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["deviceId"], "properties": { "deviceId": { "type": "string" }, "challenge": { "type": "string" }, "signature": { "type": "string" }, "refreshToken": { "type": "string" } } } } } }, "responses": { "200": { "description": "Session refreshed", "content": { "application/json": { "schema": { "type": "object", "properties": { "jwt": { "type": "string" }, "refreshToken": { "type": "string" }, "expiresAt": { "type": "integer" } } } } } }, "201": { "description": "Session established", "content": { "application/json": { "schema": { "type": "object", "properties": { "jwt": { "type": "string" }, "refreshToken": { "type": "string" }, "expiresAt": { "type": "integer" } } } } } }, "401": { "description": "Unauthorized signature or invalid refresh token" } } } }, "/mobile/auth/logout": { "post": { "summary": "Revoke active session token", "description": "Invalidates the active refresh token and associated JWT session.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["deviceId", "refreshToken"], "properties": { "deviceId": { "type": "string" }, "refreshToken": { "type": "string" } } } } } }, "responses": { "200": { "description": "Logged out successfully" } } } }, "/mobile/auth/devices": { "get": { "summary": "List all registered devices", "description": "Lists all pending, approved, and revoked companion devices. Gated by console admin credentials.", "responses": { "200": { "description": "Array of registered devices" }, "403": { "description": "Forbidden - Administrator role required" } } } }, "/mobile/auth/device/{id}": { "delete": { "summary": "Revoke and delete paired device", "description": "Permanently revokes a mobile companion device's credentials. Gated by console admin credentials.", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Device revoked successfully" }, "403": { "description": "Forbidden - Administrator role required" } } } }, "/workflows": { "get": { "summary": "List active workflow definitions", "responses": { "200": { "description": "Array of workflow definitions", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowDefinition" } } } } } } }, "post": { "summary": "Create workflow definition", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowDefinition" } } } }, "responses": { "201": { "description": "Workflow created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowDefinition" } } } } } } }, "/workflows/{id}": { "get": { "summary": "Fetch workflow by ID", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Workflow definition payload", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowDefinition" } } } }, "404": { "description": "Workflow not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } } } }, "/workflows/executions": { "get": { "summary": "List executions logs", "responses": { "200": { "description": "Array of executions runs" } } }, "post": { "summary": "Start, cancel, or resume a workflow execution", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["action"], "properties": { "action": { "type": "string", "enum": ["start", "cancel", "resume"] }, "workflowId": { "type": "string" }, "executionId": { "type": "string" }, "nodeId": { "type": "string" }, "decision": { "type": "string", "enum": ["approved", "rejected"] }, "variables": { "type": "object" } } } } } }, "responses": { "200": { "description": "Action executed successfully" } } } }, "/mobile/commands": { "get": { "summary": "List command execution history", "description": "Retrieves audit trails of command dispatches with status, risk, and type filters.", "parameters": [ { "name": "status", "in": "query", "schema": { "type": "string" } }, { "name": "type", "in": "query", "schema": { "type": "string" } }, { "name": "search", "in": "query", "schema": { "type": "string" } }, { "name": "limit", "in": "query", "schema": { "type": "integer" } }, { "name": "offset", "in": "query", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Filtered list of commands" } } }, "post": { "summary": "Submit command execution request", "description": "Submits a signed command payload from paired devices, triggering validation checks and policy gates.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["type", "payload"], "properties": { "type": { "type": "string" }, "payload": { "type": "object" }, "priority": { "type": "string", "enum": ["LOW", "MEDIUM", "HIGH", "CRITICAL"] }, "deviceId": { "type": "string" }, "signature": { "type": "string" }, "replayNonce": { "type": "string" }, "timestamp": { "type": "integer" }, "emergencyOverride": { "type": "boolean" } } } } } }, "responses": { "201": { "description": "Command received and scheduled or pending approval" } } } }, "/mobile/commands/{id}": { "get": { "summary": "Retrieve command details by ID", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Details of the command lifecycle and results" } } } }, "/mobile/commands/{id}/approve": { "post": { "summary": "Approve command", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Command approved and enqueued" } } } }, "/mobile/commands/{id}/reject": { "post": { "summary": "Reject command", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Command rejected and cancelled" } } } }, "/mobile/commands/{id}/cancel": { "post": { "summary": "Cancel command", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Command cancelled" } } } }, "/mobile/commands/{id}/rollback": { "post": { "summary": "Rollback completed command", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Command rolled back successfully" } } } } }, "components": { "schemas": { "ProblemDetails": { "type": "object", "properties": { "type": { "type": "string", "format": "uri" }, "title": { "type": "string" }, "status": { "type": "integer" }, "detail": { "type": "string" }, "instance": { "type": "string" }, "code": { "type": "string" }, "correlationId": { "type": "string" } } }, "WorkflowDefinition": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "version": { "type": "string" }, "status": { "type": "string", "enum": ["active", "draft", "deprecated"] }, "nodes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "type": "string" }, "config": { "type": "object" } } } } } } } } }