Search the docs

Pages and API endpoints

Developer dashboard
Docs/Webhooks

Webhooks

New

Receive real-time HTTP notifications when events happen in SyncBooks. No polling required.

How Webhooks Work

1

An event happens in SyncBooks (e.g. an invoice is paid).

2

SyncBooks sends an HTTP POST with the event to each of your endpoints that listens for it, signed with that endpoint's secret.

3

Your server checks the signature and answers with any 2xx status within 10 seconds. Do slow work after answering.

4

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.

Create Webhook
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"]
  }'
201 Created
{
  "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

ParameterTypeDescription
X-SyncBooks-Signaturestringsha256= followed by the HMAC-SHA256 of the raw body, keyed with the endpoint's secret (hex)
X-SyncBooks-EventstringThe event name, e.g. invoice.paid
X-SyncBooks-Event-IdstringThe event's ID (also id in the body): the same on every retry, for skipping duplicates
X-SyncBooks-DeliverystringThis delivery's ID, as shown in the delivery log
X-SyncBooks-Attemptnumber1 for the first try, up to 5
Body
{
  "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.

Node.js (Express)
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);
});
Python (Flask)
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 "", 200

Sending a Test

POST/api/v1/webhooks/:id/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.

Response
{
  "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

EventDescription
invoice.createdA new invoice was created
invoice.updatedAn invoice was modified
invoice.sentAn invoice was sent to a customer
invoice.paidAn invoice was fully paid
invoice.overdueAn invoice became overdue (auto-detected)
invoice.deletedAn invoice was deleted

Payments

EventDescription
payment.createdA payment was recorded against an invoice
payment.deletedA payment was removed

Expenses

EventDescription
expense.createdA new expense was recorded
expense.updatedAn expense was modified
expense.approvedAn expense was approved
expense.rejectedAn expense was rejected
expense.paidAn expense was marked as paid
expense.deletedAn expense was deleted

Bills

EventDescription
bill.createdA vendor bill was created
bill.updatedA vendor bill was modified
bill.approvedA vendor bill was approved
bill.paidA vendor bill was paid
bill.overdueA vendor bill became overdue (auto-detected)
bill.deletedA vendor bill was deleted

Customers

EventDescription
customer.createdA new customer was added
customer.updatedA customer record was modified
customer.deletedA customer was removed

Vendors

EventDescription
vendor.createdA new vendor was added
vendor.updatedA vendor record was modified
vendor.deletedA vendor was removed

Products & Inventory

EventDescription
product.createdA new product was created
product.updatedA product was modified
product.deletedA product was removed
product.low_stockA product hit its reorder level (auto-detected)

Estimates

EventDescription
estimate.createdA new estimate was created
estimate.acceptedAn estimate was accepted by the customer
estimate.declinedAn estimate was declined by the customer
estimate.convertedAn estimate was converted to an invoice

Purchase Orders

EventDescription
purchase_order.createdA purchase order was created
purchase_order.approvedA purchase order was approved
purchase_order.receivedA purchase order was marked as received
purchase_order.deletedA purchase order was deleted

Journal Entries

EventDescription
journal_entry.createdA journal entry was created
journal_entry.postedA journal entry was posted to the general ledger

Chart of Accounts

EventDescription
account.createdA new account was added to the chart of accounts
account.updatedAn account was modified
account.deletedAn account was removed

Bank Transactions

EventDescription
bank_transaction.createdA bank transaction was recorded
bank_transaction.updatedA bank transaction was modified
bank_transaction.deletedA bank transaction was removed

Credit Notes

EventDescription
credit_note.createdA credit note was issued
credit_note.appliedA credit note was applied to an invoice

Budgets

EventDescription
budget.createdA new budget was created
budget.updatedA budget was modified
budget.activatedA budget was activated
budget.deletedA budget was removed

Fixed Assets

EventDescription
asset.createdA fixed asset was registered
asset.updatedA fixed asset was modified
asset.depreciatedDepreciation was recorded for a fixed asset

Employees & Payroll

EventDescription
employee.createdA new employee was added
employee.updatedAn employee record was modified
employee.deletedAn employee was removed
payroll.run_createdA payroll run was created
payroll.run_paidA payroll run was marked as paid

Organization & Subscription

EventDescription
organization.deletedAn organization account was permanently deleted
subscription.expiredAn organization subscription expired