curl --request POST \
--url https://async.api.zenrows.com/v1/jobs/{job_id}/close \
--header 'X-API-Key: <api-key>'import requests
url = "https://async.api.zenrows.com/v1/jobs/{job_id}/close"
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}/close', 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}/close';
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}/close"
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}/close",
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}/close")
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}/close")
.header("X-API-Key", "<api-key>")
.asString();{
"job_id": "<string>",
"type": "regular",
"status": "open",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"format": "html",
"template_tasks": [
{
"url": "<string>",
"external_id": "<string>",
"metadata": {},
"method": "GET",
"body": "<unknown>",
"zenrows_params": {}
}
],
"zenrows_params": {},
"external_id": "<string>",
"name": "<string>",
"metadata": {},
"schedule": {
"at": "2026-09-01T09:00:00",
"rate": {
"every": 6,
"unit": "hour"
},
"calendar": {
"times_of_day": [
"09:00",
"18:00"
],
"cadence": {
"daily": {},
"weekly": {
"days": [
"mon",
"wed",
"fri"
]
},
"monthly": {
"days": [
1,
15
]
}
}
},
"timezone": "Europe/Berlin"
},
"next_scheduled_run": "2023-11-07T05:31:56Z",
"schedule_state": "active",
"webhook": {
"url": "<string>",
"signature": true
},
"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."
}
}{
"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>"
}
]
}Close an open job (no more tasks coming)
Flips job.status from open to closed and sets the
initial run’s last_batch_received = true, the same as an
addBatchTasks call with last_batch: true on its last batch. (An
addBatchTasks call needs at least one task, so with nothing left
to add, call /close.)
Does NOT stop the job: any pending or processing tasks
continue. If all known tasks are already terminal, the run
flips to completed immediately and the job’s webhook fires.
That includes an open job that never got a task: closing it
completes its run and frees its active-job slot.
Idempotent: calling on an already-closed job returns the
current state with 200. A scheduled job has no open/closed
flow: closing one returns 409 conflict.
curl --request POST \
--url https://async.api.zenrows.com/v1/jobs/{job_id}/close \
--header 'X-API-Key: <api-key>'import requests
url = "https://async.api.zenrows.com/v1/jobs/{job_id}/close"
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}/close', 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}/close';
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}/close"
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}/close",
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}/close")
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}/close")
.header("X-API-Key", "<api-key>")
.asString();{
"job_id": "<string>",
"type": "regular",
"status": "open",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"format": "html",
"template_tasks": [
{
"url": "<string>",
"external_id": "<string>",
"metadata": {},
"method": "GET",
"body": "<unknown>",
"zenrows_params": {}
}
],
"zenrows_params": {},
"external_id": "<string>",
"name": "<string>",
"metadata": {},
"schedule": {
"at": "2026-09-01T09:00:00",
"rate": {
"every": 6,
"unit": "hour"
},
"calendar": {
"times_of_day": [
"09:00",
"18:00"
],
"cadence": {
"daily": {},
"weekly": {
"days": [
"mon",
"wed",
"fri"
]
},
"monthly": {
"days": [
1,
15
]
}
}
},
"timezone": "Europe/Berlin"
},
"next_scheduled_run": "2023-11-07T05:31:56Z",
"schedule_state": "active",
"webhook": {
"url": "<string>",
"signature": true
},
"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."
}
}{
"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
Path Parameters
Response
Close accepted. Body is the refreshed Job object, without latest_run (read it with GET /v1/jobs/{id}).
regular: a run is created at submit time.scheduled: fires on a recurring or one-shot schedule. Submit stores the task list as a template on the job row; each scheduled fire produces a fresh Run.schedulefield required. Read-only template:addBatchTasksandclosereturn 409.rerun(full or filtered) andstopare allowed.
regular, scheduled 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 Derived server-side from zenrows_params at submit time.
Precedence:
response_type: markdown|plaintext|pdf→ matching format.- a non-empty
include→json, ahead ofresponse_type. autoparse: true,json_response: true, or non-emptycss_extractororextract→json. (outputsreturns JSON from the scraper but is not part of this derivation, so such a result is typedhtml; kept as is for existing clients.)- otherwise →
html. The job'sformatis the default from its job-level params; each task result'stypeis derived from that task's merged params and sets theContent-Typeof its content.
Clients must accept values not listed here.
html, json, markdown, plaintext, pdf Was this page helpful?