# Async jobs and webhooks

> Queue screenshots with POST /v1/jobs and receive results through signed webhooks.

`POST /v1/jobs` takes the same parameters as a JSON body and returns `202` with a `job_id`. Poll `GET /v1/jobs/:id` (results are kept for 24 hours) or pass `webhook_url` to receive the result.

Webhooks are signed with the secret of the key that created the job: `X-Shotfly-Signature: t=<unix>,v1=<hex>`, where `v1` is HMAC-SHA256 of `<t>.<raw body>`. Reject timestamps older than five minutes. Failed deliveries are retried with backoff for about a day; see `GET /v1/webhook-deliveries`.

```js
import { createHmac, timingSafeEqual } from 'node:crypto'

function verify(rawBody, header, secret) {
  const { t, v1 } = Object.fromEntries(header.split(',').map((p) => p.split('=')))
  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false
  const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`).digest()
  const given = Buffer.from(v1, 'hex')
  return given.length === expected.length && timingSafeEqual(given, expected)
}
```

---

Source: https://shotfly.dev/docs/async-jobs · Last updated 2026-11-27
