Cancel Scenario job
curl --request DELETE \
--url https://api.exec.com/rest/v1/scenario-studio/jobs/{job_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exec.com/rest/v1/scenario-studio/jobs/{job_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exec.com/rest/v1/scenario-studio/jobs/{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.exec.com/rest/v1/scenario-studio/jobs/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.exec.com/rest/v1/scenario-studio/jobs/{job_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.exec.com/rest/v1/scenario-studio/jobs/{job_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exec.com/rest/v1/scenario-studio/jobs/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "j1o2b3i4d5x6",
"status": "cancelled",
"scenario": null,
"error": null,
"created_at": "2024-03-01T10:00:00Z",
"started_at": "2024-03-01T10:00:05Z",
"completed_at": "2024-03-01T10:00:10Z",
"duration_seconds": 5
}{
"error": {
"type": "invalid_request",
"code": "job_not_cancellable",
"message": "Cannot cancel job in 'completed' state"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid or inactive API key"
}
}{
"error": {
"type": "not_found",
"code": "job_not_found",
"message": "Job not found: j1o2b3i4d5x6"
}
}Scenario Studio
Cancel Scenario job
Cancels a scenario creation job that is queued or processing.
- Queued jobs: Marked as cancelled immediately
- Processing jobs: The background task is terminated and the job is marked cancelled
- Completed/failed/cancelled jobs: Returns 400 error (cannot cancel terminal states)
DELETE
/
scenario-studio
/
jobs
/
{job_id}
Cancel Scenario job
curl --request DELETE \
--url https://api.exec.com/rest/v1/scenario-studio/jobs/{job_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exec.com/rest/v1/scenario-studio/jobs/{job_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exec.com/rest/v1/scenario-studio/jobs/{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.exec.com/rest/v1/scenario-studio/jobs/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.exec.com/rest/v1/scenario-studio/jobs/{job_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.exec.com/rest/v1/scenario-studio/jobs/{job_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exec.com/rest/v1/scenario-studio/jobs/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "j1o2b3i4d5x6",
"status": "cancelled",
"scenario": null,
"error": null,
"created_at": "2024-03-01T10:00:00Z",
"started_at": "2024-03-01T10:00:05Z",
"completed_at": "2024-03-01T10:00:10Z",
"duration_seconds": 5
}{
"error": {
"type": "invalid_request",
"code": "job_not_cancellable",
"message": "Cannot cancel job in 'completed' state"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid or inactive API key"
}
}{
"error": {
"type": "not_found",
"code": "job_not_found",
"message": "Job not found: j1o2b3i4d5x6"
}
}Authorizations
API key created in Settings > API.
Format: exec_live_ followed by 40 alphanumeric characters.
Path Parameters
The job ID to cancel
Response
Job cancelled successfully
Job identifier
Current job status
Available options:
queued, processing, completed, failed, cancelled Created scenario details (only present when status is "completed")
Show child attributes
Show child attributes
Error details (only present when status is "failed")
Show child attributes
Show child attributes
When the job was created
When the job started processing
When the job finished (success, failure, or cancelled)
Processing duration in seconds (only present when job has completed)