Skip to main content
GET
/
sandboxes
/
{sandbox_id}
/
files
/
list
List Directory
curl --request GET \
  --url https://api.declaw.ai/sandboxes/{sandbox_id}/files/list \
  --header 'X-API-Key: <api-key>'
{
  "[].name": "<string>",
  "[].path": "<string>",
  "[].type": "<string>",
  "[].size": 123
}
Returns the immediate children (files and subdirectories) of the specified directory path. Does not recurse into subdirectories.

Path Parameters

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

Query Parameters

path
string
required
Absolute path of the directory to list inside the sandbox.Example: /home/user

Response

Returns an array of EntryInfo objects, one per directory entry.
[].name
string
Entry filename or directory name (not the full path).
[].path
string
Full absolute path inside the sandbox.
[].type
string
Entry type: "file", "dir", or "symlink".
[].size
integer
Size in bytes. 0 for directories.

Example

curl "https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/files/list?path=/home/user" \
  -H "X-API-Key: YOUR_API_KEY"
Response
[
  {
    "name": "script.py",
    "path": "/home/user/script.py",
    "type": "file",
    "size": 1024
  },
  {
    "name": "data",
    "path": "/home/user/data",
    "type": "dir",
    "size": 0
  }
]

Error Responses

StatusCause
401Missing or invalid API key
404Sandbox not found
502envd daemon unreachable
503Sandbox has no VM