Webhooks
NewReceive real-time HTTP notifications when events happen in SyncBooks. No polling required.
How Webhooks Work
An event happens in SyncBooks (e.g. an invoice is paid).
SyncBooks sends an HTTP POST with the event to each of your endpoints that listens for it, signed with that endpoint's secret.
Your server checks the signature and answers with any 2xx status within 10 seconds. Do slow work after answering.
Anything else (an error status, a timeout, no connection) is retried: 5 attempts in all, waiting 1 minute, 5 minutes, 30 minutes, then 2 hours.
Because of retries, the same event can reach you more than once. Every event has an id that never changes across retries: keep the IDs you've handled and skip one you've seen.
Setting Up a Webhook
Add endpoints in the developer dashboard (Webhooks), or with the API. SyncBooks creates the signing secret and returns it once: store it with your server's other secrets.
curl -X POST https://api.syncbooksapp.com/api/v1/webhooks \
-H "Authorization: Bearer sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.com/webhooks/syncbooks",
"events": ["invoice.paid", "payment.received"]
}'{
"data": {
"id": "65f1a2b3c4d5e6f7a8b9c0d1",
"url": "https://your-app.com/webhooks/syncbooks",
"events": ["invoice.paid", "payment.received"],
"secret": "9f2c…e41a"
}
}The URL must be public and use https://. Use ["*"] for every event.
What Your Endpoint Receives
| Parameter | Type | Description |
|---|---|---|
X-SyncBooks-Signature | string | sha256= followed by the HMAC-SHA256 of the raw body, keyed with the endpoint's secret (hex) |
X-SyncBooks-Event | string | The event name, e.g. invoice.paid |
X-SyncBooks-Event-Id | string | The event's ID (also id in the body): the same on every retry, for skipping duplicates |
X-SyncBooks-Delivery | string | This delivery's ID, as shown in the delivery log |
X-SyncBooks-Attempt | number | 1 for the first try, up to 5 |
{
"id": "evt_8c1d2e3f4a5b6c7d8e9f0a1b",
"event": "invoice.paid",
"timestamp": "2026-06-06T14:30:00.000Z",
"data": {
"_id": "65f1a2b3c4d5e6f7a8b9c0d1",
"invoiceNumber": "INV-06-0001",
"totalAmount": 2375,
"paidAmount": 2375,
"status": "paid"
}
}Verifying Signatures
Check every request before trusting it. Sign the raw body exactly as received: parsing the JSON and turning it back into text can change it, and the signature then won't match.
const crypto = require("crypto");
const express = require("express");
const app = express();
const SECRET = process.env.SYNCBOOKS_WEBHOOK_SECRET;
const seen = new Set(); // use your database in production
function isFromSyncBooks(rawBody, header) {
const expected = "sha256=" + crypto.createHmac("sha256", SECRET).update(rawBody).digest("hex");
const a = Buffer.from(header || "");
const b = Buffer.from(expected);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}
// The raw body, not express.json(), for this route.
app.post("/webhooks/syncbooks", express.raw({ type: "application/json" }), (req, res) => {
if (!isFromSyncBooks(req.body, req.get("X-SyncBooks-Signature"))) {
return res.status(401).send("Invalid signature");
}
const event = JSON.parse(req.body.toString("utf8"));
res.sendStatus(200); // answer first; do the work after
if (seen.has(event.id)) return; // a retry of one already handled
seen.add(event.id);
console.log("Received", event.event, event.data);
});import hashlib, hmac, json, os
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["SYNCBOOKS_WEBHOOK_SECRET"].encode()
@app.post("/webhooks/syncbooks")
def syncbooks_webhook():
raw = request.get_data() # the raw body
expected = "sha256=" + hmac.new(SECRET, raw, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, request.headers.get("X-SyncBooks-Signature", "")):
abort(401)
event = json.loads(raw)
# skip event["id"] if you've handled it already
return "", 200Sending a Test
Sends a test event to that endpoint now, whatever events it listens for, and tells you what it answered. The last 50 deliveries of an endpoint, with their status and timing:GET /api/v1/webhooks/:id/deliveries.
{
"message": "Test webhook delivered (HTTP 200, 184 ms)",
"data": { "delivered": true, "statusCode": 200, "durationMs": 184, "error": null, "deliveryId": "6650…" }
}Available Events
SyncBooks dispatches 62 webhook events across all modules.
Invoices
| Event | Description |
|---|---|
invoice.created | A new invoice was created |
invoice.updated | An invoice was modified |
invoice.sent | An invoice was sent to a customer |
invoice.paid | An invoice was fully paid |
invoice.overdue | An invoice became overdue (auto-detected) |
invoice.deleted | An invoice was deleted |
Payments
| Event | Description |
|---|---|
payment.created | A payment was recorded against an invoice |
payment.deleted | A payment was removed |
Expenses
| Event | Description |
|---|---|
expense.created | A new expense was recorded |
expense.updated | An expense was modified |
expense.approved | An expense was approved |
expense.rejected | An expense was rejected |
expense.paid | An expense was marked as paid |
expense.deleted | An expense was deleted |
Bills
| Event | Description |
|---|---|
bill.created | A vendor bill was created |
bill.updated | A vendor bill was modified |
bill.approved | A vendor bill was approved |
bill.paid | A vendor bill was paid |
bill.overdue | A vendor bill became overdue (auto-detected) |
bill.deleted | A vendor bill was deleted |
Customers
| Event | Description |
|---|---|
customer.created | A new customer was added |
customer.updated | A customer record was modified |
customer.deleted | A customer was removed |
Vendors
| Event | Description |
|---|---|
vendor.created | A new vendor was added |
vendor.updated | A vendor record was modified |
vendor.deleted | A vendor was removed |
Products & Inventory
| Event | Description |
|---|---|
product.created | A new product was created |
product.updated | A product was modified |
product.deleted | A product was removed |
product.low_stock | A product hit its reorder level (auto-detected) |
Estimates
| Event | Description |
|---|---|
estimate.created | A new estimate was created |
estimate.accepted | An estimate was accepted by the customer |
estimate.declined | An estimate was declined by the customer |
estimate.converted | An estimate was converted to an invoice |
Purchase Orders
| Event | Description |
|---|---|
purchase_order.created | A purchase order was created |
purchase_order.approved | A purchase order was approved |
purchase_order.received | A purchase order was marked as received |
purchase_order.deleted | A purchase order was deleted |
Journal Entries
| Event | Description |
|---|---|
journal_entry.created | A journal entry was created |
journal_entry.posted | A journal entry was posted to the general ledger |
Chart of Accounts
| Event | Description |
|---|---|
account.created | A new account was added to the chart of accounts |
account.updated | An account was modified |
account.deleted | An account was removed |
Bank Transactions
| Event | Description |
|---|---|
bank_transaction.created | A bank transaction was recorded |
bank_transaction.updated | A bank transaction was modified |
bank_transaction.deleted | A bank transaction was removed |
Credit Notes
| Event | Description |
|---|---|
credit_note.created | A credit note was issued |
credit_note.applied | A credit note was applied to an invoice |
Budgets
| Event | Description |
|---|---|
budget.created | A new budget was created |
budget.updated | A budget was modified |
budget.activated | A budget was activated |
budget.deleted | A budget was removed |
Fixed Assets
| Event | Description |
|---|---|
asset.created | A fixed asset was registered |
asset.updated | A fixed asset was modified |
asset.depreciated | Depreciation was recorded for a fixed asset |
Employees & Payroll
| Event | Description |
|---|---|
employee.created | A new employee was added |
employee.updated | An employee record was modified |
employee.deleted | An employee was removed |
payroll.run_created | A payroll run was created |
payroll.run_paid | A payroll run was marked as paid |
Organization & Subscription
| Event | Description |
|---|---|
organization.deleted | An organization account was permanently deleted |
subscription.expired | An organization subscription expired |