cURL
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": ""
}Scheduled jobs
Cancel an execution
Cancel queued execution or request cancellation of a running execution
POST
/
harness
/
cronjobs
/
{job_id}
/
runs
/
{run_id}
/
cancel
cURL
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": ""
}Requires a Harness Runtime deployed with AgentKit CLI 0.54.0 and scheduled tasks enabled
A queued execution can immediately become
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
Path Parameters
Response
Success
Last modified on September 19, 2026