Skip to Content
Payload Bay

Runner overview

The Runner delivers webhooks to an application that is not reachable from the internet, such as one on a laptop or a private network.

The Runner delivers webhooks to an application that is not reachable from the internet, such as one on a laptop or a private network. Payload Bay stays the public receiving endpoint; a small agent next to your application connects outbound, claims queued requests and replays them to a local URL. This is durable webhook delivery, not a general reverse proxy: nothing from the internet can reach your application except the requests Payload Bay has accepted and queued.

Both the Core transport and the agent are unreleased development software. The agent lives in payloadbay/runner.

Two ways to use it

DestinationForwarding target
Used byA route with a processing script that sends to a configured destinationA forwarding route's target group
SelectionThe script decidesThe first healthy target by priority
HealthNone; an offline Runner makes the send time out and the script retriesDerived from Runner connectivity; an offline Runner is skipped and events queue when no target is healthy
GuideOutbound private receiver RunnerRunner as a forwarding target

Both use the same agent, the same two endpoints and the same token format; the agent cannot tell them apart. A credential is scoped to exactly one destination or one Runner target.

Run the agent

The agent needs Node 22.23.5 or newer. Configuration is environment-only; the credential, the Core URL and the local URL never appear as command-line arguments or in logs.

VariableRequiredDefaultMeaning
PAYLOADBAY_URLyesCore HTTPS origin, no path. Plain HTTP is accepted only on loopback.
PAYLOADBAY_RUNNER_TARGETyesThe local HTTP(S) URL requests are sent to. The server can never change it.
PAYLOADBAY_RUNNER_TOKENyesThe pabr_... credential from Core.
PAYLOADBAY_RUNNER_POLL_INTERVAL_MSno2000Pause between idle polls (250 to 60000). Keep it far below Core's 20-second presence window.
PAYLOADBAY_RUNNER_TIMEOUT_MSno15000Longest wait for the local receiver (1000 to 60000), also bounded by the lease.
PAYLOADBAY_RUNNER_MAX_BACKOFF_MSno30000Cap on the reconnect backoff (1000 to 300000).
PAYLOADBAY_RUNNER_GRACE_MSno10000How long a delivery in flight may finish after a stop signal (0 to 120000).
export PAYLOADBAY_URL=https://payloadbay.example.test
export PAYLOADBAY_RUNNER_TARGET=http://localhost:3000/webhooks
export PAYLOADBAY_RUNNER_TOKEN=...   # from your secret store
node src/cli.mjs

The agent fails at start-up for a malformed configuration and exits with code 1.

Connection behavior

  • Polling is the connection. The agent calls POST /api/v1/runner/claim in a loop. An idle poll returns 204 and tells Core the Runner is alive. After a delivery the agent polls again at once, so a backlog drains without the idle pause.
  • Reconnect. A failed poll or acknowledgement is retried with exponential backoff and full jitter, capped by PAYLOADBAY_RUNNER_MAX_BACKOFF_MS; the delay resets after any success. During an outage a Runner target becomes unhealthy after the presence window and events use the next target or queue.
  • Rejected credential. 401 or 403 (revoked, rotated, or the creator lost access) is permanent: the agent stops with exit code 1 instead of retrying.
  • Graceful shutdown. SIGINT or SIGTERM stops claiming new work, lets the delivery in flight finish and report within PAYLOADBAY_RUNNER_GRACE_MS, then exits 0. A delivery still running after the grace period is cancelled and never reported as a success; its lease expires and Core fails over or redelivers. A second signal exits immediately with code 130.

Protocol

The protocol is two bearer-authenticated JSON endpoints. Only the Runner token is accepted on them; sessions and ordinary API keys are not.

POST /api/v1/runner/claim returns 204 when nothing is waiting, or 200 with one delivery:

FieldMeaning
idThe delivery (attempt) identifier.
leaseTokenSecret proof of the lease, needed to acknowledge.
leaseExpiresAtWhen the lease ends. The agent refuses a delivery with under a second left.
method, headers, bodyBase64The request to replay. GET and HEAD carry no body.
idempotencyKeyA stable 64-character hexadecimal key, sent to the receiver as x-payloadbay-delivery-id.

POST /api/v1/runner/deliveries/{id}/complete takes {"leaseToken": "...", "result": ...} where result is {"status": 200, "bodyBase64": "...", "contentType": "..."} (at most 64 KiB of response) or {"networkError": "local_delivery_failed"}, and returns 204. A second identical report is accepted; a different one, or an expired, superseded, foreign or revoked lease, gets 409 stale_delivery or 409 delivery_result_changed and cannot finalize anything.

The agent sends the bytes to its fixed local URL, drops host and hop-by-hop headers, never follows redirects, and treats a larger response as a failed delivery.

Security

  • Credentials are random, hashed at rest, scoped to one destination or target and revocable. The creator's permissions and any parent API-key limits are checked again on every use.
  • Queued request bytes and headers are encrypted with the instance encryption key and cleared once the delivery ends or expires.
  • Core never supplies the local URL, so a compromised server envelope cannot make the agent call another address.
  • Delivery is at least once. If the receiver acted but the acknowledgement was lost, the event can arrive again; deduplicate on x-payloadbay-delivery-id.
Edit on GitHub

On this page