Batch webhooks
Give a batch job a webhookUrl, and when the job ends the API sends one JSON POST to it, with a link to every screenshot. You can fetch the results straight away instead of polling. It works for your own server, with a signature you can check, and for no-code tools such as n8n, Zapier and Make, which need no secret at all.
Plan: batch jobs need the Starter plan or above. A webhook costs nothing more: it needs no other plan and uses none of your screenshots.
When it fires
Once per job, when the job ends: completed (at least one URL was captured), failed (none was) or cancelled. Delivery is at least once: a delivery that fails is tried again, for about two hours, and that carries on through restarts. Now and then the same event may reach you twice, so drop duplicates by their id.
Set it up
Add webhookUrl to POST /batch/screenshots, and optionally a webhookSecret to sign deliveries and webhookHeaders to send with them.
curl -X POST https://screenshotforweb.com/api/v1/batch/screenshots \
-H "X-API-Key: sk_live_your_key" -H "Content-Type: application/json" \
-d '{
"urls": ["https://a.com", "https://b.com"],
"options": { "format": "png" },
"webhookUrl": "https://your-app.com/hooks/batch",
"webhookSecret": "a_long_random_string",
"webhookHeaders": { "Authorization": "Bearer your_token" }
}'{
"success": true,
"data": {
"jobId": "4f0c9a2e-…",
"status": "queued",
…
"webhook": {
"url": "https://your-app.com/hooks/batch",
"signed": true,
"headers": ["Authorization"],
"status": "waiting",
"attempts": 0,
"lastAttemptAt": null,
"nextAttemptAt": null,
"deliveredAt": null,
"lastError": null
}
}
}With the SDKs. They aren’t on npm or PyPI yet; until they are, the HTTP API above does the same in any language:
import { ScreenshotForWeb } from "@screenshotforweb/sdk";
const client = new ScreenshotForWeb({ apiKey: "sk_live_your_key" });
const job = await client.batch.create({
urls: ["https://a.com", "https://b.com"],
options: { format: "png" },
webhookUrl: "https://your-app.com/hooks/batch",
webhookSecret: "a_long_random_string",
webhookHeaders: { Authorization: "Bearer your_token" },
});
console.log(job.jobId, job.webhook?.status); // "waiting"from screenshotforweb import ScreenshotForWeb
client = ScreenshotForWeb(api_key="sk_live_your_key")
job = client.batch.create(
["https://a.com", "https://b.com"],
options={"format": "png"},
webhook_url="https://your-app.com/hooks/batch",
webhook_secret="a_long_random_string",
webhook_headers={"Authorization": "Bearer your_token"},
)
print(job["jobId"], job["webhook"]["status"]) # waitingIn the dashboard, switch on Notify a webhook when the batch finishes on the Batch Screenshots page, and enter the URL and, if you like, a signing secret.
The fields
| Field | Rules |
|---|---|
webhookUrl | An absolute http or https URL of up to 2,048 characters. A query string is fine. It must resolve to public addresses. |
webhookSecret | Optional, 1 to 256 characters. Each delivery is then signed with it. It is kept only for signing and is never returned by any endpoint. |
webhookHeaders | Optional. Up to 10 headers, as an object of names and string values, sent with every delivery: an Authorization header your endpoint checks, for example. See the header rules. Job responses list their names, never their values. |
A bad field is refused with 400 VALIDATION_ERROR and one of these messages, where <name> is the header name as you gave it:
webhookUrl must be an absolute http(s) URLwebhookSecret must be a string of 1 to 256 characterswebhookHeaders must be an object of at most 10 headerswebhookHeaders: '<name>' is not a valid header namewebhookHeaders: '<name>' is set by Screenshot for Web and can't be replacedwebhookHeaders: the value of '<name>' must be a string of at most 1024 characters, without line breaks or characters beyond Latin-1webhookSecret and webhookHeaders need a webhookUrl
A URL that doesn’t resolve, or resolves to a private address, is refused with a 400 too.
The payload
One JSON body, built when it is sent, so its links are fresh. Every time is ISO 8601 in UTC, and every link is absolute.
{
"id": "4f0c9a2e-…:completed",
"type": "batch.completed",
"test": false,
"jobId": "4f0c9a2e-…",
"status": "completed",
"createdAt": "2026-11-11T10:00:00.000Z",
"completedAt": "2026-11-11T10:03:12.000Z",
"progress": { "total": 2, "completed": 1, "failed": 1 },
"items": [
{
"itemId": "…",
"url": "https://a.com",
"status": "completed",
"signedUrl": "https://storage.googleapis.com/…",
"downloadUrl": "https://screenshotforweb.com/api/v1/assets/screenshot/eyJ…",
"expiresAt": "2026-11-11T10:18:12.000Z",
"metadata": { "width": 1920, "height": 1080, "format": "png", "sizeBytes": 123456 }
},
{
"itemId": "…",
"url": "https://b.com",
"status": "failed",
"error": "Navigation timeout of 30000 ms exceeded"
}
],
"zip": { "signedUrl": "https://storage.googleapis.com/…", "expiresAt": "2026-11-11T10:18:12.000Z" },
"links": {
"job": "https://screenshotforweb.com/api/v1/batch/jobs/4f0c9a2e-…",
"results": "https://screenshotforweb.com/api/v1/batch/jobs/4f0c9a2e-…/results"
}
}| Field | What it holds |
|---|---|
id | <jobId>:<status>. It stays the same on every retry and redelivery of the event. |
type | batch.completed, batch.failed (every URL failed) or batch.cancelled. A completed job can still have failed URLs: check each item. |
test | false. Only the test endpoint’s sample has true. |
jobId, status | The job, and how it ended: completed, failed or cancelled. |
createdAt, completedAt | When the job was created and when it ended. For a cancelled job, completedAt is when the job was last updated: the cancellation, or a little later if a capture under way then finished afterwards. |
progress | total, completed and failed, counted from the items when the webhook is sent. |
items | Every URL of the job, in the order of the request. |
items[].status | completed, failed, or cancelled for a URL that was still being captured when the job was cancelled. URLs a cancelled job never started are failed, with the error Cancelled before it was captured. |
items[].signedUrl, downloadUrl, expiresAt | Completed items only. signedUrl is a signed link to the file in storage. downloadUrl, on screenshotforweb.com, redirects to a newly signed link each time it is opened. Neither needs an API key, and both work until expiresAt, 15 minutes after the webhook was sent. If a link couldn’t be made, the item is listed without it. |
items[].metadata | width, height, format and sizeBytes of the capture, when known. |
items[].error | Failed items: why the URL couldn’t be captured. |
zip | signedUrl and expiresAt of one ZIP with every screenshot. Only there when the job completed and its ZIP was built. |
links.job, links.results | The job and its results on the API. These need your API key. links.results gives fresh links to a completed job’s screenshots once the ones in the payload have expired. |
Headers
| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | ScreenshotForWeb-Webhooks/1.0 |
X-Webhook-Event | The type, such as batch.completed. |
X-Webhook-Id | The id, such as 4f0c9a2e-…:completed. |
X-Webhook-Attempt | The delivery round, from 1 to 6. |
X-Webhook-Signature | sha256=<hex>, only when the job has a webhookSecret. |
| Your headers | Each of the job’s webhookHeaders. |
Your endpoint must answer with a 2xx status within 10 seconds. Only the status counts; we don’t read the body. Anything else, a redirect included, counts as a failure and is tried again. Answer first, then do the slow work, such as downloading the screenshots.
Check the signature
With a webhookSecret, X-Webhook-Signature is sha256= followed by the hex HMAC-SHA256 of the request body, keyed with the secret: the same scheme as async screenshots and change monitors. Compute it over the raw body, exactly as it arrived. Parsing the JSON and serializing it again changes the bytes, and the signature with them. Compare in constant time.
import crypto from "node:crypto";
import express from "express";
const app = express();
const secret = process.env.WEBHOOK_SECRET;
function validSignature(rawBody, header) {
if (!Buffer.isBuffer(rawBody) || typeof header !== "string" || !header.startsWith("sha256=")) return false;
const expected = Buffer.from(crypto.createHmac("sha256", secret).update(rawBody).digest("hex"));
const given = Buffer.from(header.slice("sha256=".length));
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
}
// express.raw() keeps the body as the bytes that were signed; parse it only after the check.
app.post("/hooks/batch", express.raw({ type: "application/json" }), (req, res) => {
if (!validSignature(req.body, req.get("X-Webhook-Signature"))) return res.sendStatus(401);
const event = JSON.parse(req.body.toString("utf8"));
res.sendStatus(204);
console.log(event.type, event.items.length);
});
app.listen(3000);import hashlib
import hmac
import json
import os
from flask import Flask, abort, request
app = Flask(__name__)
SECRET = os.environ["WEBHOOK_SECRET"].encode()
def valid_signature(raw_body, header):
if not header or not header.startswith("sha256="):
return False
expected = hmac.new(SECRET, raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(header[len("sha256="):].encode(), expected.encode())
@app.post("/hooks/batch")
def batch_webhook():
raw_body = request.get_data() # the bytes that were signed
if not valid_signature(raw_body, request.headers.get("X-Webhook-Signature")):
abort(401)
event = json.loads(raw_body)
print(event["type"], len(event["items"]))
return "", 204The SDKs do the check for you: verifyWebhookSignature(rawBody, signatureHeader, secret) in Node and verify_webhook_signature(raw_body, signature_header, secret) in Python. Both take the raw body as bytes or text, and return false (never an error) when the header is missing or malformed.
import express from "express";
import { verifyWebhookSignature } from "@screenshotforweb/sdk";
const app = express();
app.post("/hooks/batch", express.raw({ type: "application/json" }), (req, res) => {
const signature = req.get("X-Webhook-Signature");
if (!verifyWebhookSignature(req.body, signature, process.env.WEBHOOK_SECRET)) return res.sendStatus(401);
const event = JSON.parse(req.body.toString("utf8"));
res.sendStatus(204);
console.log(event.type, event.items.length);
});import json
import os
from fastapi import FastAPI, HTTPException, Request, Response
from screenshotforweb import verify_webhook_signature
app = FastAPI()
@app.post("/hooks/batch")
async def batch_webhook(request: Request):
raw_body = await request.body()
signature = request.headers.get("X-Webhook-Signature")
if not verify_webhook_signature(raw_body, signature, os.environ["WEBHOOK_SECRET"]):
raise HTTPException(status_code=401)
event = json.loads(raw_body)
print(event["type"], len(event["items"]))
return Response(status_code=204)Retries
Each delivery round makes a few quick attempts in a row. When they all fail, the next round is due later. After six failed rounds, about two hours in all, the webhook is marked failed.
| Round | Starts |
|---|---|
| 1 | When the job ends |
| 2 | About 1 minute after round 1 |
| 3 | About 5 minutes after round 2 |
| 4 | About 15 minutes after round 3 |
| 5 | About 30 minutes after round 4 |
| 6 | About 60 minutes after round 5 |
A URL that is refused, because it isn’t allowed or now resolves to a private address, fails straight away: trying again can’t help. A name that briefly fails to resolve is a normal failure, and is tried again.
Delivery status
GET /batch/jobs/:jobId and GET /batch/jobs show each job’s webhook, or null for a job without one. The dashboard’s Batch Screenshots page shows it on each job too.
"webhook": {
"url": "https://hooks.zapier.com/hooks/catch/…",
"signed": true,
"headers": ["Authorization"],
"status": "delivered",
"attempts": 1,
"lastAttemptAt": "2026-11-11T10:03:13.000Z",
"nextAttemptAt": null,
"deliveredAt": "2026-11-11T10:03:13.000Z",
"lastError": null
}status | Means |
|---|---|
waiting | The job hasn’t finished yet. |
pending | Due to be sent: now, or at nextAttemptAt after a failed round. |
delivering | A round is under way. |
delivered | Your endpoint answered 2xx, at deliveredAt. |
failed | Every round failed, or the URL was refused. lastError says why. |
skipped | The job ended before batch webhooks existed, so it was never sent. |
signed says whether deliveries carry a signature, and headers lists your header names. attempts counts the rounds tried. lastError is HTTP <code> when your endpoint answered with another status, or the error, such as a timeout, in up to 300 characters.
Redeliver
Send a job’s webhook again, with fresh links and a new set of six rounds starting now. It works for delivered, failed and skipped webhooks, for one waiting for its next round, and for a job that has ended but whose webhook still says waiting, but not before its first delivery has been tried. The event keeps its id, so a receiver that drops duplicates will drop it too if it has seen that id before. Redelivery is rate-limited like your other requests.
curl -X POST https://screenshotforweb.com/api/v1/batch/jobs/{jobId}/webhook/redeliver -H "X-API-Key: sk_live_your_key"
// -> 202 { "success": true, "data": { "webhook": { "status": "...", ... } } }| Status | Code | When |
|---|---|---|
| 404 | NOT_FOUND | There’s no such job in your account. |
| 400 | VALIDATION_ERROR | This job has no webhook |
| 409 | WEBHOOK_NOT_READY | The job hasn't finished yet |
| 409 | WEBHOOK_NOT_READY | The first delivery hasn't been tried yet |
| 409 | WEBHOOK_IN_PROGRESS | A delivery is already in progress |
| 429 | RATE_LIMITED | Too many requests in the last minute; try again after the time in Retry-After. |
With the SDKs: client.batch.redeliverWebhook(jobId) in Node and client.batch.redeliver_webhook(job_id) in Python.
Send a test
POST /batch/webhooks/test sends a sample payload to a URL, so you can check your endpoint, and so a no-code tool can learn the fields before a real batch runs. It takes the same webhookUrl, webhookSecret and webhookHeaders as a batch, with the same rules.
curl -X POST https://screenshotforweb.com/api/v1/batch/webhooks/test \
-H "X-API-Key: sk_live_your_key" -H "Content-Type: application/json" \
-d '{ "webhookUrl": "https://your-app.com/hooks/batch", "webhookSecret": "a_long_random_string" }'
// -> 200 { "success": true, "data": { "delivered": true, "statusCode": 200 } }- The sample has
test: true, the job ID00000000-0000-4000-8000-000000000000and the typebatch.completed. Its two items arehttps://example.com/, completed with example links, andhttps://example.org/, failed with the errorNavigation timeout of 30000 ms exceeded. It has azipandlinkstoo. The links are examples and lead to no real files. - The headers are those of a real delivery, with
X-Webhook-Attempt: 1, and a signature when you pass a secret. - It sends one round, with its quick retries, and answers
200either way:delivered, thestatusCodeyour endpoint answered with, and anerrorwhen it wasn’t delivered. A URL on a private address is refused with a 400. - It needs a plan with batch jobs (Starter and above), uses no screenshots, and is rate-limited.
In the SDKs it is client.batch.testWebhook() in Node, which takes webhookUrl and, optionally, webhookSecret and webhookHeaders, and client.batch.test_webhook(webhook_url, webhook_secret=None, webhook_headers=None) in Python. In the dashboard, the Send test button under Notify a webhook when the batch finishes does the same, and shows the answer.
No-code tools
These tools answer a webhook as soon as it arrives, which is what the 10-second limit needs, so keep that default. They don’t need a secret. Treat the URL they give you as private, and with n8n you can also check a header that you send with webhookHeaders.
n8n
Wait for the batch in one workflow. n8n gives each run that waits a resume URL, $execution.resumeUrl:
- Add an HTTP Request node: method POST, URL
https://screenshotforweb.com/api/v1/batch/screenshots, a headerX-API-Keywith your key (or a Header Auth credential), and a JSON body with yoururls,optionsandwebhookUrl. - Set
webhookUrlto the expression{{ $execution.resumeUrl }}, for example"webhookUrl": "{{ $execution.resumeUrl }}"in the JSON body. - Add a Wait node after it, with Resume set to On Webhook Call and HTTP Method set to POST.
- When the batch ends, the run carries on from the Wait node with the payload in
body. A Split Out node onbody.itemsgives you one item per URL.
Or use a separate workflow that starts with a Webhook node, with the HTTP method POST. Use its production URL as the Webhook URL, and activate the workflow. To see the fields while you build it, click Listen for test event and send a test to the node’s test URL, from the dashboard or the test endpoint. To check where calls come from, set the Webhook node’s authentication to Header Auth and send the same header in webhookHeaders.
Your n8n has to be reachable from the internet: a URL on localhost or a private network is refused. Our community node, n8n-nodes-screenshotforweb, isn’t published yet. Once it is, its Batch resource does the same with form fields: Create with Notify a Webhook → Webhook URL, plus Get, Get Results, Cancel, Send Test Webhook and Redeliver Webhook.
Zapier
- Start a Zap with the trigger Webhooks by Zapier and the event Catch Hook, and copy the webhook URL it gives you (
https://hooks.zapier.com/hooks/catch/…). - Send a test to that URL, from the dashboard’s Send test button or the test endpoint.
- Back in Zapier, click Test trigger. It finds the sample and shows its fields, such as
jobId,statusanditems. - Add your actions and publish the Zap. A Filter step that only goes on when
testis false keeps test sends from running them. Then create batches with the hook URL as theirwebhookUrl.
Make
- In a new scenario, add the Webhooks app’s Custom webhook trigger, add a webhook and copy its address (
https://hook.eu1.make.com/…, or your region’s). - Make listens for a first request to learn the fields from; for a webhook you already had, click Redetermine data structure to make it listen again. Then send a test to the address, from the dashboard’s Send test button or the test endpoint. The sample holds a completed item and a failed one, so Make learns both.
- Add an Iterator on
itemsto handle each URL, and the modules you need. Turn the scenario on, and create batches with the address as theirwebhookUrl.
Limits and security
- Public addresses only. The URL must resolve to public addresses. It is checked when you create the job or send a test, and again on every connection. Localhost, private networks and names that don’t resolve are refused. To try it on your own machine, expose your endpoint through a public tunnel.
- Header rules. Up to 10 headers. A name is 1 to 64 letters, digits and hyphens. These names are reserved, whatever their case:
Host,Content-Length,Content-Type,Transfer-Encoding,Connection,Keep-Alive,Upgrade,TE,Trailer,Expect,Proxy-Authorization,Proxy-Connection,User-Agentand any name that starts withX-Webhook-. A value is a string of up to 1,024 characters, with no line breaks or other control characters (a tab is fine). - Secrets stay secret. The secret and the header values are never returned; job responses only say whether there is a secret and list the header names.
- Links expire. The links in a payload work for 15 minutes after it is sent. For fresh ones, call
links.resultswith your API key (for a completed job), or redeliver the webhook. - Drop duplicates. Delivery is at least once, so keep the
id(also sent asX-Webhook-Id) of each event you’ve handled and ignore it if it comes again. - Answer fast. A
2xxwithin 10 seconds, or the delivery counts as failed and is tried again.