API v1
Agents
Agents Workspace

Workspace: File Edit

Edit a file in the agent's workspace by replacing exact text occurrences.

post/v1/agents/{agent_id}/workspace/file_edit

Request

  • Base URL
    https://api.xpander.ai (the document declares no server; this is the origin it was published from)
  • Auth
    API key in header x-api-key

Path parameters

agent_idstring required

Request body

pathstring required

Relative path to the file to edit.

old_textstring required

The exact text to find and replace. Must match the file content exactly (whitespace-sensitive).

new_textstring required

The replacement text that will substitute old_text.

Example request

{
  "path": "app.py",
  "old_text": "DEBUG = True",
  "new_text": "DEBUG = False"
}

Response

Successful Response

pathstring required

The path of the edited file

replacements_madeinteger

Number of replacements made

Example response

{
  "replacements_made": 1
}

Changes

No recorded changes to this operation across all 6 revisions of this API.