Skip to content
Tools/Nodes/batch_create_nodes

batch_create_nodes

Create up to 50 entities in one atomic call, optionally with explicit edges in the same transaction. Use `parent_ref` ("$0", "$1") to reference nodes created earlier in the same batch. The optional `edges` array accepts the same `$N` refs (or existing node IDs) for both endpoints. All nodes and edges validate up front; on failure nothing lands.

Nodesatomic-with-rollback. Full validation pass first, then commit.

Arguments

nodesarrayrequired

Array of nodes to create (max 50)

edgesarrayoptional

Optional edges to create alongside the nodes (same atomic transaction). Each edge's from/to may be a `$N` ref into the `nodes` array OR an existing node ID.

Returns

Shape
{ created, edges_created, count, edges_count, warnings? }

Examples

Live call against the Notion example graph.

Input

{
  "nodes": [
    {
      "type": "person",
      "title": "Example node A"
    },
    {
      "type": "person",
      "title": "Example node B"
    }
  ]
}

Output

{
  "created": [
    {
      "id": "n_psZXNbg3DydBoRqy",
      "type": "person",
      "title": "Example node A"
    },
    {
      "id": "n_UJalQ1iIh93K5eJ9",
      "type": "person",
      "title": "Example node B"
    }
  ],
  "edges": [],
  "count": 2,
  "warnings": [
    "Created 2 nodes with no edges; they are orphans. Use the edges[] array in this call to link them. See get_entity_schema(<type>) for canonical edges per type."
  ]
}

See Also