{"openapi":"3.1.0","info":{"title":"Ezy-CLI Platform & Live Terminal Control API","version":"1.0.0","description":"Programmatic REST API for Cloud AI Sandboxes, Live Terminal Control (tmux), and API Key Management on Ezy-CLI.","contact":{"name":"Ezy-CLI Support","url":"https://cli.ezy-journey.com"}},"servers":[{"url":"https://cli.ezy-journey.com","description":"Production Cloudflare Worker Edge"},{"url":"http://localhost:3000","description":"Local Development Server"}],"security":[{"BearerAuth":[]}],"paths":{"/api/sandboxes/{id}/terminal/input":{"post":{"summary":"Send input or command to live sandbox terminal","description":"Transmits terminal keystrokes or full commands into the active tmux session of the target sandbox. Requires \"terminal:write\" or \"*\" scope.","operationId":"sendTerminalInput","tags":["Terminal Control"],"parameters":[{"name":"id","in":"path","required":true,"description":"Sandbox ID (e.g. sbx_...)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"Command or keystroke string to send to the terminal","example":"ls -la"},"withEnter":{"type":"boolean","description":"Whether to append carriage return (\\r) to execute the command","default":true,"example":true}}}}}},"responses":{"200":{"description":"Input successfully dispatched to runner terminal session","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"sandboxId":{"type":"string","example":"sbx_abc123"},"machineId":{"type":"string","example":"mach_xyz789"},"bytesSent":{"type":"integer","example":7},"withEnter":{"type":"boolean","example":true},"delivered":{"type":"boolean","example":true}}}}}}}},"400":{"description":"Bad request (e.g. missing input)"},"401":{"description":"Unauthorized (missing or invalid Bearer token / lack terminal:write scope)"},"403":{"description":"Forbidden (no access to sandbox or machine expired)"},"404":{"description":"Sandbox not found"}}}},"/api/sandboxes/{id}/terminal/status":{"get":{"summary":"Get sandbox terminal session status","description":"Retrieves the real-time runner connectivity and terminal session state. Requires \"terminal:read\" or \"*\" scope.","operationId":"getTerminalStatus","tags":["Terminal Control"],"parameters":[{"name":"id","in":"path","required":true,"description":"Sandbox ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Terminal status details","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"sandboxId":{"type":"string","example":"sbx_abc123"},"machineId":{"type":"string","example":"mach_xyz789"},"sandboxName":{"type":"string","example":"My Python App"},"status":{"type":"string","example":"running"},"agentType":{"type":"string","example":"bash"},"activeSessions":{"type":"integer","example":1},"runnerConnected":{"type":"boolean","example":true},"updatedAt":{"type":"string","format":"date-time"}}}}}}}},"401":{"description":"Unauthorized (requires terminal:read scope)"},"404":{"description":"Sandbox not found"}}}},"/api/user/api-keys":{"get":{"summary":"List user API keys","description":"Returns all API keys associated with the current user. Secret keys are masked.","operationId":"listApiKeys","tags":["API Key Management"],"responses":{"200":{"description":"List of active API keys","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}}}}}},"post":{"summary":"Create a new API key","description":"Generates a new prefixed API key. The unhashed raw key is returned strictly once in the response.","operationId":"createApiKey","tags":["API Key Management"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","scopes"],"properties":{"name":{"type":"string","description":"Label/name for the key","example":"CI/CD Pipeline Key"},"scopes":{"type":"array","description":"List of permission scopes","items":{"type":"string","enum":["terminal:write","terminal:read","sandboxes:read","services:write","*"]},"example":["terminal:write","terminal:read"]},"expiresInDays":{"type":"integer","description":"Expiration in days (optional, 0 or omit for never expires)","example":30}}}}}},"responses":{"201":{"description":"Key successfully created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"rawKey":{"type":"string","description":"The secret API key (shown only once)","example":"ezy_live_aB3dE...xyz"},"apiKey":{"$ref":"#/components/schemas/ApiKey"}}}}}}}}}}},"/api/user/api-keys/{id}":{"delete":{"summary":"Revoke an API key","description":"Permanently deletes/revokes an API key belonging to the authenticated user.","operationId":"revokeApiKey","tags":["API Key Management"],"parameters":[{"name":"id","in":"path","required":true,"description":"API Key ID","schema":{"type":"string"}}],"responses":{"200":{"description":"API key revoked successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true}}}}}}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key (ezy_live_...)","description":"Pass your API key in the Authorization header: `Bearer ezy_live_<token>`"}},"schemas":{"ApiKey":{"type":"object","properties":{"id":{"type":"string","example":"key_12345678"},"name":{"type":"string","example":"GitHub Actions"},"key_prefix":{"type":"string","example":"ezy_live_abc1***"},"scopes":{"type":"array","items":{"type":"string"},"example":["terminal:write","terminal:read"]},"expires_at":{"type":"string","nullable":true,"format":"date-time"},"last_used_at":{"type":"string","nullable":true,"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}}}}}