curl --request POST \
--url https://async.api.zenrows.com/v1/jobs/{job_id}/rerun \
--header 'X-API-Key: <api-key>'import requests
url = "https://async.api.zenrows.com/v1/jobs/{job_id}/rerun"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://async.api.zenrows.com/v1/jobs/{job_id}/rerun', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://async.api.zenrows.com/v1/jobs/{job_id}/rerun';
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://async.api.zenrows.com/v1/jobs/{job_id}/rerun"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://async.api.zenrows.com/v1/jobs/{job_id}/rerun",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://async.api.zenrows.com/v1/jobs/{job_id}/rerun")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://async.api.zenrows.com/v1/jobs/{job_id}/rerun")
.header("X-API-Key", "<api-key>")
.asString();{
"job_id": "<string>",
"status": "open",
"latest_run": {
"run_id": "<string>",
"job_id": "<string>",
"run_sequence": 2,
"status": "running",
"stats": {
"total": 123,
"completed": 123,
"successful": 123,
"failed": 123,
"failure_reasons": {
"blocked": 9,
"gateway_error": 4
},
"spend": {
"credits": 1,
"cost": 1
}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"trigger": "manual",
"last_batch_received": true,
"pause_state": "active",
"ingest_status": "pending",
"failure_reason": "insufficient_credits",
"failure_detail": "Subscription has no credit available."
},
"retried_tasks": 123,
"inherited_tasks": 123,
"rerun_of": "<string>"
}{
"job_id": "<string>",
"status": "open",
"latest_run": {
"run_id": "<string>",
"job_id": "<string>",
"run_sequence": 2,
"status": "running",
"stats": {
"total": 123,
"completed": 123,
"successful": 123,
"failed": 123,
"failure_reasons": {
"blocked": 9,
"gateway_error": 4
},
"spend": {
"credits": 1,
"cost": 1
}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"trigger": "manual",
"last_batch_received": true,
"pause_state": "active",
"ingest_status": "pending",
"failure_reason": "insufficient_credits",
"failure_detail": "Subscription has no credit available."
},
"retried_tasks": 123,
"inherited_tasks": 123,
"rerun_of": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}Start a new run (full replay or partial retry of the previous run)
Two modes share this endpoint, picked by the optional
?status= filter:
Full rerun (no status). Replays every task from the
previous run into a fresh new run. Same task_id carries
through together with external_id, url, metadata, and
per-task zenrows_params. No source-child link: the
new run is fully independent. For scheduled jobs with no
prior run, builds from the job’s task template instead: the
manual equivalent of an automatic scheduled fire.
Partial retry (?status=failed[,pending,...]). Copies
every prev-run task row, but rows matching the filter are
reset to pending and re-enqueued; everything else is
copied verbatim with source_run_id (the run that owns the
stored result) stamped. The new run’s stats are pre-seeded
from the inherited terminal rows. On chained retries,
source_run_id chases back to the run that owns the result
so intermediate retries can be deleted freely;
DELETE /v1/jobs/{id}/runs/{run_id} only 409s when a
newer run still has tasks pointing at the targeted run.
Both modes stamp trigger: manual on the new run.
Accepted status values: pending, processing,
failed, successful. Unknown values → 400. ?status=
with no value is the same as leaving it out (a full rerun); a
list with no values in it (?status=,) → 400.
Preconditions:
- The job is not
deleted. - If a previous run exists, it must be terminal-non-deleted
(
completed/stopped/failed), and its task ingestion must have finished: a run interrupted mid-ingest is refused with409 run_not_terminal(delete the job and resubmit). ?status=mode additionally requires a prior run, created no more than 10 days ago; an older one is refused with409 partial_rerun_window_expired(a full rerun has no such limit).- Full mode on a scheduled job with no prior run requires a non-empty task template.
Side effects:
- Auto-closes an
openjob (existing behavior). - Honors
Idempotency-Key: a repeat call with the same key and filter replays the original response (the same new run), also while that run is still in flight. A rerun refused before it started a run (no_matching_tasks,no_prior_run, a503) gives the key back, so the same key works once the cause is fixed.
Reruns are normally accepted asynchronously: the call returns
202 and the new run’s task rows stream into storage off the
request path. A deployment that processes reruns on the
request path answers 201 instead. Treat both as success.
curl --request POST \
--url https://async.api.zenrows.com/v1/jobs/{job_id}/rerun \
--header 'X-API-Key: <api-key>'import requests
url = "https://async.api.zenrows.com/v1/jobs/{job_id}/rerun"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://async.api.zenrows.com/v1/jobs/{job_id}/rerun', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://async.api.zenrows.com/v1/jobs/{job_id}/rerun';
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://async.api.zenrows.com/v1/jobs/{job_id}/rerun"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://async.api.zenrows.com/v1/jobs/{job_id}/rerun",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://async.api.zenrows.com/v1/jobs/{job_id}/rerun")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://async.api.zenrows.com/v1/jobs/{job_id}/rerun")
.header("X-API-Key", "<api-key>")
.asString();{
"job_id": "<string>",
"status": "open",
"latest_run": {
"run_id": "<string>",
"job_id": "<string>",
"run_sequence": 2,
"status": "running",
"stats": {
"total": 123,
"completed": 123,
"successful": 123,
"failed": 123,
"failure_reasons": {
"blocked": 9,
"gateway_error": 4
},
"spend": {
"credits": 1,
"cost": 1
}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"trigger": "manual",
"last_batch_received": true,
"pause_state": "active",
"ingest_status": "pending",
"failure_reason": "insufficient_credits",
"failure_detail": "Subscription has no credit available."
},
"retried_tasks": 123,
"inherited_tasks": 123,
"rerun_of": "<string>"
}{
"job_id": "<string>",
"status": "open",
"latest_run": {
"run_id": "<string>",
"job_id": "<string>",
"run_sequence": 2,
"status": "running",
"stats": {
"total": 123,
"completed": 123,
"successful": 123,
"failed": 123,
"failure_reasons": {
"blocked": 9,
"gateway_error": 4
},
"spend": {
"credits": 1,
"cost": 1
}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"trigger": "manual",
"last_batch_received": true,
"pause_state": "active",
"ingest_status": "pending",
"failure_reason": "insufficient_credits",
"failure_detail": "Subscription has no credit available."
},
"retried_tasks": 123,
"inherited_tasks": 123,
"rerun_of": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "<string>",
"detail": "<string>",
"instance": "<string>",
"invalid_tasks": [
{
"index": 123,
"reason": "malformed_url",
"value": "<string>"
}
]
}Authorizations
Headers
Optional opaque token scoping a single submit / rerun /
add-tasks request, kept for 24 hours. A retry with the same
key and the same body replays the original status and body.
The same key with a different body, or while the original
request is still being processed, returns
409 idempotency_key_conflict. A request that is refused
(any 4xx, or a 503 before the job or run was created)
gives the key back, so a retry with the same key is
processed afresh. A 503 after the job or run was created
keeps the key: a retry under it is 409; check the job
before you resend with a fresh key. On add-tasks a retry
with the same body finishes an attempt that stopped partway
and adds each task once. The credit check runs first, so a
retry of a call that succeeded returns 402 if the account
has run out of credit since. At most 128 characters; a
longer key is 400 invalid_argument.
128Path Parameters
Query Parameters
Response
New run created synchronously; the API can answer this way instead of 202. All task rows are written.
open: initial run still acceptingaddBatchTasks. Only meaningful whilelatest_run.run_sequence == 1.closed: no more tasks accepted (created closed, or closed via/close/addTasks{last_batch}//rerun).deleted: never returned. A deleted job disappears from every read and list the momentDELETEis accepted (reads answer 404); its data is cleaned up asynchronously after.
Clients must accept values not listed here.
open, closed, deleted Was this page helpful?