Edit an in-house Space document by block id or quoted words with prose ops (insert, replace, delete, move, set, restore), guarded by block hash and revision
Edit a Space document with prose ops, applied in order and all-or-nothing on the latest version (text people type meanwhile is kept). Ops: insert {target, side, source} · replace {target, with} · delete {target} · move {target, to:{target, side}} · set {target, attrs:{kind|checked|background|rows|spec|caption}} · restore {rev} (the only op in its call, with payload.ifRev = the latest rev). Targets: {"kind":"find","text":"…","nth"?} words as they stand · {"kind":"blocks","ids":[…]} full ids off a read or ack · {"kind":"root"} with side start/end · {"kind":"cell","table","row","col"}. source/with = {"from":{"kind":"inline","content":…},"as":"text"|"markdown"|"blocks"}: text re-words in place keeping formatting; markdown re-creates blocks; blocks is a JSON node tree (table rows: [{"type":"row","content":[{"type":"cell",…}]}]). A pending block is filled by replacing its id with "## Heading" + body (no guard); later edits use the ids in that ack. A whole-block replace/delete carries "ifHash" (its newest h) and "ifRev" (the rev of the read that showed it); several ids or a cell take "ifRev"; "force" only when told to overwrite. side "end" on a heading id = end of its section; on a list/table/row id = append inside it. set: list kind bullet|ordered|check, checked on a check-list item, cell background one of #f0efec #fbebeb #f9ece7 #f9eeda #e5f4e4 #e7f1fb #efedff (null clears). Column: insert with "each":true at every row id. Charts and diagrams: a chart block is drawn from rows + spec, never a picture; a diagram block from boxes + connectors. Place one with the embed chip <?claude block chart?> + blocks {"chart":{"type":"chart","spec":{…},"rows":[…],"caption":"…"}} (or "type":"diagram"); change it with set attrs {rows|spec|caption} on its id. Chips: put <?claude block key?> in the markdown and the chip in "blocks": mention {"user":"me"} (the requesting user), an existing member's user id, or an email only when the user named it — never guess one; mention {"ref":"project/<doc id>"} links another document; date {"value":"YYYY-MM-DD"} for actionable dates only. Only members and documents of this workspace resolve. Images and files: create a blob first (create_space_document_blob), then insert its markdown (); a blob/<id> of another workspace is refused. A refusal writes nothing: 409 with error.code (guard_mismatch: the block changed, error.data shows it as it stands, redo from it and never force; find_none: re-read and quote what it says now; block_gone: someone removed it, never re-create it; missing_guard, cell_none, last_block, same_anchor, place_arity, shape, bad_request) and error.param (the op path).
curl -X POST "https://api.orchestor.io/v1/space/documents/%3Cdocument_id%3E/edit" \ -H "Authorization: Bearer $API_KEY" \ -H "X-Workspace-ID: wks_abc123" \ -H "Content-Type: application/json" \ -d '{ "answering": "string", "ifRev": 1, "ops": [ { "each": true, "op": "insert", "side": "before", "source": { "as": "text", "blocks": {}, "from": { "content": "string", "kind": "inline" } }, "target": { "kind": "find", "nth": 1, "text": "string", "within": { "col": 1, "kind": "cell", "row": 1, "table": "string" } } } ]}'{ "data": { "ops": [ { "notices": [ "<string>" ], "op": "<string>", "xml": "<string>" } ], "rev": 0 }}Get your Orchestor API key
Create an API key in your workspace settings.
Authorizations
Authentication details
Headers
Workspace to access. With a workspace-scoped API key, the server derives this value from the key, so the header is optional. If supplied, it must match the credential workspace or the request returns 403 workspace_mismatch. For interactive session requests, supply this header to select a workspace where you are a member. A project ID cannot be used as a workspace ID.
"wks_abc123"