Custom API webhooks tell your server when something happens to a design, so you do not have to poll. There are two, both optional: Design Saved and Gang Sheet Generation Completed. With a signing secret set, every call carries a signature your server can check.
Set the Webhook URLs
- In your merchant dashboard, click API Tokens in the side menu. This opens the Custom API page.
- Under Webhooks, enter the URLs your server listens on:
- Design Saved is called the moment a customer saves a design in the builder. Every save is sent, edits included. The event is
design:saved. - Gang Sheet Generation Completed is called when a print file has finished generating. The event is
design:completed.
- Design Saved is called the moment a customer saves a design in the builder. Every save is sent, edits included. The event is
- Click Save Webhooks. Leave a field empty to stop that webhook.
Create a Signing Secret
- Under Webhook signing secret, click Create secret and confirm.
- Copy the secret with the copy button next to it. It starts with
whsec_. Store it on your server.
To change the secret, click Replace secret. The new secret takes effect at once: calls sent after that verify only with the new value, so update your server right after.
Without a secret, webhooks are sent unsigned.
What Each Call Contains
Each webhook is a POST with Content-Type: application/json and these headers:
X-BAGS-Event:design:savedordesign:completed.X-BAGS-Design-Id: the design id.X-BAGS-Signature: only when you have a signing secret.
{
"event": "design:saved",
"sent_at": "2026-10-29T14:09:40+00:00",
"design": { "id": "{DESIGN_ID}", "status": "created", "name": "My sheet", "quantity": 1, "size": { "id": 2, "width": 22, "height": 24, "unit": "in" }, "thumbnail_url": "https://...", "download_url": "https://...", "images": [], "quality": {} },
"reference": "whatsapp:9198",
"metadata": { "conversation_id": "c-55" }
}
reference and metadata are what you sent when you created the design with a design session. See Send Customers a Design Link Without a Storefront. For other designs they are null.
In a design:saved call the print file does not exist yet, so download_url cannot be downloaded. Wait for design:completed.
Answer and Retries
- Answer with a
2xxstatus within 15 seconds. - A Design Saved call that fails or times out is tried up to 3 times in total, 30 seconds apart.
- The same event can arrive more than once. Use
design.idtogether witheventto skip duplicates.
Verify the Signature
The header looks like X-BAGS-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256>. v1 is the HMAC-SHA256 of t, a full stop and the raw request body, keyed with your signing secret.
- Read the raw request body exactly as received, before parsing the JSON.
- Split the header on commas and read
tandv1. - Reject the call if
tis more than a few minutes old. - Compute the HMAC-SHA256 of
t + "." + raw bodywith your secret and compare it tov1with a constant-time comparison.
function verifyBagsWebhook(string $secret, string $header, string $rawBody, int $tolerance = 300): bool
{
$parts = [];
foreach (explode(',', $header) as $pair) {
[$k, $v] = array_pad(explode('=', $pair, 2), 2, null);
$parts[trim($k)] = trim((string) $v);
}
$t = (int) ($parts['t'] ?? 0);
if (! $t || abs(time() - $t) > $tolerance) {
return false;
}
return hash_equals(hash_hmac('sha256', $t.'.'.$rawBody, $secret), $parts['v1'] ?? '');
}
If It Does Not Work
- No calls arrive: check that the URL is saved under Webhooks and reachable from the internet. There is no sandbox, so while you build, point the URL at a request-inspection service and save a test design.
- The signature never matches: verify over the raw body, not re-encoded JSON, and check that your server uses the current secret after a Replace secret.