Skip to main content
POST
/
sandboxes
/
{sandbox_id}
/
files
/
batch
Write Files (Batch)
curl --request POST \
  --url https://api.declaw.ai/sandboxes/{sandbox_id}/files/batch \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "files": [
    {
      "path": "<string>",
      "data": "<string>"
    }
  ]
}
'
Writes multiple files to the sandbox filesystem in a single API call. All files are written atomically through envd. Parent directories are created automatically for each entry. Use batch writes to upload a project’s source files, configuration, or datasets without making one API call per file.

Path Parameters

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

Request Body

files
object[]
required
Array of file entries to write. Each entry has a path and data field.

Response

Returns the envd batch write confirmation as a JSON object.

Example

curl -X POST https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/files/batch \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      { "path": "/home/user/main.py", "data": "import helper\nhelper.run()\n" },
      { "path": "/home/user/helper.py", "data": "def run(): print(\"ok\")\n" }
    ]
  }'

Error Responses

StatusCause
400Invalid request body
401Missing or invalid API key
404Sandbox not found
502envd daemon unreachable
503Sandbox has no VM