Guides
Batch requests
Up to 25 v2 calls over one connection. Each is dispatched back through the API, so it is the same call through the same guard: a batch can never reach anything the caller could not already call.
Sending a batch
curl -X POST "https://docuflow.pendral.io/api/v2/batch" \-H "Authorization: Bearer $DOCUFLOW_API_KEY" \-H "Content-Type: application/json" \-d '{"mode": "parallel","requests": [{ "id": "doc", "method": "GET", "path": "/api/v2/documents/clx9k2m4p0001qh8z3v7d5f2a" },{ "id": "fields", "method": "GET", "path": "/api/v2/documents/clx9k2m4p0001qh8z3v7d5f2a/fields" },{ "id": "queues", "method": "GET", "path": "queues" }]}'
200 OK
{"results": [{ "id": "doc", "method": "GET", "path": "/api/v2/documents/clx9k2m4p0001qh8z3v7d5f2a", "status": 200, "body": { … }, "durationMs": 41 },{ "id": "fields", "method": "GET", "path": "/api/v2/documents/clx9k2m4p0001qh8z3v7d5f2a/fields", "status": 200, "body": { … }, "durationMs": 58 },{ "id": "queues", "method": "GET", "path": "/api/v2/queues", "status": 200, "body": { … }, "durationMs": 37 }],"summary": { "total": 3, "succeeded": 3, "failed": 0, "durationMs": 61 }}
The outer response is 200 whenever the batch itself ran: read each result's own status. id is echoed back so results can be matched without relying on order.
The rules
- parallel
- Runs everything and reports each outcome.The default.
- sequential
- Stops at the first failure; the rest come back skipped, with status
0. - path
- Relative (
queues) or absolute (/api/v2/queues), and always inside/api/v2on this deployment. A batch cannot contain a batch, and the live event stream cannot be batched. - 1 to 25
- Calls per batch. Uploads are multipart and are not batchable.
- same guard
- Each call is authorized, validated and rate-limited exactly as the direct call would be, with the caller's own credential.
When it helps
Batching saves round trips, not budget: each call still counts against your rate limit. Use it where latency is the cost, such as a dashboard that needs a document, its fields and its queue at once.