Skip to main content
GET
/
sandboxes
/
{sandbox_id}
/
files
Read File
curl --request GET \
  --url https://api.declaw.ai/sandboxes/{sandbox_id}/files \
  --header 'X-API-Key: <api-key>'
Reads the specified file from the sandbox filesystem and returns its raw content as a plain-text response body (Content-Type: text/plain). The bytes are returned unmodified — no encoding is applied.

Path Parameters

sandbox_id
string
required
The sandbox identifier. Format: sbx-<8 chars>.

Query Parameters

path
string
required
Absolute path of the file to read inside the sandbox.Example: /home/user/script.py

Response

Returns the raw file content as text/plain. The response body is the file’s bytes — no JSON wrapper.

Example

curl "https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/files?path=/home/user/script.py" \
  -H "X-API-Key: YOUR_API_KEY"
print('hello')

Error Responses

StatusCause
401Missing or invalid API key
404File not found or sandbox not found
409Sandbox is paused — resume it before accessing files
410Sandbox has been killed
502envd daemon unreachable
503Sandbox has no VM