Write a file in the sandbox
Call Create sandbox first and replace sbx_123 with its returned sandboxID.
PUT
/sandbox/v1/sandboxes/{sandbox_id}/files● SupportedRequest parameters
sandbox_idstringrequiredpath: Sandbox ID returned by sandboxes.create or sandboxes.list.
pathstringrequiredFile or directory path inside the sandbox; relative paths use the user's home directory.
datastringrequiredUTF-8 text to write, replacing existing content.
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 -X PUT https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/files \
-H "X-API-Key: $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path":"/tmp/docs-files/hello.txt","data":"Hello from Praxis!"}'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.put(
"https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/files",
headers={"X-API-Key": api_key},
json={"path": "/tmp/docs-files/hello.txt", "data": "Hello from Praxis!"},
)
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`, {
method: "PUT",
headers: { "X-API-Key": apiKey, "Content-Type": "application/json" },
body: JSON.stringify({ path: "/tmp/docs-files/hello.txt", data: "Hello from Praxis!" }),
});
console.log(resp.status, await resp.text());Response 200
{
"name": "hello.txt",
"path": "/tmp/docs-files/hello.txt",
"size": 0,
"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. |