Skip to main content
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

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

Request Body

string
required
Absolute path to write inside the sandbox. Parent directories are created automatically.Example: "/home/user/script.py"
string
required
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"
string
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