Webhook signatures and retries
What a webhook delivery contains and how MockHub sends it, for anyone writing the receiver. To set a webhook up, see Send webhooks from a project; for verification code, see Verify webhook signatures.
Request
Section titled “Request”A delivery is one HTTP request to the webhook’s Target URL, with its Method (POST, PUT or PATCH), the headers below, and a body that is either the standard envelope or the webhook’s Body template filled in.
Headers
Section titled “Headers”| Header | Value |
|---|---|
Content-Type |
The webhook’s Content type; application/json unless changed |
X-MockHub-Webhook-Id |
The webhook’s id, a UUID |
X-MockHub-Delivery |
The delivery’s id, a UUID. The same on every attempt of one delivery; a replay has its own |
X-MockHub-Cause |
What fired it: manual, scheduled, mock-served or replay |
X-MockHub-Timestamp |
When this attempt was signed, in Unix seconds, such as 1700000000 |
X-MockHub-Signature |
v1= followed by 64 lowercase hexadecimal characters |
User-Agent |
MockHub-Webhook/1, unless a static header spelled exactly User-Agent sets another |
| Static headers | Each name and value set on the webhook, sent unchanged |
A static header’s name is a single HTTP token: letters, digits and !#$%&'*+-.^_`|~, with no spaces, and not made only of digits. Each name can be used once, in any case, and a value cannot contain a control character other than tab. These names are reserved, in any case, because MockHub or the HTTP connection sets them:
Content-Type, which comes from Content type- anything starting with
X-MockHub- Host,Expect,Content-Length,Transfer-Encoding,Connection,Keep-Alive,TE,Trailer,Upgrade,Accept-Encoding,Via,Proxy-Authorization,Proxy-Connection,X-Forwarded-For,X-Forwarded-ProtoandX-Forwarded-Host
The webhook form refuses one with, for example:
X-MockHub-Test is set by the delivery itself, not by a webhook.Content-Type comes from the Content type field, not from a header.X Token is not a header name: use letters, digits and dashes, no spaces, and not only digits.A configuration document gets the same rules in its own words, such as The "X-MockHub-Test" header is reserved and cannot be set on a webhook., "X Token" is not a valid header name., The "x-token" header is set twice. or The "X-Token" header value contains a control character.
Header values are never shown again
Section titled “Header values are never shown again”Once saved, a static header’s value is stored encrypted and shown nowhere: the webhook, its deliveries, the configuration document and a saved pack all show it as [REDACTED]. Every delivery still sends it.
To keep a saved value, leave it as it is. In the webhook form its field is empty, with the placeholder Hidden; type to replace; in a configuration document its value stays [REDACTED]. To change it, type or write the new value. A hidden value belongs to its name, so a renamed header needs its value again: the form says Type a value for X-Api-Key: the hidden one stays with X-Token., and a configuration document gets The "X-Api-Key" header has no stored value to keep; send its value. A header’s value cannot be the text [REDACTED] itself.
Signature
Section titled “Signature”Every delivery is signed with the webhook’s signing secret:
| Part | Value |
|---|---|
| Key | The secret exactly as shown, whsec_ and 64 hexadecimal characters, prefix included |
| Signed string | The value of X-MockHub-Timestamp, a full stop, and the request body byte for byte as sent |
| Algorithm | HMAC-SHA256 |
| Encoding | Lowercase hexadecimal, after v1= |
The signature is computed when each attempt is sent, so a retry or a replay carries a new timestamp and a new signature over the same body. It is always made with the webhook’s secret at that moment: after a rotation, retries of older deliveries are signed with the new secret. MockHub never sends two signatures.
To verify, compute the same HMAC over the timestamp and the raw body you received, compare it with the value after v1= using a constant-time comparison, and reject a timestamp too far from your own clock. MockHub does not set that window; five minutes on either side is a common choice, and retries pass it because they are signed afresh.
A fixed example, from MockHub’s own tests:
Secret: whsec_0123456789abcdefX-MockHub-Timestamp: 1700000000Body: {"a":1}Signed string: 1700000000.{"a":1}X-MockHub-Signature: v1=9f5e37cdc7ea587c7c02062d93283cad000d66a831b2a1676418696db47ed6c2The signature covers the timestamp and the body only, not the method, the address or any other header.
Standard envelope
Section titled “Standard envelope”With Body template empty, the body is this JSON object, shown here with spaces added. MockHub sends it on one line, with / written as \/ and characters outside ASCII as \u escapes; any JSON parser reads them the same way, but verify the signature against the bytes as they arrived.
{ "event": "mock-served", "firedAt": "2026-09-30T09:41:07+00:00", "deliveryId": "5b1f0c7e-2d4a-4e9b-8f3c-6a7d9e0b1c2d", "project": { "id": "0d8e6f4a-9b3c-4a1e-b7d2-3c5f8e1a9b40", "name": "Orders API" }, "webhook": { "id": "e4a7c2b9-1f6d-4b8e-a3c5-7d9f0e2b4a61", "name": "Order created" }, "mock": { "id": "9c3b5d7e-8a1f-4e2c-b6d4-0f7a9e3c5b18", "name": "Create order" }, "request": { "method": "POST", "path": "/orders" }, "responseStatus": 202}| Field | Value |
|---|---|
event |
What fired the webhook: manual, scheduled or mock-served. A replay resends the original body, so it keeps the original’s event |
firedAt |
When the webhook fired, in ISO 8601 and UTC. For a mock trigger, a moment after the mock answered, before any delay |
deliveryId |
The delivery’s id. A replay keeps the original’s; its X-MockHub-Delivery header has its own |
project |
The project’s id and name |
webhook |
The webhook’s id and name |
mock |
The id and name of the mock that fired the webhook, or null |
request |
The method and path of the request that mock answered, or null |
responseStatus |
The status code the mock answered with, or null |
mock, request and responseStatus are null for a delivery fired by hand or by a schedule.
Body template placeholders
Section titled “Body template placeholders”A Body template is sent as written, with each {{name}} replaced. Spaces inside the braces are allowed, and a name MockHub does not know is refused when you save, with Unknown placeholder "{{name}}" in the body template.
| Placeholder | Replaced with |
|---|---|
{{event}} |
What fired the webhook: manual, scheduled or mock-served |
{{firedAt}} |
When the webhook fired, such as 2026-09-30T09:41:07+00:00 |
{{now}} |
When the body was built, in the same form |
{{delivery.id}} |
The delivery’s id |
{{webhook.id}} |
The webhook’s id |
{{webhook.name}} |
The webhook’s name |
{{project.id}} |
The project’s id |
{{project.name}} |
The project’s name |
{{mock.id}} |
The id of the mock that fired the webhook |
{{mock.name}} |
That mock’s name |
{{request.method}} |
The method of the request the mock answered |
{{request.path}} |
Its path, without the query string |
{{request.url}} |
Its path with the query string, such as /orders?page=2 |
{{request.body}} |
Its whole body, as text |
{{request.body.<path>}} |
One value from a JSON body, with a full stop between levels: request.body.customer.id, request.body.items.0.sku |
{{request.query.<name>}} |
The value of one query parameter |
{{request.header.<name>}} |
The value of one request header, its name in any case. Several values are joined with , |
{{response.status}} |
The status code the mock answered with |
{{response.body}} |
The mock’s whole answer, as text, up to 256 KiB |
{{response.body.<path>}} |
One value from a JSON answer, written as request.body.<path> is |
{{response.header.<name>}} |
One header of the mock’s answer, its name in any case. Several values are joined with , |
{{random.uuid}} |
A new random UUID at each place it appears |
- The
mock.*,request.*andresponse.*placeholders are empty for a delivery fired by hand or by a schedule, and so is any value the request does not have. - Values are inserted as they are, with no JSON escaping: a value containing
"breaks a JSON body around it. A JSON object or array fromrequest.body.<path>is inserted as compact JSON. - The request placeholders read the request as it arrived, before the project’s logging settings redact anything.
- The delivery’s record shows the body with those values as the request log keeps them, so a header the project redacts reads
[REDACTED]there, although the receiver got its value. - The body is built once, when the webhook fires. Retries and replays resend it unchanged,
{{now}}and{{random.uuid}}included. - A template can be up to 65,536 characters. A built body over 262,144 bytes is not sent, and the delivery fails with
The rendered payload exceeds the 262144 byte limit. - A built body that is not UTF-8 text, or contains a NUL byte, is not sent either, because it is kept for retries and replays: the delivery fails with
The rendered webhook body is not UTF-8 text, so it cannot be kept for retries and replays.Inside a quoted JSON string, such a value fails with the placeholder named, as inThe value of {{request.body}} is not UTF-8 text, so a JSON body cannot carry it.
What counts as delivered
Section titled “What counts as delivered”| What happened | Result |
|---|---|
Your receiver answered 2xx |
Succeeded |
It answered 408, 429 or any 5xx |
The attempt failed and is retried |
It answered 3xx |
Failed, not retried: redirects are not followed |
It answered any other 4xx |
Failed, not retried |
| What happened | Result |
|---|---|
| The address is refused by the destination rules | Failed, not retried |
| What happened | Result |
|---|---|
| No answer: connection refused or reset, TLS failure, timeout, or a name that does not resolve | The attempt failed and is retried |
| The workspace already had three outgoing requests under way, so the attempt was not sent | The attempt is retried |
An attempt times out when the whole answer takes longer than 15 seconds, or when nothing arrives for 5 seconds. MockHub reads at most the first 8 KiB of the answer and keeps it with the delivery.
The answer is kept as text: cut where a character ends, with each byte that is not UTF-8 text shown as ? and a NUL byte as �.
Retries
Section titled “Retries”A delivery makes at most three attempts:
| Attempt | When |
|---|---|
| 1 | When the webhook fires, or after the delay of a mock trigger |
| 2 | 30 seconds after attempt 1 failed |
| 3 | 5 minutes after attempt 2 failed |
A Retry-After header in your receiver’s answer is not read. After the third failed attempt the delivery is Failed; a replay is the way to send it again.
Before each attempt, MockHub checks that the delivery may still go. If not, the delivery is Failed without being sent, and not retried, with the reason recorded on it:
| Why | Reason recorded |
|---|---|
| The webhook has been paused | The webhook was disabled before the delivery could run. |
| The project cannot run: it is archived or beyond the plan’s active projects, or the workspace is suspended, is still waiting for its first checkout or is a demo that has ended | The refusal’s own message, such as This workspace is suspended. |
| No Owner of the workspace has a confirmed email address, or the address breaks the destination rules | The refusal’s own message |
| The plan no longer includes webhooks, or the delivery allowance is used up | Webhook execution or attempt allowance is unavailable. or Daily webhook delivery quota exhausted. |
Deliveries are sent at least once, and on rare occasions twice. They are not guaranteed to arrive in the order they fired. Use X-MockHub-Delivery to recognise a delivery you have already handled.
An attempt that never reports back, as when MockHub restarts while sending it, still counts as one of the three. When it was the third, the delivery is Failed with The last attempt never reported an outcome, and none is left to retry with., because MockHub cannot tell whether it arrived.
Each fire counts once against the workspace’s daily and monthly delivery allowance, whatever its cause, replays included. Retries do not count. The limits page lists each plan’s allowance.
Where a webhook can send
Section titled “Where a webhook can send”These rules are checked when the Target URL is saved, and again before every attempt, because a name can resolve somewhere else later.
- The address uses
http://orhttps://, and contains no user name or password. - The host name resolves, and every address it resolves to is public. One private address among several refuses the whole name.
- MockHub connects to the address it checked, so a change in DNS between the check and the request cannot redirect it.
- Any port is allowed. Redirects are never followed.
- A Target URL may instead be exactly one request placeholder, such as
{{request.body.callback_url}},{{request.query.callback}}or{{request.header.X-Callback}}, for a webhook that fires when a mock is served and has no schedule. It is read from each request, so the checks above run on every attempt, and the host must also be listed under Allowed hosts: an exact host,.example.comfor its subdomains, or a name the platform allows. The project’s own inbox needs no entry. See Send the callback to the address the request gives.
Only public addresses are allowed. Private networks, loopback, link-local addresses (including cloud instance metadata) and other reserved or special-purpose IPv4 and IPv6 ranges are refused. An IPv6 address that carries an IPv4 address is judged by that IPv4 address.
A refused address is reported when you save, under the webhook’s or alert rule’s address, such as the messages below. The form checks the scheme itself first, with Enter a full http:// or https:// URL.
Host "hooks.internal.example" resolves to 10.0.0.5, which is not a public address.URL scheme "ftp" is not allowed; use http or https.URLs with embedded credentials are not allowed.Host "hooks.example.invalid" does not resolve to any address.Email verification
Section titled “Email verification”A webhook can send to an address outside MockHub only once one of the workspace’s Owners has confirmed their email address. It is the Owners’ addresses that count, whoever creates the webhook, and whether a person or a machine token does. It is checked when the Target URL is saved and again before every attempt. Until then, saving is refused with a 403 of type email-unverified:
This workspace cannot send to an address you choose until the owner confirms their email (ada@example.com). Resend the verification link from the profile screen, then try again.In a workspace with more than one Owner, the message reads until one of its owners confirms their email and names every Owner’s address.
The Webhooks page warns an Admin whose own address is unconfirmed; the check itself is on the Owners’. See Verify your email.
The project’s own inbox needs no confirmed address, on any plan, because a delivery there never leaves MockHub. An address counts as the project’s inbox only when it has the project’s own host, http:// or https://, the scheme’s standard port or none, no user name or password, no # fragment, and the path /__inbox or a path below it with no . or .. segment. In a demo, it is the only address a webhook can use.
Alert rule webhooks
Section titled “Alert rule webhooks”An alert rule that calls a webhook address sends each alert as a delivery that follows this page, with these differences:
- It is always a
POSTof the alert’s body, withContent-Type: application/jsonand no static headers. X-MockHub-Alert-Rule-Id, the rule’s id, takes the place ofX-MockHub-Webhook-Id, andX-MockHub-Causeisalert, orreplayfor a replay.- It is signed with the rule’s own secret, which an Admin reads or rotates on the rule.
- Each alert and each replay counts once against the alerts’ own sending allowance, which is as large as the webhook delivery allowance but separate from it. Retries do not count.
- Before each attempt, a paused rule fails the delivery with
The alert rule was paused before the delivery could run., and a plan without alert rules withAlerts are not part of this workspace's plan.