Cancel Job
curl --request POST \
--url https://api.explorium.ai/v2/jobs/cancel/{job_id} \
--header 'api_key: <api-key>'import requests
url = "https://api.explorium.ai/v2/jobs/cancel/{job_id}"
headers = {"api_key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {api_key: '<api-key>'}};
fetch('https://api.explorium.ai/v2/jobs/cancel/{job_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.explorium.ai/v2/jobs/cancel/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"api_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.explorium.ai/v2/jobs/cancel/{job_id}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("api_key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.explorium.ai/v2/jobs/cancel/{job_id}")
.header("api_key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.explorium.ai/v2/jobs/cancel/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "<string>",
"input": {
"list_id": "<string>",
"row_count": 123,
"entity_type": "<string>"
},
"timing": {
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z"
},
"additional_data": {},
"credit_usage": {
"total_credits": 123,
"total_results": 123
},
"results": {
"format": "csv",
"download_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"file_expires_at": "2023-11-07T05:31:56Z"
},
"error": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Async jobs
Cancel job
POST
/
v2
/
jobs
/
cancel
/
{job_id}
Cancel Job
curl --request POST \
--url https://api.explorium.ai/v2/jobs/cancel/{job_id} \
--header 'api_key: <api-key>'import requests
url = "https://api.explorium.ai/v2/jobs/cancel/{job_id}"
headers = {"api_key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {api_key: '<api-key>'}};
fetch('https://api.explorium.ai/v2/jobs/cancel/{job_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.explorium.ai/v2/jobs/cancel/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"api_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.explorium.ai/v2/jobs/cancel/{job_id}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("api_key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.explorium.ai/v2/jobs/cancel/{job_id}")
.header("api_key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.explorium.ai/v2/jobs/cancel/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "<string>",
"input": {
"list_id": "<string>",
"row_count": 123,
"entity_type": "<string>"
},
"timing": {
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z"
},
"additional_data": {},
"credit_usage": {
"total_credits": 123,
"total_results": 123
},
"results": {
"format": "csv",
"download_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"file_expires_at": "2023-11-07T05:31:56Z"
},
"error": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Description
The Cancel Job endpoint stops an asynchronous job that is queued or still running. Use it to release capacity and avoid consuming credits on a run you no longer need.How It Works
How It Works
- Input: Provide the
job_idof the job you want to stop. - Processing: The system marks the job as cancelled and stops further work on it.
- Output: The job’s status record, in the same shape returned by Get job status.
Best Practices
Best Practices
- Cancel superseded jobs when you resubmit with corrected input, rather than leaving both running.
- Confirm the outcome by calling Get job status after cancelling.
- Cancelling a completed job has no effect — check the status first if you are unsure.
Authorizations
APIKeyHeaderAPIKeyHeader
Path Parameters
Response
Successful Response
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?