How does the Bulk API handle high-volume data migrations and asynchronous enterprise synchronization jobs?
Answer
Basics: Standard REST/SOAP calls handle roughly 200 records each and are synchronous, which is slow and expensive for millions of rows. Bulk API is designed for loads, deletes, hard deletes and large queries. Two versions exist: Bulk API 1.0 (you create batches yourself, XML/JSON/CSV) and Bulk API 2.0 (simpler: upload one CSV, Salesforce splits it automatically).
How it works (Bulk API 2.0):
- Create an ingest job:
POST /services/data/vXX.0/jobs/ingestwith object, operation (insert, update, upsert, delete, hardDelete) and external ID field for upsert. - Upload CSV data with
PUT .../jobs/ingest/{id}/batches(about 100 MB raw per job upload, 150 MB base64, verify limits). - Mark the job
UploadCompleteusing PATCH. - Salesforce processes it asynchronously and in parallel.
- Poll the job status, then download
successfulResults,failedResultsandunprocessedrecords. Query jobs (/jobs/query) export big result sets the same way.
Advanced / deep dive: Bulk API 1.0 gives control: batches up to 10,000 records, parallel or serial mode, and PK chunking for huge queries (chunk size default 100,000, max 250,000). Bulk 2.0 removes batch management but gives less control. Parallelism causes record lock contention (UNABLE_TO_LOCK_ROW) on child records of the same parent, so sort the data by parent ID or use serial mode. Triggers, flows and validation rules still run per record, so heavy automation can make jobs slow; use bypass switches carefully. The daily allocation counts batches (1.0) or total records (2.0); verify current numbers in the limits documentation. Data Loader, Dataloader.io and most ETL tools can use Bulk API underneath.