---
title: "Workspace: Multi Edit"
method: POST
path: "/v1/agents/{agent_id}/workspace/multi_edit"
tags: ["API v1", "Agents", "Agents Workspace"]
---

# Workspace: Multi Edit

`POST /v1/agents/{agent_id}/workspace/multi_edit`

## Request

- Base URL: `https://api.xpander.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.xpander.ai/v1/agents/{agent_id}/workspace/multi_edit`
- Auth: API key in header `x-api-key`

Apply multiple edits atomically to one or more files in the agent's workspace. If any edit fails, all changes are rolled back.

## Path parameters

- `agent_id` string, required

## Request body

- MultiEditRequest
  - `edits` SingleEdit[], required: List of edits to apply atomically. If any edit fails, all changes are rolled back.
    - `path` string, required: Relative path to the file to edit
    - `old_text` string, required: Exact text to find and replace
    - `new_text` string, required: Replacement text

## Response `200`

Successful Response

- MultiEditResponse
  - `results` SingleEditResult[]: Results for each edit operation
    - `path` string, required: The path of the edited file
    - `replacements_made` integer: Number of replacements made in this file

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/xpander/apis/xpander-ai-api-service.md) - [All operations](https://skmtc.dev/xpander/apis/xpander-ai-api-service/llms.txt) - [OpenAPI document](https://skmtc.dev/xpander/apis/xpander-ai-api-service/revisions/4389ec0875d0?raw)
