Webhooks
Meadow can POST to your server each time a sandbox changes status, so you do not have to poll.
Next step: set a webhook_url, then verify the signature of every delivery with the code below.
Set the address
There are two places. A sandbox’s own webhook_url wins over the project’s.
On one sandbox:
On the project, for every sandbox in it that has no address of its own (needs an admin key):
The address must use https and resolve to a public address. These return 400:
An address that names Meadow’s own API host is accepted and never delivered. Point webhook_url at your own receiver.
The address is read when each event happens. Changing it does not move events that are already queued.
Events
A normal life is creating, running, terminated. A create with a misspelled image and two providers sent creating, provider_failed, provider_failed, failed.
There are no events for commands, files, or image builds.
A project’s address also receives budget.threshold_crossed when spend reaches a budget threshold. Branch on type. See Budgets and alerts.
Payload
Each delivery is a POST with content-type: application/json, user-agent: meadow-webhooks/1, the three Standard Webhooks headers (webhook-id, webhook-timestamp, webhook-signature) and Meadow’s own x-meadow-signature header. The body:
sandbox is the same object the API returns, as it was when the event happened, without cost: only GET /v1/sandboxes and GET /v1/sandboxes/{sandbox_id} return that. id is the same on every retry of one event, so use it to drop duplicates.
Verify the signature
Anyone can POST to your address. Check the signature before you trust a delivery.
Every delivery is signed twice, with the same secret. Check either signature.
- The Standard Webhooks headers. Libraries for most languages verify them, so you write no signature code. Use these in new receivers.
- Meadow’s own
x-meadow-signatureheader. It came first and stays for now. A receiver that checks it keeps working with no change. If it is ever removed, the changelog will say so first.
Standard Webhooks
webhook-idis the eventid. It is the same on every retry of one event, so you can use it to drop duplicates.webhook-timestampis the time of this delivery attempt, in Unix seconds. Reject one that is more than 5 minutes from your clock.webhook-signatureisv1,and then the HMAC-SHA256 of<webhook-id>.<webhook-timestamp>.<raw body>, in standard base64. The key is the bytes you get by base64-decoding the part of your secret afterwhsec_.- For 24 hours after you rotate the secret, the header holds one signature for each valid secret, separated by spaces, newest first.
With the Python library (pip install standardwebhooks):
The signature was checked against the reference library and against values computed with openssl, in Meadow’s tests. The sample above was not run against a delivery from the hosted beta.
A secret issued before the update of 2026-11-28 is written in URL-safe base64, which the Standard Webhooks libraries do not read. Do one of these:
- Rotate the secret (see Rotate the secret). A new secret is in standard base64 and works with the libraries as it is.
- Or keep the secret and convert it before you hand it to a library: in the part after
whsec_, replace every-with+and every_with/. Thex-meadow-signaturecheck below uses the secret exactly as issued, with no conversion.
Meadow’s own header
tis the time of this delivery attempt, in Unix seconds.v1is the HMAC-SHA256 of<t>.<body>, in hex, keyed with your project’s webhook secret.
The secret starts with whsec_. It is returned once, in webhook_secret, when the project is created or the secret is rotated. See Projects. If you never saved it, rotate it to get a new one.
To verify:
- Read the raw body bytes. Do not parse and re-encode the JSON first.
- Reject a
tmore than 5 minutes from your clock. - Compute the HMAC of
t, a dot, and the body with each secret you hold. - Accept when any
v1in the header matches, using a constant-time comparison.
The header can carry several v1 values after a rotation, so compare against all of them.
Python
Standard library only. Put one secret, or several separated by commas, in MEADOW_WEBHOOK_SECRET.
Go
Both programs listen on plain HTTP at 127.0.0.1:8787, and Meadow delivers only to a public https address. To try one from a laptop, put an HTTPS tunnel or a TLS reverse proxy in front of port 8787 and use its public URL as webhook_url. In production, run the handler behind your usual HTTPS front end.
Both programs received live deliveries from the hosted beta. The Python one printed:
Both verify functions were also checked against one captured delivery that carried two v1 values: each secret alone passed, a wrong secret failed, a changed body failed, and a clock 301 seconds late failed.
Retries
Only a 2xx answer counts as delivered. Anything else is retried: another status, a redirect (redirects are not followed), a connection error, or no answer within 10 seconds.
In our runs a receiver that answered 500 to a first attempt got the second attempt 5 to 6 seconds later. Those runs were on the hosted beta when it retried for one hour. The 72 hour window has not been seen there yet.
What this means for your receiver:
- Answer 2xx fast and do the work afterwards. Deliveries to one address are sent one at a time, so a slow receiver delays its own later events.
- Expect duplicates. Drop an event
idyou have already handled. - Do not rely on order. A retried
sandbox.creatingcan arrive aftersandbox.running. Readsandbox.statusand the timestamps. tandwebhook-timestampchange on each retry, and so do the signatures.webhook-iddoes not.- An event that was given up on is never sent again. After an outage longer than 72 hours, read
GET /v1/sandboxesto catch up.
Rotate the secret
The new secret is shown once. The old secret stays valid for 24 hours. During that time each delivery carries one v1 for the new secret and one for each earlier secret still inside its own 24 hours, newest first:
We rotated, then deleted a sandbox. The next delivery carried two v1 values, and both the old and the new secret verified it. In a later run a receiver that held only the old secret, and then one that held only the new secret, each accepted all three events of a sandbox, and a receiver with a wrong secret accepted none.
A rotation without downtime:
- Rotate and save the new secret.
- Give your receiver both secrets. The sample code accepts a comma-separated list.
- After 24 hours, remove the old secret.
A receiver that keeps only the old secret keeps working for those 24 hours, and one that switches straight to the new secret works at once.
More in Known limits.
API reference
Operations on this page: createSandbox, updateProject, createProject.