curl --request POST "${HARNESS_URL}/harness/cronjobs/${CRONJOB_ID}/runs/${RUN_ID}/cancel" \
--header "Authorization: Bearer ${HARNESS_TOKEN}"import json
import os
from urllib.request import Request, urlopen
base_url = os.environ["HARNESS_URL"]
headers = {"Authorization": "Bearer " + os.environ["HARNESS_TOKEN"]}
job_id = os.environ["CRONJOB_ID"]
run_id = os.environ["RUN_ID"]
request = Request(base_url + f"/harness/cronjobs/{job_id}/runs/{run_id}/cancel", headers=headers, method="POST")
with urlopen(request) as response:
print(json.load(response))const baseUrl = process.env.HARNESS_URL;
const headers = { Authorization: `Bearer ${process.env.HARNESS_TOKEN}` };
const response = await fetch(`${baseUrl}/harness/cronjobs/${process.env.CRONJOB_ID}/runs/${process.env.RUN_ID}/cancel`, {
method: "POST",
headers,
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());{
"cronjob_id": "0e58ff7f7dcbf348c252fc70e7fdb587",
"run_id": "8210479599999-677bde100cec511735b2",
"revision": 1,
"scheduled_at": "2026-09-16T01:00:00Z",
"created_at": "2026-09-16T01:00:00Z",
"prompt": "Summarize recent activity",
"harness": null,
"timeout_seconds": 1800,
"state": "running",
"owner": "replica-1",
"started_at": "2026-09-16T01:00:00+00:00",
"completed_at": null,
"lease_until": "2026-09-16T01:01:00+00:00",
"cancel_requested": true,
"output": "",
"error": ""
}Cancel an execution
Cancel queued execution or request cancellation of a running execution
curl --request POST "${HARNESS_URL}/harness/cronjobs/${CRONJOB_ID}/runs/${RUN_ID}/cancel" \
--header "Authorization: Bearer ${HARNESS_TOKEN}"import json
import os
from urllib.request import Request, urlopen
base_url = os.environ["HARNESS_URL"]
headers = {"Authorization": "Bearer " + os.environ["HARNESS_TOKEN"]}
job_id = os.environ["CRONJOB_ID"]
run_id = os.environ["RUN_ID"]
request = Request(base_url + f"/harness/cronjobs/{job_id}/runs/{run_id}/cancel", headers=headers, method="POST")
with urlopen(request) as response:
print(json.load(response))const baseUrl = process.env.HARNESS_URL;
const headers = { Authorization: `Bearer ${process.env.HARNESS_TOKEN}` };
const response = await fetch(`${baseUrl}/harness/cronjobs/${process.env.CRONJOB_ID}/runs/${process.env.RUN_ID}/cancel`, {
method: "POST",
headers,
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());{
"cronjob_id": "0e58ff7f7dcbf348c252fc70e7fdb587",
"run_id": "8210479599999-677bde100cec511735b2",
"revision": 1,
"scheduled_at": "2026-09-16T01:00:00Z",
"created_at": "2026-09-16T01:00:00Z",
"prompt": "Summarize recent activity",
"harness": null,
"timeout_seconds": 1800,
"state": "running",
"owner": "replica-1",
"started_at": "2026-09-16T01:00:00+00:00",
"completed_at": null,
"lease_until": "2026-09-16T01:01:00+00:00",
"cancel_requested": true,
"output": "",
"error": ""
}cancelled. For a running execution, the response may still show running with cancel_requested: true; cancellation is processed during a subsequent check, normally within about 20 seconds with default settings
Repeated cancellation of a completed execution returns its existing result. Cancellation cannot undo external actions already performed by tools; continue reading the result to confirm the terminal stateAuthorizations
Runtime access credential for a service-authenticated Harness, such as a Runtime API key; shared OAuth deployments do not support background scheduled tasks
Path Parameters
Task ID containing 32 lowercase hexadecimal characters
^[a-f0-9]{32}$Execution ID returned in task state or execution history
^[0-9]{13}-[a-f0-9]{20}$Response
Success
Owning task ID
^[a-f0-9]{32}$Execution ID used to read or cancel this occurrence
^[0-9]{13}-[a-f0-9]{20}$Task revision used for this execution
Scheduled occurrence time in UTC
Execution record creation time in UTC
Prompt for this execution
Settings applied to each execution of this task; explicit fields override the deployed agent and omitted fields inherit it
Show child attributes
Show child attributes
Timeout in seconds for this execution
Execution state
queued, running, succeeded, failed, cancelled, skipped, interrupted Identifier of the replica executing this occurrence; null before execution begins
Execution start time in UTC; null before execution begins
Execution completion time in UTC; null while unfinished
Current execution lease expiry in UTC; null before execution begins
Whether cancellation has been requested for this execution
Execution output; empty on failure. Successful output is limited to 1 MiB
Failure, cancellation, skip, or interruption details; empty when there is no error
Earliest missed occurrence combined into this run, in UTC; present only when occurrences were coalesced