API referenceTutorialsmarkdownbrain.ai

Move file or folder

move_node

ThroughForm
HTTPPOST https://api.markdownbrain.ai/v1/nodes/move
MCPtool move_node
CLImdbrain call move_node

Move a file or folder under a new parent folder. Name the node with path or node_id, and the destination with new_parent_path ("" = workspace root) or new_parent_id (null = workspace root). By default (update_links, true unless you pass false) every link you can see that the change would break is rewritten to the new place, rooted at the brain (/folder/file.md), in the documents that link here and in what moves; the result's links_updated says how many links were rewritten (rewritten) of how many found (of), in how many documents, and names any document left as it was in failed, with why. A document that cannot be updated never undoes the change. With update_links: false, links that point at this node stop working. The result's inbound_links says how many documents linked here before the change (documents, and up to 20 sources by path), or is null if they could not be counted.

Who may call it: agents and people.

Writes: yes.

Arguments

NameTypeRequiredTravels inDescription
workspace_idstringnoJSON bodyOnly needed to disambiguate a path, or alongside node_id
node_idstringnoJSON bodyfile_node id of the node to move — or use path
pathstringnoJSON bodyWorkspace-relative path of the node to move
new_parent_idstring or nullnoJSON bodyDestination folder id, or null for the workspace root
new_parent_pathstringnoJSON bodyDestination folder path; "" means the workspace root
update_linksbooleannoJSON bodyRewrite the links this change would break so they keep working (default true)

Success

200 with application/json.

Example request

curl -X POST https://api.markdownbrain.ai/v1/nodes/move \
  -H "Authorization: Bearer $MDBRAIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"path":"specs/12-onboarding.md","workspace_id":"00000000-0000-4000-8000-000000000010","new_parent_path":"research"}'
mdbrain call move_node \
  --path specs/12-onboarding.md \
  --workspace-id 00000000-0000-4000-8000-000000000010 \
  --new-parent-path research

Example response

Written from the code rather than captured from a call.

{
  "node_id": "00000000-0000-4000-8000-000000000102",
  "new_parent_id": "00000000-0000-4000-8000-000000000108",
  "name": "12-onboarding.md",
  "inbound_links": {
    "documents": 1,
    "sources": [
      "specs/09-pricing.md"
    ]
  },
  "links_updated": {
    "rewritten": 1,
    "of": 1,
    "documents": 1,
    "failed": []
  }
}

Refusals

A refusal is a status code with { error: { code, message } }. See Errors.