Verify signatures
Every webhook GlobalyMint sends is signed with your endpoint's secret. Check the signature before you trust the body.
What we send
| Header | Value |
|---|---|
x-mint-signature | t=1763424000,v1=5f2a…: a Unix timestamp and an HMAC-SHA256 signature in hex |
x-mint-timestamp | The same timestamp, in Unix seconds |
The signature is the HMAC-SHA256 of the string {t}.{raw body}, keyed with your endpoint's whsec_ secret. The body is the exact bytes we sent.
Verify with the SDK
The handler checks the signature and the timestamp, then calls your function. It answers 400 for a bad signature or a timestamp more than 5 minutes from now, 500 if your function throws (so we send the event again), and 200 otherwise.
If your framework parses JSON before your code runs, read the body as a string for this route and verify it yourself:
verifyWebhook(rawBody, header, secret, { toleranceSec }) is also exported on its own and needs no client.
Verify by hand
In any language:
- Read
tand everyv1value fromx-mint-signature. - Reject the request if
tis more than 300 seconds from the current time. - Compute the HMAC-SHA256 of
t, a full stop and the raw body, with your secret as the key, and write it as lowercase hex. - Compare it with each
v1value using a constant-time comparison. Accept the request if any one matches.
Rotating a secret
Rotate a secret in the dashboard under Developers › Webhooks, or with POST /api/v1/webhook-endpoints/{id}/rotate-secret. The new secret is shown once.
For 24 hours after a rotation we sign every delivery with both secrets. The header carries two v1 values, the new secret's first, and a delivery is valid if either matches. The SDK accepts any matching v1, and so do the samples above, so you can switch to the new secret at any point in those 24 hours without a failed delivery.
Once the new secret is deployed, you can end the overlap early from the dashboard or with POST /api/v1/webhook-endpoints/{id}/end-secret-overlap. After that only the new secret signs.
Handle duplicates
A valid signature proves who sent the event, not that you have not seen it. Store event.id and skip repeats. See Receive events.
Troubleshooting
| What you see | Likely cause |
|---|---|
invalid_signature | The body was parsed and re-serialised before verifying, or the secret belongs to another endpoint or mode. |
timestamp_out_of_tolerance | Your server's clock is wrong, or the request was held in a queue for more than 5 minutes before you verified it. |
malformed_header | The x-mint-signature header is missing. Check that a proxy is not removing it. |
malformed_payload | The signature matched but the body is not an event. This should not happen; tell us. |
These are the code values on the SDK's WebhookVerificationError.