Workspace: File Edit
Edit a file in the agent’s workspace by replacing an exact text occurrence
Edit a file in the per-agent workspace by replacing an exact text occurrence.Documentation Index
Fetch the complete documentation index at: https://docs.xpander.ai/llms.txt
Use this file to discover all available pages before exploring further.
old_text must match the existing file content exactly, including whitespace and indentation.
Path Parameters
Request Body
Response
ok).Example Request
Notes
- The match is exact and case-sensitive. If
old_textappears more than once in the file, the request fails — include additional surrounding context inold_textto make the match unique. - To apply several edits atomically, use Workspace: Multi Edit instead.
See Also
Authorizations
API Key for authentication
Path Parameters
Agent UUID
Body
Request body for editing a file in the agent workspace by replacing exact text occurrences.
Path to the file to edit, relative to the workspace root.
"app.py"
Exact text to find and replace. Must match existing file content, including whitespace.
"DEBUG = True"
Replacement text. Use an empty string to delete the matched content.
"DEBUG = False"
Response
Successful Response
Generic response wrapper returned by agent workspace endpoints. Not every field is populated for every tool.
Result status of the workspace operation.
"ok"
Standard output captured from the workspace command. Present for bash.
Standard error captured from the workspace command. Present for bash.
Process exit code returned by the workspace. Present for bash.
File contents. Present for file_read.
File path affected by the operation. Present for file_write, file_edit, multi_edit, file_share.
Match results. Present for glob and grep.
Public CDN URL. Present for file_share.
Error message when the operation fails.

