Workspace API
The workspace API provides file operations for managing files within the configured workspace root directory.
All paths are relative to the workspace root. Path traversal (..) and absolute paths are rejected.
Read File
bash
POST /api/v1/workspace/readjson
{ "path": "src/main.erl" }Response:
json
{
"path": "src/main.erl",
"content": "-module(main).\n",
"size": 15
}Write File
bash
POST /api/v1/workspace/writeAtomic write (write to temp, then rename). Creates parent directories automatically.
json
{ "path": "src/new_file.erl", "content": "-module(new_file).\n" }Edit File
bash
POST /api/v1/workspace/editFind-and-replace with exact match. Rejects if old_text appears more than once.
json
{
"path": "src/main.erl",
"old_text": "-module(old_name)",
"new_text": "-module(new_name)"
}Response on multiple matches:
json
{ "error": "multiple matches", "matches": 3 }Search Files
bash
POST /api/v1/workspace/searchjson
{ "query": "*.erl", "max_results": 50 }Response:
json
{
"results": [
{ "path": "src/main.erl", "size": 256, "modified": "2026-05-18T14:30:45Z" }
],
"count": 1
}List Files
bash
GET /api/v1/workspace/list?path=.&recursive=trueResponse:
json
{
"path": ".",
"entries": [
{ "path": "src/main.erl", "type": "file", "size": 256, "modified": "2026-05-18T14:30:45Z" },
{ "path": "src", "type": "directory", "size": 4096, "modified": "2026-05-18T12:00:00Z" }
],
"count": 2
}