POST /compat/e2b/envd/files
envd's `POST /files` (the SDKs' `files.write` and `files.writeFiles`). `multipart/form-data` with one `file` part per file (its filename is the path when `path` is absent), or the bytes of one file as `application/octet-stream` with `path`. Each file is at most 64 MiB; missing parent directories are made. Answers the written entries. A request with `signature` or `signature_expiration` (E2B's signed `uploadUrl`) is refused with the envd `401`.

Query Parameters

path string optional query
The file (required for `application/octet-stream`); relative paths are taken from the user's home.
username string optional query
`user` (the default) or `root`: whose home a relative path starts from.

Header Parameters

X-Access-Token string required header
The sandbox's envd access token (`b3os_et_…`), from the create or connect answer.
E2b-Sandbox-Id string required header
The sandbox the call is for (`sandboxID` of the create answer). The token must be this sandbox's.

Request Body required

multipart/form-data
file string (binary)

Responses

200 The written files.
application/json
Array of:
name string
type string
path string
400 A malformed value, or an option B3OS cannot honor named in the message (`invalid_request`, `unsupported_option`).
401 The envd call is refused (`envd_token_invalid`), the same answer on every envd path whatever the reason, in E2B's error shape (Connect clients read the 401 as `unauthenticated`).
curl -X POST 'https://beta-api.b3os.org/compat/e2b/envd/files' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'X-Access-Token: string' \  -H 'E2b-Sandbox-Id: string' \  -H 'Content-Type: application/json' \  -d '{  "file": "string"}'
const response = await fetch('https://beta-api.b3os.org/compat/e2b/envd/files', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json",      "X-Access-Token": "string",      "E2b-Sandbox-Id": "string"  },  body: JSON.stringify({    "file": "string"  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN',    'X-Access-Token': 'string',    'E2b-Sandbox-Id': 'string'}response = requests.post('https://beta-api.b3os.org/compat/e2b/envd/files', headers=headers, json={  "file": "string"})print(response.json())
200 Response
[  {    "name": "hello.txt",    "type": "file",    "path": "/home/user/hello.txt"  }]
Ask a question... ⌘I