Batch Operations
Batch operations let you execute up to 100 operations in a single atomic request. All operations succeed together or fail together — there's no partial state.
How It Works
Send an array of operations to the batch endpoint. Each operation specifies a type and the data for that operation. The entire batch is executed within a single transaction.
Usage
rekor batch --workspace my-workspace --operations '[
{"type":"upsert_record","collection":"orders",
"data":{"customer":"Acme Corp","total":5000}},
{"type":"upsert_record","collection":"line_items",
"data":{"product":"Widget","qty":10,"price":500}},
{"type":"upsert_relationship",
"rel_type":"contains",
"source_collection":"orders","source_id":"ord_1",
"target_collection":"line_items","target_id":"li_1"}
]'
Supported Operation Types
| Type | What it does |
|---|---|
upsert_record | Create or update a record in a collection |
delete_record | Soft-delete a record |
upsert_relationship | Create or update a relationship between two records |
delete_relationship | Delete a relationship |
upsert_collection | Create or update a collection schema |
delete_collection | Delete a collection |
When to Use Batch
- Related records — create a parent record and its children together, ensuring both exist or neither does.
- Record + relationship — create a record and link it to another in one atomic step.
- Bulk imports — load many records at once, with guaranteed consistency.
- Schema + data — create a collection and seed it with initial records atomically (preview workspaces only for schema changes).
Limits
Maximum 100 operations per batch request. Each operation is validated individually — if any operation fails validation, the entire batch is rejected before any writes occur.
REST API
POST /v1/{workspace_id}/batch
Content-Type: application/json
{
"operations": [
{"type": "upsert_record", "collection": "orders", "data": {...}},
{"type": "upsert_relationship", "rel_type": "contains", ...}
]
}
MCP Tool
batch_operations(
workspace_id: "my-workspace",
operations: [
{type: "upsert_record", collection: "orders", data: {...}},
{type: "upsert_relationship", rel_type: "contains", ...}
]
)