Skip to content

Webhooks

Webhooks tell your server when a job changes state, so you never have to poll. Deskew signs every delivery, retries failures for about a day, and disables an endpoint that has been failing for three days.

Open Webhooks in the dashboard and add an HTTPS URL. Each endpoint has:

  • a secret (whsec_…) shown once at creation and on demand under Reveal, and rotatable;
  • a list of events it subscribes to (default job.completed and job.failed);
  • a mode, inherited from the dashboard’s Test / Live switch; test jobs only reach test endpoints.

Use Send test to receive a sample job.completed event with "test": true in the payload. Every delivery, with request body, response code and timing, is listed under the endpoint.

You can also pass webhook_url on a single POST /v1/extract. That URL receives the job’s events in addition to any configured endpoints. Deliveries to a per-request URL are signed with a project-less key you cannot verify, so use configured endpoints for anything you need to trust.

Event When
job.queued An async job was accepted
job.processing A worker started on the job
job.completed The result is stored; data.result_url is set
job.failed The job failed; data.error is set

Synchronous jobs that finish inside the request still emit job.processing and job.completed (or job.failed), so a webhook sees every job.

{
"id": "evt_01JE4KD3N8P9Q0R1S2T3U4V5W6",
"type": "job.completed",
"created_at": "2026-12-02T09:16:41.027Z",
"data": {
"id": "job_01JE4KB0X8Y2Z3A4B5C6D7E8F9",
"status": "completed",
"mode": "async",
"file_name": "annual-report.pdf",
"pages": { "total": 48, "done": 48, "failed": 0 },
"credits": 61,
"result_url": "https://api.deskew.dev/v1/jobs/job_01JE4KB0X8Y2Z3A4B5C6D7E8F9/result",
"error": null
}
}

The payload never contains the extracted content. Fetch result_url with your API key.

Request headers:

Header Value
Content-Type application/json
User-Agent deskew-webhooks/1.0
Deskew-Signature t=<unix seconds>,v1=<hex HMAC-SHA256>
X-Delivery-Id whd_…, unique per delivery attempt chain; use it to deduplicate
X-Event-Type Same as type

The signature is HMAC-SHA256 of the string "{t}.{body}" where t is the timestamp from the header and body is the raw request body bytes, keyed with the endpoint secret. Reject deliveries whose timestamp is more than 5 minutes old. Compare in constant time.

import hmac, hashlib, time
def verify_deskew_signature(secret: str, header: str, body: bytes, tolerance: int = 300) -> bool:
try:
parts = dict(p.split("=", 1) for p in header.split(","))
ts = int(parts["t"])
sig = parts["v1"]
except (ValueError, KeyError):
return False
if abs(time.time() - ts) > tolerance:
return False
expected = hmac.new(secret.encode(), f"{ts}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, sig)
# Flask example
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["DESKEW_WEBHOOK_SECRET"]
@app.post("/webhooks/deskew")
def deskew_webhook():
if not verify_deskew_signature(SECRET, request.headers.get("Deskew-Signature", ""), request.get_data()):
abort(400)
event = request.get_json()
if event["type"] == "job.completed":
enqueue_download(event["data"]["result_url"]) # your code
return "", 204

Return any 2xx within 10 seconds. Anything else, including a timeout or a redirect (redirects are not followed), counts as a failure. Do the real work after you have responded.

A failed delivery is retried with increasing delays, up to 8 attempts spread over roughly 24 hours:

Attempt Wait before it
2 30 s
3 2 min
4 10 min
5 30 min
6 1 h
7 4 h
8 6 h

(An 8-hour step exists after that in the schedule but is never reached with the default of 8 attempts.) Every attempt carries the same X-Delivery-Id, so you can safely ignore a repeat you have already processed. Events may also arrive out of order; use data.status rather than the arrival order.

Each endpoint tracks when its current failure streak started. If deliveries keep failing for more than 3 days, the endpoint is set inactive, disabled_at is recorded and it stops receiving events. A single successful delivery resets the streak. Re-enable the endpoint from the dashboard once your receiver is healthy.

Any delivery can be sent again from the dashboard (Redeliver on the delivery row). The replay carries the original event body with a fresh signature and timestamp, gets a new X-Delivery-Id, and is attempted once without the retry schedule.

  • Verify Deskew-Signature on every request and reject anything older than 5 minutes.
  • Return 2xx in under 10 seconds; process asynchronously.
  • Deduplicate on X-Delivery-Id or id.
  • Fetch result_url within 24 hours; results expire.
  • Keep separate endpoints for test and live.