Webhooks
Webhooks
Event notifications Borkol POSTs to your server, with the event catalog, delivery semantics, HMAC signature verification, and retry behavior.
View as MarkdownWebhooks push platform events from Borkol to your server as they happen, so you do not have to poll. When an order is created, an order changes status, a stock level is adjusted, a quote is offered, accepted, declined or expires, an invoice or credit note is sent, an invoice is paid or becomes overdue, a content record is published, a form is published, a visitor sends a form, or a product, category or contact is created, changed or deleted, Borkol sends an HTTP POST to every active endpoint of the store that is subscribed to that event. Each delivery is signed with a per-endpoint secret so your server can verify it genuinely came from Borkol.
Configuring endpoints
Webhook endpoints are configured per store in the client dashboard (app.borkol.com) under Settings > Webhooks. Endpoint configuration is not part of the public storefront API. Each endpoint has:
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Endpoint identifier. |
url | string | Destination URL, maximum 2048 characters. Must be https except for local development hosts (localhost, 127.0.0.1, *.test, *.localhost). |
events | array of strings | The events this endpoint subscribes to; any subset of the event catalog below. |
is_active | boolean | Inactive endpoints receive no deliveries. |
secret | string | Signing secret in the format whsec_ followed by 40 random alphanumeric characters. Shown exactly once at creation and hidden afterwards; store it immediately. Rotate secret in the dashboard replaces it with a new one, also shown once; the old secret stops signing at that moment. |
An event fans out to every active endpoint of the store subscribed to it. The dashboard also offers a "Send test" action that delivers a ping event to a single endpoint regardless of its subscriptions.
Delivery format
Every delivery is an HTTP POST to the endpoint URL with these headers:
| Header | Value |
|---|---|
Content-Type | application/json |
X-Borkol-Event | The event name (for example order.created). |
X-Borkol-Signature | Lowercase hex HMAC-SHA256 of the exact raw request body, computed with the endpoint's whsec_ secret. |
The body is always this envelope (JSON encoded with unescaped slashes):
| Name | Type | Required | Description |
|---|---|---|---|
event | string | always | One of order.created, order.status_changed, stock.adjusted, quote.offered, quote.accepted, quote.declined, quote.expired, invoice.sent, invoice.paid, invoice.overdue, credit_note.sent, object_record.published, object_record.updated, object_record.unpublished, object_record.deleted, object_schema.updated, media.updated, form.published, form_submission.created, product.created, product.updated, product.deleted, category.created, category.updated, category.deleted, contact.created, contact.updated, contact.deleted, ping. |
created_at | string (ISO 8601) | always | Timestamp of the delivery record's creation (when the event was recorded, not when this particular attempt was sent). |
data | object | always | Event-specific payload; see the catalog below. |
{
"event": "order.created",
"created_at": "2026-08-14T09:12:44+00:00",
"data": {
"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"number": 1042,
"status": "pending_payment",
"total_amount": 15900,
"currency": "EUR",
"email": "buyer@example.com"
}
}Your server must respond with any 2xx status within 10 seconds. The response body is ignored. Any non-2xx status, connection error, or timeout counts as a failed attempt and triggers a retry.
Event catalog
These are the only subscribable events. Retries deliver the same envelope again; deduplicate on your side if processing is not idempotent (an event plus created_at plus payload identity is a practical key).
order.created
Sent when an order is created. data fields:
| Name | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | always | Order ID. |
number | integer | always | Per-store sequential order number. |
status | string | always | Order status at creation; one of pending_payment, paid, shipped, completed, cancelled, refunded. |
total_amount | integer | always | Order total in minor units (cents). |
currency | string | always | ISO 4217 currency code. |
email | string | always | Buyer email address. |
{
"event": "order.created",
"created_at": "2026-08-14T09:12:44+00:00",
"data": {
"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"number": 1042,
"status": "pending_payment",
"total_amount": 15900,
"currency": "EUR",
"email": "buyer@example.com"
}
}order.status_changed
Sent when an order transitions to a new status. data has the same shape as order.created; status is the new status.
Order statuses follow this state machine:
| From | Allowed transitions |
|---|---|
pending_payment | paid, cancelled |
paid | shipped, cancelled, refunded |
shipped | completed, refunded |
completed | refunded |
cancelled | none (terminal) |
refunded | none (terminal) |
{
"event": "order.status_changed",
"created_at": "2026-08-14T10:03:01+00:00",
"data": {
"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"number": 1042,
"status": "paid",
"total_amount": 15900,
"currency": "EUR",
"email": "buyer@example.com"
}
}stock.adjusted
Sent when a stock level changes. data fields:
| Name | Type | Required | Description |
|---|---|---|---|
product_id | string (UUID) | always | Product whose stock changed. |
variant_id | string (UUID) or null | always | Variant whose stock changed; null when the product has no variants. |
quantity | number | always | The new absolute on-hand quantity (not the delta), in the product's unit. May be fractional (for example 47.84) for products sold by weight, length, area or volume. |
{
"event": "stock.adjusted",
"created_at": "2026-08-14T11:27:19+00:00",
"data": {
"product_id": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
"variant_id": null,
"quantity": 42
}
}quote.offered
Sent when a merchant sends an offer on a quote (status becomes offered). Resending the same offer sends no event. The payload never contains the acceptance token: the buyer's link is only ever mailed. data fields (the same for all four quote.* events):
| Name | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | always | Quote ID. |
number | string | always | Quote number from the store's number series, for example Q-17. |
status | string | always | Quote status at the time of the event; one of draft, submitted, offered, accepted, declined, expired, cancelled. |
origin | string | always | storefront for a quote that started as a cart-based request, merchant for one the merchant wrote directly. |
total_amount | integer | always | Quote total in minor units (cents). |
currency | string | always | ISO 4217 currency code. |
email | string | always | Buyer email address. |
valid_until | string (ISO 8601) or null | always | End of the offer's validity, or null when the offer has no expiry. |
signed_at | string (ISO 8601) or null | always | When the buyer accepted (in both acceptance modes); null until then. |
{
"event": "quote.offered",
"created_at": "2026-10-24T09:12:44+00:00",
"data": {
"id": "6e7f8a9b-0c1d-4e2f-a3b4-c5d6e7f8a9b0",
"number": "Q-17",
"status": "offered",
"origin": "storefront",
"total_amount": 248900,
"currency": "EUR",
"email": "buyer@corp.example",
"valid_until": "2026-11-07T23:59:59+00:00",
"signed_at": null
}
}quote.accepted
Sent when a quote becomes accepted: the buyer accepts it through POST .../accept (click or signature mode), or the merchant converts it in the dashboard. signed_at is set. Depending on the store's setting the quote has become an order (order.created is sent as well) or an invoice. data as for quote.offered.
quote.declined
Sent when the buyer declines an offered quote through POST .../decline. A declined quote is not terminal: a later re-offer sends quote.offered again. data as for quote.offered.
quote.expired
Sent when an offered quote passes its valid_until: either the expiry sweep finds it, or the first by-token request after that moment flips it. Sent once per expiry. data as for quote.offered, with status expired.
invoice.sent
Sent when a merchant sends an invoice (kind invoice): the number is allocated and the PDF is locked at that moment. Resending sends no event. data fields (the same for invoice.sent, invoice.paid, invoice.overdue and credit_note.sent):
| Name | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | always | Invoice ID. |
number | string | always | Document number from the store's number series. |
kind | string | always | invoice or credit_note. |
status | string | always | One of draft, sent, paid, overdue, cancelled. |
total_amount | integer | always | Document total in minor units (cents). |
paid_amount | integer | always | Sum of recorded payments in minor units. |
open_amount | integer | always | What is still open in minor units (total_amount minus paid_amount, never negative). |
currency | string | always | ISO 4217 currency code. |
email | string | always | Recipient email address. |
issue_date | string (YYYY-MM-DD) or null | always | Issue date. |
due_date | string (YYYY-MM-DD) or null | always | Due date; null on a credit note. |
{
"event": "invoice.sent",
"created_at": "2026-10-24T10:03:01+00:00",
"data": {
"id": "0f1e2d3c-4b5a-4968-8776-655443322110",
"number": "F2026-0042",
"kind": "invoice",
"status": "sent",
"total_amount": 248900,
"paid_amount": 0,
"open_amount": 248900,
"currency": "EUR",
"email": "buyer@corp.example",
"issue_date": "2026-10-24",
"due_date": "2026-11-07"
}
}invoice.paid
Sent once, when an invoice transitions to paid: a recorded payment covers the open amount, or the merchant marks it paid. A further payment or a second mark-paid on an already paid invoice sends nothing. data as for invoice.sent, with status paid and open_amount 0.
invoice.overdue
Sent when the overdue sweep moves a sent invoice whose due_date has passed to overdue. Sent once per invoice. data as for invoice.sent, with status overdue.
credit_note.sent
Sent when a merchant sends a credit note (kind credit_note); the credit note's own number is allocated at that moment. data as for invoice.sent, with kind credit_note and due_date null.
object_record.published
Sent when a draft record of a publishable object type is published. It fires at the moment a merchant publishes, also when the record is scheduled for a future published_at, and once more within a minute of that published_at passing, when the record becomes visible. A record already announced while visible is not announced again; a record unpublished and scheduled again is announced again when its new time comes. Records of types that are not publishable have no draft step, so publishing never sends it for them, and creating a record on such a type in the dashboard or through the API sends no event at all. The objects:import command is the exception: every record it creates as published sends object_record.published, also on a type that is not publishable.
data fields (the same for all four object_record.* events):
| Name | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | always | Record ID. |
type_key | string | always | The object type key, for example service. |
slugs | object | always | Language tag to the record's address in that language, for example {"en": "kitchen-fitting"}. An empty object {} when the type has no addresses or the record has none yet. Only languages that are enabled as content languages, the same as the slugs of the record in the public API. |
published_at | string (ISO 8601) or null | always | When the record goes or went live, in the same format as the record in the public API (2026-10-12T09:30:00.000000Z). In the future for a scheduled record. |
tags | array of string | always | Cache tags to flush; ["borkol"] in v1. |
The payload never contains record values. Fetch the record with GET /v1/api/objects/records/{id} or by address, which only answers once the record is visible.
{
"event": "object_record.published",
"created_at": "2026-10-12T09:30:00+00:00",
"data": {
"id": "7a8b9c0d-1e2f-4a3b-84c5-d6e7f8a9b0c1",
"type_key": "service",
"slugs": { "en": "kitchen-fitting", "nl": "keukenmontage" },
"published_at": "2026-10-12T09:30:00.000000Z",
"tags": ["borkol"]
}
}object_record.updated
Sent when a published record changes: its values, its addresses, or its published_at (rescheduling or changing the date of a published record). Saving without changing anything sends nothing, and neither does editing a draft. Because a published record can still be scheduled for the future, it can be sent for a record that is not visible yet. data as for object_record.published.
object_record.unpublished
Sent when a published record is set back to draft. Sent only for a real transition: unpublishing a record that is already a draft sends nothing. Drop the page from your cache or site. data as for object_record.published.
object_record.deleted
Sent when a record that is published is deleted, including through a bulk delete. Deleting a draft sends nothing, because the public API never exposed it. slugs carries the addresses the record had, so you can remove those pages. data as for object_record.published.
object_schema.updated
Sent when a schema push from the connected site applies (see Build a site). Dry runs, refused pushes and a push of an unchanged manifest send nothing. Types, properties or section types may have changed, so flush every cached page.
| Name | Type | Required | Description |
|---|---|---|---|
site | string | always | The key of the connected site. |
manifest_hash | string | always | SHA-256 of the manifest that was applied, as returned by PUT /v1/api/objects/schema. |
tags | array of string | always | Cache tags to flush; ["borkol"]. |
{
"event": "object_schema.updated",
"created_at": "2026-11-12T09:30:00+00:00",
"data": {
"site": "bakery-web",
"manifest_hash": "f78d42f8be58f6d5a4157b40a4ecbff94eb46e742ad56f7e1bc6327b8ba8c860",
"tags": ["borkol"]
}
}media.updated
Sent when the alt text or the default focal point of a media library image changes while a published, visible record shows it (in a media or media_list value, a repeater row or a section). Each change sends one event; saving the same values again sends nothing, and an image that no published record shows sends nothing. The image may appear on several pages, so flush every cached page that renders it, or the whole borkol tag.
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | always | The media library id, as in the id of a media value. |
tags | array of string | always | Cache tags to flush; ["borkol"]. |
{
"event": "media.updated",
"created_at": "2026-11-12T09:30:00+00:00",
"data": {
"id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"tags": ["borkol"]
}
}form.published
Sent each time a merchant publishes a new version of a form. Use it to refresh a cached form definition. It is sent whatever the form's status, so it can arrive for a form that is still a draft and cannot be loaded yet. Activating or archiving a form and saving its settings send nothing. data fields:
| Name | Type | Required | Description |
|---|---|---|---|
key | string | always | The form key, as used in GET /v1/api/forms/{key}. |
version | integer | always | The version number that was just published. |
{
"event": "form.published",
"created_at": "2026-10-13T09:30:00+00:00",
"data": {
"key": "quote-request",
"version": 3
}
}form_submission.created
Sent after a visitor's submission is stored through POST /v1/api/forms/{key}/submissions. A honeypot hit stores nothing and sends nothing. The payload never contains the answers, files or anything about the visitor's address; the merchant reads those in the dashboard inbox, and the public API has no endpoint to fetch a submission. data fields:
| Name | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | always | Submission ID. |
number | string | always | Submission number, for example INQ-0042. |
form_key | string | always | The key of the form that was submitted. |
status | string | always | Inbox status at creation, always new. Later statuses (open, done, spam) are set in the dashboard and send no event. |
locale | string | always | The submission's language: the locale the site sent when it is enabled for the store, otherwise the store's default language. |
name | string or null | always | The answer to the field keyed name, or null. |
email | string or null | always | The answer to the first answered email field, or null. |
created_at | string (ISO 8601) | always | When the submission was stored. |
{
"event": "form_submission.created",
"created_at": "2026-10-13T09:41:12+00:00",
"data": {
"id": "4d5e6f7a-8b9c-4d0e-9f1a-2b3c4d5e6f7a",
"number": "INQ-0042",
"form_key": "quote-request",
"status": "new",
"locale": "en",
"name": "Ada Lovelace",
"email": "ada@example.com",
"created_at": "2026-10-13T09:41:12+00:00"
}
}product.created
Sent when a product is created: in the dashboard, by a duplicate, or by a CSV import (one event per created product). data fields (the same for all three product.* events):
| Name | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | always | Product ID. |
sku | string or null | always | Product SKU. |
slug | string | always | The product's address (slug). |
name | string | always | Product name. |
status | string | always | One of draft, active, archived. |
updated_at | string (ISO 8601) | always | When the product row last changed. |
{
"event": "product.updated",
"created_at": "2026-11-11T09:30:00+00:00",
"data": {
"id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
"sku": "CHAIR-OAK",
"slug": "oak-chair",
"name": "Oak chair",
"status": "active",
"updated_at": "2026-11-11T09:30:00+00:00"
}
}product.updated
Sent when a field of the product itself changes (name, SKU, address, status, price, description, tags, SEO fields and the like), including through a bulk action or a CSV import. Saving without a change sends nothing. Changes to variants, media, category placement or stock do not send it (stock changes send stock.adjusted). Fetch the product with GET /v1/api/commerce/products/{id} to read the current state. data as for product.created.
product.deleted
Sent when a product is deleted, including through a bulk delete. data as for product.created, with the values the product had.
category.created
Sent when a category is created. data fields (the same for all three category.* events):
| Name | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | always | Category ID. |
parent_id | string (UUID) or null | always | Parent category, or null for a top-level category. |
slug | string | always | The category's address. |
name | string | always | Category name. |
is_active | boolean | always | Whether the category is visible in the storefront API. |
updated_at | string (ISO 8601) | always | When the category last changed. |
{
"event": "category.created",
"created_at": "2026-11-11T09:31:00+00:00",
"data": {
"id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
"parent_id": null,
"slug": "garden-furniture",
"name": "Garden furniture",
"is_active": true,
"updated_at": "2026-11-11T09:31:00+00:00"
}
}category.updated
Sent when a category changes: name, address, parent, description, image, SEO fields, position, or is_active (also through bulk activate and deactivate). data as for category.created.
category.deleted
Sent when a category is deleted, including through a bulk delete. data as for category.created.
contact.created
Sent when a contact (a customer, person or company) is created: in the dashboard, by a contacts import, by a storefront registration, or for a guest buyer. data fields (the same for all three contact.* events):
| Name | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | always | Contact ID. |
kind | string | always | person or company. |
type | string | always | b2c or b2b. |
name | string or null | always | Contact name. |
company_name | string or null | always | Company name, for a company. |
email | string or null | always | Email address. |
external_id | string or null | always | The ID the merchant keeps for this contact in another system. |
is_guest | boolean | always | true for a contact created by a guest checkout. |
updated_at | string (ISO 8601) | always | When the contact last changed. |
The payload never contains passwords, addresses, notes or custom field values.
{
"event": "contact.created",
"created_at": "2026-11-11T09:32:00+00:00",
"data": {
"id": "8b9c0d1e-2f3a-4b4c-9d5e-6f7a8b9c0d1e",
"kind": "company",
"type": "b2b",
"name": "Ada Lovelace",
"company_name": "Analytical Ltd",
"email": "ada@example.com",
"external_id": "ERP-1042",
"is_guest": false,
"updated_at": "2026-11-11T09:32:00+00:00"
}
}contact.updated
Sent when a contact's details change (name, email, phone, type, B2B status, group, company fields, custom fields). Logins, password changes and email verification send nothing. data as for contact.created.
contact.deleted
Sent when a contact is deleted. data as for contact.created.
ping (test only)
Not subscribable. Sent to a single endpoint when a merchant clicks "Send test" in the dashboard, regardless of the endpoint's subscriptions. data fields:
| Name | Type | Required | Description |
|---|---|---|---|
message | string | always | Always "Borkol webhook test". |
{
"event": "ping",
"created_at": "2026-08-14T12:00:00+00:00",
"data": {
"message": "Borkol webhook test"
}
}Verifying signatures
Compute HMAC-SHA256 over the exact raw request body (before any JSON parsing or re-serialization) using the endpoint's whsec_ secret, hex-encode the result, and compare it to the X-Borkol-Signature header with a constant-time comparison. Reject the request if they differ.
import crypto from "node:crypto";
import express from "express";
const app = express();
// Capture the raw body; parsing and re-stringifying breaks the signature.
app.post("/webhooks/borkol", express.raw({ type: "application/json" }), (req, res) => {
const secret = process.env.BORKOL_WEBHOOK_SECRET; // "whsec_..."
const signature = req.get("X-Borkol-Signature") ?? "";
const expected = crypto.createHmac("sha256", secret).update(req.body).digest("hex");
const valid =
signature.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
if (!valid) {
return res.status(401).send("invalid signature");
}
const { event, created_at, data } = JSON.parse(req.body.toString("utf8"));
// Acknowledge fast; do real work asynchronously (the 10 second timeout is strict).
res.status(200).end();
// handle(event, data) ...
});$secret = getenv('BORKOL_WEBHOOK_SECRET'); // "whsec_..."
$rawBody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_BORKOL_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $rawBody, $secret);
if (! hash_equals($expected, $signature)) {
http_response_code(401);
exit;
}
$payload = json_decode($rawBody, true);
http_response_code(200);
// handle($payload['event'], $payload['data']) ...Two rules matter in practice: verify against the raw bytes you received, never a re-encoded copy of the parsed JSON; and use a constant-time comparison (crypto.timingSafeEqual, hash_equals) rather than ==.
Retries and delivery records
Deliveries are queued and sent asynchronously. Each delivery is attempted up to 3 times in total:
| Attempt | When |
|---|---|
| 1 | Immediately after the event. |
| 2 | 60 seconds after attempt 1 fails. |
| 3 | 300 seconds after attempt 2 fails. |
An attempt fails on any non-2xx response, connection error, or timeout (10 seconds). After the third failed attempt the delivery is marked failed and is not retried again. A delivery's status moves from pending to either success or failed.
Each delivery is recorded with id, event, status (pending, success, or failed), attempts, response_status (the HTTP status your server returned, or null on a connection error), last_attempt_at, and created_at. The last 25 deliveries per endpoint are viewable in the client dashboard, which is the first place to look when debugging a receiver.
A merchant can send any logged delivery again with Redeliver in the dashboard. A redelivery is a new delivery with the same event and data, its own created_at and its own attempts; the original record stays as it was. Treat it like a retry: deduplicate on the payload identity.
Because retries exist, your receiver must be idempotent: the same event can arrive more than once (for example when your server processed the event but the 2xx response was lost). Respond 2xx quickly, then process; a handler that does slow work before responding will time out and cause duplicate deliveries.