Home / Help Center / pos-app / Online Channels / API & Webhooks
🔌 For developers

API & Webhooks

Let your own website or internal tools read and manage products, customers, orders, coupons and gift cards (vouchers) in BazaarPOS, and get a signed message on your own server when an order, coupon or gift card changes. It works the same on the desktop app (your data stays on your PC) and on the online app.

📍 Menu path: Settings → Admin → API & Webhooks
👤 Who uses it: The owner (Admin)
⭐ Plan: Enterprise — without it the page only shows an upgrade note
Your developer needs more detail? Send them the full API Reference: every call with real requests and answers, webhook signature code, errors and limits.

Overview

There are two parts, and each has its own on/off switch. Both are off until you switch them on.

Each business is separate: a key only ever reaches the data of the business it was made in, and events are only sent to that business's own addresses.

Step-by-Step Guide

1 Switch it on and make a key

  1. Open Settings → Admin → API & Webhooks.
  2. Switch API access on.
  3. Under API keys, type a name (for example "Our website"), tick Can also change data only if the program needs to create or change records, and click Make a key.
  4. Copy the key now. It starts with bpk_ and is shown only once. If you lose it, delete it and make a new one.

2 Call the API

The address is shown on the same screen ("Address for your developer"). A full description that Postman or Swagger can import is at /open/openapi.json.

curl https://YOUR-ADDRESS/api/v1/open/products?search=cake \
  -H "Authorization: Bearer bpk_xxxxxxxxxxxxxxxx"

curl -X POST https://YOUR-ADDRESS/api/v1/open/orders \
  -H "Authorization: Bearer bpk_xxxxxxxxxxxxxxxx" -H "Content-Type: application/json" \
  -d '{"items":[{"productId":12,"quantity":2,"price":550}],"paymentMethod":"CASH","amountPaid":1100,
       "externalRef":"WEB-ORDER-5001","metadata":{"channel":"website"}}'

A read-only key can only use GET. The limit is 300 requests a minute per key. Errors come back as {"error": "…"} with a plain sentence.

3 Add a webhook address

  1. Switch Webhooks on.
  2. Under Webhook addresses, enter a name and the address on your server (online accounts need https://; a desktop installation may also use an address inside your own network, such as http://192.168.1.50:8080/hook).
  3. Leave Send all events ticked, or untick it and choose the events you want.
  4. Click Add address and copy the signing secret (whsec_…, shown once).
  5. Click Test. Your server should answer with any 2xx status. The result appears in the Delivery log.

What the API covers

RecordsWhat you can do
/productsList (search, page), read one, create, change
/customersList, read one, create, change
/ordersList, read one with its items, create (stock and tax follow the same rules as the app), cancel (/void), refund
/couponsList, create (type is PERCENT or FLAT; optional maxUses, expiresAt, minOrderValue, customerId to make it for one customer), check a code against an order total (/coupons/validate), see every use (/coupons/{id}/history)
/giftcardsList, issue, check balance (/giftcards/balance?code=), use part of it (/redeem), add money (/{id}/topup), see every use (/giftcards/{id}/history)

Coupons and gift cards on orders

Put couponCode (and couponDiscount) and/or giftCardCode and giftCardAmount in the order, in the app or through the API:

Your own ids: externalRef and metadata

Send externalRef (the id the record has in your system, up to 120 characters) and metadata (a small JSON object, up to 4000 characters) when you create or change a record. They come back on every read and are included in webhook messages. An externalRef can be used by only one record of each type, so you can never create the same order twice by mistake — the second try answers 409 and creates nothing.

GET  /open/lookup/orders?externalRef=WEB-ORDER-5001        # find the BazaarPOS order for your order number
PUT  /open/products/12/external-ref   {"externalRef":"SHOP-77"}  # attach your id to a record that already exists

Webhook events

EventWhen
order.createdAn order (sale) is made, in the app or through the API
order.updatedAn order is cancelled, refunded or its payment changes (data.change says which)
coupon.createdA coupon is created
coupon.redeemedAn order is made with a coupon code
giftcard.issuedA gift card (voucher) is issued
giftcard.redeemedPart of a gift card is used (old and new balance included)
giftcard.balance_changedThe balance changes for any reason — used or topped up (data.change is negative or positive)

Every message looks like this:

{
  "id": "evt_Qe3...",            // the same id if we send it again - use it to ignore repeats
  "type": "giftcard.redeemed",
  "createdAt": "2026-11-19T10:15:00.000Z",
  "tenantId": 1,                 // your business
  "storeId": 1,                  // the branch it happened in
  "data": { "id": 4, "code": "GC-WEB-1", "amount": 300, "previousBalance": 1000, "balance": 700,
            "externalRef": "VOUCHER-1", "metadata": null }
}

Check that a message really came from BazaarPOS

Each message has a header X-BazaarPOS-Signature: t=<unix seconds>,v1=<hex>. Work out HMAC-SHA256(secret, t + "." + rawBody) as hex with your signing secret; it must equal v1. Use the raw body exactly as received, and refuse a message whose t is more than 5 minutes old.

// Node.js
const crypto = require('crypto');
function valid(rawBody, header, secret) {
  const t = /t=(\d+)/.exec(header)[1], v1 = /v1=([0-9a-f]+)/.exec(header)[1];
  const want = crypto.createHmac('sha256', secret).update(t + '.' + rawBody).digest('hex');
  return Math.abs(Date.now() / 1000 - t) < 300 && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(want));
}

# Python
import hmac, hashlib, time, re
def valid(raw_body: bytes, header: str, secret: str) -> bool:
    t = re.search(r"t=(\d+)", header).group(1); v1 = re.search(r"v1=([0-9a-f]+)", header).group(1)
    want = hmac.new(secret.encode(), (t + ".").encode() + raw_body, hashlib.sha256).hexdigest()
    return abs(time.time() - int(t)) < 300 and hmac.compare_digest(v1, want)

// PHP
function valid($raw, $header, $secret) {
  preg_match('/t=(\d+)/', $header, $a); preg_match('/v1=([0-9a-f]+)/', $header, $b);
  return abs(time() - $a[1]) < 300 && hash_equals(hash_hmac('sha256', $a[1] . '.' . $raw, $secret), $b[1]);
}

If your server does not answer

Answer any 2xx status within 10 seconds. Otherwise BazaarPOS tries again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 24 hours (7 tries in all), and then marks the message Failed. The Delivery log shows every message with its status, the number of tries and the reason for the last failure, and Send again sends a failed or waiting message at once. Messages older than 30 days are removed from the log.

Where webhooks are sent from

In Settings → Advanced → Automatic jobs the owner chooses, for webhooks, Automatic, Desktop app only or Online server only (and can switch them off).

Desktop app and online app

Common questions

MessageWhat it means
"API key missing" / "not valid"Send the key as Authorization: Bearer bpk_… or in X-API-Key. A key that was switched off or deleted stops working at once.
"API access is switched off"Switch API access on in Settings → Admin → API & Webhooks.
"This API key is read-only"Make a key with Can also change data ticked.
"part of the Enterprise plan"The business's licence does not include this feature. Upgrade the licence.
409 on createThe externalRef is already used by another record of that type; nothing was created.