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#
/v1/sandboxes/{id}/filesscope sandboxes:readThe 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.
Parametersidrequiredpath · stringpathrequiredquery · stringRangeheader · stringcurl -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#
/v1/sandboxes/{id}/filesscope sandboxes:writeThe 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.
Parametersidrequiredpath · stringpathrequiredquery · stringoffsetquery · integerappendquery · "1" | "true"modequery · stringapplication/octet-stream: the raw bytes.
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#
/v1/sandboxes/{id}/filesscope sandboxes:writeidrequiredpath · stringpathrequiredquery · stringrecursivequery · "1" | "true"curl -s -X DELETE https://api.kosa8.com/v1/sandboxes/$SBX/files \ -H "Authorization: Bearer $KOSA8_API_KEY"
List a folder (default /workspace)#
/v1/sandboxes/{id}/files/listscope sandboxes:readidrequiredpath · stringpathquery · stringcurl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/files/list \ -H "Authorization: Bearer $KOSA8_API_KEY"
Make a folder (and its parents)#
/v1/sandboxes/{id}/files/mkdirscope sandboxes:writeidrequiredpath · stringpathrequiredstringcurl -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