Problem
Clients needing to create, update or fetch hundreds of items make a call per item, paying latency, auth and rate-limit costs each time. Server-side per-request overhead and chatty traffic degrade throughput.
Also known as: batch-endpoint, bulk-operations
Let clients submit or fetch many items in a single request to cut round trips and per-call overhead.
Clients needing to create, update or fetch hundreds of items make a call per item, paying latency, auth and rate-limit costs each time. Server-side per-request overhead and chatty traffic degrade throughput.
A bulk or batch API processes many items per request. It reduces network round trips and fixed per-request costs such as authentication, TLS and rate limit accounting, and lets the server apply set-based optimisations.
The client sends an array; the server validates, processes and reports per-item results.
POST /contacts:batchCreate
{ "items": [ {"ref":"a1","email":"x@e.com"}, {"ref":"a2","email":"bad"} ] }
207 Multi-Status
{ "results": [
{"ref":"a1","status":201,"id":"c9"},
{"ref":"a2","status":422,"error":"invalid email"} ] }
The ref field is a client-chosen id that correlates results and makes retries idempotent. Cap items per call, for instance 100, and total body size. For very large imports, return 202 Accepted with a job URL; the client polls the job for progress and a result file. For reads, accept a list of ids on a batch get endpoint.
Low - endpoint and validation
Medium - limits, async job handling
Medium - error semantics design
Partial success mishandled by clients that only check the status code
Oversized batch exhausts memory or times out
Retried batch duplicates items without idempotency