Webhooks & polling
Every Fluxpool generation is asynchronous: the first POST answers at once with a generation id, and the file follows when the model is done. There are two ways to find out when that is: poll for it, or register a webhook and Fluxpool sends a signed POST to your server when a run finishes or fails, an approval is asked for or decided, a client leaves review feedback, or a project nears its budget.
Polling
The first response already carries the links the file will be served from:
{
"created": 1785845810,
"id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"status": "pending",
"model": "flux-2-pro",
"type": "image",
"estimated_credits": 12,
"credits_used": null,
"data": [
{
"url": "https://api.fluxpool.ai/v1/files/6dcc89ce-964e-466e-8100-ba2bdfb6d07c?e=…&s=…",
"s3_url": "https://…amazonaws.com/…",
"app_url": "https://app.fluxpool.ai/library?space=…&asset=6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"generation_id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"status": "pending"
}
]
} The three file links
| Field | What it is |
|---|---|
url | A short download link, valid for 24 hours. It answers 409 not_ready until the generation finishes, then redirects to a freshly signed S3 link. No API key needed: the signature in the link is the credential, so treat it like a password. |
s3_url | The S3 link behind it, for a client that wants to skip the redirect. Long, and valid for 1 hour. |
app_url | Opens the file in your Fluxpool library. It never expires, but only someone signed in to that workspace can see it. |
All three are null when there is no file to point at. A short link that has expired answers 410 link_expired; ask for the generation again with GET /v1/generations/{id} to get a new one. A deleted file answers 404.
Option 1: poll the generation
Best when you want structured status: errors, credits used, size and duration.
curl https://api.fluxpool.ai/v1/generations/6dcc89ce-964e-466e-8100-ba2bdfb6d07c \
-H "Authorization: Bearer $FLUXPOOL_API_KEY" Poll every 3 seconds or so until status is completed or failed. Other values on the way: pending, processing, and awaiting_approval (in a team workspace with approvals on, a member's run that waits for an owner or admin).
Option 2: poll the short link
Cheaper when you only want the bytes. A HEAD (or GET) on data[0].url answers 409 while the run is going and 302 with a Location header once the file is ready.
curl -sI "https://api.fluxpool.ai/v1/files/6dcc89ce-…?e=…&s=…"
# HTTP/2 409 -> not finished yet
# HTTP/2 302 -> ready; Location: is the file Complete Python example
import os
import time
import requests
headers = {"Authorization": f"Bearer {os.environ['FLUXPOOL_API_KEY']}"}
# 1. Submit
submit = requests.post(
"https://api.fluxpool.ai/v1/videos/generations",
headers=headers,
json={
"model": "seedance-v2",
"prompt": "A drone shot over a coral reef",
"duration": 5,
"resolution": "720p",
},
).json()
gen_id = submit["id"]
# 2. Poll the status
while True:
status = requests.get(
f"https://api.fluxpool.ai/v1/generations/{gen_id}",
headers=headers,
).json()
if status["status"] == "completed":
video_url = status["data"][0]["url"] # short link, valid 24 hours
break
if status["status"] == "failed":
raise RuntimeError(status.get("error") or "generation failed")
time.sleep(3)
# 3. Keep a copy: the link follows the redirect to the file.
with open("video.mp4", "wb") as f:
f.write(requests.get(video_url).content) Webhooks Beta
A workspace registers up to 10 https endpoints. When something happens in it, Fluxpool sends each endpoint that listens for that event a JSON POST, signed with that endpoint's own secret. Webhooks belong to the workspace, not to a request: there is no per-request callback URL on the generation endpoints.
Each event is recorded in the same database transaction as the change it describes, so a finished run can't slip through without its event. Most are sent within seconds; anything waiting goes out within a minute.
Who can use them
Webhooks are in beta
They are switched on account by account. If the webhooks API answers 403 feature_not_enabled, email hi@fluxpool.ai and we will switch them on for your account.
Beyond the beta switch, the server checks two things on every webhooks request:
- •The caller is an owner or admin of the workspace. With an API key, that is the person who made the key, in the key's workspace. Anyone else gets
403forbidden. - •The workspace is on a plan with API access. Otherwise the answer is
403plan_upgrade_requiredwithdetails.limit: "api_access".
You can manage them without code, too: in the app, open Settings → Webhooks to add endpoints, send a test and see deliveries. Verify signatures there gives you the checking code with your own secret filled in, and checks a delivery in the browser.
Create an endpoint
POST /v1/webhooks with:
| Field | Type | Notes |
|---|---|---|
url | string | Required. https:// only, port 443 or 8443, no user name or password in it, up to 2,000 characters. The host must resolve to a public address: private, loopback, link-local and other reserved ranges are refused, when you save it and again on every send. |
events | string[] | Required. Event types from the list below, or ["*"] for all of them, including any added later. |
description | string | Optional, up to 200 characters. |
curl https://api.fluxpool.ai/v1/webhooks \
-H "Authorization: Bearer $FLUXPOOL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/fluxpool/webhooks",
"events": ["generation.completed", "generation.failed"],
"description": "Production"
}' import os
import requests
r = requests.post(
"https://api.fluxpool.ai/v1/webhooks",
headers={"Authorization": f"Bearer {os.environ['FLUXPOOL_API_KEY']}"},
json={
"url": "https://example.com/fluxpool/webhooks",
"events": ["generation.completed", "generation.failed"],
"description": "Production",
},
)
r.raise_for_status()
created = r.json()
print(created["endpoint"]["id"])
print(created["secret"]) # store it as FLUXPOOL_WEBHOOK_SECRET const res = await fetch('https://api.fluxpool.ai/v1/webhooks', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.FLUXPOOL_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com/fluxpool/webhooks',
events: ['generation.completed', 'generation.failed'],
description: 'Production',
}),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { endpoint, secret } = await res.json();
// store secret as FLUXPOOL_WEBHOOK_SECRET It answers 201 with the endpoint and its signing secret:
{
"endpoint": {
"id": "c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f",
"url": "https://example.com/fluxpool/webhooks",
"description": "Production",
"events": ["generation.completed", "generation.failed"],
"active": true,
"disabled_reason": null,
"secret_last4": "Q2xw",
"consecutive_failures": 0,
"last_success_at": null,
"last_failure_at": null,
"created_at": "2026-10-28T09:12:44.104Z",
"updated_at": "2026-10-28T09:12:44.104Z"
},
"secret": "whsec_…"
} Keep the secret on your server. You can read it again later with GET /v1/webhooks/{id}/secret.
Manage endpoints
All routes take your API key as Authorization: Bearer fp_live_….
| Method and path | What it does | Answers |
|---|---|---|
POST /v1/webhooks | Create an endpoint | 201 { endpoint, secret } |
GET /v1/webhooks | List the workspace's endpoints | { endpoints, event_types } |
POST /v1/webhooks/{id} | Update: any of url, events, description, active | { endpoint } |
DELETE /v1/webhooks/{id} | Delete it, with its delivery history | { deleted: true, endpoint_id } |
POST /v1/webhooks/{id}/rotate | Make a new signing secret | { endpoint, secret } |
GET /v1/webhooks/{id}/secret | Read the current secret | { secret } |
POST /v1/webhooks/{id}/test | Send a webhook.test event now | { delivery_id } |
GET /v1/webhooks/{id}/deliveries?limit=50 | Recent deliveries, newest first (limit 1 to 100, default 50) | { deliveries } |
POST /v1/webhooks/deliveries/{id}/resend | Send a delivery's event again | { delivery_id } |
Updating is a POST with only the fields you change. "active": false switches an endpoint off; "active": true switches it back on and resets its failure count. Nothing is recorded for an endpoint while it is off, so events from that time are not sent later.
The endpoint object:
| Field | Notes |
|---|---|
id, url, description, events | As saved. events is ["*"] when it listens for everything. |
active | false when you switched it off or Fluxpool did. |
disabled_reason | "turned off" (you), "failing" (Fluxpool, see retries), or null. |
secret_last4 | The last 4 characters of the secret, to tell secrets apart. |
consecutive_failures, last_success_at, last_failure_at | Delivery health. |
created_at, updated_at | ISO 8601 timestamps. |
Errors
Refusals use the same shape as the rest of the API: { "error": { "message", "type", "param", "code", "details" } }.
| Status | code | When |
|---|---|---|
400 | validation_error | A bad url, an unknown event type, a description over 200 characters, nothing to change on an update, or an 11th endpoint. message says which. |
403 | feature_not_enabled | Webhooks aren't switched on for you yet (beta). |
403 | forbidden | You aren't an owner or admin of the workspace. |
403 | plan_upgrade_required | The workspace's plan doesn't include API access. |
404 | not_found | No endpoint or delivery with that id in this workspace. |
502 | upstream_error | Webhooks are briefly unavailable. Try again. |
Events
| Type | Sent when | data |
|---|---|---|
generation.completed | A run finishes. | generation_id, status, model, media_type, user_id, credits, file_url |
generation.failed | A run fails or is cancelled. | The same first five, credits, error: { code, message }, cancelled |
generation.awaiting_approval | A member's run waits for an owner or admin to approve it. | The same first five, credits (the estimate) |
generation.approval_decided | That run is approved, declined, or expires unapproved after 48 hours. | The same first five, decision, decided_by |
review.feedback_created | A client approves, asks for changes, or comments on a review link. | feedback_id, review_link_id, review_title, asset_id, kind, body, reviewer_name |
project.budget_warning | A charge brings a project's spend to 80% of its budget. | project_id, name, budget_credits, spent_credits, percent, generation_id |
project.budget_reached | A charge brings it to 100% or more. | The same as the warning |
webhook.test | You send a test. | message, endpoint_id |
- •Prompts are never included.
- •
modelis the model id you generate with (as inGET /v1/models), andmedia_typeisimageorvideo.user_idis the member who started the run. - •
creditsongeneration.completedandgeneration.failedis what the run cost, less any refund, counted when the event is first sent. A failed run is normally refunded, so it is usually0. - •
file_urlis a short link, valid for 24 hours from the first send. - •An approved run sends
generation.approval_decidedwithdecision: "approved"and its newstatus, thengeneration.completedorgeneration.failedwhen it ends. A declined or expired one ends there, withstatus: "failed"anddecided_by: nullwhen it expired. A waiting run that is cancelled instead sendsgeneration.failed. - •Budget events fire once per crossing: one charge past both lines sends only
project.budget_reached. If refunds bring spend back under a line, a later charge can cross it, and report it, again. - •
kindon review feedback isapprove,changesorcomment.
The payload
Every event has the same envelope; data changes with the type. id is the event id, the same on every retry and resend.
{
"id": "0b6f2a4e-1c3d-4e5f-8a9b-0c1d2e3f4a5b",
"type": "generation.completed",
"created_at": "2026-10-28T09:14:03.512Z",
"workspace_id": "2b1e7c40-5d1f-4a8e-9b0c-3f6a7d8e9c10",
"data": {
"generation_id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"status": "completed",
"model": "flux-2-pro",
"media_type": "image",
"user_id": "9a4f1e22-6c3b-4d5e-8f70-1a2b3c4d5e6f",
"credits": 12,
"file_url": "https://api.fluxpool.ai/v1/files/6dcc89ce-964e-466e-8100-ba2bdfb6d07c?e=…&s=…"
}
} "data": {
"generation_id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"status": "failed",
"model": "seedance-v2",
"media_type": "video",
"user_id": "9a4f1e22-6c3b-4d5e-8f70-1a2b3c4d5e6f",
"credits": 0,
"error": { "code": "…", "message": "…" },
"cancelled": false
} "data": {
"generation_id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"status": "pending",
"model": "seedance-v2",
"media_type": "video",
"user_id": "9a4f1e22-6c3b-4d5e-8f70-1a2b3c4d5e6f",
"decision": "approved",
"decided_by": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9"
} "data": {
"feedback_id": "7f8e9d0c-1b2a-4c3d-9e4f-5a6b7c8d9e0f",
"review_link_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"review_title": "Spring campaign, round 2",
"asset_id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"kind": "changes",
"body": "Warmer light on the second shot, please.",
"reviewer_name": "Dana"
} "data": {
"project_id": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
"name": "Spring campaign",
"budget_credits": 5000,
"spent_credits": 4012,
"percent": 80,
"generation_id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c"
} Headers sent with every delivery:
| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | Fluxpool-Webhooks/1.0 |
Fluxpool-Event-Id | The event id (the body's id). |
Fluxpool-Event-Type | The event type. |
Fluxpool-Delivery-Id | This delivery. A resend has a new one. |
Fluxpool-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256>, see below. |
Verifying the signature
Check every delivery before you trust it. Fluxpool-Signature looks like t=1793166644,v1=e382…, where:
- •
tis when this attempt was sent, in Unix seconds. Each retry is signed afresh, so it gets a newt. - •
v1is the hex HMAC-SHA256 of the string<t>.<raw body>(the timestamp, a dot, then the body exactly as sent), keyed with the endpoint's whole secret,whsec_prefix included.
So: read the raw body before any JSON parsing (re-serialising changes the bytes), compute the same HMAC, compare in constant time, and turn away a t more than 5 minutes from now so an old delivery can't be replayed. Fluxpool doesn't enforce that window itself; it is your check to make.
import crypto from 'node:crypto';
const TOLERANCE_SECONDS = 300; // 5 minutes
// rawBody: the request body exactly as received (a Buffer or string).
// header: the Fluxpool-Signature header.
// secret: the endpoint's whole secret, whsec_ prefix included.
export function verifyFluxpoolSignature(rawBody, header, secret) {
const parts = {};
for (const piece of String(header || '').split(',')) {
const i = piece.indexOf('=');
if (i > 0) parts[piece.slice(0, i).trim()] = piece.slice(i + 1).trim();
}
const t = Number(parts.t);
if (!Number.isInteger(t) || !parts.v1) return false;
if (Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false;
const expected = crypto.createHmac('sha256', secret)
.update(`${t}.`)
.update(rawBody)
.digest();
const given = Buffer.from(parts.v1, 'hex');
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
}
// Express: keep the body raw on this route.
// app.post('/fluxpool/webhooks', express.raw({ type: 'application/json' }), (req, res) => {
// if (!verifyFluxpoolSignature(req.body, req.get('Fluxpool-Signature'), process.env.FLUXPOOL_WEBHOOK_SECRET)) {
// return res.sendStatus(400);
// }
// const event = JSON.parse(req.body);
// res.sendStatus(200); // answer quickly, then do the work
// }); import hashlib
import hmac
import time
TOLERANCE_SECONDS = 300 # 5 minutes
def verify_fluxpool_signature(raw_body: bytes, header: str, secret: str) -> bool:
"""raw_body: the request body exactly as received (bytes).
header: the Fluxpool-Signature header.
secret: the endpoint's whole secret, whsec_ prefix included."""
parts = {}
for piece in (header or "").split(","):
key, sep, value = piece.partition("=")
if sep:
parts[key.strip()] = value.strip()
try:
t = int(parts["t"])
except (KeyError, ValueError):
return False
if abs(time.time() - t) > TOLERANCE_SECONDS:
return False
expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))
# Flask:
# @app.post("/fluxpool/webhooks")
# def fluxpool_webhook():
# if not verify_fluxpool_signature(request.get_data(), request.headers.get("Fluxpool-Signature"),
# os.environ["FLUXPOOL_WEBHOOK_SECRET"]):
# abort(400)
# event = request.get_json()
# return "", 200 Delivery and retries
- •Any 2xx answer within 10 seconds counts as delivered. The reply body is ignored. Redirects are not followed, so a
3xxcounts as a failure. - •A failed attempt is tried again after 1 min, 5 min, 30 min, 2 h, 6 h and 24 h: seven tries in all, over about a day and a half. After the last one the delivery is marked
failed. - •Every retry and resend carries the same body, byte for byte, with a fresh signature.
- •An endpoint that has failed for 3 days with no success in between is switched off (
active: false,disabled_reason: "failing"), and the person who made it gets an email. Fix it, then switch it back on with"active": true. - •Deliveries can arrive out of order, and you may see an event more than once (a resend, say). Use
Fluxpool-Event-Idto skip events you have already handled, and answer quickly: do slow work after you reply. - •Events and their delivery history are kept for 30 days.
See and resend deliveries
curl "https://api.fluxpool.ai/v1/webhooks/c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f/deliveries?limit=20" \
-H "Authorization: Bearer $FLUXPOOL_API_KEY" {
"deliveries": [
{
"id": "8c9d0e1f-2a3b-4c4d-9e5f-6a7b8c9d0e1f",
"event_id": "0b6f2a4e-1c3d-4e5f-8a9b-0c1d2e3f4a5b",
"event_type": "generation.completed",
"status": "pending",
"attempts": 2,
"next_attempt_at": "2026-10-28T09:20:03.900Z",
"last_status_code": 503,
"last_error": "HTTP 503",
"last_duration_ms": 412,
"created_at": "2026-10-28T09:14:03.530Z",
"delivered_at": null
}
]
} status is pending (waiting for its next try), succeeded or failed. To send one again, use its delivery id:
curl -X POST https://api.fluxpool.ai/v1/webhooks/deliveries/8c9d0e1f-2a3b-4c4d-9e5f-6a7b8c9d0e1f/resend \
-H "Authorization: Bearer $FLUXPOOL_API_KEY" A resend is the same event (same id, same body) as a new delivery, sent at once. Because the body is the same, a file_url in it may have expired by then; get a fresh link from GET /v1/generations/{id}.
Rotate the secret
curl -X POST https://api.fluxpool.ai/v1/webhooks/c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f/rotate \
-H "Authorization: Bearer $FLUXPOOL_API_KEY" This answers { endpoint, secret } and the new secret takes over at once: every send from then on, retries of older events included, is signed with it. There is no overlap with the old one, so update your server straight away (or briefly accept either secret while you switch).
Send a test
curl -X POST https://api.fluxpool.ai/v1/webhooks/c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f/test \
-H "Authorization: Bearer $FLUXPOOL_API_KEY" This sends a webhook.test event to that endpoint straight away, whatever events it listens for, and answers { delivery_id } so you can find it in the deliveries list. Its data is { "message": "A test event from Fluxpool.", "endpoint_id": "…" }. An endpoint that is switched off won't get it.