openapi: 3.1.0 info: title: Kernel API Keys Browser Computer Controls API description: Developer tools and cloud infrastructure for AI agents to use web browsers version: 0.1.0 servers: - url: https://api.onkernel.com description: API Server security: - bearerAuth: [] tags: - name: Browser Computer Controls description: Control mouse, keyboard, and screen on the browser instance. paths: /browsers/{id}/computer/click_mouse: post: summary: Simulate a mouse click action on the browser instance operationId: clickMouse tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ClickMouseRequest' responses: '200': description: Mouse action performed '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.browsers.computer.clickMouse('id', { x: 0, y: 0 });" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nclient.browsers.computer.click_mouse(\n id=\"id\",\n x=0,\n y=0,\n)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Browsers.Computer.ClickMouse(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerClickMouseParams{\n\t\t\tX: 0,\n\t\t\tY: 0,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" /browsers/{id}/computer/move_mouse: post: summary: Move the mouse cursor to the specified coordinates on the browser instance operationId: moveMouse tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MoveMouseRequest' responses: '200': description: Mouse cursor moved '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.browsers.computer.moveMouse('id', { x: 0, y: 0 });" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nclient.browsers.computer.move_mouse(\n id=\"id\",\n x=0,\n y=0,\n)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Browsers.Computer.MoveMouse(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerMoveMouseParams{\n\t\t\tX: 0,\n\t\t\tY: 0,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" /browsers/{id}/computer/screenshot: post: summary: Capture a screenshot of the browser instance operationId: takeScreenshot tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/ScreenshotRequest' responses: '200': description: Screenshot image content: image/png: schema: type: string format: binary '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.browsers.computer.captureScreenshot('id');\n\nconsole.log(response);\n\nconst content = await response.blob();\nconsole.log(content);" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nresponse = client.browsers.computer.capture_screenshot(\n id=\"id\",\n)\nprint(response)\ncontent = response.read()\nprint(content)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Browsers.Computer.CaptureScreenshot(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerCaptureScreenshotParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n" /browsers/{id}/computer/type: post: summary: Type text on the browser instance operationId: typeText tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TypeTextRequest' responses: '200': description: Text typed successfully '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.browsers.computer.typeText('id', { text: 'text' });" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nclient.browsers.computer.type_text(\n id=\"id\",\n text=\"text\",\n)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Browsers.Computer.TypeText(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerTypeTextParams{\n\t\t\tText: \"text\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" /browsers/{id}/computer/press_key: post: summary: Press one or more keys on the host computer operationId: pressKey tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PressKeyRequest' responses: '200': description: Keys pressed successfully '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.browsers.computer.pressKey('id', { keys: ['string'] });" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nclient.browsers.computer.press_key(\n id=\"id\",\n keys=[\"string\"],\n)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Browsers.Computer.PressKey(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerPressKeyParams{\n\t\t\tKeys: []string{\"string\"},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" /browsers/{id}/computer/scroll: post: summary: Scroll the mouse wheel at a position on the host computer operationId: scroll tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ScrollRequest' responses: '200': description: Scroll performed '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.browsers.computer.scroll('id', { x: 0, y: 0 });" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nclient.browsers.computer.scroll(\n id=\"id\",\n x=0,\n y=0,\n)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Browsers.Computer.Scroll(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerScrollParams{\n\t\t\tX: 0,\n\t\t\tY: 0,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" /browsers/{id}/computer/drag_mouse: post: summary: Drag the mouse along a path operationId: dragMouse tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DragMouseRequest' responses: '200': description: Drag performed '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.browsers.computer.dragMouse('id', {\n path: [\n [0, 0],\n [0, 0],\n ],\n});" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nclient.browsers.computer.drag_mouse(\n id=\"id\",\n path=[[0, 0], [0, 0]],\n)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Browsers.Computer.DragMouse(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerDragMouseParams{\n\t\t\tPath: [][]int64{{0, 0}, {0, 0}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" /browsers/{id}/computer/cursor: post: summary: Set cursor visibility operationId: setCursor tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SetCursorRequest' responses: '200': description: Cursor visibility set content: application/json: schema: $ref: '#/components/schemas/OkResponse' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.browsers.computer.setCursorVisibility('id', { hidden: true });\n\nconsole.log(response.ok);" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nresponse = client.browsers.computer.set_cursor_visibility(\n id=\"id\",\n hidden=True,\n)\nprint(response.ok)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Browsers.Computer.SetCursorVisibility(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerSetCursorVisibilityParams{\n\t\t\tHidden: true,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Ok)\n}\n" /browsers/{id}/computer/clipboard/read: post: summary: Read text from the clipboard on the browser instance operationId: readClipboard tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID responses: '200': description: Clipboard content read successfully content: application/json: schema: $ref: '#/components/schemas/ClipboardContent' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.browsers.computer.readClipboard('id');\n\nconsole.log(response.text);" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nresponse = client.browsers.computer.read_clipboard(\n \"id\",\n)\nprint(response.text)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Browsers.Computer.ReadClipboard(context.TODO(), \"id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Text)\n}\n" /browsers/{id}/computer/clipboard/write: post: summary: Write text to the clipboard on the browser instance operationId: writeClipboard tags: - Browser Computer Controls security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string description: Browser session ID requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/WriteClipboardRequest' responses: '200': description: Text written to clipboard successfully '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' x-codeSamples: - lang: JavaScript source: "import Kernel from '@onkernel/sdk';\n\nconst client = new Kernel({\n apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.browsers.computer.writeClipboard('id', { text: 'text' });" - lang: Python source: "import os\nfrom kernel import Kernel\n\nclient = Kernel(\n api_key=os.environ.get(\"KERNEL_API_KEY\"), # This is the default and can be omitted\n)\nclient.browsers.computer.write_clipboard(\n id=\"id\",\n text=\"text\",\n)" - lang: Go source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/kernel/kernel-go-sdk\"\n\t\"github.com/kernel/kernel-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := kernel.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Browsers.Computer.WriteClipboard(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserComputerWriteClipboardParams{\n\t\t\tText: \"text\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" components: responses: InternalError: description: Internal Server Error content: application/json: schema: $ref: '#/components/schemas/Error' NotFound: description: Resource not found content: application/json: schema: $ref: '#/components/schemas/Error' BadRequest: description: Bad Request – invalid input content: application/json: schema: $ref: '#/components/schemas/Error' schemas: ErrorDetail: type: object properties: code: type: string description: Lower-level error code providing more specific detail example: invalid_input message: type: string description: Further detail about the error example: Provided version string is not semver compliant ScreenshotRequest: type: object properties: region: $ref: '#/components/schemas/ScreenshotRegion' additionalProperties: false ClipboardContent: type: object required: - text properties: text: type: string description: Current clipboard text content additionalProperties: false ScrollRequest: type: object required: - x - y properties: x: type: integer description: X coordinate at which to perform the scroll y: type: integer description: Y coordinate at which to perform the scroll delta_x: type: integer description: Horizontal scroll amount in xdotool "wheel units." Positive scrolls right, negative scrolls left. default: 0 delta_y: type: integer description: Vertical scroll amount in xdotool "wheel units." Positive scrolls down, negative scrolls up. default: 0 hold_keys: type: array description: Modifier keys to hold during the scroll items: type: string additionalProperties: false PressKeyRequest: type: object required: - keys properties: keys: type: array description: 'List of key symbols to press. Each item should be a key symbol supported by xdotool (see X11 keysym definitions). Examples include "Return", "Shift", "Ctrl", "Alt", "F5". Items in this list could also be combinations, e.g. "Ctrl+t" or "Ctrl+Shift+Tab". ' items: type: string duration: type: integer description: Duration to hold the keys down in milliseconds. If omitted or 0, keys are tapped. minimum: 0 default: 0 hold_keys: type: array description: Optional modifier keys to hold during the key press sequence. items: type: string additionalProperties: false ScreenshotRegion: type: object required: - x - y - width - height properties: x: type: integer description: X coordinate of the region's top-left corner y: type: integer description: Y coordinate of the region's top-left corner width: type: integer description: Width of the region in pixels height: type: integer description: Height of the region in pixels additionalProperties: false ClickMouseRequest: type: object required: - x - y properties: button: type: string description: Mouse button to interact with enum: - left - right - middle - back - forward click_type: type: string description: Type of click action enum: - down - up - click x: type: integer description: X coordinate of the click position y: type: integer description: Y coordinate of the click position hold_keys: type: array description: Modifier keys to hold during the click items: type: string num_clicks: type: integer description: Number of times to repeat the click default: 1 additionalProperties: false Error: type: object required: - code - message properties: code: type: string description: Application-specific error code (machine-readable) example: bad_request message: type: string description: Human-readable error description for debugging example: 'Missing required field: app_name' details: type: array description: Additional error details (for multiple errors) items: $ref: '#/components/schemas/ErrorDetail' inner_error: $ref: '#/components/schemas/ErrorDetail' SetCursorRequest: type: object required: - hidden properties: hidden: type: boolean description: Whether the cursor should be hidden or visible additionalProperties: false MoveMouseRequest: type: object required: - x - y properties: x: type: integer description: X coordinate to move the cursor to y: type: integer description: Y coordinate to move the cursor to hold_keys: type: array description: Modifier keys to hold during the move items: type: string smooth: type: boolean description: Use human-like Bezier curve path instead of instant mouse movement. default: true duration_ms: type: integer description: Target total duration in milliseconds for the mouse movement when smooth=true. Omit for automatic timing based on distance. minimum: 50 maximum: 5000 additionalProperties: false WriteClipboardRequest: type: object required: - text properties: text: type: string description: Text to write to the system clipboard additionalProperties: false TypeTextRequest: type: object required: - text properties: text: type: string description: Text to type on the browser instance delay: type: integer description: Delay in milliseconds between keystrokes minimum: 0 default: 0 additionalProperties: false OkResponse: type: object description: Generic OK response. required: - ok properties: ok: type: boolean description: Indicates success. default: true additionalProperties: false DragMouseRequest: type: object required: - path properties: path: type: array description: Ordered list of [x, y] coordinate pairs to move through while dragging. Must contain at least 2 points. minItems: 2 items: type: array minItems: 2 maxItems: 2 items: type: integer button: type: string description: Mouse button to drag with enum: - left - middle - right delay: type: integer description: Delay in milliseconds between button down and starting to move along the path. minimum: 0 default: 0 steps_per_segment: type: integer description: Number of relative move steps per segment in the path. Minimum 1. minimum: 1 default: 10 step_delay_ms: type: integer description: Delay in milliseconds between relative steps while dragging (not the initial delay). minimum: 0 default: 50 hold_keys: type: array description: Modifier keys to hold during the drag items: type: string smooth: type: boolean description: Use human-like Bezier curves between path waypoints instead of linear interpolation. When true, steps_per_segment and step_delay_ms are ignored. default: true duration_ms: type: integer description: Target total duration in milliseconds for the entire drag movement when smooth=true. Omit for automatic timing based on total path length. minimum: 50 maximum: 10000 additionalProperties: false securitySchemes: bearerAuth: type: http scheme: bearer