Webhooks
Get a signed HTTPS request when an order or product changes, and catch up on anything you missed.
A webhook endpoint is a URL on your server. When something happens to one of your orders or
products, we send it a signed POST with a JSON body describing the change.
Scope: webhooks:manage, for every endpoint on this page.
Adding an endpoint
curl -X POST https://api.bhaktibaazar.com/seller-api/v1/webhook-endpoints \
-H "Authorization: Bearer $BHAKTI_BAAZAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://erp.example.com/hooks/bhaktibaazar",
"events": ["order.created", "order.cancelled", "order.shipment.updated"],
"description": "ERP order sync"
}'The response includes the endpoint's signing secret (whsec_…). It is shown only in this
response. Store it with your other secrets; you need it to verify requests.
- The URL must be
https://on a public host and the standard port (443), with no user name or password in it, and at most 2,048 characters. Redirects are not followed. eventslists the event types to send to this URL. Only those are sent.- You can have up to 5 endpoints.
Manage endpoints with GET, PATCH and DELETE /webhook-endpoints/{endpointId}. PATCH changes the
URL, events or description, or switches the endpoint off ("enabled": false) and on again.
The request we send
POST /hooks/bhaktibaazar HTTP/1.1
Content-Type: application/json
webhook-id: 2f7c9d1e-4b6a-4c8e-9f0a-1b2c3d4e5f60
webhook-timestamp: 1764739800
webhook-signature: v1,<base64 signature>
{
"id": "2f7c9d1e-4b6a-4c8e-9f0a-1b2c3d4e5f60",
"type": "order.created",
"created": "2026-12-03T05:30:00.000Z",
"data": {
"orderId": "8a1d…",
"orderNumber": "BB2612030042",
"status": "ordered",
"paymentMethod": "prepaid",
"placedAt": "2026-12-03T05:29:58.000Z"
}
}The body is always { id, type, created, data }. id is the event id; it is also the webhook-id
header and stays the same on every retry.
Event types
Every order event's data has orderId, orderNumber and status (the order's status when the
event was recorded), plus:
| Type | Sent when | More in data |
|---|---|---|
order.created | An order is confirmed: paid, or cash on delivery. Checkout and failed-payment orders are never sent. | paymentMethod, placedAt |
order.accepted | The order is accepted. | none |
order.cancelled | The whole order, or some of its lines, is cancelled. A later cancellation of more lines is a new event. | orderCancelled (whole order), cancelledLineIds, cancelledAt |
order.shipment.updated | Tracking is added or corrected, or the courier status changes. | shipment, the same shape as in GET /orders/{orderId} |
order.delivered | The order is delivered or completed. | none |
order.return.requested | A customer or our team raises a return on the order. Once per return. | returnId, requestedAt |
order.return.updated | A return moves on: approved, picked up, back with you, refunded, rejected or closed. One event per step after requested. | returnId, returnStatus |
order.item.updated | One line's status changes (shipped, delivered, cancelled, coming back by RTO, returned), or its returned quantity changes. Not sent for pending. | lineId, lineStatus, sellerSku, quantity, returnedQuantity |
product.review_status.changed | Our team approves a product or sends it back to review. | productId, sellerProductCode, reviewStatus (approved or pending_review) |
POST /webhook-endpoints/{endpointId}/test sends a webhook.test event straight away, with
data: { "endpointId": "…" }, and tells you how your endpoint answered (delivered, statusCode,
and an error of http_status, timeout, network, dns_failed, blocked_address or
invalid_url). It is not retried or kept, and it works on a switched-off endpoint, so you can check it
before switching it back on.
Events never contain customer names, addresses, phone numbers or emails. See Customer details.
Signatures
Requests are signed the Standard Webhooks way, so you can use its official libraries or the Node.js snippet on the next page.
| Header | Value |
|---|---|
webhook-id | The event id. The same on every retry. |
webhook-timestamp | When this attempt was sent, in seconds since the Unix epoch. |
webhook-signature | v1, followed by the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}. |
To check a request:
- Take the secret after
whsec_and base64-decode it. That is the HMAC key. - Build the signed content: the
webhook-id, a., thewebhook-timestamp, a., and the raw body exactly as received. Don't parse and re-serialise the JSON first. - Compute the HMAC-SHA256 and base64-encode it.
- The
webhook-signatureheader holds one or morev1,<signature>values separated by spaces. Accept the request if any of them matches, comparing in constant time. - Refuse a
webhook-timestampmore than a few minutes away from your clock (5 minutes is usual), so an old request cannot be replayed.
Rotating the secret
POST /webhook-endpoints/{endpointId}/rotate-secret returns a new secret, shown only in that
response. For 24 hours, every request carries two signatures, one from the old secret and one from
the new, so you can switch your server over without missing a request. The endpoint's
previousSecretExpiresAt says when the old secret stops signing.
Responding and retries
- Answer with any 2xx status within 10 seconds. Anything else, or no answer in time, counts as a failure. Do slow work after you answer, for example from a queue. We read at most 64 KB of your response.
- A failed request is retried, first after 30 seconds, then after waits that double each time, up to one hour between attempts. Retries stop 24 hours after the first attempt.
- An endpoint where every attempt has failed for 24 hours is switched off:
enabledbecomesfalseanddisabledReasonbecomesfailing. Its waiting deliveries end. Fix your server, then switch it back on withPATCHand"enabled": true. - While an endpoint is off, whether we switched it off or you did, events for it are not queued.
Read them from
GET /events.
Delivery is at least once, and not in order
- The same event can arrive more than once, for example when your answer was lost. De-duplicate on
webhook-id. - Events can arrive out of order, and most arrive within moments of the change but some up to
about a minute later. Use
created, and treatGET /orders/{orderId}as the truth for the order's current state. - An event reports the state we saw. A shipment status that is replaced quickly may not get an event of its own. A shipment that returns to an earlier status (out for delivery, back in transit, out for delivery again) gets an event each time.
Catching up with GET /events
GET /events lists every event of the last 30 days, oldest first, whether or not a webhook received
it. Use it after downtime, or after an endpoint was switched off.
- Filter with
since(events recorded at or after this time) andtype. - Page with
cursorandlimit, as on other lists (see paging). - The newest 5 seconds are held back, so a page never skips an event that was still being saved.
- Events are kept for 30 days. Older ones are no longer listed.
- Each event has the same
idas its webhook, so the same de-duplication works for both.