Skip to content
中文

List files in a sandbox directory

Call Create sandbox first and replace sbx_123 with its returned sandboxID.

GET/sandbox/v1/sandboxes/{sandbox_id}/files:list● Supported

Request parameters

  • sandbox_idstringrequired

    path: Sandbox ID returned by sandboxes.create or sandboxes.list.

  • pathstringrequired

    query: File or directory path inside the sandbox; relative paths use the user's home directory.

Returns

200

Errors follow the E2B format — see error codes

Request

curl
# Call Create sandbox first and replace sbx_123 with its returned sandboxID.
curl "https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/files:list?path=/tmp/docs-files" \
  -H "X-API-Key: $PRAXIS_API_KEY"
Python
# Call Create sandbox first and replace sbx_123 with its returned sandboxID.
import requests

api_key = "$PRAXIS_API_KEY"

# Call /sandbox/v1 directly over HTTP.
resp = requests.get(
    "https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/files:list?path=/tmp/docs-files",
    headers={"X-API-Key": api_key},
)
print(resp.status_code, resp.text)
TypeScript
// Call Create sandbox first and replace sbx_123 with its returned sandboxID.
const apiKey = "$PRAXIS_API_KEY";

// Call /sandbox/v1 directly over HTTP.
const resp = await fetch(`https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/files:list?path=/tmp/docs-files`, {
  headers: { "X-API-Key": apiKey },
});
console.log(resp.status, await resp.text());

Response 200

[
  {
    "name": "hello.txt",
    "path": "/tmp/docs-files/hello.txt",
    "size": 18,
    "type": "file"
  }
]

Response

HTTP 200

Operation completed

application/json

Name Type Description
[].name string Entry basename.
[].path string Entry path in the sandbox.
[].type string file is a regular file, dir a directory, symlink a symbolic link.
[].size number Entry size in bytes.

Prepare the example file

In a new sandbox, run the Write a file example first to create /tmp/docs-files/hello.txt and its parent directory, then run this example. Replace path to use your own file. After trying the example, delete the sandbox to remove it and its files.