Skip to content

Reference

Webhooks

Be told when a generation succeeds or fails, instead of polling.

Add an endpoint under Webhooks in the dashboard and pick its events: generation.succeeded, generation.failed, or both. Each one covers every generation of the workspace, from the API and the Studio.

Delivery

A delivery is a POST with a JSON body: its own id, the event, when it happened, and the generation as GET returns it. Answer with a 2xx within 10 seconds and do the work afterwards.

generation.succeeded
{
  "id": "whd_5f1c0a9e3b7d42c8a61e0f93",
  "type": "generation.succeeded",
  "created_at": "2026-11-27T10:01:12.000Z",
  "data": {
    "id": "gen_4kQ8vT2nLm9Xr7Wd1sYcPa",
    "object": "generation",
    "type": "image",
    "model": "fp-image-1",
    "status": "succeeded",
    "input": {
      "prompt": "A lighthouse on a cliff at dawn, long exposure, soft fog",
      "n": 1,
      "aspect_ratio": "16:9"
    },
    "reserved_usd": 0.025,
    "cost_usd": 0.025,
    "outputs": [
      {
        "id": "file_8Hc2RkQw5ZpT1mVb7nXe3L",
        "status": "succeeded",
        "url": "https://frameport.ai/v1/files/file_8Hc2RkQw5ZpT1mVb7nXe3L?expires=1795779600&signature=Qm9yZW1fZXhhbXBsZV9zaWduYXR1cmU",
        "url_expires_at": "2026-11-27T11:10:00.000Z",
        "content_type": "image/png",
        "cost_usd": 0.025
      }
    ],
    "error": null,
    "created_at": "2026-11-27T10:00:00.000Z",
    "completed_at": "2026-11-27T10:01:12.000Z"
  }
}

A delivery that gets no 2xx (no answer in 10 seconds, an error, or a redirect) is sent again after 1, 5 and 15 minutes: four attempts in all. The same delivery keeps its id on every attempt (also sent as the Frameport-Delivery header, next to Frameport-Event), so a receiver can skip one it has already handled. The dashboard shows each endpoint's last status.

An endpoint whose deliveries all fail for 24 hours (10 in a row at least) is turned off, and everyone in the workspace who manages webhooks gets an email. Turn it back on under Webhooks once it answers again: events in between are not sent again, so read those generations with GET.

Verify the signature

The signing secret (whsec_…) is shown once, when you add the endpoint. Each delivery carries Frameport-Signature: t=<unix seconds>,v1=<hex>, where v1 is the HMAC-SHA256 of <t>.<raw body> with that secret. Compare in constant time and refuse old timestamps.

Node
import crypto from 'node:crypto'

export function verify(rawBody, header, secret, toleranceSeconds = 300) {
  const parts = Object.fromEntries(header.split(',').map(part => part.split('=')))
  const age = Math.abs(Date.now() / 1000 - Number(parts.t))
  if (!parts.t || !parts.v1 || age > toleranceSeconds) return false
  const expected = crypto.createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex')
  return expected.length === parts.v1.length
    && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1))
}
Python
import hashlib, hmac, time

def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
    parts = dict(part.split("=", 1) for part in header.split(","))
    if "t" not in parts or "v1" not in parts or abs(time.time() - int(parts["t"])) > tolerance:
        return False
    signed = parts["t"].encode() + b"." + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts["v1"])
Webhooks tell you a generation settled; the file links inside expire like any other. Read the generation again when you download later.