Designing a bulk operation API: define partial success and progress
A bulk operation endpoint is an API designed to process many resources or operations of the same kind at once. Unlike a batch endpoint that wraps several individual HTTP requests in one envelope, it usually applies one domain operation to many targets. Its contract should define synchronous or asynchronous processing, atomic or partial outcomes, per-item errors, and status lookup.
A bulk operation endpoint is an API designed to process many resources or operations of the same kind at once. Unlike a batch endpoint that wraps several individual HTTP requests in one envelope, it usually applies one domain operation to many targets. Its contract should define synchronous or asynchronous processing, atomic or partial outcomes, per-item errors, and status lookup.
Bulk operations versus batched transport
A batch endpoint groups subrequests to reduce transport overhead and can represent different methods or paths. A bulk operation endpoint exposes a domain command, such as books:batchUpdate, that performs one kind of action across multiple resources. This is more than naming: a batch contract centers on the request envelope and each subresponse; a bulk contract centers on the result and progress of a multi-resource operation.
Google AIP-234 requires synchronous BatchUpdate methods to be atomic. An asynchronous method returning a long-running Operation may choose atomic or partial success. Amazon S3 DeleteObjects is a real example where one request deletes multiple objects and an HTTP 200 response can contain both successful deletions and permission errors. Microsoft Entra synchronization's bulkUpload accepts work with 202 Accepted and a Location for checking status. These semantics and limits belong to the named products.
| Contract | Example | What the client must check |
|---|---|---|
| Synchronous atomic processing | Google AIP-234 synchronous BatchUpdate guidance | Contract makes success mean all requested changes were applied |
| Synchronous per-item results | Amazon S3 DeleteObjects | Inspect Deleted and Error; outer 200 is insufficient |
| Asynchronous acceptance | Microsoft Entra bulkUpload | Use Location to query the job log for actual results after 202 |
No row is universally best. Atomic synchronous processing is easy to understand when the transaction can be guaranteed and the work finishes quickly. Partial success helps when one invalid item should not block the others, but requires per-item results and retry rules. Async processing suits long-running or large requests, but adds status lookup and result-retention requirements.
Define the outcome contract
Decide whether the request is one homogeneous command or a collection of independent commands. Give each item a stable identifier or resource name, and define how duplicate targets and input order work. If duplicate targets are allowed, say whether they run in order, the last value wins, or the whole request is rejected.
Then select the failure model:
**Atomic:** all changes succeed or none are applied. Use this only within a scope where the server can truly guarantee rollback.
**Partial success:** successful items remain applied and errors are returned for failed items. Responses need a key that safely maps an error back to its input.
**Asynchronous:** separate acceptance from completion for long-running or large work. Define a job ID, states, final results, failure details, and expiration.
If clients may mistake a successful synchronous status for success of every item, specify mixed-result formatting and compatibility rules carefully. Google AIP-234 requires synchronous batch updates to be atomic and describes indexed per-request statuses for partial failures in async operations. This is one API design guide, not a universal requirement for all HTTP APIs.
Async acceptance and checking results
If the server cannot finish immediately, distinguish accepting the job from completing it. 202 Accepted means work was accepted, not completed. Return a Location or job ID for status lookup; distinguish queued, running, completed, and failed states. After completion, clients should be able to inspect an overall summary and each item's outcome.
Status lookup lets clients recover results after a restart or network interruption. If the connection drops before completion, tell clients to check the existing job ID or idempotency key instead of blindly submitting again. Define the scope and retention period for duplicate-submission keys.
For example, imagine a service applying a list of 80 users to an external directory. The number is illustrative, not a product limit. After accepting the work, the server returns a job identifier; the client polls it for queued or running status. The final result should map successes and failures to original input positions or stable item IDs. If item 12 failed for lack of permission, resubmitting the whole list could repeat side effects for accounts already processed. The response contract should let the client identify failed items and decide whether they can be retried after correction.
Safety, authorization, and operating limits
Set limits for item count and body size, as well as execution time, concurrent jobs, queue capacity, and per-user quotas. Reject over-limit requests predictably with an explanation; do not silently process only part of them. Choose maximums based on work cost and service capacity. Do not present one product's limit as a general rule.
Apply authorization and validation to every resource. Inclusion in a bulk request does not waive ownership checks, state-transition rules, input validation, or audit records. Decide whether unauthorized items reject the entire request or fail individually, consistently with the atomicity policy.
Design retries around failed items and side effects. For risky repeated actions such as payments or creation, prevent duplicates with idempotency keys or deduplication. Explain whether item errors are retryable and any backoff guidance. For hard-to-reverse operations such as bulk deletion, consider safeguards such as target previews, conditional execution, or a cancellation window.
Idempotency means repeating the same request leaves the final result as though it had been processed once.
Design review sequence
Decide whether this is one domain operation over many resources or just a wrapper around different HTTP requests.
Choose synchronous processing or an async job, and describe expected duration and size range.
Define atomicity, partial success, per-item errors, and successful results.
Document duplicate targets, input order, authorization failures, validation errors, and retry behavior.
Bound item count, body size, execution time, and concurrent work; for async jobs, define IDs, states, and result retention.
Review all-success, all-failure, mixed results, duplicate submission, permission errors, timeouts, and status recovery.
This contract makes partial failure and completion time visible to API users instead of hiding them behind “send many at once.” The example is illustrative guidance, not a report of executing or measuring a service.
Sources
[Google API Improvement Proposal 234: Batch methods: Update](https://google.aip.dev/234)
[Amazon S3 API: DeleteObjects](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html)
[Microsoft Graph: Perform bulkUpload](https://learn.microsoft.com/en-us/graph/api/synchronization-synchronizationjob-post-bulkupload?view=graph-rest-1.0)