Loading

Abort Bulk API jobs

Date de publication: May 23, 2026
Description

When multiple Bulk API jobs are running in a Salesforce org and need to be aborted, doing so manually one at a time is time-consuming. The following approach uses the Bulk API REST endpoint to abort jobs programmatically using a list of Job IDs.
Note: This approach is provided as a code sample and is not officially supported by Salesforce. Test in a Sandbox org before using in production, and ensure you understand the risks of aborting active jobs.

Résolution

How to Abort a Bulk API Job via REST

To abort a Bulk API job, send the following REST PATCH request for each Job ID:
  • Endpoint: PATCH /services/async//job/
  • Headers: X-SFDC-Session: and Content-Type: application/json
  • Request Body: { "state": "Aborted" }
A successful response returns the job record with state set to Aborted.

Information to Collect Before Running

  1. Prepare a list of all Bulk API Job IDs that need to be aborted.
  2. Obtain an active Session ID for a Salesforce user who has API permissions and can abort jobs in the org.
  3. Note the org's Base URL (for example: `).

Process

  1. For each Job ID in the list, send the PATCH request above using the Session ID and Base URL.
  2. Confirm the API response shows "state": "Aborted" for each job.
  3. Verify the job status in Setup > Apex Jobs — each aborted job should now show the Aborted status.

Note on Getting Job IDs

When a Bulk API job is submitted, Salesforce returns a Job ID in the response. Your integration should store these IDs. There is no supported SOQL query for retrieving all active Bulk API jobs — store Job IDs at the time of submission.
Numéro d’article de la base de connaissances

000382516

Pièces jointes

JAVA_Code_to_abort_job.txt

2 KB

 
Chargement
Salesforce Help | Article