Webhooks
Get notified when a job finishes instead of polling, what we guarantee about delivery, and how to verify that each webhook really came from HDRflow.
Set webhook_url when you create a job and HDRflow sends a POST request to that URL when the job finishes. It saves you from polling and gets results to your users faster.
The request we send
POST https://yourapp.example.com/hooks/hdrflow
Content-Type: application/json
X-HDRflow-Signature: sha256=5d5b09f6dcb2d53a5fffc60c4ac0d55fabdf556069d6631545f42aa6e3500f2eA completed job:
{
"job_id": "f3ab0f7a-52f3-4b11-bd49-badb7cf1a9d3",
"listing_id": "0b0c9e5b-1ee7-4e36-9adb-2c0f8ed12345",
"status": "completed",
"photos": [
{ "photo_id": "9c1d8e8b-1eb5-4f3f-a3f8-20f9cf4a44e9", "filename": "IMG_0001.ARW", "status": "done", "web_url": "https://...signed-download-url..." }
]
}A failed job:
{
"job_id": "f3ab0f7a-52f3-4b11-bd49-badb7cf1a9d3",
"listing_id": "0b0c9e5b-1ee7-4e36-9adb-2c0f8ed12345",
"status": "failed",
"photos": [
{ "photo_id": "9c1d8e8b-1eb5-4f3f-a3f8-20f9cf4a44e9", "filename": "IMG_0001.ARW", "status": "queued", "web_url": null }
]
}| Field | Meaning |
|---|---|
status | The job's result: completed or failed. This is the only field to act on. |
photos | The job's photos. For a completed job, one entry per finished image, each with status done and a web_url. |
photos[].status | Follows the job. It is never a separate result (see below). |
web_url | A short-lived download link, or null when there is no finished file. Download the file soon after the webhook arrives, and don't store the link. |
Jobs succeed or fail as a whole
A job never partly fails. When it completes, every photo in it is done and has a web_url. When it fails, no photo has a finished file: photos keep the status they had while waiting (usually queued) and web_url is null. There is no photo-level error to handle. Read the job's status, then either download everything or retry the job.
The photos list can be shorter than the number of files you uploaded. Bracketed exposures are merged into one finished image, and only finished images are listed.
What we guarantee about delivery
| Question | Answer |
|---|---|
| Can the same webhook arrive more than once? | Yes. Delivery is at least once on our side, so you may receive the same job_id and status twice. Make your handler idempotent: if you have already handled that job_id with that status, reply 2xx and do nothing. |
| Can one job send more than one webhook? | Yes. A failed job that you retry sends a new webhook with the same job_id when it finishes again, usually completed. |
| Is the order guaranteed? | No. Each job sends its webhook when it finishes, independently of your other jobs. Don't rely on the order webhooks arrive in, across jobs or for one job. If the order matters, fetch GET /jobs/{job_id} and use the status it returns. |
| Are failed deliveries retried? | Yes, automatically: up to 3 attempts in total, all within about a minute. After that we stop. |
| Can a delivery be replayed? | No. There is no way to resend a webhook, from the API or through support. To catch up on anything you missed, call GET /jobs/{job_id}, or GET /jobs/ for your recent jobs. |
| Is every status change sent? | No. Webhooks are sent when processing finishes a job. Other changes, such as a job our team re-edits and delivers by hand, don't send one. |
In short: treat the webhook as a fast notification and GET /jobs/{job_id} as the source of truth. If a job has been running much longer than usual and no webhook has arrived, check the job directly.
Responding to a webhook
Reply with any 2xx status as soon as you have received the request, and do slow work afterwards. We wait up to 15 seconds for your reply. A slower reply, a non-2xx status or a dropped connection counts as a failed attempt and is retried, even if your handler already processed the request. That is one more reason to make it idempotent.
Verifying the signature
Signing is optional and switched on by HDRflow. When it is on, every webhook carries an X-HDRflow-Signature header: sha256= followed by the hex HMAC-SHA256 of the raw request body, made with your signing secret. When it is off, webhooks arrive without the header.
Your HDRflow contact gives you the secret once, privately, during onboarding. Ask them if you want signing turned on. Once you have a secret, reject any webhook without a valid signature: a missing header means the request did not come from us.
Always compute the HMAC over the raw bytes you received, before parsing the JSON, and compare in constant time.
import hmac, hashlib
def verify(raw_body: bytes, signature_header: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature_header or "")const crypto = require('crypto');
function verify(rawBody, signatureHeader, secret) {
const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
const a = Buffer.from(expected);
const b = Buffer.from(signatureHeader || '');
return a.length === b.length && crypto.timingSafeEqual(a, b);
}In Express, read the raw body with express.raw({ type: 'application/json' }) on the webhook route, so the bytes are not re-serialised before you check them.
A handler that covers all of this
@app.post("/hooks/hdrflow")
def hdrflow_webhook(request):
raw = request.body # raw bytes, before JSON parsing
if not verify(raw, request.headers.get("X-HDRflow-Signature"), SECRET):
return 401
event = json.loads(raw)
key = (event["job_id"], event["status"])
if already_handled(key): # duplicates are expected
return 200
queue_for_later(event) # download files in the background
mark_handled(key)
return 200 # reply fast, well within 15 seconds