Several writes that succeed or fail together. `operations`: `[{"op": ..., ...arguments}]` where
const url = 'https://example.com/datanotes/operations/batch/';const options = { method: 'POST', headers: { 'X-Datanotes-Actor': '{"harness":"my-script","model":"","session":"s-1"}', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"operations":[{}],"summary":null,"dry_run":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/datanotes/operations/batch/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'X-Datanotes-Actor: {"harness":"my-script","model":"","session":"s-1"}' \ --data '{ "operations": [ {} ], "summary": null, "dry_run": false }'Several writes that succeed or fail together. operations: [{"op": ..., ...arguments}] where
op is a row operation (insert_row, update_row, update_rows, delete_rows, merge_rows,
move_rows, adopt_rows, recompute_columns, align_relations, restore_table) or a DDL op
(create_table, add_column, alter_column, …), with the same arguments as the operation (an unknown one refuses the batch) (e.g.
values for insert_row, set for update_row / update_rows). They run in order, each seeing the previous ones; if one is
refused, the ones already applied are undone (rolled_back). Returns steps (per operation, each with its result,
where ambiguous_mentions is as in insert_row) and
migration_id: undo_migration on it reverts the whole batch. Use it when a change spans several
rows (create an event and update the people in it). dry_run checks each operation against the
current data only.
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”JSON: on whose behalf the write is made, recorded in the journal (harness, model, session).
Example
{"harness":"my-script","model":"","session":"s-1"}Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Done.
object
True when every operation was applied (or would be, on a dry run).
The operation: batch, in the answer and in a refusal (each step names its own).
Journal id of the batch: undo it to undo every operation. Absent on a dry run or when nothing was journaled.
Result of each operation, in order.
object
Position in operations.
Result of a write operation. A refusal (ok false) is answered with HTTP 422, a failed write with 500, so a 2xx body has ok true.
object
True when the operation was applied (or, on a dry run, would be).
The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).
True when nothing was written (preview).
Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.
Notes whose front matter or body were written.
Files created.
Files moved or renamed.
Files deleted or archived.
Links rewritten in other notes.
Reasons the operation was refused (empty on success).
object
Note or file path.
Why the operation cannot proceed.
Rows that would break the table’s rules (empty on success).
The violations of one row.
object
Row note path.
What is wrong with this row.
object
The column the violation is about (every code but check and unreadable).
The item of a list column that breaks the rule, from 0.
The CHECK’s name (code check).
Kind of violation.
Agent-readable explanation.
The offending value, when there is one.
Files that could not be written (empty on success).
object
Vault path.
What went wrong.
Set when a write failed partway (failed): true when the engine put back what it had written, so nothing is left written; false when that rollback failed too (failed names the files left, and undo_migration on migration_id retries it).
Front matter edits per note (planned, or made).
object
Note path.
Front matter keys set, with their new values.
object
Front matter keys removed.
True when the note body changes too.
Paths of notes created.
Files moved: from → to.
object
Paths deleted (or archived).
Files rewritten whole, e.g. metastore.yaml for DDL.
Transaction-log commits written (tables with history on).
object
Qualified table.
New log version.
Log operation, e.g. WRITE.
Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.
A link the write added in place of a mention.
object
The note the link was written into.
The mention, as written.
Vault path of the note it links.
The link written in place of the mention.
Mentions left as text because the engine is not sure which note they name. Present when there is one: read the candidates and the context, then link the right one with update_row and autolink: false, or leave the text.
A mention left as text: more than one note could be meant.
object
The note the mention is in.
The mention, as written.
Same_name: several notes have this name; adjacent: names of different notes side by side, which may be one name; overlap: names of notes overlap; part_of_name: a capitalized word next to it suggests a longer name; sentence_start: a one-word name at the start of a sentence, a line, a list item or a label, where its capital says nothing.
Vault paths of the notes it may name.
The line around the mention.
What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.
Error of an operation that threw.
Index of the refused operation (refusals only, HTTP 422/500).
Undo of an applied operation after a refusal.
object
Example
{ "op": "batch", "steps": [ { "result": { "violations": [ { "violations": [ { "code": "required" } ] } ], "ambiguous_mentions": [ { "reason": "same_name" } ] } } ]}Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Missing or wrong bearer token.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}A named token beyond its permissions (the engine’s administration, tables outside its write patterns, schema changes without ddl).
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Unknown table, view, migration, note or folder.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Ambiguous table name: it matches several tables (paths or tables lists them).
object
The tables’ folders the name matches.
The qualified tables the name matches.
Example generated
{ "error": "example", "paths": [ "example" ], "tables": [ "example" ]}Refused (validation failures, conflicts, an unmet expect): nothing written. Same body as 200, with ok: false and the reasons.
object
True when every operation was applied (or would be, on a dry run).
The operation: batch, in the answer and in a refusal (each step names its own).
Journal id of the batch: undo it to undo every operation. Absent on a dry run or when nothing was journaled.
Result of each operation, in order.
object
Position in operations.
Result of a write operation. A refusal (ok false) is answered with HTTP 422, a failed write with 500, so a 2xx body has ok true.
object
True when the operation was applied (or, on a dry run, would be).
The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).
True when nothing was written (preview).
Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.
Notes whose front matter or body were written.
Files created.
Files moved or renamed.
Files deleted or archived.
Links rewritten in other notes.
Reasons the operation was refused (empty on success).
object
Note or file path.
Why the operation cannot proceed.
Rows that would break the table’s rules (empty on success).
The violations of one row.
object
Row note path.
What is wrong with this row.
object
The column the violation is about (every code but check and unreadable).
The item of a list column that breaks the rule, from 0.
The CHECK’s name (code check).
Kind of violation.
Agent-readable explanation.
The offending value, when there is one.
Files that could not be written (empty on success).
object
Vault path.
What went wrong.
Set when a write failed partway (failed): true when the engine put back what it had written, so nothing is left written; false when that rollback failed too (failed names the files left, and undo_migration on migration_id retries it).
Front matter edits per note (planned, or made).
object
Note path.
Front matter keys set, with their new values.
object
Front matter keys removed.
True when the note body changes too.
Paths of notes created.
Files moved: from → to.
object
Paths deleted (or archived).
Files rewritten whole, e.g. metastore.yaml for DDL.
Transaction-log commits written (tables with history on).
object
Qualified table.
New log version.
Log operation, e.g. WRITE.
Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.
A link the write added in place of a mention.
object
The note the link was written into.
The mention, as written.
Vault path of the note it links.
The link written in place of the mention.
Mentions left as text because the engine is not sure which note they name. Present when there is one: read the candidates and the context, then link the right one with update_row and autolink: false, or leave the text.
A mention left as text: more than one note could be meant.
object
The note the mention is in.
The mention, as written.
Same_name: several notes have this name; adjacent: names of different notes side by side, which may be one name; overlap: names of notes overlap; part_of_name: a capitalized word next to it suggests a longer name; sentence_start: a one-word name at the start of a sentence, a line, a list item or a label, where its capital says nothing.
Vault paths of the notes it may name.
The line around the mention.
What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.
Error of an operation that threw.
Index of the refused operation (refusals only, HTTP 422/500).
Undo of an applied operation after a refusal.
object
Example
{ "op": "batch", "steps": [ { "result": { "violations": [ { "violations": [ { "code": "required" } ] } ], "ambiguous_mentions": [ { "reason": "same_name" } ] } } ]}Unexpected error ({error}), or a write that failed partway and could not be rolled back: rolled_back: false, failed lists the files left (undo_migration on migration_id retries the rollback).
object
True when every operation was applied (or would be, on a dry run).
The operation: batch, in the answer and in a refusal (each step names its own).
Journal id of the batch: undo it to undo every operation. Absent on a dry run or when nothing was journaled.
Result of each operation, in order.
object
Position in operations.
Result of a write operation. A refusal (ok false) is answered with HTTP 422, a failed write with 500, so a 2xx body has ok true.
object
True when the operation was applied (or, on a dry run, would be).
The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).
True when nothing was written (preview).
Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.
Notes whose front matter or body were written.
Files created.
Files moved or renamed.
Files deleted or archived.
Links rewritten in other notes.
Reasons the operation was refused (empty on success).
object
Note or file path.
Why the operation cannot proceed.
Rows that would break the table’s rules (empty on success).
The violations of one row.
object
Row note path.
What is wrong with this row.
object
The column the violation is about (every code but check and unreadable).
The item of a list column that breaks the rule, from 0.
The CHECK’s name (code check).
Kind of violation.
Agent-readable explanation.
The offending value, when there is one.
Files that could not be written (empty on success).
object
Vault path.
What went wrong.
Set when a write failed partway (failed): true when the engine put back what it had written, so nothing is left written; false when that rollback failed too (failed names the files left, and undo_migration on migration_id retries it).
Front matter edits per note (planned, or made).
object
Note path.
Front matter keys set, with their new values.
object
Front matter keys removed.
True when the note body changes too.
Paths of notes created.
Files moved: from → to.
object
Paths deleted (or archived).
Files rewritten whole, e.g. metastore.yaml for DDL.
Transaction-log commits written (tables with history on).
object
Qualified table.
New log version.
Log operation, e.g. WRITE.
Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.
A link the write added in place of a mention.
object
The note the link was written into.
The mention, as written.
Vault path of the note it links.
The link written in place of the mention.
Mentions left as text because the engine is not sure which note they name. Present when there is one: read the candidates and the context, then link the right one with update_row and autolink: false, or leave the text.
A mention left as text: more than one note could be meant.
object
The note the mention is in.
The mention, as written.
Same_name: several notes have this name; adjacent: names of different notes side by side, which may be one name; overlap: names of notes overlap; part_of_name: a capitalized word next to it suggests a longer name; sentence_start: a one-word name at the start of a sentence, a line, a list item or a label, where its capital says nothing.
Vault paths of the notes it may name.
The line around the mention.
What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.
Error of an operation that threw.
Index of the refused operation (refusals only, HTTP 422/500).
Undo of an applied operation after a refusal.
object
object
What went wrong, for a person or an agent.
Example
{ "op": "batch", "steps": [ { "result": { "violations": [ { "violations": [ { "code": "required" } ] } ], "ambiguous_mentions": [ { "reason": "same_name" } ] } } ]}A write that failed partway (a file another program holds) and was rolled back: rolled_back: true, nothing written. Send it again later. Same body as 200, with ok: false and failed.
object
True when every operation was applied (or would be, on a dry run).
The operation: batch, in the answer and in a refusal (each step names its own).
Journal id of the batch: undo it to undo every operation. Absent on a dry run or when nothing was journaled.
Result of each operation, in order.
object
Position in operations.
Result of a write operation. A refusal (ok false) is answered with HTTP 422, a failed write with 500, so a 2xx body has ok true.
object
True when the operation was applied (or, on a dry run, would be).
The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).
True when nothing was written (preview).
Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.
Notes whose front matter or body were written.
Files created.
Files moved or renamed.
Files deleted or archived.
Links rewritten in other notes.
Reasons the operation was refused (empty on success).
object
Note or file path.
Why the operation cannot proceed.
Rows that would break the table’s rules (empty on success).
The violations of one row.
object
Row note path.
What is wrong with this row.
object
The column the violation is about (every code but check and unreadable).
The item of a list column that breaks the rule, from 0.
The CHECK’s name (code check).
Kind of violation.
Agent-readable explanation.
The offending value, when there is one.
Files that could not be written (empty on success).
object
Vault path.
What went wrong.
Set when a write failed partway (failed): true when the engine put back what it had written, so nothing is left written; false when that rollback failed too (failed names the files left, and undo_migration on migration_id retries it).
Front matter edits per note (planned, or made).
object
Note path.
Front matter keys set, with their new values.
object
Front matter keys removed.
True when the note body changes too.
Paths of notes created.
Files moved: from → to.
object
Paths deleted (or archived).
Files rewritten whole, e.g. metastore.yaml for DDL.
Transaction-log commits written (tables with history on).
object
Qualified table.
New log version.
Log operation, e.g. WRITE.
Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.
A link the write added in place of a mention.
object
The note the link was written into.
The mention, as written.
Vault path of the note it links.
The link written in place of the mention.
Mentions left as text because the engine is not sure which note they name. Present when there is one: read the candidates and the context, then link the right one with update_row and autolink: false, or leave the text.
A mention left as text: more than one note could be meant.
object
The note the mention is in.
The mention, as written.
Same_name: several notes have this name; adjacent: names of different notes side by side, which may be one name; overlap: names of notes overlap; part_of_name: a capitalized word next to it suggests a longer name; sentence_start: a one-word name at the start of a sentence, a line, a list item or a label, where its capital says nothing.
Vault paths of the notes it may name.
The line around the mention.
What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.
Error of an operation that threw.
Index of the refused operation (refusals only, HTTP 422/500).
Undo of an applied operation after a refusal.
object
Example
{ "op": "batch", "steps": [ { "result": { "violations": [ { "violations": [ { "code": "required" } ] } ], "ambiguous_mentions": [ { "reason": "same_name" } ] } } ]}