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

HTTP API / Terminal and large files

Terminal and large files

4 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.

A wss:// URL for an interactive terminal (PTY) in the sandbox#

POST/v1/sandboxes/{id}/terminalscope sandboxes:write

The terminal is a fresh container from the sandbox's image with /workspace mounted. Binary WebSocket messages are keys in and output out; text messages are JSON: {type: "resize", cols, rows} in, {type: "exit", code} out. A sleeping sandbox is woken first.

Parameters
idrequiredpath · string
Sandbox id (sbx_…)
JSON body
colsinteger
Min 1. Max 1000.
rowsinteger
Min 1. Max 1000.
commandarray of string
Run this instead of a login shell, e.g. ["python3"]
Responses
200400401403404409501
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/terminal \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
POST/v1/sandboxes/{id}/files/linkscope sandboxes:read

PUT links need sandboxes:write. No size cap but the sandbox's disk (4 GiB per upload). A sleeping sandbox is woken first; a link used after it falls asleep again answers 409 use_api.

Parameters
idrequiredpath · string
Sandbox id (sbx_…)
JSON body
pathrequiredstring
—
method"GET" | "PUT"
—
ttl_sinteger
Min 10. Max 300.
Responses
200400401403404409501
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/files/link \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

The file's bytes, streamed (the same as GET …/files on a host that streams)#

GET/v1/sandboxes/{id}/files/rawscope sandboxes:read
Parameters
idrequiredpath · string
Sandbox id (sbx_…)
pathrequiredquery · string
An absolute path in the sandbox such as /workspace/data.csv or /tmp/out.bin (no ..)
Rangeheader · string
One byte range (bytes=a-b, a-, -n): 206 with Content-Range, 416 past the end
Responses
200400401403404409416501
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/files/raw \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Write the request body to the file, streamed (the same as PUT …/files on a host that streams)#

PUT/v1/sandboxes/{id}/files/rawscope sandboxes:write

Through this API an upload is bounded by the request size Cloudflare allows (100 MB on most plans); past that, send parts with offset=, or PUT to the direct files_url or a PUT link, which go to the host straight (4 GiB a request).

Parameters
idrequiredpath · string
Sandbox id (sbx_…)
pathrequiredquery · string
An absolute path in the sandbox such as /workspace/data.csv or /tmp/out.bin (no ..)
offsetquery · integer
Write the body at this byte; the rest of the file is kept and it grows as needed
appendquery · "1" | "true"
Add the body at the end (not with offset)
modequery · string
Permission bits, octal
Body

application/octet-stream: the raw bytes.

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

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