Home/Documentation

Bulk Operations

Create, update, patch, or delete multiple documents in a single request.

POST/v1/db/{ns}/{collection}/_bulk

Execute multiple operations in a single request.

info

Limits

Free tier: up to 25 operations per request. Pro tier: up to 100.

Request Format

curl -X POST https://api.jsondb.cloud/v1/db/default/users/_bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operations": [
      { "method": "POST", "body": { "name": "Alice", "email": "[email protected]" } },
      { "method": "POST", "body": { "name": "Bob", "email": "[email protected]" } },
      { "method": "PATCH", "id": "use_existing123", "body": { "role": "admin" } },
      { "method": "DELETE", "id": "use_old456" }
    ]
  }'

Response (207 Multi-Status)

{
  "results": [
    { "status": 201, "_id": "use_a1b2c3d4", "ok": true },
    { "status": 201, "_id": "use_e5f6g7h8", "ok": true },
    { "status": 200, "_id": "use_existing123", "ok": true },
    { "status": 204, "_id": "use_old456", "ok": true }
  ],
  "summary": {
    "total": 4,
    "succeeded": 4,
    "failed": 0
  }
}

Operation Types

MethodRequires IDDescription
POSTOptionalCreate a new document
PUTRequiredReplace an entire document
PATCHRequiredMerge-patch a document
DELETERequiredDelete a document