Skip to main content
POST
/
v1
/
agents
/
{agent_id}
/
sandbox
/
multi_edit
Sandbox: Multi Edit
curl --request POST \
  --url https://api.xpander.ai/v1/agents/{agent_id}/sandbox/multi_edit \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "edits": [
    {
      "path": "<string>",
      "old_text": "<string>",
      "new_text": "<string>"
    }
  ]
}
'
{
  "status": "ok",
  "stdout": "<string>",
  "stderr": "<string>",
  "exit_code": 123,
  "content": "<string>",
  "path": "<string>",
  "matches": [
    {}
  ],
  "url": "<string>",
  "error": "<string>"
}
Apply multiple file edits atomically. Each edit uses the same exact-match semantics as Sandbox: File Edit. If any edit fails, all changes are rolled back.

Path Parameters

agent_id
string
required
Agent ID (UUID)

Request Body

edits
array
required
Ordered list of edits to apply. Each item has:

Response

status
string
Result status (e.g., ok).

Example Request

curl -X POST "https://api.xpander.ai/v1/agents/<agent-id>/sandbox/multi_edit" \
  -H "Content-Type: application/json" \
  -H "x-api-key: <your-api-key>" \
  -d '{
    "edits": [
      {
        "path": "app.py",
        "old_text": "DEBUG = True",
        "new_text": "DEBUG = False"
      }
    ]
  }'

Notes

  • Edits are applied in the order provided. Later edits can operate on content produced by earlier edits in the same request.
  • If any single edit fails (e.g., old_text not found), the entire batch is rolled back so the sandbox is not left in a half-applied state.

See Also

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

agent_id
string
required

Agent UUID

Body

application/json

Request body for applying multiple file edits atomically.

edits
SandboxFileEdit · object[]
required

Ordered list of edits to apply atomically. If any edit fails, all changes are rolled back.

Response

Successful Response

Generic response wrapper returned by agent sandbox endpoints. Not every field is populated for every tool.

status
string

Result status of the sandbox operation.

Example:

"ok"

stdout
string | null

Standard output captured from the sandbox command. Present for bash.

stderr
string | null

Standard error captured from the sandbox command. Present for bash.

exit_code
integer | null

Process exit code returned by the sandbox. Present for bash.

content
string | null

File contents. Present for file_read.

path
string | null

File path affected by the operation. Present for file_write, file_edit, multi_edit, file_share.

matches
Matches · object[] | null

Match results. Present for glob and grep.

url
string<uri> | null

Public CDN URL. Present for file_share.

error
string | null

Error message when the operation fails.