Delete a Query Job

Deletes a query job. When a job is deleted, job data stored by Salesforce is deleted and job metadata information is removed. The job no longer displays in the Bulk Data Load Jobs page in Salesforce.

You can only delete a job if its state is JobComplete, Aborted, or Failed.

Note

Syntax 

URI: /services/data/vXX.X/jobs/query/queryJobId

Available since release:

This resource is available in API version 47.0 and later.

Formats: None

HTTP methods: DELETE

Authentication: Authorization: Bearer token

Request parameters:

ParameterDescriptionRequired or Optional
queryJobIdThe ID of the query job to be deleted.Required

Response Body

If the method is successful, the status code is 204 (No Content) and there is no response body.

Response Body - For an Unsuccessful Request

If the request fails, the server returns a 400 (Bad Request) status, and the request body shows details of the error. For example:

1HTTP/1.1 400 Bad Request
2[{
3	"errorCode": "API_ERROR",
4	"message": "Error encountered when deleting the job because the job is not terminated"
5}]

Example 

This example deletes the job with ID 750R0000000zxnaIAA.

1curl --include --request DELETE \
2--header "Authorization: Bearer token \
3--header "Content-Type: " \
4https://instance.salesforce.com/services/data/vXX.X/jobs/query/750R0000000zxnaIAA

The response status is

1204 No Content