Webhooks
A webhook is an HTTPS call SQL Flow makes to your system when something changes in SQL Accounting: a new invoice, a payment, a stock movement, an edited customer. Instead of polling every minute, your system is told within seconds.
How it works
SQL Flow watches each company's tables for changes and keeps them as a journal of events. Every few seconds, each enabled webhook is sent the events after its cursor, one HTTP POST per batch. Your endpoint answers 2xx and the cursor moves on. Anything else is retried with growing delays (backoff) for up to a day, then marked failed; the console shows every delivery and its outcome.
Setting one up
Open the console's Webhooks page and add one:
- URL: your HTTPS endpoint. Plain HTTP is allowed only on your own network.
- Events: the resources you care about (
salesinvoice,customerpayment,stockitem, ...), or all. - Secret: generated for you; copy it to your system. It signs every delivery.
Each webhook starts from now: it does not replay history unless you ask it to.
The delivery
POST /hooks/sqlflow HTTP/1.1
Content-Type: application/json
X-SqlFlow-Signature: sha256=3f6c...
X-SqlFlow-Delivery: 1042
{
"company": "DEMO",
"events": [
{ "id": 5120, "type": "salesinvoice.changed", "key": "IV-1041", "at": "2026-11-03T06:12:40Z" },
{ "id": 5121, "type": "customerpayment.changed", "key": "OR-00231", "at": "2026-11-03T06:12:44Z" }
]
}
Each delivery also carries the same values as X-SqlBridge-Signature, X-SqlBridge-Event and X-SqlBridge-Delivery, the names used before version 1.0.4, so a receiver written against them keeps working.
Verifying the signature
The signature is HMAC-SHA256 of the raw request body with your webhook's secret, hex encoded. Compute it over the bytes as received, before any JSON parsing, and compare in constant time.
$expected = 'sha256=' . hash_hmac('sha256', $rawBody, $secret);
if (!hash_equals($expected, $_SERVER['HTTP_X_SQLBRIDGE_SIGNATURE'] ?? '')) {
http_response_code(401);
exit;
}
const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(req.get('X-SqlFlow-Signature') || ''))) {
return res.sendStatus(401);
}
Handling events well
- Fetch, do not trust the event alone. An event says what changed and its key; read the row with the API to get its current state. Two edits in quick succession may arrive as two events for the same key.
- Be idempotent. A retried delivery carries the same events and the same
X-SqlFlow-Deliverynumber. Remember the event ids you have handled. - Answer fast. Queue the work and answer 204 within a few seconds; a slow endpoint is retried as if it had failed.
Replay
Missed something? The console's Webhooks page lets you move a webhook's cursor back to an earlier event, and GET /v2/api/changes?since=<time> reads the journal directly, so a system that was down can catch up without webhooks at all.
Last updated 3 Nov 2026