Shotfly

API reference

Async jobs and 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.

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)
}

Last updated 2026-11-27. Markdown version: /docs/async-jobs.md