kosa8 docs Dashboard
esc
↑ ↓ move↵ openRuns in your browser; nothing you type is sent anywhere.

HTTP API / Sandbox files

Sandbox files

5 endpoints at https://api.kosa8.com, sent with Authorization: Bearer $KOSA8_API_KEY. Generated from the API's own OpenAPI description, which a test holds to the router.

Download a file, streamed; a sleeping sandbox wakes first#

GET/v1/sandboxes/{id}/filesscope sandboxes:read

The bytes stream between the caller and the sandbox, never held whole on the way, so a file has no size cap but the sandbox's disk (4 GiB a request). Any absolute path: /workspace, which lasts across sleep and snapshots, or anywhere else in the sandbox's container (/tmp, /root, /home/…), the filesystem its commands see.

Parameters
idrequiredpath · string
Sandbox id (sbx_…)
pathrequiredquery · string
An absolute path in the sandbox, e.g. /workspace/app.py, /tmp/out.bin or /root/.bashrc (a relative path is relative to /workspace; no ..)
Rangeheader · string
One byte range, bytes=a-b, a- or -n: the answer is 206 with Content-Range, or 416 past the end
Responses
200400401402403404409413416501502
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/files \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Upload a file (the body, any bytes), streamed#

PUT/v1/sandboxes/{id}/filesscope sandboxes:write

The bytes stream between the caller and the sandbox, never held whole on the way, so a file has no size cap but the sandbox's disk (4 GiB a request). Any absolute path: /workspace, which lasts across sleep and snapshots, or anywhere else in the sandbox's container (/tmp, /root, /home/…), the filesystem its commands see. Through this API one request body is at most 100 MB (Cloudflare's limit): send a bigger file in parts with offset=, or PUT it to the direct files_url (POST …/direct) or a PUT link (POST …/files/link), which go to the host straight.

Parameters
idrequiredpath · string
Sandbox id (sbx_…)
pathrequiredquery · string
An absolute path in the sandbox, e.g. /workspace/app.py, /tmp/out.bin or /root/.bashrc (a relative path is relative to /workspace; no ..)
offsetquery · integer
Write the body at this byte, keeping the rest of the file and growing it as needed: parts of a big upload, in any order or in parallel
appendquery · "1" | "true"
Add the body at the end of the file (not with offset)
modequery · string
Permission bits, octal, e.g. 755
Body

application/octet-stream: the raw bytes.

Responses
200400401402403404409413501502507
curl -s -X PUT https://api.kosa8.com/v1/sandboxes/$SBX/files \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  --data-binary @file

Remove a file, or a folder with recursive=1#

DELETE/v1/sandboxes/{id}/filesscope sandboxes:write
Parameters
idrequiredpath · string
Sandbox id (sbx_…)
pathrequiredquery · string
An absolute path in the sandbox, e.g. /workspace/app.py, /tmp/out.bin or /root/.bashrc (a relative path is relative to /workspace; no ..)
recursivequery · "1" | "true"
Remove a folder and everything in it
Responses
200400401402403404409501502
curl -s -X DELETE https://api.kosa8.com/v1/sandboxes/$SBX/files \
  -H "Authorization: Bearer $KOSA8_API_KEY"

List a folder (default /workspace)#

GET/v1/sandboxes/{id}/files/listscope sandboxes:read
Parameters
idrequiredpath · string
Sandbox id (sbx_…)
pathquery · string
Folder; default /workspace
Responses
200400401402403404409501502
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/files/list \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Make a folder (and its parents)#

POST/v1/sandboxes/{id}/files/mkdirscope sandboxes:write
Parameters
idrequiredpath · string
Sandbox id (sbx_…)
JSON body
pathrequiredstring
—
Responses
200400401402403404409501502
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/files/mkdir \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

The kosa8 weekly

Agent security news, one industry deep-dive and a hands-on challenge, every Monday. Unsubscribe in one click.

© 2026 kosa8 · kosa8.com · AI Agent Sandbox: Secure and Sovereign for Enterprise · Local models served by llamay · Agent gateway: MAQPNA