Write File
Filesystem API
Write File
Create or overwrite a file inside a sandbox.
POST
Write File
Writes a file to the specified path inside the sandbox. If the file already
exists it is overwritten. Parent directories are created automatically if they
do not exist. Returns the envd write response.
Path Parameters
The sandbox identifier. Format:
sbx-<8 chars>.Request Body
Absolute path to write inside the sandbox. Parent directories are created
automatically.Example:
"/home/user/script.py"File content as a UTF-8 string. This endpoint is text-only — it cannot
carry arbitrary bytes. For binary payloads (images, compiled artifacts,
base64-decoded blobs) use the streaming
PUT /files/raw endpoint with
Content-Type: application/octet-stream (500 MiB cap). The Python and
TypeScript SDKs dispatch automatically based on payload type — pass bytes
/ Uint8Array to files.write() and the SDK routes to /files/raw for you.Example: "print('hello')\n"Unix user to own the written file. Defaults to the envd default user.Example:
"user"Response
Returns the envd write confirmation as a JSON object.Example
Error Responses
| Status | Cause |
|---|---|
400 | Invalid request body |
401 | Missing or invalid API key |
404 | Sandbox not found |
409 | Sandbox is paused — resume it before accessing files |
410 | Sandbox has been killed |
502 | envd daemon unreachable |
503 | Sandbox has no VM |