Skip to the content
Forge

Webhooks

A webhook sends a project's run events to a URL of yours as they happen: a run queued, started, succeeded or failed, a deploy waiting for approval. Use it to post to a chat, update a dashboard or start something in another system. Each delivery is a signed JSON POST, and Forge retries failed deliveries for about a day.

Set it up

Webhooks belong to a project. Open the project's Webhooks page and Add a webhook. This needs webhook:manage on the project (maintainers and up).

  • URL: where events are POSTed, http or https. Only public addresses are reached, and redirects are not followed.
  • Description: optional, for you.
  • Events: All run events, or the ones you pick.

After Add webhook, Forge shows the Signing secret once. Copy it and store it where your receiver can read it. A project can have at most 20 webhooks. Disable stops deliveries without deleting the webhook; Enable starts them again.

Events

Event When
run.queued The run waits for a runner.
run.scheduled A runner took it.
run.pulling The runner fetches its image.
run.starting Its container or VM is being set up.
run.running Its commands run.
run.succeeded It ended with exit code 0.
run.failed It failed.
run.timed_out It ran past its timeout.
run.cancelled It was cancelled.
run.lost Its runner went away while it ran.
run.cancel_requested Someone asked to cancel it.
run.rejected It ended without running while it waited for approval: rejected, not approved in time, or no longer allowed.
run.approval_requested A deploy to a protected environment waits for approval.

run.* subscribes to all of them. A ping event, sent by Send test, goes to the webhook whatever it subscribed to.

The payload

Every delivery has the same envelope:

{
  "id": "0193a5c2-…",
  "type": "run.failed",
  "occurred_at": "2026-11-27T09:14:03.512Z",
  "project_id": "0192f0e1-…",
  "organization_id": "0192f0d8-…",
  "data": {
    "run_id": "0193a5c1-…",
    "project_id": "0192f0e1-…",
    "organization_id": "0192f0d8-…",
    "number": 412,
    "state": "failed",
    "exit_code": 1,
    "runner_id": "0193a0aa-…",
    "occurred_at": "2026-11-27T09:14:03.512Z"
  }
}
  • data describes the run: its id, number and state, with reason, exit_code and runner_id when there are any.
  • run.approval_requested adds environment (its id and name) and approval_due_at.
  • A ping has only webhook_id in data.
  • Payloads never hold the run spec, its environment values or secrets.

id is the event's. It stays the same when an event goes to several webhooks or is sent again, so use it to drop duplicates. Events can arrive out of order: sort them by occurred_at.

Headers

Header Value
Content-Type application/json
User-Agent Forge-Webhooks/<version>
Forge-Event the event type, such as run.failed
Forge-Delivery the delivery's id
Forge-Signature t=<unix seconds>,v1=<hex>

Verify the signature

v1 is the hex HMAC-SHA256 of <t>.<body> (the timestamp, a dot, then the raw request body) under the signing secret. To check a delivery:

  1. Split Forge-Signature on , and read t and every v1.
  2. Compute the HMAC-SHA256 of t + "." + body with your secret, over the body bytes exactly as received.
  3. Accept the delivery if any v1 equals it, compared in constant time.
  4. Reject it when t is too far from now, for example more than five minutes, against replays.

In Python:

import hashlib, hmac, time

def verify(header: str, body: bytes, secret: str, tolerance: int = 300) -> bool:
    parts = [p.strip().split("=", 1) for p in header.split(",")]
    t = next((v for k, v in parts if k == "t"), None)
    sigs = [v for k, v in parts if k == "v1"]
    if t is None or abs(time.time() - int(t)) > tolerance:
        return False
    want = hmac.new(secret.encode(), f"{t}.".encode() + body, hashlib.sha256).hexdigest()
    return any(hmac.compare_digest(want, s) for s in sigs)

Rotate the secret

New secret makes a new signing secret and shows it once. For the next 24 hours the previous secret signs too, so the header carries two v1 values. Switch your receiver to the new secret within that day and no delivery fails.

Retries and delivery history

A delivery succeeds when your URL answers with a 2xx status within 10 seconds. Anything else is retried, after 10 seconds, 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours: 8 attempts over about 21 hours. Then it fails for good.

Deliveries on a webhook lists what was sent, newest first: its status (Pending, Delivered or Failed), the attempts, the next attempt, how long it took, the error, the payload and the first 1 KiB of your response. Send again sends a delivery's event once more, with the same event id. Deliveries are kept for 30 days.

Test it

Send test sends a ping event to check the URL and your signature check. It shows up in Deliveries like any other.

From the API

Webhooks are under /api/v1/projects/{project}/webhooks and /api/v1/webhooks/{webhook}, with rotate-secret, ping, deliveries and redeliver. See service accounts and API keys for using the API.