Home / Help Center / pos-app / Online Channels / API Reference
⭐ Enterprise · Settings → System & Admin → API & Webhooks

API Reference for Shops and Developers

One page for both people. The shop owner reads the first part: switch the API on, make a key, add a webhook. The developer reads the rest: how to sign in, every call with a real request and answer, webhooks with working signature code, limits, errors and ready recipes.

🔗 Base address: https://www.bazaarpos.in/pos-app-backend/api/v1/open
🔑 Header: Authorization: Bearer bpk_…
📄 JSON only
⏱ 300 calls a minute per key

For the shop owner

Part 1 · for the shop

This part is for the person who owns the BazaarPOS account. You do not write any code. You switch the feature on, make a key, and give your developer two things: the address and the key.

1 What you need

  • The Enterprise plan. On any other plan the screen only shows an upgrade note and nothing below works. Ask us to add it to your plan.
  • Sign in as the owner (Admin). Other staff do not see this screen.
  • The online (cloud) app or the Windows desktop app. Both work the same way.

2 Switch it on

  1. Open Settings → System & Admin → API & Webhooks.
  2. Switch on API access. Everything is off until you do this, even if keys already exist. A key made earlier will answer "API access is switched off" until then.
  3. Switch on Webhooks only if your developer needs to be told when something happens (see the webhook part below). The two switches are separate.

3 Make a key

  1. Press Make a key and give it a name that says who uses it, for example Website or Accountant reports. One key per tool is best, so you can switch off one without stopping the others.
  2. Choose what it may do. Choose Read only or Read and write. A read-only key can only look at data. A write key can also create and change products, customers, orders, coupons and gift cards. Give write only when it is needed.
  3. The key (it starts with bpk_) is shown once. Copy it now and send it to your developer through a safe channel. We store only a scrambled form, so nobody, including us, can show it to you again. If it is lost, delete it and make a new one.
A key works only for your business. It cannot see any other shop's data. If you have several branches, a key made while a branch is selected is limited to that branch.

4 Give your developer these two things

  • The address shown on the screen under "Address for your developer". It ends with /open.
  • The key you just made.
  • Also send them this page, and the link …/open/openapi.json (the machine-readable description, which needs no key).

5 Keeping it safe

  • Treat a key like a password. Anyone who has a write key can create bills and issue gift cards in your name.
  • Never put a key inside a website page or a phone app that customers can open. It must stay on your developer's own server.
  • To stop a key at once, switch it off with its on/off switch, or delete it, in the key list. It stops working within about 15 seconds. The list shows when each key was last used, so you can spot one that nobody uses any more.
  • To stop everything at once, switch API access off. Your shop and billing carry on normally.
  • The API cannot do anything that changes your settings, users, licence, or reports. It covers products, customers, orders, coupons and gift cards only.

6 Webhooks: messages sent to your developer's server

  1. Press Add address under Webhook addresses. Enter a name and the full address on your developer's server, for example https://shop.example.com/hooks/bazaarpos.
  2. Choose Send all events or tick only the events you need.
  3. The signing secret (it starts with whsec_) is shown when you add it. Give it to your developer; it lets their server check that a message really came from BazaarPOS.
  4. Press Test. Your developer's server should receive a ping and the screen shows OK. If it shows an error, it tells you what went wrong (for example "Your server answered 404").
  5. The delivery log lists every message with its result and number of tries. A message that failed all its tries has a Send again button.
An online account can only send to https:// addresses on the public internet. A desktop installation sends from the shop PC itself, so an address inside your own network (such as http://192.168.1.20:8080/hook) also works and no data goes through our cloud.

Quick start (5 minutes)

Part 2 · for the developer

Get the key and the switches from the shop owner (see above). Then:

curl "https://www.bazaarpos.in/pos-app-backend/api/v1/open/ping" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE"
HTTP 200
{
  "ok": true,
  "apiVersion": "1",
  "tenantId": 1,
  "storeId": 1,
  "canWrite": true
}

ok: true means the key works. tenantId is the shop's business number, storeId is the branch the key is limited to (or null for all branches), and canWrite tells you whether this key may change data. Now list products:

curl "https://www.bazaarpos.in/pos-app-backend/api/v1/open/products?limit=2" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE"

If you get 401, 403 or 429, see the error table — every error says in plain words what to fix.

Address, format and versions

Base addresshttps://www.bazaarpos.in/pos-app-backend/api/v1/open
The owner's screen shows the exact address for the shop (Settings → System & Admin → API & Webhooks → "Address for your developer"). Use that one. For a desktop installation it is the shop PC's own address, usually on the local network.
ProtocolHTTPS only for the online app. The desktop app uses its own certificate; see "Desktop" below.
FormatJSON in and out. Send Content-Type: application/json with POST and PUT. Dates in responses are ISO 8601 text (2026-11-20T07:34:46.000Z) on most records; the delivery log and key list use Unix milliseconds.
MoneyPlain numbers in the shop's currency (550 means 550 rupees), never in paise or cents. Send numbers, not text.
VersionThe address contains /v1/. We add new fields and new endpoints inside v1 without notice, so ignore fields you do not know. A change that could break your code would go to a new version number.
Call from your serverKeep the key on your own server. Do not call the API from browser JavaScript or a mobile app: anyone could read the key from there.
Machine-readable descriptionGET https://www.bazaarpos.in/pos-app-backend/api/v1/open/openapi.json — an OpenAPI 3 file that needs no key. Load it into Postman, Insomnia or Swagger UI.

Authentication

Send the key on every request in either header (use one of them):

Authorization: Bearer bpk_YOUR_KEY_HERE
# or
X-API-Key: bpk_YOUR_KEY_HERE

Errors and limits

Every error has the same shape: { "error": "text in plain words" }. Show or log that text; it says what to do.

StatusMessage (real)Meaning and fix
401API key missing. Send it as "Authorization: Bearer bpk_..." or in the "X-API-Key" header.No key was sent. Add the header.
401This API key is not valid, or it has been switched off.The key is wrong, was deleted, or the owner switched it off. Check you copied all of it.
403API access is switched off for this business. Switch it on in Settings > API & Webhooks.The owner has not switched API access on (or switched it off again).
403API access and webhooks are part of the Enterprise plan. Upgrade your licence to use them.The shop's plan does not include the API.
403This API key is read-only. Create a key with write access to change data.You used a read-only key for a write. Ask the owner for a write key.
400items requiredA required field is missing or wrong. The text names it.
400Insufficient balance (Rs.900.00 available)A business rule refused it (here, a gift card with too little balance).
404Nothing with externalRef "NOPE".Nothing found with that id or externalRef.
409externalRef "WP-9001" is already used by product #201.That externalRef is already attached to another record of the same kind. This is how you avoid creating the same order twice.
429Too many requests. Please slow down (limit: 300 a minute per key).Wait for the next minute and slow down. Spread bulk work over time.

Lists, search and paging

Every list answers with the records and the paging numbers:

HTTP 200
{
  "products": [
    {
      "id": 201,
      "name": "Web Cake 1kg",
      "sku": "WEB-1",
      "barcode": "601678151907",
      "price": 500,
      "costPrice": 300,
      "taxRate": 0,
      "unit": "pcs",
      "category": "General",
      "isActive": true,
      "externalRef": "WP-9001",
      "metadata": {
        "shopifyId": "gid://1",
        "note": "x"
      },
      "createdAt": "2026-11-20T07:36:07.000Z",
      "updatedAt": "2026-11-20T07:36:07.000Z"
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 2,
  "pages": 1
}
ListFilters you can sendPage size
/productssearch, categoryId, isActive, stockStatus, sortBy (default name), sortDir (asc / desc), page, limit20 by default
/customerssearch (name, phone, email or barcode), page, limitset by limit
/ordersfrom and to (dates, 2026-11-01), paymentMethod, paymentStatus, type, search (text to look for, such as the invoice number), page, limit30 by default, at most 5000
/coupons, /giftcardsnone needed; the list is returned whole—

To read everything, keep asking for page=1,2,3… until page reaches pages. Prefer a moderate limit (100 or less) so a call stays fast. Because records can be added while you read, to stay in step with the shop use the webhooks and read only what changed, not the whole list every minute.

Your own ids: externalRef and metadata

Your website or system has its own numbers (a Shopify order id, an ERP customer code). Store them in BazaarPOS with the record, and find the record by them later. They work the same on products, customers, orders, coupons and gift cards.

Find a record by your id

curl "https://www.bazaarpos.in/pos-app-backend/api/v1/open/lookup/products?externalRef=WP-9001" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE"
HTTP 200
{
  "product": {
    "id": 201,
    "name": "Web Cake 1kg",
    "sku": "WEB-1",
    "barcode": "601678151907",
    "price": 550,
    "costPrice": 300,
    "taxRate": 0,
    "unit": "pcs",
    "category": "General",
    "isActive": true,
    "inventory": {
      "id": 201,
      "tenantId": 1,
      "storeId": 1,
      "productId": 201,
      "quantity": 50,
      "minStockLevel": 0,
      "maxStockLevel": 0,
      "reorderPoint": 0,
      "lastRestocked": null,
      "expiryDate": null,
      "syncBaseQty": null,
      "batchNumber": null,
      "warehouseId": null,
      "defaultSupplierId": null,
      "binLocation": null,
      "syncId": "t1-b1-0daaa76876ec532ec1ae9e1c6b254e54",
      "createdAt": "2026-11-20T07:36:07.000Z",
      "updatedAt": "2026-11-20T07:36:07.000Z"
    },
    "externalRef": "WP-9001",
    "metadata": {
      "shopifyId": "gid://1",
      "note": "x"
    },
    "createdAt": "2026-11-20T07:36:07.000Z",
    "updatedAt": "2026-11-20T07:36:07.000Z"
  }
}

The kind in the address is one of products, customers, orders, coupons, giftcards. Nothing found: 404 with Nothing with externalRef "NOPE".

Attach or change an id on a record that already exists

curl -X PUT "https://www.bazaarpos.in/pos-app-backend/api/v1/open/products/201/external-ref" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" -H "Content-Type: application/json" \
  -d '{"externalRef":"WP-9002","metadata":{"colour":"red"}}'
HTTP 200
{
  "id": 201,
  "externalRef": "WP-9002",
  "metadata": {
    "colour": "red"
  }
}
Using an id that belongs to another record of the same kind gives 409 and nothing is changed or created. That is on purpose: it makes "create this order" safe to repeat.

Products

The things you sell. Stock is part of the product (inventory).

AddressWhat it doesNeeds
GET/productsList and searchAny key
GET/products/:idOne productAny key
POST/productsCreate a productWrite key
PUT/products/:idChange a product (send only what changes)Write key

Create

Required: name, price and costPrice (without them you get 400 "Product name is required", "Price is required" or "Cost price is required"). Useful: sku (your stock code; also a barcode is made if you send none), taxRate (percent, for example 5 or 18), unit, category, hsn, description, mrp, initialStock (the opening quantity), isActive, externalRef, metadata.

curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/products" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"name":"Web Cake 1kg","sku":"WEB-1","price":500,"costPrice":300,"taxRate":0,"unit":"pcs","initialStock":50,"externalRef":"WP-9001","metadata":{"shopifyId":"gid://1","note":"x"}}'
HTTP 201
{
  "message": "Product created",
  "product": {
    "id": 201,
    "name": "Web Cake 1kg",
    "sku": "WEB-1",
    "barcode": "601678151907",
    "price": 500,
    "costPrice": 300,
    "taxRate": 0,
    "unit": "pcs",
    "category": "General",
    "isActive": true,
    "inventory": {
      "id": 201,
      "tenantId": 1,
      "storeId": 1,
      "productId": 201,
      "quantity": 50,
      "minStockLevel": 0,
      "maxStockLevel": 0,
      "reorderPoint": 0,
      "lastRestocked": null,
      "expiryDate": null,
      "syncBaseQty": null,
      "batchNumber": null,
      "warehouseId": null,
      "defaultSupplierId": null,
      "binLocation": null,
      "syncId": "t1-b1-0daaa76876ec532ec1ae9e1c6b254e54",
      "createdAt": "2026-11-20T07:36:07.000Z",
      "updatedAt": "2026-11-20T07:36:07.000Z"
    },
    "externalRef": "WP-9001",
    "metadata": {
      "shopifyId": "gid://1",
      "note": "x"
    },
    "createdAt": "2026-11-20T07:36:07.000Z",
    "updatedAt": "2026-11-20T07:36:07.000Z"
  }
}

Change

Send only the fields to change. The reference you set earlier stays.

curl -X PUT "https://www.bazaarpos.in/pos-app-backend/api/v1/open/products/201" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"price":550}'
HTTP 200
{
  "message": "Product updated",
  "product": {
    "id": 201,
    "name": "Web Cake 1kg",
    "sku": "WEB-1",
    "barcode": "601678151907",
    "price": 550,
    "costPrice": 300,
    "taxRate": 0,
    "unit": "pcs",
    "category": "General",
    "isActive": true,
    "inventory": {
      "id": 201,
      "tenantId": 1,
      "storeId": 1,
      "productId": 201,
      "quantity": 50,
      "minStockLevel": 0,
      "maxStockLevel": 0,
      "reorderPoint": 0,
      "lastRestocked": null,
      "expiryDate": null,
      "syncBaseQty": null,
      "batchNumber": null,
      "warehouseId": null,
      "defaultSupplierId": null,
      "binLocation": null,
      "syncId": "t1-b1-0daaa76876ec532ec1ae9e1c6b254e54",
      "createdAt": "2026-11-20T07:36:07.000Z",
      "updatedAt": "2026-11-20T07:36:07.000Z"
    },
    "externalRef": "WP-9001",
    "metadata": {
      "shopifyId": "gid://1",
      "note": "x"
    },
    "createdAt": "2026-11-20T07:36:07.000Z",
    "updatedAt": "2026-11-20T07:36:07.000Z"
  }
}

Reading one (GET /products/201) returns { "product": { … } }. A product record has many more fields than shown here (for example images, tags, hsn, allergens, isSerialTracked); they are there for the shop's own screens and can be ignored. inventory holds the stock for the branch.

There is no delete in the API on purpose. To stop selling a product, send {"isActive": false}.

Customers

People who buy from the shop. A customer is matched by phone in the shop's own screens, so send a phone number when you have one.

AddressWhat it doesNeeds
GET/customersList and searchAny key
GET/customers/:idOne customer, with purchase totalsAny key
POST/customersCreate a customerWrite key
PUT/customers/:idChange a customerWrite key

Required: name. Useful: phone, email, address, city, state, pincode, gstin, dateOfBirth, notes, creditLimit, externalRef, metadata.

curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/customers" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"name":"Web Buyer","phone":"9000011111","email":"buyer@example.com","externalRef":"CUST-77"}'
HTTP 201
{
  "customer": {
    "id": 151,
    "name": "Web Buyer",
    "phone": "9000011111",
    "email": "buyer@example.com",
    "address": null,
    "loyaltyPoints": 0,
    "creditLimit": 0,
    "walletBalance": 0,
    "externalRef": "CUST-77",
    "metadata": null,
    "createdAt": "2026-11-20T07:36:07.000Z"
  }
}

Reading one customer also returns salesCount, totalSpend and lastPurchase.

Orders (bills)

An order is a bill, the same record the shop creates at the counter. An order made through the API shows in the shop's Sales screen, reports, stock and accounts like any other, and gets the next invoice number in the shop's own series.

AddressWhat it doesNeeds
GET/ordersList orders (filter by date, payment, search)Any key
GET/orders/:idOne order with its itemsAny key
POST/ordersCreate an orderWrite key
POST/orders/:id/voidCancel an order made by mistakeWrite key
POST/orders/:id/refundRefund the whole orderWrite key

Create an order

FieldMeaning
items (required)A list. Each item: productId (BazaarPOS id), quantity, price (per unit, as charged), optional discount, taxRate, name/itemName, batchId, serialNumbers. Quantity may have decimals only as far as the shop allows (for example kilograms); otherwise it is refused with a message.
paymentMethodCASH (default), CARD, UPI and the other methods the shop uses. For a part-credit bill leave amountPaid lower than the total.
amountPaidWhat was received. Lower than the total means the rest is on credit (udhaar) for that customer; the shop sees it in dues.
customerIdThe BazaarPOS customer. Find it first with /lookup/customers or create it.
discountA bill-level discount amount.
couponCode + couponDiscountUse a coupon. The coupon is counted as used, once, and reversed again if the order is voided or refunded. See Coupons.
giftCardCode + giftCardAmountPay (part of) the bill from a gift card. The amount is taken off the card at the same moment, and put back if the order fails or is voided or refunded.
transactionRefThe payment reference from your gateway.
shippingAddress, placeOfSupply, isInterState, dueDate, notes, customDataDelivery and tax details, due date for credit, free notes.
externalRef, metadataYour own order number and notes. Always send the externalRef so a repeated call cannot create a second bill.
curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/orders" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"productId":201,"quantity":2,"price":550}],"paymentMethod":"CASH","amountPaid":990,"customerId":151,"couponCode":"WEB10","couponDiscount":110,"externalRef":"WEB-ORDER-5001","metadata":{"channel":"website"}}'
HTTP 201
{
  "sale": {
    "id": 5803,
    "saleNumber": "SALE-1795160168015",
    "invoiceNumber": "INV-BIZ-88888881-MAIN01-05803",
    "type": "SALE",
    "customerId": 151,
    "subtotal": 1100,
    "tax": 0,
    "discount": 110,
    "total": 990,
    "amountPaid": 990,
    "paymentMethod": "CASH",
    "paymentStatus": "COMPLETED",
    "createdAt": "2026-11-20T07:36:08.000Z",
    "externalRef": "WEB-ORDER-5001",
    "metadata": {
      "channel": "website"
    },
    "coupon": {
      "code": "WEB10",
      "discount": 110
    },
    "giftCard": null,
    "items": [
      {
        "id": 7783,
        "productId": 201,
        "name": "Web Cake 1kg",
        "quantity": 2,
        "price": 550,
        "discount": 0,
        "taxRate": 0,
        "tax": 0,
        "subtotal": 1100
      }
    ]
  },
  "invoiceNumber": "INV-BIZ-88888881-MAIN01-05803"
}

coupon and giftCard in the answer show what this order used. A missing product, a quantity that is too precise, or a coupon or gift card that cannot be used gives 400 with the reason, and nothing is created.

Read, search

curl "https://www.bazaarpos.in/pos-app-backend/api/v1/open/orders?from=2026-11-01&to=2026-11-30&limit=2" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE"

The answer has sales (the list) with total, page, limit, pages. GET /orders/:id returns { "sale": { … } }, with items.

Payment status

paymentStatus is COMPLETED (paid in full), PENDING (not paid in full, so the rest is on credit), CANCELLED (voided) or REFUNDED. Check it before you act on a webhook.

Void and refund

Both take an optional reason. Void cancels a bill that should not have existed. Refund returns the whole bill. Both reverse a coupon or gift card the order used. A refunded bill cannot be voided, and voiding or refunding the same bill twice is refused ("Already cancelled", "Already refunded"). Partial returns (a few items back) are done in the shop's app, not through the API.

curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/orders/5804/void" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"reason":"changed my mind"}'
HTTP 200
{ "sale": { "id": 5804, "paymentStatus": "CANCELLED", … } }
curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/orders/5803/refund" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"reason":"damaged"}'
HTTP 200
{ "sale": { "id": 5803, "paymentStatus": "REFUNDED", … } }

Coupons

Discount codes. A code is stored in capital letters.

AddressWhat it doesNeeds
GET/couponsList couponsAny key
POST/couponsCreate a couponWrite key
POST/coupons/validateCheck a code and get the discount for a totalWrite key
GET/coupons/:id/historyEvery use of the coupon, each tied to its orderAny key

Create

Required: code. type is PERCENT (default) or FIXED; value is the percent or the amount. Optional: description, minOrderValue, maxDiscount, maxUses, expiresAt, customerId (only that customer may use it), externalRef, metadata.

curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/coupons" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"code":"WEB10","type":"PERCENT","value":10,"externalRef":"PROMO-1"}'
HTTP 201
{
  "coupon": {
    "id": 1,
    "tenantId": 1,
    "storeId": 1,
    "code": "WEB10",
    "description": null,
    "type": "PERCENT",
    "value": 10,
    "minOrderValue": 0,
    "maxDiscount": null,
    "maxUses": null,
    "customerId": null,
    "usedCount": 0,
    "isActive": true,
    "expiresAt": null,
    "syncId": null,
    "createdAt": "2026-11-20T07:36:07.000Z",
    "updatedAt": "2026-11-20T07:36:07.000Z",
    "externalRef": "PROMO-1",
    "metadata": null
  }
}

Check a code before you charge

Send the code and the order total (orderTotal, and customerId if the coupon is for one customer). It tells you whether it may be used and how much it takes off. It does not use the coupon up.

curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/coupons/validate" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"code":"WEB10","orderTotal":1100}'
HTTP 200
{
  "ok": true,
  "discount": 110,
  "coupon": {
    "id": 1,
    "code": "WEB10",
    "description": "10% off",
    "type": "PERCENT",
    "value": 10,
    "customerId": null,
    "externalRef": "PROMO-1",
    "metadata": null
  }
}

Then create the order with couponCode and couponDiscount; the coupon is counted as used at that moment. A coupon past its limit, expired, below its minimum order, or for another customer is refused with a reason.

Where it was used

HTTP 200
{
  "coupon": {
    "id": 1,
    "code": "WEB10",
    "maxUses": null,
    "usedCount": 1,
    "customerId": null
  },
  "history": [
    {
      "id": 1,
      "saleId": 5803,
      "invoiceNumber": "INV-BIZ-88888881-MAIN01-05803",
      "customerId": 151,
      "customerName": "Web Buyer",
      "discount": 110,
      "reversed": false,
      "createdAt": 1795160168055
    }
  ]
}

reversed: true means the order was voided or refunded and the use was given back.

Gift cards (vouchers)

Prepaid value with a code. Every change of balance is recorded with who, when, and which order.

AddressWhat it doesNeeds
GET/giftcardsList gift cardsAny key
POST/giftcardsIssue a gift cardWrite key
GET/giftcards/balance?code=…Check a balanceAny key
POST/giftcards/redeemTake an amount off the cardWrite key
POST/giftcards/:id/topupAdd money to the cardWrite key
GET/giftcards/:id/historyEvery issue, use, top-up, with the balance before and afterAny key

Issue

Required: amount (above zero). Optional: code (made for you if you send none), customerId, expiresAt, externalRef, metadata.

curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/giftcards" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"amount":1000,"code":"GC-WEB-1","externalRef":"VOUCHER-1"}'
HTTP 201
{
  "giftCard": {
    "id": 1,
    "tenantId": 1,
    "storeId": 1,
    "code": "GC-WEB-1",
    "initialBalance": 1000,
    "balance": 1000,
    "customerId": null,
    "issuedBySaleId": null,
    "isActive": true,
    "expiresAt": null,
    "syncId": "t1-b1-721de367e52b416ed2ba3185d3899b36",
    "createdAt": "2026-11-20T07:36:08.000Z",
    "updatedAt": "2026-11-20T07:36:08.000Z",
    "externalRef": "VOUCHER-1",
    "metadata": null
  }
}

Check, use, top up

curl "https://www.bazaarpos.in/pos-app-backend/api/v1/open/giftcards/balance?code=GC-WEB-1" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE"
HTTP 200
{
  "ok": true,
  "code": "GC-WEB-1",
  "balance": 1000,
  "expiresAt": null
}
curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/giftcards/redeem" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"code":"GC-WEB-1","amount":300}'
HTTP 200
{
  "ok": true,
  "deducted": 300,
  "remainingBalance": 700
}
curl -X POST "https://www.bazaarpos.in/pos-app-backend/api/v1/open/giftcards/1/topup" \
  -H "Authorization: Bearer bpk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"amount":200}'
HTTP 200
{
  "ok": true,
  "newBalance": 900
}

Taking more than the balance is refused (Insufficient balance (Rs.900.00 available)) and nothing changes. Two calls at the same moment cannot spend the same money twice: the balance is taken in one step. An expired, unknown or switched-off card is refused ("Gift card not found or inactive", "Gift card has expired", "Gift card has no remaining balance").

History

HTTP 200
{
  "giftCard": {
    "id": 1,
    "code": "GC-WEB-1",
    "initialBalance": 1000,
    "balance": 900,
    "expiresAt": null
  },
  "history": [
    {
      "id": 3,
      "kind": "TOPUP",
      "amount": 200,
      "balanceBefore": 700,
      "balanceAfter": 900,
      "saleId": null,
      "note": "Money added to the card",
      "reversed": false,
      "createdAt": 1795160168457
    },
    {
      "id": 2,
      "kind": "REDEEM",
      "amount": 300,
      "balanceBefore": 1000,
      "balanceAfter": 700,
      "saleId": null,
      "note": null,
      "reversed": false,
      "createdAt": 1795160168439
    },
    {
      "id": 1,
      "kind": "ISSUE",
      "amount": 1000,
      "balanceBefore": 0,
      "balanceAfter": 1000,
      "saleId": null,
      "note": "Gift card issued",
      "reversed": false,
      "createdAt": 1795160168398
    }
  ]
}

kind is ISSUE, REDEEM or TOPUP. A gift card used on a bill through giftCardCode shows with that bill's saleId.

Webhooks

Instead of asking again and again, let BazaarPOS tell you. When something happens, it sends one POST with JSON to your address for each event.

What you receive

POST /your/webhook/address HTTP/1.1
Content-Type: application/json
User-Agent: BazaarPOS-Webhooks/1
X-BazaarPOS-Event: order.created
X-BazaarPOS-Event-Id: evt_iaxB2u3mrButCjUn
X-BazaarPOS-Delivery: 1
X-BazaarPOS-Signature: t=1795160086,v1=fb95a7f8a5319657eb9a24c7d26a36c58b847e33ccb93f479bc4a75f2e6efc16
{
  "id": "evt_hz0-HefALM99d3TD",
  "type": "order.created",
  "createdAt": "2026-11-20T07:36:08.065Z",
  "tenantId": 1,
  "storeId": 1,
  "data": {
    "id": 5803,
    "saleNumber": "SALE-1795160168015",
    "invoiceNumber": "INV-BIZ-88888881-MAIN01-05803",
    "type": "SALE",
    "customerId": 151,
    "subtotal": 1100,
    "tax": 0,
    "discount": 110,
    "total": 990,
    "amountPaid": 990,
    "paymentMethod": "CASH",
    "paymentStatus": "COMPLETED",
    "createdAt": "2026-11-20T07:36:08.000Z",
    "externalRef": "WEB-ORDER-5001",
    "metadata": {
      "channel": "website"
    },
    "items": [
      {
        "id": 7783,
        "productId": 201,
        "name": "Web Cake 1kg",
        "quantity": 2,
        "price": 550,
        "discount": 0,
        "taxRate": 0,
        "tax": 0,
        "subtotal": 1100
      }
    ],
    "…": "the same fields as the order you read through the API"
  }
}
idThe event id, also in the X-BazaarPOS-Event-Id header. The same event always has the same id, even when it is sent again. Keep the ids you handled and ignore a repeat.
typeThe event name (below).
createdAtWhen the event happened (ISO time, UTC).
tenantId, storeIdThe business and the branch where it happened.
dataThe record, in the same shape the API gives, including your externalRef and metadata if you set them.
X-BazaarPOS-DeliveryWhich try this is: 1 the first time, 2 on the first retry, and so on.

Events

EventWhendata holds
order.createdA bill is made, by anyone (the counter, the phone, your API call).The order with its items, and the coupon or gift card it used.
order.updatedA bill is voided or refunded.The order, plus change: voided or refunded (check paymentStatus too).
coupon.createdA coupon is made.The coupon.
coupon.redeemedA coupon is used on a bill.code, discount, orderId, invoiceNumber, customerId.
giftcard.issuedA gift card is made.The card with its starting balance.
giftcard.redeemedMoney is taken off a card.amount, previousBalance, balance, saleId.
giftcard.balance_changedAny change of a card's balance (use, top-up, giving back).change (+ or −), previousBalance, balance, reason (redeemed, topped_up…).
pingOnly when the owner presses Test.{ "message": "This is a test from BazaarPOS." }

The events are sent for changes made in the shop's own app as well, not only through the API, so your system also learns about counter sales. Real examples:

{
  "id": "evt_m3VwVeKqCmXb1jkl",
  "type": "coupon.redeemed",
  "createdAt": "2026-11-20T07:36:08.073Z",
  "tenantId": 1,
  "storeId": 1,
  "data": {
    "id": 1,
    "code": "WEB10",
    "discount": 110,
    "orderId": 5803,
    "invoiceNumber": "INV-BIZ-88888881-MAIN01-05803",
    "customerId": 151,
    "externalRef": "PROMO-1",
    "metadata": null
  }
}
{
  "id": "evt_-nEM5dL465Pw3cFo",
  "type": "giftcard.balance_changed",
  "createdAt": "2026-11-20T07:36:08.433Z",
  "tenantId": 1,
  "storeId": 1,
  "data": {
    "id": 1,
    "code": "GC-WEB-1",
    "amount": 300,
    "previousBalance": 1000,
    "balance": 700,
    "saleId": null,
    "storeId": 1,
    "change": -300,
    "reason": "redeemed",
    "externalRef": "VOUCHER-1",
    "metadata": null
  }
}
{
  "id": "evt_IwpfRqSXFykwu-Uf",
  "type": "order.updated",
  "createdAt": "2026-11-20T07:36:08.217Z",
  "tenantId": 1,
  "storeId": 1,
  "data": {
    "id": 5804,
    "invoiceNumber": "INV-BIZ-88888881-MAIN01-05804",
    "paymentStatus": "CANCELLED",
    "total": 550,
    "change": "voided",
    "…": "the rest of the order"
  }
}

Check the signature

Anyone can post to your address, so check that a message really came from BazaarPOS. Each message carries X-BazaarPOS-Signature: t=<unix seconds>,v1=<hex>.

  1. Take the raw body exactly as received (the bytes, before you parse the JSON).
  2. Build the text t + "." + rawBody using the t from the header.
  3. Compute HMAC-SHA256 of it with the endpoint's signing secret (whsec_…) and write it as lower-case hex.
  4. Compare with v1 using a constant-time comparison.
  5. Refuse the message if t is more than 5 minutes away from your clock (this stops someone re-sending an old message).

Node.js

const crypto = require('crypto');

// Express: use express.raw({ type: 'application/json' }) on this route so req.body is the raw Buffer
app.post('/hooks/bazaarpos', express.raw({ type: 'application/json' }), (req, res) => {
  const header = req.get('X-BazaarPOS-Signature') || '';
  const t = (/t=(\d+)/.exec(header) || [])[1];
  const v1 = (/v1=([0-9a-f]+)/.exec(header) || [])[1];
  if (!t || !v1) return res.sendStatus(400);
  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return res.sendStatus(400);      // too old
  const want = crypto.createHmac('sha256', process.env.BAZAARPOS_WEBHOOK_SECRET)
    .update(t + '.' + req.body.toString('utf8')).digest('hex');
  const ok = want.length === v1.length && crypto.timingSafeEqual(Buffer.from(want), Buffer.from(v1));
  if (!ok) return res.sendStatus(400);

  const event = JSON.parse(req.body.toString('utf8'));
  // 1. if you already handled event.id, just answer 200
  // 2. save it, then handle it, then answer 200 quickly
  res.sendStatus(200);
});

Python (Flask)

import hmac, hashlib, os, re, time
from flask import Flask, request, abort

app = Flask(__name__)

@app.post('/hooks/bazaarpos')
def hook():
    raw = request.get_data()                      # the raw bytes
    header = request.headers.get('X-BazaarPOS-Signature', '')
    t = re.search(r't=(\d+)', header)
    v1 = re.search(r'v1=([0-9a-f]+)', header)
    if not t or not v1 or abs(time.time() - int(t.group(1))) > 300:
        abort(400)
    want = hmac.new(os.environ['BAZAARPOS_WEBHOOK_SECRET'].encode(),
                    t.group(1).encode() + b'.' + raw, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(want, v1.group(1)):
        abort(400)
    event = request.get_json()
    # ignore a repeat of event['id'], handle the event, answer quickly
    return '', 200

PHP

<?php
$raw = file_get_contents('php://input');
$header = $_SERVER['HTTP_X_BAZAARPOS_SIGNATURE'] ?? '';
preg_match('/t=(\d+)/', $header, $t);
preg_match('/v1=([0-9a-f]+)/', $header, $v);
if (!$t || !$v || abs(time() - (int)$t[1]) > 300) { http_response_code(400); exit; }
$want = hash_hmac('sha256', $t[1] . '.' . $raw, getenv('BAZAARPOS_WEBHOOK_SECRET'));
if (!hash_equals($want, $v[1])) { http_response_code(400); exit; }
$event = json_decode($raw, true);
// ignore a repeat of $event['id'], handle it, answer quickly
http_response_code(200);
If the check fails even though the secret is right, the usual cause is a framework that already parsed and re-wrote the JSON. The signature is made from the exact bytes we sent, so use the raw body. The secret can be changed on the screen (New secret); the old one stops working at once.

How delivery works, retries and the log

Which addresses are allowed

Online (cloud) accountDesktop installation
Protocolhttps:// onlyhttps:// or http://
Where the address pointsA public internet address. Addresses inside a private network (10.x, 192.168.x, 172.16–31.x, 127.x, localhost, *.local, *.internal) are refused, also if the name later turns out to point thereAny, including your own network
Sent fromOur serversThe shop PC itself; nothing goes through our cloud

For development on your own laptop with an online account, use a tunnel (for example ngrok or Cloudflare Tunnel) to get a public https:// address.

Desktop installation

Recipes: what developers usually build

1. Put website orders into BazaarPOS

  1. When your website takes an order, find or create the customer: GET /lookup/customers?externalRef=<your customer id>; on 404, POST /customers with the same externalRef.
  2. Map each cart line to a BazaarPOS product. Keep the mapping by giving every product an externalRef (your SKU), then /lookup/products once and cache the ids.
  3. POST /orders with the externalRef set to your order number and metadata holding anything you want to see later. If the call times out, send it again; a 409 tells you it already exists, and /lookup/orders gets it.
  4. If the customer paid online, send paymentMethod (UPI or CARD), amountPaid equal to the total, and your gateway's reference in transactionRef.

2. Keep stock and prices in step

Read products page by page into your store once, then update by PUT /products/:id when you change a price. For stock, take it from the order webhooks (order.created, and order.updated for a void or refund) and read the product's inventory when you need the exact number.

3. Sell gift cards online

  1. When the buyer pays, POST /giftcards with the amount, a code of your own or leave it out, and your order number as externalRef. Email the code to the buyer.
  2. At checkout on your website, GET /giftcards/balance?code=… to show the balance, then include giftCardCode and giftCardAmount in POST /orders. The card is charged at the same moment the order is created.
  3. Use giftcard.balance_changed to show customers their latest balance when they also spend it in the shop.

4. Offer a coupon code on your website

Create it once with POST /coupons (or let the shop make it in the app). At checkout, POST /coupons/validate with the cart total shows the discount; then send couponCode and couponDiscount with the order. The shop's own limits (minimum order, maximum uses, expiry, one customer) are checked for you.

5. Send every sale to your accounting or CRM system

Add a webhook address with order.created and order.updated. On each message, verify the signature, ignore a repeated event id, then write the order into your system keyed by invoiceNumber. The shop never has to do double entry.

Before you go live

Questions and problems

I get 401 but I copied the key.
Check for a missing character at the end or a space around it. The key is 40+ characters and starts with bpk_. If the owner deleted or switched off that key, it is refused too. Make a new one.
I get 403 "API access is switched off".
The owner must switch on API access in Settings → System & Admin → API & Webhooks. It is off by default. A change takes effect within about 5 seconds.
I get 403 about the Enterprise plan.
The shop's plan does not include the API. Ask us to move the shop to a plan with API access.
The API address on my screen works in a browser but my code gets an HTML page.
You are calling an address that is not the API address. Use exactly the address shown under "Address for your developer", and add /ping to test it. A real answer is JSON.
My order was created twice.
You sent it twice without an externalRef. Always send one. With it, the second call gets 409 and creates nothing.
My webhook shows "Your server answered 404/500" or no message arrives.
Press Test and read the line next to it. Check the address is the full address of your route and is reachable from the internet over https. Check Webhooks is switched on, the event is ticked for that address, and the delivery log for the reason. Fix your server, then press Send again on the failed message.
The signature never matches.
Use the raw body and the secret of that address (each address has its own). Use t + "." + body. Make the result lower-case hex. If you rotated the secret, update your copy.
I get the same event twice.
That is normal after a slow or failed answer. Keep the event ids you handled and ignore a repeat.
Can I delete products, customers or orders?
No. This keeps the shop's books safe. Switch a product off with isActive: false and void or refund an order.
Can two businesses share one key?
No. A key belongs to exactly one business. Each business makes its own key.