Handle many items in one call, and send big files without tying up your servers.
A bulk API lets a caller do many things in one request (create 500 products, for example). File upload is the special case of sending big blobs of data. Both save round trips, but both need care, because one request now carries a lot of work or a lot of bytes.
Suppose a client has 10,000 contacts to import. One request per contact means 10,000 round trips, 10,000 logins checked and 10,000 chances for a network error. A bulk (batch) endpoint takes a list in a single request, like POST /contacts:batch, and handles them together.
The hard part is partial success. If 3 of the 500 items are invalid, you must decide: reject the whole batch (all or nothing), or accept the good ones and report the bad ones. Most public APIs choose partial success with a status for each item.
POST /products/batch
{ "items": [
{ "clientId": "a1", "name": "Pen", "price": 2 },
{ "clientId": "a2", "name": "", "price": 3 },
{ "clientId": "a3", "name": "Book", "price": 12 }
] }
200 OK
{ "results": [
{ "clientId": "a1", "status": 201, "id": "p-901" },
{ "clientId": "a2", "status": 400, "error": "name is required" },
{ "clientId": "a3", "status": 201, "id": "p-902" }
] }A file is just bytes, but a big file is slow and can fail half way. The simple way is one multipart/form-data request: good for small files. For large files you need two upgrades: chunked, resumable uploads and direct-to-storage uploads.
| Style | How it works | Good for | Watch out |
|---|---|---|---|
| All or nothing | Run everything in one transaction. One bad item fails the whole batch. | Items that depend on each other (a payment and its lines) | One typo blocks everything. Batches must stay small. |
| Partial success | Process each item on its own and return a status per item. | Independent items: imports, syncs | The client has to read the per-item results and retry only the failures. |
| Async job | Reply 202 Accepted with a job id. Workers process in the background. The client polls or gets a callback. | Very large batches, slow work | More moving parts: job storage, status endpoint, expiry. |
200 with item statuses in the body. Some use 207 Multi-Status. Pick one, and write it in your contract.| Method | How it works | Good for | Limits |
|---|---|---|---|
| Multipart form | One request with the file and fields (multipart/form-data) | Small files, simple forms | Whole file in one request. A failure means starting again. |
| Raw body | Send the bytes as the body of a PUT or POST | Simple API clients | Same: no resume, and the server carries the bytes. |
| Chunked / resumable | Split into parts, send each, and ask which parts arrived | Big files, bad networks | More requests, and the server must track parts. |
| Presigned URL to storage | Your API signs a short-lived URL, and the client sends the file straight to object storage | Large files at scale | Checks happen after the file arrives (scan, type, size). |
Illustrative numbers, not benchmarks: each connection sends 10 MB/s and the app servers together pass 250 MB/s. Real links, storage limits and retry rules differ. The model ignores the final call that tells the server the upload is complete.
photo.jpg. Check the real content, store files under names that you generate, and never serve uploads from a place where they could run as code.| Term | Meaning in easy words |
|---|---|
| Bulk / batch endpoint | An endpoint that takes many items in one request |
| Partial success | Some items worked and some failed, and the response says which |
| 207 Multi-Status | An HTTP status that carries a separate status for many operations in one response |
| 202 Accepted | The work was accepted, but it is not finished yet |
| Job id / status endpoint | A handle that the client uses to check on a background job |
| Idempotency key | A unique value that makes a retried request safe to repeat |
| multipart/form-data | A request format that can carry files and fields together |
| Chunked / resumable upload | A file sent in pieces, so a failure costs only the missing pieces |
| Presigned URL | A temporary link that allows one specific upload (or download) without a login |
| Direct-to-storage upload | The client sends the file straight to object storage, not through your app |
| Virus scan / content check | Looking inside an upload to see if it is safe and really what it claims to be |
| Choice | We gain | We lose |
|---|---|---|
| Bigger batches | Fewer calls | Longer requests, more to retry, higher timeout risk |
| Smaller batches | Fast, simple, easy to retry | More calls |
| All or nothing | A clean result and no half-done state | One bad item blocks the rest |
| Partial success | Good items go through | Clients must handle mixed results |
| Smaller chunks | Less wasted on a failure | More requests and more bookkeeping |
| Direct to storage | Scale and speed, simple servers | A second system to secure and a delay before checks |