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#
/v1/sandboxes/{id}/terminalscope sandboxes:writeThe 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.
Parametersidrequiredpath · stringcolsintegerrowsintegercommandarray of stringcurl -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
A presigned URL for one download (GET) or upload (PUT) of one path, straight to the host#
/v1/sandboxes/{id}/files/linkscope sandboxes:readPUT 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.
Parametersidrequiredpath · stringpathrequiredstringmethod"GET" | "PUT"ttl_sintegercurl -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)#
/v1/sandboxes/{id}/files/rawscope sandboxes:readidrequiredpath · stringpathrequiredquery · stringRangeheader · stringcurl -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)#
/v1/sandboxes/{id}/files/rawscope sandboxes:writeThrough 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).
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/raw \ -H "Authorization: Bearer $KOSA8_API_KEY" \ --data-binary @file