{
    "openapi": "3.1.0",
    "info": {
        "title": "Mola Cloud API",
        "version": "1.0.0",
        "description": "Create and control persistent Omarchy cloud computers. Lifecycle changes are asynchronous; poll the returned operation."
    },
    "servers": [
        {
            "url": "https://cloud.mola.sh/api/v1"
        }
    ],
    "externalDocs": {
        "description": "Mola Cloud documentation",
        "url": "https://cloud.mola.sh/docs/api"
    },
    "paths": {
        "/account": {
            "get": {
                "summary": "Get account, plan, usage, and trial state",
                "operationId": "getAccount",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            }
        },
        "/profiles": {
            "get": {
                "summary": "List available computer profiles",
                "operationId": "getProfiles",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            }
        },
        "/images": {
            "get": {
                "summary": "List available computer images",
                "operationId": "getImages",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            }
        },
        "/computers": {
            "get": {
                "summary": "List computers",
                "operationId": "getComputers",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            },
            "post": {
                "summary": "Create a computer",
                "operationId": "postComputers",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreateComputer"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/computers/{computer}": {
            "get": {
                "summary": "Get a computer",
                "operationId": "getComputersComputer",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ]
            },
            "patch": {
                "summary": "Update auto-stop",
                "operationId": "patchComputersComputer",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["auto_stop_minutes"],
                                "properties": {
                                    "auto_stop_minutes": {
                                        "type": ["integer", "null"],
                                        "enum": [30, 60, 240, null]
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a computer",
                "operationId": "deleteComputersComputer",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "description": "Optional. Deletion permanently removes the disk. Stop the computer instead to retain its files.",
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "delete_disk": {
                                        "type": "boolean",
                                        "enum": [true],
                                        "default": true,
                                        "description": "May be omitted. False is unsupported when disk-preserving deletion is unavailable."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/computers/{computer}/start": {
            "post": {
                "summary": "Start a computer",
                "operationId": "postComputersComputerStart",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/computers/{computer}/stop": {
            "post": {
                "summary": "Stop a computer",
                "operationId": "postComputersComputerStop",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/computers/{computer}/restart": {
            "post": {
                "summary": "Restart a computer",
                "operationId": "postComputersComputerRestart",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/computers/{computer}/actions": {
            "post": {
                "summary": "Run a command, file, or desktop action",
                "operationId": "postComputersComputerActions",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["action"],
                                "properties": {
                                    "action": {
                                        "type": "string",
                                        "enum": [
                                            "exec",
                                            "read_file",
                                            "write_file",
                                            "screenshot",
                                            "click",
                                            "move",
                                            "scroll",
                                            "type",
                                            "key"
                                        ]
                                    },
                                    "command": {
                                        "type": "string",
                                        "maxLength": 32768
                                    },
                                    "path": {
                                        "type": "string",
                                        "maxLength": 4096
                                    },
                                    "content": {
                                        "type": "string",
                                        "maxLength": 1048576
                                    },
                                    "text": {
                                        "type": "string"
                                    },
                                    "key": {
                                        "type": "string"
                                    },
                                    "x": {
                                        "type": "integer"
                                    },
                                    "y": {
                                        "type": "integer"
                                    },
                                    "direction": {
                                        "type": "string",
                                        "enum": ["up", "down"]
                                    },
                                    "amount": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 20
                                    },
                                    "timeout": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 120
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/computers/{computer}/action-sessions": {
            "post": {
                "summary": "Create a persistent action WebSocket session",
                "operationId": "postComputersComputerActionSessions",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Single-use WebSocket session grant",
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": ["data"],
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "required": [
                                                "session_url",
                                                "token",
                                                "expires_at",
                                                "computer_id",
                                                "generation",
                                                "kind"
                                            ],
                                            "properties": {
                                                "session_url": {
                                                    "type": "string",
                                                    "format": "uri",
                                                    "pattern": "^wss://"
                                                },
                                                "token": {
                                                    "type": "string",
                                                    "description": "Single-use credential; append as the token query parameter only when opening the WebSocket."
                                                },
                                                "expires_at": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "computer_id": {
                                                    "type": "string",
                                                    "format": "uuid"
                                                },
                                                "generation": {
                                                    "type": "integer"
                                                },
                                                "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                        "actions",
                                                        "tunnel"
                                                    ]
                                                },
                                                "port": {
                                                    "type": "integer",
                                                    "minimum": 1024,
                                                    "maximum": 65535
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "409": {
                        "description": "Computer is not ready or does not support this data plane."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "description": "Session grant rate limit reached."
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "additionalProperties": false
                            }
                        }
                    }
                }
            }
        },
        "/computers/{computer}/cua": {
            "get": {
                "summary": "Check Cua Driver availability on a ready Omarchy computer",
                "operationId": "getComputerCua",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Cua Driver status",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "required": [
                                                "available",
                                                "version",
                                                "hyprland_plugin",
                                                "session_endpoint"
                                            ],
                                            "properties": {
                                                "available": {
                                                    "type": "boolean"
                                                },
                                                "version": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "hyprland_plugin": {
                                                    "type": "boolean"
                                                },
                                                "session_endpoint": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "description": "Token lacks computers:write or the caller cannot update this computer."
                    },
                    "404": {
                        "description": "Computer or Cua session not found."
                    },
                    "409": {
                        "description": "Computer is not ready or another action is running."
                    },
                    "502": {
                        "description": "Cua Driver or the private host connection is unavailable."
                    }
                }
            }
        },
        "/computers/{computer}/cua-sessions": {
            "post": {
                "summary": "Open a boot-bound Cua Driver session",
                "description": "Requires computers:write. Returns the tools and input schemas advertised by the guest driver.",
                "operationId": "createComputerCuaSession",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Cua session and advertised tools",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "required": [
                                                "id",
                                                "version",
                                                "expires_in",
                                                "tools"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "string",
                                                    "format": "uuid"
                                                },
                                                "version": {
                                                    "type": "string"
                                                },
                                                "expires_in": {
                                                    "type": "integer",
                                                    "description": "Idle lifetime in seconds"
                                                },
                                                "tools": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "description": "Token lacks computers:write or the caller cannot update this computer."
                    },
                    "404": {
                        "description": "Computer or Cua session not found."
                    },
                    "409": {
                        "description": "Computer is not ready or another action is running."
                    },
                    "502": {
                        "description": "Cua Driver or the private host connection is unavailable."
                    },
                    "429": {
                        "description": "Cua session limit reached."
                    }
                }
            }
        },
        "/computers/{computer}/cua-sessions/{session}/calls": {
            "post": {
                "summary": "Call one tool advertised by the Cua session",
                "description": "Requires computers:write. For desktop pointer or keyboard input, pass scope: \"desktop\" with coordinates from a fresh get_desktop_state image. Inspect the returned MCP isError flag and verify state after input.",
                "operationId": "callComputerCuaTool",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "name": "session",
                        "in": "path",
                        "required": true,
                        "description": "Cua session ID returned by session creation",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "tool"
                                ],
                                "properties": {
                                    "tool": {
                                        "type": "string"
                                    },
                                    "arguments": {
                                        "type": "object",
                                        "default": {}
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Native Cua MCP tool result, including content and optional isError",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "description": "Token lacks computers:write or the caller cannot update this computer."
                    },
                    "404": {
                        "description": "Computer or Cua session not found."
                    },
                    "409": {
                        "description": "Computer is not ready or another action is running."
                    },
                    "502": {
                        "description": "Cua Driver or the private host connection is unavailable."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            }
        },
        "/computers/{computer}/cua-sessions/{session}/end": {
            "post": {
                "summary": "Close a Cua Driver session",
                "description": "Requires computers:write.",
                "operationId": "endComputerCuaSession",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "name": "session",
                        "in": "path",
                        "required": true,
                        "description": "Cua session ID returned by session creation",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Cua session closed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "data"
                                    ],
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "required": [
                                                "ended"
                                            ],
                                            "properties": {
                                                "ended": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "403": {
                        "description": "Token lacks computers:write or the caller cannot update this computer."
                    },
                    "404": {
                        "description": "Computer or Cua session not found."
                    },
                    "409": {
                        "description": "Computer is not ready or another action is running."
                    },
                    "502": {
                        "description": "Cua Driver or the private host connection is unavailable."
                    }
                }
            }
        },
        "/computers/{computer}/tunnels": {
            "post": {
                "summary": "Create a machine-scoped TCP tunnel session",
                "operationId": "postComputersComputerTunnels",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Single-use WebSocket session grant",
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": ["data"],
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "required": [
                                                "session_url",
                                                "token",
                                                "expires_at",
                                                "computer_id",
                                                "generation",
                                                "kind"
                                            ],
                                            "properties": {
                                                "session_url": {
                                                    "type": "string",
                                                    "format": "uri",
                                                    "pattern": "^wss://"
                                                },
                                                "token": {
                                                    "type": "string",
                                                    "description": "Single-use credential; append as the token query parameter only when opening the WebSocket."
                                                },
                                                "expires_at": {
                                                    "type": "string",
                                                    "format": "date-time"
                                                },
                                                "computer_id": {
                                                    "type": "string",
                                                    "format": "uuid"
                                                },
                                                "generation": {
                                                    "type": "integer"
                                                },
                                                "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                        "actions",
                                                        "tunnel"
                                                    ]
                                                },
                                                "port": {
                                                    "type": "integer",
                                                    "minimum": 1024,
                                                    "maximum": 65535
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "409": {
                        "description": "Computer is not ready or does not support this data plane."
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "description": "Session grant rate limit reached."
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["port"],
                                "additionalProperties": false,
                                "properties": {
                                    "port": {
                                        "type": "integer",
                                        "minimum": 1024,
                                        "maximum": 65535,
                                        "not": {
                                            "enum": [22, 4141, 5900]
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/computers/{computer}/desktop-sessions": {
            "post": {
                "summary": "Create a single-use desktop ticket",
                "description": "For a browser on another site, register its exact HTTPS origin in Settings → Desktop origins, then pass origin in this request from your server. Keep the API token on your server. Connect a VNC viewer to ws_url with the token query parameter within 60 seconds. Request a new ticket for each reconnection. Do not use Idempotency-Key for this endpoint.",
                "operationId": "createDesktopSession",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "format": "uri",
                                        "description": "Exact registered browser origin, such as https://app.example.com. Omit for the Mola dashboard or non-browser viewers."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Single-use desktop ticket",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": ["ws_url", "token", "expires_in"],
                                    "properties": {
                                        "ws_url": { "type": "string", "format": "uri" },
                                        "token": { "type": "string", "description": "Single-use ticket; append as ?token= on ws_url." },
                                        "expires_in": { "type": "integer", "example": 60 }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ]
            }
        },
        "/computers/{computer}/usage": {
            "get": {
                "summary": "Get computer usage",
                "operationId": "getComputersComputerUsage",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ]
            }
        },
        "/computers/{computer}/operations/{operation}": {
            "get": {
                "summary": "Get an asynchronous operation",
                "operationId": "getComputersComputerOperationsOperation",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "name": "operation",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/computers/{computer}/snapshots": {
            "get": {
                "summary": "List snapshots",
                "operationId": "getComputersComputerSnapshots",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ]
            },
            "post": {
                "summary": "Create a snapshot",
                "operationId": "postComputersComputerSnapshots",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["name"],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 120
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/computers/{computer}/snapshots/{snapshot}/restore": {
            "post": {
                "summary": "Restore a snapshot",
                "operationId": "postComputersComputerSnapshotsSnapshotRestore",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "name": "snapshot",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["confirm_restore"],
                                "properties": {
                                    "confirm_restore": {
                                        "type": "boolean",
                                        "const": true
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/computers/{computer}/snapshots/{snapshot}": {
            "delete": {
                "summary": "Delete a snapshot",
                "operationId": "deleteComputersComputerSnapshotsSnapshot",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "name": "snapshot",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/computers/{computer}/migrate": {
            "post": {
                "summary": "Move a stopped computer while preserving its identity",
                "operationId": "postComputersComputerMigrate",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Operation accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ComputerOperationResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "region": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ssh-keys": {
            "get": {
                "summary": "List account SSH public keys",
                "operationId": "getSsh-Keys",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            },
            "post": {
                "summary": "Add an account SSH public key",
                "operationId": "postSsh-Keys",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["name", "public_key"],
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "public_key": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/ssh-keys/{sshKey}": {
            "delete": {
                "summary": "Remove an SSH public key",
                "operationId": "deleteSsh-KeysSshkey",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Removed"
                    }
                },
                "parameters": [
                    {
                        "name": "sshKey",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ]
            }
        },
        "/computers/{computer}/ssh-keys": {
            "get": {
                "summary": "List effective computer SSH keys",
                "operationId": "getComputersComputerSsh-Keys",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    }
                ]
            },
            "post": {
                "summary": "Add a computer SSH public key",
                "operationId": "postComputersComputerSsh-Keys",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ComputerId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["name", "public_key"],
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "public_key": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tokens": {
            "get": {
                "summary": "List API tokens (browser session only)",
                "operationId": "getTokens",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            },
            "post": {
                "summary": "Create an API token (browser session only)",
                "operationId": "postTokens",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["name", "abilities"],
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "abilities": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "computers:read",
                                                "computers:write"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tokens/{token}": {
            "delete": {
                "summary": "Revoke an API token (browser session only)",
                "operationId": "deleteTokensToken",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Revoked"
                    }
                }
            }
        },
        "/snapshots": {
            "get": {
                "summary": "List saved account snapshots",
                "operationId": "getSnapshots",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Saved snapshots, including snapshots retained after source deletion",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            }
        },
        "/snapshots/{snapshot}": {
            "get": {
                "summary": "Get a saved account snapshot",
                "operationId": "getSnapshot",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SnapshotId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Saved snapshot",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            },
            "delete": {
                "summary": "Delete a saved account snapshot",
                "operationId": "deleteSnapshot",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SnapshotId"
                    },
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Snapshot deletion accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "parameters": {
            "ComputerId": {
                "name": "computer",
                "in": "path",
                "required": true,
                "description": "Computer ID",
                "schema": {
                    "type": "string"
                }
            },
            "IdempotencyKey": {
                "name": "Idempotency-Key",
                "in": "header",
                "required": false,
                "description": "Unique key for safely retrying a write request",
                "schema": {
                    "type": "string",
                    "maxLength": 255
                }
            },
            "SnapshotId": {
                "name": "snapshot",
                "in": "path",
                "required": true,
                "schema": {
                    "type": "string",
                    "format": "uuid"
                }
            }
        },
        "responses": {
            "Unauthenticated": {
                "description": "Missing or invalid authentication"
            },
            "ValidationError": {
                "description": "Request validation failed"
            }
        },
        "schemas": {
            "CreateComputer": {
                "type": "object",
                "required": ["name", "profile"],
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 48
                    },
                    "profile": {
                        "type": "string",
                        "example": "small"
                    },
                    "image": {
                        "type": ["string", "null"]
                    },
                    "auto_stop_minutes": {
                        "type": ["integer", "null"],
                        "enum": [30, 60, 240, null]
                    },
                    "snapshot_id": {
                        "type": ["string", "null"],
                        "format": "uuid",
                        "description": "Ready account snapshot to copy. Omit image when provided."
                    },
                    "acknowledge_sensitive_state": {
                        "type": "boolean",
                        "description": "Required and true with snapshot_id; confirms private disk state may be copied."
                    }
                }
            },
            "Computer": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "address": {
                        "type": ["string", "null"],
                        "format": "uri"
                    },
                    "auto_stop_minutes": {
                        "type": ["integer", "null"]
                    }
                }
            },
            "Operation": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "error_code": {
                        "type": ["string", "null"]
                    },
                    "error_message": {
                        "type": ["string", "null"]
                    }
                }
            },
            "ComputerOperationResponse": {
                "type": "object",
                "properties": {
                    "data": {
                        "$ref": "#/components/schemas/Computer"
                    },
                    "operation": {
                        "$ref": "#/components/schemas/Operation"
                    }
                }
            }
        }
    }
}
