Kernel Browser Filesystem API
Read, write, and manage files on the browser instance.
Read, write, and manage files on the browser instance.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/kernel-browser-filesystem-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
openapi: 3.2.0
info:
title: Kernel API Keys Browser Filesystem 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 Filesystem
description: Read, write, and manage files on the browser instance.
paths:
/browsers/{id}/fs/read_file:
get:
summary: Read file contents
operationId: readFile
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
- name: path
in: query
required: true
schema:
type: string
pattern: ^/.*
description: Absolute file path to read.
responses:
'200':
description: File read successfully
content:
application/octet-stream:
schema:
type: string
format: binary
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.readFile('id', { path: '/J!' });\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.fs.read_file(\n id=\"id\",\n path=\"/J!\",\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.Fs.ReadFile(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFReadFileParams{\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n"
/browsers/{id}/fs/write_file:
put:
summary: Write or create a file
operationId: writeFile
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
- name: path
in: query
required: true
schema:
type: string
pattern: ^/.*
description: Destination absolute file path.
- name: mode
in: query
required: false
schema:
type: string
pattern: ^[0-7]{3,4}$
description: Optional file mode (octal string, e.g. 644). Defaults to 644.
requestBody:
required: true
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'201':
description: File written successfully
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.writeFile('id', fs.createReadStream('path/to/file'), { path: '/J!' });"
- 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.fs.write_file(\n id=\"id\",\n contents=b\"Example data\",\n path=\"/J!\",\n)"
- lang: Go
source: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"io\"\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.Fs.WriteFile(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tio.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tkernel.BrowserFWriteFileParams{\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/list_files:
get:
summary: List files in a directory
operationId: listFiles
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
- name: path
in: query
required: true
schema:
type: string
pattern: ^/.*
description: Absolute directory path.
responses:
'200':
description: Directory listing
content:
application/json:
schema:
$ref: '#/components/schemas/ListFiles'
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.listFiles('id', { path: '/J!' });\n\nconsole.log(response);"
- 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.fs.list_files(\n id=\"id\",\n path=\"/J!\",\n)\nprint(response)"
- 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.Fs.ListFiles(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFListFilesParams{\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n"
/browsers/{id}/fs/create_directory:
put:
summary: Create a new directory
operationId: createDirectory
tags:
- Browser Filesystem
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/CreateDirectoryRequest'
responses:
'201':
description: Directory created successfully
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.createDirectory('id', { path: '/J!' });"
- 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.fs.create_directory(\n id=\"id\",\n path=\"/J!\",\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.Fs.NewDirectory(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFNewDirectoryParams{\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/delete_file:
put:
summary: Delete a file
operationId: deleteFile
tags:
- Browser Filesystem
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/DeletePathRequest'
responses:
'200':
description: File deleted
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.deleteFile('id', { path: '/J!' });"
- 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.fs.delete_file(\n id=\"id\",\n path=\"/J!\",\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.Fs.DeleteFile(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFDeleteFileParams{\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/delete_directory:
put:
summary: Delete a directory
operationId: deleteDirectory
tags:
- Browser Filesystem
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/DeletePathRequest'
responses:
'200':
description: Directory deleted
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.deleteDirectory('id', { path: '/J!' });"
- 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.fs.delete_directory(\n id=\"id\",\n path=\"/J!\",\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.Fs.DeleteDirectory(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFDeleteDirectoryParams{\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/set_file_permissions:
put:
summary: Set file or directory permissions/ownership
operationId: setFilePermissions
tags:
- Browser Filesystem
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/SetFilePermissionsRequest'
responses:
'200':
description: Permissions updated
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.setFilePermissions('id', { mode: '0611', path: '/J!' });"
- 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.fs.set_file_permissions(\n id=\"id\",\n mode=\"0611\",\n path=\"/J!\",\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.Fs.SetFilePermissions(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFSetFilePermissionsParams{\n\t\t\tMode: \"0611\",\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/file_info:
get:
summary: Get information about a file or directory
operationId: fileInfo
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
- name: path
in: query
required: true
schema:
type: string
pattern: ^/.*
description: Absolute path of the file or directory.
responses:
'200':
description: File information
content:
application/json:
schema:
$ref: '#/components/schemas/FileInfo'
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.fileInfo('id', { path: '/J!' });\n\nconsole.log(response.is_dir);"
- 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.fs.file_info(\n id=\"id\",\n path=\"/J!\",\n)\nprint(response.is_dir)"
- 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.Fs.FileInfo(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFFileInfoParams{\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.IsDir)\n}\n"
/browsers/{id}/fs/move:
put:
summary: Move or rename a file or directory
operationId: movePath
tags:
- Browser Filesystem
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/MovePathRequest'
responses:
'200':
description: Move successful
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.move('id', { dest_path: '/J!', src_path: '/J!' });"
- 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.fs.move(\n id=\"id\",\n dest_path=\"/J!\",\n src_path=\"/J!\",\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.Fs.Move(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFMoveParams{\n\t\t\tDestPath: \"/J!\",\n\t\t\tSrcPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/watch:
post:
summary: Watch a directory for changes
operationId: startFsWatch
tags:
- Browser Filesystem
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/StartFsWatchRequest'
responses:
'201':
description: Watch started successfully
content:
application/json:
schema:
type: object
properties:
watch_id:
type: string
description: Unique identifier for the directory watch
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.watch.start('id', { path: 'path' });\n\nconsole.log(response.watch_id);"
- 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.fs.watch.start(\n id=\"id\",\n path=\"path\",\n)\nprint(response.watch_id)"
- 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.Fs.Watch.Start(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFWatchStartParams{\n\t\t\tPath: \"path\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.WatchID)\n}\n"
/browsers/{id}/fs/watch/{watch_id}/events:
get:
summary: Stream filesystem events for a watch
operationId: streamFsEvents
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
- name: watch_id
in: path
required: true
schema:
type: string
responses:
'200':
description: SSE stream of filesystem events
headers:
X-SSE-Content-Type:
description: Media type of SSE data events (application/json)
schema:
type: string
const: application/json
content:
text/event-stream:
schema:
$ref: '#/components/schemas/FileSystemEvent'
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.watch.events('watch_id', { id: 'id' });\n\nconsole.log(response.path);"
- 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)\nfor watch in client.browsers.fs.watch.events(\n watch_id=\"watch_id\",\n id=\"id\",\n):\n print(watch)"
- 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\tstream := client.Browsers.Fs.Watch.EventsStreaming(\n\t\tcontext.TODO(),\n\t\t\"watch_id\",\n\t\tkernel.BrowserFWatchEventsParams{\n\t\t\tID: \"id\",\n\t\t},\n\t)\n\tfor stream.Next() {\n\t\tfmt.Printf(\"%+v\\n\", stream.Current())\n\t}\n\terr := stream.Err()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/watch/{watch_id}:
delete:
summary: Stop watching a directory
operationId: stopFsWatch
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
- name: watch_id
in: path
required: true
schema:
type: string
responses:
'204':
description: Watch stopped successfully
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.watch.stop('watch_id', { id: 'id' });"
- 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.fs.watch.stop(\n watch_id=\"watch_id\",\n id=\"id\",\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.Fs.Watch.Stop(\n\t\tcontext.TODO(),\n\t\t\"watch_id\",\n\t\tkernel.BrowserFWatchStopParams{\n\t\t\tID: \"id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/download_dir_zip:
get:
summary: Download a directory as a ZIP archive
description: Returns a ZIP file containing the contents of the specified directory.
operationId: downloadDirZip
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
- name: path
in: query
required: true
schema:
type: string
pattern: ^/.*
description: Absolute directory path to archive and download.
responses:
'200':
description: ZIP archive of the requested directory
content:
application/zip:
schema:
type: string
format: binary
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.downloadDirZip('id', { path: '/J!' });\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.fs.download_dir_zip(\n id=\"id\",\n path=\"/J!\",\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.Fs.DownloadDirZip(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFDownloadDirZipParams{\n\t\t\tPath: \"/J!\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n"
/browsers/{id}/fs/upload:
post:
summary: Upload one or more files
description: Allows uploading single or multiple files to the remote filesystem.
operationId: uploadFiles
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
files:
type: array
items:
type: object
properties:
file:
type: string
format: binary
dest_path:
type: string
description: Absolute destination path to write the file.
pattern: ^/.*
required:
- file
- dest_path
required:
- files
responses:
'201':
description: Files uploaded successfully
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'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.fs.upload('id', {\n files: [{ dest_path: '/J!', file: fs.createReadStream('path/to/file') }],\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.fs.upload(\n id=\"id\",\n files=[{\n \"dest_path\": \"/J!\",\n \"file\": b\"Example data\",\n }],\n)"
- lang: Go
source: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"io\"\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.Fs.Upload(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\tkernel.BrowserFUploadParams{\n\t\t\tFiles: []kernel.BrowserFUploadParamsFile{{\n\t\t\t\tDestPath: \"/J!\",\n\t\t\t\tFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t\t}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
/browsers/{id}/fs/upload_zip:
post:
summary: Upload a zip archive and extract it
description: Upload a zip file and extract its contents to the specified destination path.
operationId: uploadZip
tags:
- Browser Filesystem
security:
- bearerAuth: []
parameters:
- name: id
in: path
required: true
schema:
type: string
description: Browser session ID
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
zip_file:
type: string
format: binary
dest_path:
type: string
description: Absolute destination directory to extract the archive to.
pattern: ^/.*
required:
- zip_file
- dest_path
responses:
'201':
description: Zip uploaded and extracted successfully
'400':
$ref: '#/components/responses/BadRequest'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
x-codeSamples:
- lang: JavaScript
source: "import fs from 'fs';\nimport 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.fs.uploadZip('id', {\n dest_path: '/J!',\n zip_file: fs.createReadStream('path/to/file'),\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.fs.upload_zip(\n id=\"id\",\n dest_path=\"/J!\",\n zip_file=b\"Example data\",\n)"
- lang: Go
source: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"io\"\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.Fs.UploadZip(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\
# --- truncated at 32 KB (37 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/kernel/refs/heads/main/openapi/kernel-browser-filesystem-api-openapi.yml