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.

Request
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" }
  }'
Response (202)
{
  "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:

Node (@screenshotforweb/sdk)
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"
Python (screenshotforweb)
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"])  # waiting

In 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

FieldRules
webhookUrlAn absolute http or https URL of up to 2,048 characters. A query string is fine. It must resolve to public addresses.
webhookSecretOptional, 1 to 256 characters. Each delivery is then signed with it. It is kept only for signing and is never returned by any endpoint.
webhookHeadersOptional. 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) URL
  • webhookSecret must be a string of 1 to 256 characters
  • webhookHeaders must be an object of at most 10 headers
  • webhookHeaders: '<name>' is not a valid header name
  • webhookHeaders: '<name>' is set by Screenshot for Web and can't be replaced
  • webhookHeaders: the value of '<name>' must be a string of at most 1024 characters, without line breaks or characters beyond Latin-1
  • webhookSecret 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"
  }
}
FieldWhat it holds
id<jobId>:<status>. It stays the same on every retry and redelivery of the event.
typebatch.completed, batch.failed (every URL failed) or batch.cancelled. A completed job can still have failed URLs: check each item.
testfalse. Only the test endpoint’s sample has true.
jobId, statusThe job, and how it ended: completed, failed or cancelled.
createdAt, completedAtWhen 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.
progresstotal, completed and failed, counted from the items when the webhook is sent.
itemsEvery URL of the job, in the order of the request.
items[].statuscompleted, 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, expiresAtCompleted 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[].metadatawidth, height, format and sizeBytes of the capture, when known.
items[].errorFailed items: why the URL couldn’t be captured.
zipsignedUrl and expiresAt of one ZIP with every screenshot. Only there when the job completed and its ZIP was built.
links.job, links.resultsThe 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

HeaderValue
Content-Typeapplication/json
User-AgentScreenshotForWeb-Webhooks/1.0
X-Webhook-EventThe type, such as batch.completed.
X-Webhook-IdThe id, such as 4f0c9a2e-…:completed.
X-Webhook-AttemptThe delivery round, from 1 to 6.
X-Webhook-Signaturesha256=<hex>, only when the job has a webhookSecret.
Your headersEach 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.

Node (Express)
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);
Python (Flask)
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 "", 204

The 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.

Node SDK (Express)
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);
});
Python SDK (FastAPI)
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.

RoundStarts
1When the job ends
2About 1 minute after round 1
3About 5 minutes after round 2
4About 15 minutes after round 3
5About 30 minutes after round 4
6About 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
}
statusMeans
waitingThe job hasn’t finished yet.
pendingDue to be sent: now, or at nextAttemptAt after a failed round.
deliveringA round is under way.
deliveredYour endpoint answered 2xx, at deliveredAt.
failedEvery round failed, or the URL was refused. lastError says why.
skippedThe 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": "...", ... } } }
StatusCodeWhen
404NOT_FOUNDThere’s no such job in your account.
400VALIDATION_ERRORThis job has no webhook
409WEBHOOK_NOT_READYThe job hasn't finished yet
409WEBHOOK_NOT_READYThe first delivery hasn't been tried yet
409WEBHOOK_IN_PROGRESSA delivery is already in progress
429RATE_LIMITEDToo 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 ID 00000000-0000-4000-8000-000000000000 and the type batch.completed. Its two items are https://example.com/, completed with example links, and https://example.org/, failed with the error Navigation timeout of 30000 ms exceeded. It has a zip and links too. 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 200 either way: delivered, the statusCode your endpoint answered with, and an error when 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:

  1. Add an HTTP Request node: method POST, URL https://screenshotforweb.com/api/v1/batch/screenshots, a header X-API-Key with your key (or a Header Auth credential), and a JSON body with your urls, options and webhookUrl.
  2. Set webhookUrl to the expression {{ $execution.resumeUrl }}, for example "webhookUrl": "{{ $execution.resumeUrl }}" in the JSON body.
  3. Add a Wait node after it, with Resume set to On Webhook Call and HTTP Method set to POST.
  4. When the batch ends, the run carries on from the Wait node with the payload in body. A Split Out node on body.items gives 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

  1. 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/…).
  2. Send a test to that URL, from the dashboard’s Send test button or the test endpoint.
  3. Back in Zapier, click Test trigger. It finds the sample and shows its fields, such as jobId, status and items.
  4. Add your actions and publish the Zap. A Filter step that only goes on when test is false keeps test sends from running them. Then create batches with the hook URL as their webhookUrl.

Make

  1. 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).
  2. 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.
  3. Add an Iterator on items to handle each URL, and the modules you need. Turn the scenario on, and create batches with the address as their webhookUrl.

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-Agent and any name that starts with X-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.results with your API key (for a completed job), or redeliver the webhook.
  • Drop duplicates. Delivery is at least once, so keep the id (also sent as X-Webhook-Id) of each event you’ve handled and ignore it if it comes again.
  • Answer fast. A 2xx within 10 seconds, or the delivery counts as failed and is tried again.