Skip to content

Several writes that succeed or fail together. `operations`: `[{"op": ..., ...arguments}]` where

POST
/datanotes/operations/batch/
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).

X-Datanotes-Actor
string

JSON: on whose behalf the write is made, recorded in the journal (harness, model, session).

Example

{"harness":"my-script","model":"","session":"s-1"}
Media typeapplication/json
object
operations
required
Array<object>
object
key
additional properties
any
summary
Any of:
string
dry_run
boolean

Done.

Media typeapplication/json
object
ok
required

True when every operation was applied (or would be, on a dry run).

boolean
op

The operation: batch, in the answer and in a refusal (each step names its own).

string
Allowed value: batch
dry_run
required
boolean
migration_id

Journal id of the batch: undo it to undo every operation. Absent on a dry run or when nothing was journaled.

string
steps
required

Result of each operation, in order.

Array<object>
object
index
required

Position in operations.

integer
op
required
string
ok
required
boolean
migration_id
string
result
OpResult

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
ok
required

True when the operation was applied (or, on a dry run, would be).

boolean
op
required

The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).

string
dry_run
required

True when nothing was written (preview).

boolean
migration_id

Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.

string
notes_changed
required

Notes whose front matter or body were written.

integer
files_created
required

Files created.

integer
files_moved
required

Files moved or renamed.

integer
files_deleted
required

Files deleted or archived.

integer
references_updated
required

Links rewritten in other notes.

integer
conflicts
required

Reasons the operation was refused (empty on success).

Array<object>
object
path
required

Note or file path.

string
message
required

Why the operation cannot proceed.

string
violations
required

Rows that would break the table’s rules (empty on success).

Array<object>
RowViolations

The violations of one row.

object
path
required

Row note path.

string
violations
required

What is wrong with this row.

Array<object>
Violation
object
column

The column the violation is about (every code but check and unreadable).

string
index

The item of a list column that breaks the rule, from 0.

integer
constraint

The CHECK’s name (code check).

string
code
required

Kind of violation.

string
Allowed values: required inverse type min max step enum broken_link ref unique unknown_column check generated cycle vocabulary unreadable
message
required

Agent-readable explanation.

string
value

The offending value, when there is one.

failed
required

Files that could not be written (empty on success).

Array<object>
object
path
required

Vault path.

string
error
required

What went wrong.

string
rolled_back

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).

boolean
planned_edits
required

Front matter edits per note (planned, or made).

Array<object>
object
path
required

Note path.

string
set
required

Front matter keys set, with their new values.

object
key
additional properties
any
remove
required

Front matter keys removed.

Array<string>
body

True when the note body changes too.

boolean
planned_creates
required

Paths of notes created.

Array<string>
planned_moves
required

Files moved: from → to.

Array<object>
object
from
required
string
to
required
string
planned_deletes
required

Paths deleted (or archived).

Array<string>
planned_texts
required

Files rewritten whole, e.g. metastore.yaml for DDL.

Array<string>
commits

Transaction-log commits written (tables with history on).

Array<object>
object
table
required

Qualified table.

string
version
required

New log version.

integer
operation
required

Log operation, e.g. WRITE.

string
links_added

Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.

Array<object>
LinkAdded

A link the write added in place of a mention.

object
path
required

The note the link was written into.

string
text
required

The mention, as written.

string
target
required

Vault path of the note it links.

string
link
required

The link written in place of the mention.

string
ambiguous_mentions

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.

Array<object>
LinkAmbiguous

A mention left as text: more than one note could be meant.

object
path
required

The note the mention is in.

string
text
required

The mention, as written.

string
reason
required

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.

string
Allowed values: same_name adjacent overlap part_of_name sentence_start
candidates
required

Vault paths of the notes it may name.

Array<string>
context
required

The line around the mention.

string
hint
required

What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.

string
error

Error of an operation that threw.

string
failed_at

Index of the refused operation (refusals only, HTTP 422/500).

integer
rolled_back
boolean
rollback
Array<object>

Undo of an applied operation after a refusal.

object
key
additional properties
any

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.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Missing or wrong bearer token.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

A named token beyond its permissions (the engine’s administration, tables outside its write patterns, schema changes without ddl).

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Unknown table, view, migration, note or folder.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Ambiguous table name: it matches several tables (paths or tables lists them).

Media typeapplication/json
object
error
required
string
paths

The tables’ folders the name matches.

Array<string>
tables

The qualified tables the name matches.

Array<string>

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.

Media typeapplication/json
object
ok
required

True when every operation was applied (or would be, on a dry run).

boolean
op

The operation: batch, in the answer and in a refusal (each step names its own).

string
Allowed value: batch
dry_run
required
boolean
migration_id

Journal id of the batch: undo it to undo every operation. Absent on a dry run or when nothing was journaled.

string
steps
required

Result of each operation, in order.

Array<object>
object
index
required

Position in operations.

integer
op
required
string
ok
required
boolean
migration_id
string
result
OpResult

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
ok
required

True when the operation was applied (or, on a dry run, would be).

boolean
op
required

The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).

string
dry_run
required

True when nothing was written (preview).

boolean
migration_id

Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.

string
notes_changed
required

Notes whose front matter or body were written.

integer
files_created
required

Files created.

integer
files_moved
required

Files moved or renamed.

integer
files_deleted
required

Files deleted or archived.

integer
references_updated
required

Links rewritten in other notes.

integer
conflicts
required

Reasons the operation was refused (empty on success).

Array<object>
object
path
required

Note or file path.

string
message
required

Why the operation cannot proceed.

string
violations
required

Rows that would break the table’s rules (empty on success).

Array<object>
RowViolations

The violations of one row.

object
path
required

Row note path.

string
violations
required

What is wrong with this row.

Array<object>
Violation
object
column

The column the violation is about (every code but check and unreadable).

string
index

The item of a list column that breaks the rule, from 0.

integer
constraint

The CHECK’s name (code check).

string
code
required

Kind of violation.

string
Allowed values: required inverse type min max step enum broken_link ref unique unknown_column check generated cycle vocabulary unreadable
message
required

Agent-readable explanation.

string
value

The offending value, when there is one.

failed
required

Files that could not be written (empty on success).

Array<object>
object
path
required

Vault path.

string
error
required

What went wrong.

string
rolled_back

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).

boolean
planned_edits
required

Front matter edits per note (planned, or made).

Array<object>
object
path
required

Note path.

string
set
required

Front matter keys set, with their new values.

object
key
additional properties
any
remove
required

Front matter keys removed.

Array<string>
body

True when the note body changes too.

boolean
planned_creates
required

Paths of notes created.

Array<string>
planned_moves
required

Files moved: from → to.

Array<object>
object
from
required
string
to
required
string
planned_deletes
required

Paths deleted (or archived).

Array<string>
planned_texts
required

Files rewritten whole, e.g. metastore.yaml for DDL.

Array<string>
commits

Transaction-log commits written (tables with history on).

Array<object>
object
table
required

Qualified table.

string
version
required

New log version.

integer
operation
required

Log operation, e.g. WRITE.

string
links_added

Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.

Array<object>
LinkAdded

A link the write added in place of a mention.

object
path
required

The note the link was written into.

string
text
required

The mention, as written.

string
target
required

Vault path of the note it links.

string
link
required

The link written in place of the mention.

string
ambiguous_mentions

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.

Array<object>
LinkAmbiguous

A mention left as text: more than one note could be meant.

object
path
required

The note the mention is in.

string
text
required

The mention, as written.

string
reason
required

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.

string
Allowed values: same_name adjacent overlap part_of_name sentence_start
candidates
required

Vault paths of the notes it may name.

Array<string>
context
required

The line around the mention.

string
hint
required

What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.

string
error

Error of an operation that threw.

string
failed_at

Index of the refused operation (refusals only, HTTP 422/500).

integer
rolled_back
boolean
rollback
Array<object>

Undo of an applied operation after a refusal.

object
key
additional properties
any

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).

Media typeapplication/json
Any of:
object
ok
required

True when every operation was applied (or would be, on a dry run).

boolean
op

The operation: batch, in the answer and in a refusal (each step names its own).

string
Allowed value: batch
dry_run
required
boolean
migration_id

Journal id of the batch: undo it to undo every operation. Absent on a dry run or when nothing was journaled.

string
steps
required

Result of each operation, in order.

Array<object>
object
index
required

Position in operations.

integer
op
required
string
ok
required
boolean
migration_id
string
result
OpResult

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
ok
required

True when the operation was applied (or, on a dry run, would be).

boolean
op
required

The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).

string
dry_run
required

True when nothing was written (preview).

boolean
migration_id

Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.

string
notes_changed
required

Notes whose front matter or body were written.

integer
files_created
required

Files created.

integer
files_moved
required

Files moved or renamed.

integer
files_deleted
required

Files deleted or archived.

integer
references_updated
required

Links rewritten in other notes.

integer
conflicts
required

Reasons the operation was refused (empty on success).

Array<object>
object
path
required

Note or file path.

string
message
required

Why the operation cannot proceed.

string
violations
required

Rows that would break the table’s rules (empty on success).

Array<object>
RowViolations

The violations of one row.

object
path
required

Row note path.

string
violations
required

What is wrong with this row.

Array<object>
Violation
object
column

The column the violation is about (every code but check and unreadable).

string
index

The item of a list column that breaks the rule, from 0.

integer
constraint

The CHECK’s name (code check).

string
code
required

Kind of violation.

string
Allowed values: required inverse type min max step enum broken_link ref unique unknown_column check generated cycle vocabulary unreadable
message
required

Agent-readable explanation.

string
value

The offending value, when there is one.

failed
required

Files that could not be written (empty on success).

Array<object>
object
path
required

Vault path.

string
error
required

What went wrong.

string
rolled_back

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).

boolean
planned_edits
required

Front matter edits per note (planned, or made).

Array<object>
object
path
required

Note path.

string
set
required

Front matter keys set, with their new values.

object
key
additional properties
any
remove
required

Front matter keys removed.

Array<string>
body

True when the note body changes too.

boolean
planned_creates
required

Paths of notes created.

Array<string>
planned_moves
required

Files moved: from → to.

Array<object>
object
from
required
string
to
required
string
planned_deletes
required

Paths deleted (or archived).

Array<string>
planned_texts
required

Files rewritten whole, e.g. metastore.yaml for DDL.

Array<string>
commits

Transaction-log commits written (tables with history on).

Array<object>
object
table
required

Qualified table.

string
version
required

New log version.

integer
operation
required

Log operation, e.g. WRITE.

string
links_added

Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.

Array<object>
LinkAdded

A link the write added in place of a mention.

object
path
required

The note the link was written into.

string
text
required

The mention, as written.

string
target
required

Vault path of the note it links.

string
link
required

The link written in place of the mention.

string
ambiguous_mentions

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.

Array<object>
LinkAmbiguous

A mention left as text: more than one note could be meant.

object
path
required

The note the mention is in.

string
text
required

The mention, as written.

string
reason
required

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.

string
Allowed values: same_name adjacent overlap part_of_name sentence_start
candidates
required

Vault paths of the notes it may name.

Array<string>
context
required

The line around the mention.

string
hint
required

What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.

string
error

Error of an operation that threw.

string
failed_at

Index of the refused operation (refusals only, HTTP 422/500).

integer
rolled_back
boolean
rollback
Array<object>

Undo of an applied operation after a refusal.

object
key
additional properties
any

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.

Media typeapplication/json
object
ok
required

True when every operation was applied (or would be, on a dry run).

boolean
op

The operation: batch, in the answer and in a refusal (each step names its own).

string
Allowed value: batch
dry_run
required
boolean
migration_id

Journal id of the batch: undo it to undo every operation. Absent on a dry run or when nothing was journaled.

string
steps
required

Result of each operation, in order.

Array<object>
object
index
required

Position in operations.

integer
op
required
string
ok
required
boolean
migration_id
string
result
OpResult

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
ok
required

True when the operation was applied (or, on a dry run, would be).

boolean
op
required

The operation, by the name it was called with (e.g. insert_row, create_table, recompute_columns).

string
dry_run
required

True when nothing was written (preview).

boolean
migration_id

Journal id of the applied operation: pass it to undo_migration. Absent on a dry run.

string
notes_changed
required

Notes whose front matter or body were written.

integer
files_created
required

Files created.

integer
files_moved
required

Files moved or renamed.

integer
files_deleted
required

Files deleted or archived.

integer
references_updated
required

Links rewritten in other notes.

integer
conflicts
required

Reasons the operation was refused (empty on success).

Array<object>
object
path
required

Note or file path.

string
message
required

Why the operation cannot proceed.

string
violations
required

Rows that would break the table’s rules (empty on success).

Array<object>
RowViolations

The violations of one row.

object
path
required

Row note path.

string
violations
required

What is wrong with this row.

Array<object>
Violation
object
column

The column the violation is about (every code but check and unreadable).

string
index

The item of a list column that breaks the rule, from 0.

integer
constraint

The CHECK’s name (code check).

string
code
required

Kind of violation.

string
Allowed values: required inverse type min max step enum broken_link ref unique unknown_column check generated cycle vocabulary unreadable
message
required

Agent-readable explanation.

string
value

The offending value, when there is one.

failed
required

Files that could not be written (empty on success).

Array<object>
object
path
required

Vault path.

string
error
required

What went wrong.

string
rolled_back

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).

boolean
planned_edits
required

Front matter edits per note (planned, or made).

Array<object>
object
path
required

Note path.

string
set
required

Front matter keys set, with their new values.

object
key
additional properties
any
remove
required

Front matter keys removed.

Array<string>
body

True when the note body changes too.

boolean
planned_creates
required

Paths of notes created.

Array<string>
planned_moves
required

Files moved: from → to.

Array<object>
object
from
required
string
to
required
string
planned_deletes
required

Paths deleted (or archived).

Array<string>
planned_texts
required

Files rewritten whole, e.g. metastore.yaml for DDL.

Array<string>
commits

Transaction-log commits written (tables with history on).

Array<object>
object
table
required

Qualified table.

string
version
required

New log version.

integer
operation
required

Log operation, e.g. WRITE.

string
links_added

Links the write added to the text it wrote: the notes the text mentions by name (automatic links). Present when there is one.

Array<object>
LinkAdded

A link the write added in place of a mention.

object
path
required

The note the link was written into.

string
text
required

The mention, as written.

string
target
required

Vault path of the note it links.

string
link
required

The link written in place of the mention.

string
ambiguous_mentions

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.

Array<object>
LinkAmbiguous

A mention left as text: more than one note could be meant.

object
path
required

The note the mention is in.

string
text
required

The mention, as written.

string
reason
required

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.

string
Allowed values: same_name adjacent overlap part_of_name sentence_start
candidates
required

Vault paths of the notes it may name.

Array<string>
context
required

The line around the mention.

string
hint
required

What to do: read the candidates, then link the right one with update_row and autolink: false, or leave the text.

string
error

Error of an operation that threw.

string
failed_at

Index of the refused operation (refusals only, HTTP 422/500).

integer
rolled_back
boolean
rollback
Array<object>

Undo of an applied operation after a refusal.

object
key
additional properties
any

Example

{
"op": "batch",
"steps": [
{
"result": {
"violations": [
{
"violations": [
{
"code": "required"
}
]
}
],
"ambiguous_mentions": [
{
"reason": "same_name"
}
]
}
}
]
}