Process for Creating Bulk API 2.0 Requests

Use the Bulk API 2.0 to process large amounts of data by defining a job, providing data for that job, and monitoring the results.

Create a new Bulk API 2.0 request by doing the following steps.

  1. Create a job. The job defines a specific Bulk API 2.0 operation, such as inserting new records, or updating records.
  2. Upload data for the job. For data sets under 100,000 characters, upload the data as part of a multipart request when you create the job. For larger data sets, up to 150MB (after base64 encoding), upload the data by creating an upload data request. Don’t delete your local CSV data until you’ve confirmed that Salesforce has processed all records successfully.
  3. If you’re using a separate request to upload data, once you’re done uploading data, close the job by setting the job state to UploadComplete. Salesforce will start processing the job at this point.
  4. Check the status of the job. When a job’s state is JobComplete, you can retrieve its results.

    You must use the same API version to get query results that you used to create the query. Otherwise, the call returns a 409 error.

    Note

  5. Retrieve the results of the completed job by checking the successful results, failed results, and unprocessed records.