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
Parameter Description Required or Optional
queryJobId The 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:
HTTP/1.1 400 Bad Request
[{
	"errorCode": "API_ERROR",
	"message": "Error encountered when deleting the job because the job is not terminated"
}]

Example

This example deletes the job with ID 750R0000000zxnaIAA.
curl --include --request DELETE \
--header "Authorization: Bearer token \
--header "Content-Type: " \
https://instance.salesforce.com/services/data/vXX.X/jobs/query/750R0000000zxnaIAA
The response status is
204 No Content