Bulk API 2.0 requires a client (Data Loader, MuleSoft, custom code, or the Salesforce CLI). The mechanics are straightforward; the discipline is in chunking, idempotency, and monitoring.
- Authenticate against the Salesforce API
Use OAuth (preferably JWT Bearer flow) to obtain an access token. The token authenticates every Bulk API call.
- Create a job
POST to /services/data/vNN.0/jobs/ingest with the operation, object, and content type. Salesforce returns a Job ID.
- Upload the CSV payload
PUT the CSV content to the job's upload endpoint. Bulk API 2.0 handles chunking internally; the client uploads as one payload.
- Close the job
PATCH the job state to UploadComplete. Salesforce begins processing the records on the async layer.
- Poll status and download results
Poll the job status endpoint every 30 to 60 seconds. When JobComplete, GET the successful and failed record results as CSV.
- Bulk API operations are async. Synchronous behaviour requires the client to poll until completion.
- Each row can succeed or fail independently. Production integrations must download the failed-row CSV and retry only those.
- Use Upsert with an external ID for idempotency. Insert + Update logic written by hand is error-prone at bulk scale.
- Very large queries (hundreds of millions of records) need PK Chunking enabled via HTTP header. Without it, the query may fail with memory errors.