Skip to main content
Write content to a file in the sandbox filesystem.
curl -X POST https://api.gravixlayer.com/v1/agents/sandboxes/{sandbox_id}/files/write \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "/home/user/data.txt",
    "content": "Hello, AgentBox!"
  }'

Request Parameters

ParameterTypeRequiredDescription
pathstringYesAbsolute or relative path to the file
contentstringYesFile content to write

Response

{
  "message": "File written successfully",
  "path": "/home/user/data.txt",
  "size": 18
}

Response Fields

FieldTypeDescription
messagestringSuccess message
pathstringFull path to the written file
sizeintegerFile size in bytes

Example: Write JSON Data

curl -X POST https://api.gravixlayer.com/v1/agents/sandboxes/{sandbox_id}/files/write \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "/home/user/config.json",
    "content": "{\"debug\": true, \"timeout\": 30}"
  }'

Next Steps