Webhooks
Have Factor tell your systems what happened.
A webhook posts a signed JSON body to a URL of yours when something happens — a run finishing, a spend cap being reached, a machine failing.
Creating one
Dashboard, Webhooks → Add. Give it an HTTPS URL and pick the events you care about. The signing secret is shown once; store it then.
The events
| Event | When |
|---|---|
sandbox.started | A sandbox began running. |
sandbox.succeeded | It exited zero. |
sandbox.failed | It exited non-zero, or the machine failed. |
factory.deployed | A factory came up, or was redeployed. |
factory.suspended | Suspended, by you or by its idle timeout. |
factory.resumed | Resumed. |
factory.failed | It stopped in a way nobody asked for. |
factory.terminated | Destroyed. |
artifacts.downloaded | Somebody pulled a run's results. |
billing.spend_cap_reached | The cap was hit, and machines were stopped. |
billing.credits_low | Credit is running out. |
abuse.flagged | A machine was flagged for review. |
member.joined / member.removed | Team membership changed. |
What arrives
{"event": "sandbox.succeeded","id": "whd_01M0P4K2ZQ8N","created_at": "2026-09-05T09:41:12Z","data": { "factory_id": "fac_01M0AM8702EJN8VV2QPQGQ55SJ", "exit_code": 0, "started_at": "2026-09-05T09:22:48Z", "finished_at": "2026-09-05T09:41:10Z"}}With these headers:
| Header | |
|---|---|
Factory-Event | The event name, so you can route without parsing the body. |
Factory-Delivery | A unique id for this delivery — use it to deduplicate. |
Factory-Timestamp | Unix seconds, and part of what is signed. |
Factory-Signature | v1= followed by the HMAC. |
Verifying the signature
Do this before you read the body. A webhook endpoint is a public URL, and without verification anybody who finds it can tell you a job succeeded.
The signature is HMAC-SHA256 over <timestamp>.<raw body>, keyed with your
signing secret.
import { createHmac, timingSafeEqual } from "node:crypto"; export function verify(secret, headers, rawBody) {const timestamp = Number(headers["factory-timestamp"]);const signature = headers["factory-signature"]; // Refuse anything outside five minutes, whatever the digest says: a valid// signature on an old request is exactly what a replay is.if (Math.abs(Date.now() / 1000 - timestamp) > 300) return false; const expected = "v1=" + createHmac("sha256", secret) .update(timestamp + "." + rawBody) .digest("hex"); const a = Buffer.from(signature);const b = Buffer.from(expected);return a.length === b.length && timingSafeEqual(a, b);}import hashlib, hmac, time def verify(secret: str, headers, raw_body: bytes) -> bool: timestamp = int(headers["Factory-Timestamp"]) if abs(time.time() - timestamp) > 300: return False expected = "v1=" + hmac.new( secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256, ).hexdigest() return hmac.compare_digest(expected, headers["Factory-Signature"])Retries
Answer 2xx and the delivery is done. Answer 5xx, 429 or 408 and it is
retried with a widening gap. Any other 4xx is abandoned: a body your endpoint
rejects will be rejected the same way next time.
Deliveries that keep failing eventually disable the endpoint, and the dashboard says which failure did it.
Checking it works
Send test on the webhook posts a webhook.test event immediately. Every
attempt, its response and its status are listed under Deliveries, and you
can replay any of them.