Batch endpoint
Also called: bulk endpoint, batch request, bulk API.
One endpoint that takes many operations in a single request, like "create these 200 contacts", and answers with a result for each one. It saves hundreds of round trips.
Import 20 contacts. One by one is 20 round trips. A batch endpoint takes all 20 in one request and answers with a result for each.
One by onenot run yet
One batchnot run yet
Nothing sent yet. 20 contacts are waiting to be imported.
Say it in a prompt
Add POST /api/tags/batch that accepts up to 100 operations, each {"op":"add" or "remove","itemId":...,"tag":...}. Apply each operation on its own (one savepoint each), so one that fails doesn't undo the others, and return an array of results in the same order, each with its index and status (200, or 4xx with an error message). Vague vs precise prompt
Vague prompt
let users import their contacts Typical resultThe app calls POST /contacts once per contact. 2,000 contacts take minutes, hit the rate limit halfway, and leave a half-finished import.
Precise prompt
Add POST /contacts/batch that takes up to 500 contacts, validates each one, saves the valid ones (a bad one doesn't undo the others), and returns a result per item (index, status, id or error). The import screen sends 500 at a time and lists the rows that failed. Typical result2,000 contacts go in 4 requests in a few seconds, and the user sees exactly which rows failed and why.
Seen on
- Microsoft Graph: JSON batching sends up to 20 requests in one POST to /$batch, and each answer inside the batch has its own status code.
You might describe it as
- send 500 items in one request instead of 500 requests
- bulk import that doesn't hit the rate limit
- save many things at once
Not to be confused with
- N+1 query
A batch endpoint cuts many HTTP requests down to one; fixing an N+1 query cuts many database queries inside one request.
- Bulk write
A batch endpoint joins many HTTP calls into one; a bulk write joins many database writes into one statement.