POST request, so your system learns when an answer changes without polling.
Events include a document entering or leaving a subscription, a job finishing, judging pausing at a budget, a fan-out deferred past a judgment’s rolling limit, a tenant summary that could not be written, an engine changing its behaviour, the fit that a judgment with features reads changing, and an alternatives run waiting for your confirm or finding a better alternative. The events feed lists each type and when Brussle sends it.
Your endpoint receives each event as signed JSON, so you can check that a request came from Brussle. Brussle retries when your endpoint is slow or down. Each event is also in the events feed, for receivers that prefer to pull.
Set up an endpoint
Create an endpoint with its URL and the platform events it receives, given as patterns (job.* or namespace.budget_paused, for example). A subscription names its own endpoint, so an endpoint with no events receives only what its subscriptions send to it.
- The secret. Brussle returns the secret when you create the endpoint and when you rotate the secret, and keeps it encrypted. A
read_writekey that manages the endpoint can read the secret again with a get, but lists andPATCHresponses never show it. namespace_prefixlimits the endpoint to the events of namespaces under the prefix (acme/staging/for a staging receiver, for example). It takes the same forms as a key scope:*, a prefix such asacme/staging/,acme/*, or one namespace. The default is your key’s scope, and a prefix outside your key’s scope isforbidden. A key scoped to a prefix sees and manages only the endpoints inside its scope.eventsare platform event types or patterns (job.*, for example). Brussle refuses a pattern that matches only subscription events orwebhook.test, because a subscription names its own endpoint.descriptionhas a maximum of 256 characters.max_per_secondsets a maximum delivery rate (see retries).- A get shows:
- the endpoint’s
status:active,failingordisabled failing_sinceprevious_secret_expires_at, during a rotationstats:deliveries_24h(the deliveries whose latest attempt was in the last day),success_rate_24handlast_delivery_at
- the endpoint’s
- A delete removes the endpoint’s pending deliveries and its log, so the subscriptions that name the endpoint then send their events only to the events feed.
- A retry with an
Idempotency-Keyis safe. If you send a create, a rotation, a recover or a redeliver again with the same key, you get the result of the first request and nothing changes again (for a create or a rotation, the result includes the secret that the first request made). The other endpoint requests are safe to send again without a key (see idempotency keys). - A test send delivers
webhook.testto this endpoint only, or a sample of an event type when you givetype. Both have"test": true, and the feed never lists them. - How many. Developer has 2 endpoints, Team has 20 and Scale has 100 (pricing). Brussle refuses one more with
plan_required, and itsdetailsname the plan that allows more. After a downgrade, endpoints over the new limit continue to deliver. Brussle never bills deliveries. unavailable(503) means Brussle cannot make a secret for a create or a rotation now. Nothing changed, so send the request again.
Manage endpoints in the dashboard
You can do all of this in the dashboard too. Admins and owners make changes, and every member can look.- Webhooks lists your endpoints with their status, namespaces, last delivery and deliveries of the last day, and shows how many endpoints your plan allows. When you create an endpoint, the page shows its secret one time, with a copy button. Copy the secret then, because the dashboard never shows it again. At your plan’s limit, the page offers the plan with more endpoints.
- An endpoint’s page lets you:
- rotate the secret, and choose how long the old secret continues to sign
- send a test event of any type
- disable and enable the endpoint
- delete the endpoint
- The delivery log on the endpoint’s page shows the status, attempts, response code, latency and next retry of each delivery, and you can filter it by status. Each row has Redeliver, and Recover since… queues again each delivery that failed or was skipped since a time.
- A namespace’s Subscriptions tab lists its subscriptions and creates them. On the Documents tab, Subscribe to this filter opens the create form with the query’s filter in it, or tells you why you cannot subscribe to the filter. A template’s page lists and creates the template’s subscriptions.
- Events is the feed, oldest events first, which you can filter by type and namespace prefix. It opens the JSON of each event and its deliveries.
What your endpoint receives
Each delivery is one event as JSON, signed with your endpoint’s secret, with headers that follow the Standard Webhooks specification:webhook-idis the event’s id. Each retry, redelivery and replay of an event has the samewebhook-id, so use it to remove duplicates.webhook-timestampis the time Brussle signed this attempt, in Unix seconds.webhook-signatureisv1,followed by a base64 HMAC-SHA256. During a secret rotation, it holds two signatures, separated by a space.user-agentnames Brussle and links to this page.- The body is at most 64 KB. When the full body of a subscription event would be more than 63 KB, Brussle leaves out its
attributesandanswersand setstruncatedtotrue, and you useurlwith your own key to get the rest.
Verify the signature
Check each delivery before you trust it. The SDKs do the check in one call:- TypeScript:
verifyWebhook(payload, headers, secret) - Python:
verify_webhook(payload, headers, secret)
- checks the signature and the timestamp
- accepts either signature during a rotation
- compares in constant time
- returns the event, typed by its
type
- A request that fails a check raises
WebhookVerificationError, whosereasonisheaders,timestamporsignature. Answer the request with400. secretcan be a list.- You can change the timestamp tolerance (
tolerancein Python,toleranceSecondsin TypeScript). - An empty or malformed secret, or an empty list, is a bug in your code rather than a bad request. The call raises an ordinary error instead of
WebhookVerificationErrorbefore it checks the request, and never verifies anything.
type.
You can also verify a delivery without the SDK. The check is the Standard Webhooks check, so any Standard Webhooks library can verify Brussle’s deliveries. To write the check yourself:
- Read the body as raw bytes, before any JSON parsing.
- Refuse a
webhook-timestampmore than 5 minutes from your clock, so that nobody can replay a captured request later. - Take the bytes of the secret after
whsec_and base64-decode them to get the key. - Calculate the base64 HMAC-SHA256 of
{webhook-id}.{webhook-timestamp}.{body}with that key. - Compare the result, in constant time, with each
v1,entry inwebhook-signature(one entry for each signing secret, separated by spaces). - Accept the request if the result is equal to one of the entries.
Rotate the secret
When you rotate an endpoint’s secret, Brussle returns the new secret, and the old secret continues to sign beside the new one forprevious_valid_for:
- The default is 24 hours.
- The maximum is 7 days.
0sends the old secret immediately.
Answer 2xx, fast
A delivery succeeds when your endpoint answers with any 2xx status within 15 seconds, of which the connection can use at most 5 seconds. Every other result is a failure (a timeout, a refused connection, a TLS error or any other status), and Brussle sends the delivery again. A 3xx status is also a failure, because Brussle does not follow redirects.- Queue the work, then answer. Store the event or push it onto your own queue, then return
200before you do slow work, since a receiver that does its work before it answers is the usual cause of timeouts and duplicate deliveries. - Remove duplicates by
webhook-id. Brussle delivers each event at least once, so if your 2xx response is lost (because of a timeout, for example), Brussle sends the event again. - Do not rely on the order. A retried event can arrive after a later event.
subscription.enteredandsubscription.exitedevents havesequence, which increases with each change in the namespace, so for one subscription and one document you keep the highestsequenceyou saw.
timeout, dns, tls, connect, blocked_address or http_status.
Retries
Brussle sends a failed delivery again on this schedule:
The schedule makes 9 attempts in about 3 days. Each wait can change by up to 20% in either direction, so the retries from one outage do not all arrive at the same time.
After the ninth attempt, the delivery is
failed and stays in the delivery log for 30 days, and you can send it again from the dashboard or with the API:
-
The delivery log.
GET /webhook-endpoints/{id}/deliverieslists deliveries, newest first, 100 on each page, and you can filter them bystatus(pending,succeeded,failedorskipped). For each delivery, it shows:- its event’s id and type
- its number of
attempts next_attempt_at, while it waits for a retry- the time, status code, latency, error and first 1 KB of response of its latest attempt
-
Redeliver one event.
POST /events/{id}/redeliverwith theendpointqueues a new delivery with the samewebhook-id, whatever happened to the earlier deliveries. The endpoint must include the event’s namespace, and a test send goes again only to the endpoint it tested. -
Recover since a time.
POST /webhook-endpoints/{id}/recoverwithsincequeues again eachfailedorskippeddelivery to the endpoint since that time. It goes back at most 30 days, so an oldersincecounts as 30 days ago. Each delivery gets its full retry schedule again, and the response tells how many deliveries it queued. Brussle resets each delivery in place, so its earlier attempts leave the log and a second call queues nothing twice. -
A disabled endpoint refuses redeliver and recover with
conflict, so enable the endpoint first.
429 or 503 with a Retry-After header (in seconds or as an HTTP date), and Brussle pauses all deliveries to that endpoint for that time, up to 5 minutes. Brussle also waits at least that time before it sends that delivery again, up to the next step in the schedule. Without Retry-After, the pause is 5 seconds.
Brussle never has more than 16 deliveries in progress to one endpoint. An endpoint can also set max_per_second to limit its rate, to any positive number (0.5 for one delivery every 2 seconds, for example), and null removes the limit.
Failing and disabled endpoints
Brussle counts both states from the first failed attempt after the endpoint’s last success, and checks them at each attempt.- Failing. An endpoint becomes
failingwhen nothing reached it for 24 hours and at least 10 attempts failed. Your organization’s owners and admins get an email, and deliveries and retries continue. - Disabled. After 5 days with no successful delivery, the endpoint becomes
disabled, even if it was notfailingfirst, and the owners and admins get an email. Brussle sends nothing more to the endpoint, and its pending deliveries becomeskipped. Brussle still records new events and the events feed lists them, so you lose nothing. - Active again. Any successful delivery makes a failing endpoint
activeagain.
- Fix the receiver.
- Enable the endpoint with
PATCH /webhook-endpoints/{id}and{"enabled": true}, which also clears its failure count. - Recover the deliveries it missed since it started to fail.
{"enabled": false}.
Allow our egress address
Each delivery comes from a fixed address, so you can allow it in a firewall:35.225.20.104
HTTPS only
An endpoint URL must:- start with
https:// - have a certificate from a public certificate authority
- have no user name or password in it
blocked_address. Addresses that are not public include:
- loopback
- RFC 1918
- carrier-grade NAT
- link-local
- multicast
- the other reserved ranges
- the IPv6 equivalents of these ranges
- IPv6 addresses that contain a private IPv4 address
invalid_request. These hosts include an address in the ranges above, localhost, a name with no dot, and a name under a private-use suffix (.internal, .local or .home.arpa, for example).
The delivery log says only that a host is not public, and never shows the address the host resolved to.
Pull instead of push
Each event is also in the events feed (GET /events) for 30 days, in the order Brussle recorded it.
- A receiver that was down can read the feed from the last event it handled, without waiting for retries. An event’s
idworks as a cursor, and it is also thewebhook-idof the event’s deliveries. - A receiver that cannot accept requests from outside can poll the feed, and needs no endpoint.