Batch Operations
Create, update, or delete multiple documents
POST
Perform multiple document operations in a single request.
Request Body
operationsarrayrequiredList of operations to perform.
Each operation must have a type field (create, update, or delete).
Operation Types
Create operation:
{
"type": "create",
"collection": "posts",
"data": { "title": "New Post" }
}
Update operation:
{
"type": "update",
"id": "doc_123",
"data": { "title": "Updated Post" }
}
Delete operation:
{
"type": "delete",
"id": "doc_456"
}
curl -X POST "https://api.example.com/v1/documents/batch" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operations": [
{
"type": "create",
"collection": "posts",
"data": { "title": "New Post" }
},
{
"type": "update",
"id": "doc_123",
"data": { "title": "Updated Post" }
},
{
"type": "delete",
"id": "doc_456"
}
]
}'{
"data": {
"results": [
{
"type": "create",
"success": true,
"id": "doc_789"
},
{
"type": "update",
"success": true,
"id": "doc_123"
},
{
"type": "delete",
"success": true,
"id": "doc_456"
}
],
"summary": {
"total": 3,
"succeeded": 3,
"failed": 0
}
}
}