Developers
POS API
Connect a point-of-sale system to a hotel or restaurant's Cloud Buzz SMS contact list. When a cashier records a customer, send them here and they appear in the venue's CRM, ready for SMS campaigns if they agreed to receive offers.
Quick start
- The venue signs in to Cloud Buzz SMS, opens Settings → POS integration and creates a test key. They send it to you.
- Check the connection with
GET /me. It returns the venue name. - Send customers with
POST /customers. Test keys validate everything and return real answers, but save nothing. - When your integration works, the venue creates a live key and you switch to it.
Base URL: https://cblk.site/api/v1. All requests and responses are JSON over HTTPS. Call the API from your server or POS application, not from a public web page, so the key stays secret.
Authentication
Send the venue's key as a bearer token on every request:
Authorization: Bearer cbk_live_xxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Keys starting cbk_test_ are test keys; cbk_live_ keys write real data. A key belongs to exactly one venue. Venues can revoke a key at any time, after which requests return 401.
Consent rules
- A customer is subscribed to SMS only when you send
"consent": { "sms": true }. Only send it when the customer actually agreed, for example by ticking an opt-in box or confirming at the counter. - Without consent the customer is still saved, with
smsStatus: "no_consent", and receives no campaigns. - Leaving consent out, or sending false, never unsubscribes an existing customer. Use the unsubscribe endpoint for that.
- Optional
method: "pos_checkbox", "verbal", "signed_form", "receipt_optin", "other". Optionalat: ISO 8601 time they agreed (defaults to now).
Customers
GET/me
Confirms the key works and returns the venue it belongs to.
{ "venue": { "id": "9gJV…", "name": "Grand Hotel", "type": "hotel" }, "mode": "test" }POST/customers
Create or update one customer, matched by phone number (any Sri Lankan mobile format). Only phone is required. For an existing customer only blank fields are filled in, so edits the venue made are kept. Returns 201 when created and 200 when updated.
{
"phone": "077 123 4567",
"name": "Nimal Perera",
"email": "nimal@example.com",
"birthday": "1990-05-21",
"externalId": "CUST-0042",
"consent": { "sms": true, "method": "pos_checkbox" }
}HTTP/1.1 201 Created
{
"created": true,
"customer": {
"phone": "94771234567",
"name": "Nimal Perera",
"email": "nimal@example.com",
"birthday": "1990-05-21",
"externalId": "CUST-0042",
"source": "pos",
"smsStatus": "subscribed",
"subscribed": true,
"consent": { "at": "2026-11-06T08:15:00.000Z", "method": "pos:pos_checkbox" },
"visits": { "count": 0, "totalSpend": 0, "firstVisitAt": null, "lastVisitAt": null },
"createdAt": "2026-11-06T08:15:00.000Z"
},
"test": false
}POST/customers/batch
Up to 100 customers in one call, e.g. to load an existing customer list. Each item is handled on its own; invalid items are listed with their error and don't stop the others.
{ "customers": [ { "phone": "0771234567", "name": "Nimal" }, { "phone": "0719876543", "consent": { "sms": true } } ] }
→ { "summary": { "created": 1, "updated": 1, "failed": 0 },
"results": [ { "index": 0, "ok": true, "created": true, "customer": { … } }, … ] }GET/customers/{phone}
Look a customer up, for example so the till can show “already subscribed” and skip asking for consent again. 404 if not found.
POST/customers/{phone}/unsubscribe
The customer asked to stop receiving SMS. They stay in the venue's list but no campaign will reach them.
Visits & spend
Send each paid bill so the venue can see how often customers come and how much they spend, and target regulars or lapsed customers. A bill also creates the customer if they're new (without SMS consent unless you include it).
POST/visits
Record one bill. billNo must be unique per venue: sending the same bill again is safe and returns 200 with duplicate: true without counting it twice, so you can retry freely. Amounts are in LKR.
{
"phone": "0771234567",
"billNo": "INV-2026-001234",
"amount": 4850.00,
"visitedAt": "2026-11-06T19:42:00+05:30",
"outlet": "Main restaurant",
"customer": { "name": "Nimal Perera", "consent": { "sms": true, "method": "receipt_optin" } }
}
→ 201 { "created": true, "duplicate": false, "customerCreated": false,
"visit": { "billNo": "INV-2026-001234", "amount": 4850, … },
"customer": { …, "visits": { "count": 7, "totalSpend": 38250, "lastVisitAt": "…" } } }POST/visits/batch
Up to 100 bills in one call, to import past bills or catch up after being offline. The summary counts recorded, duplicate and failed items.
{ "visits": [ { "phone": "0771234567", "billNo": "INV-1", "amount": 1200 }, … ] }POST/visits/{billNo}/void
Refund or cancellation: removes the bill from the customer's visit count and spend. URL-encode the bill number. Safe to repeat.
Errors & limits
Errors share one shape. field names the property to fix when there is one.
HTTP/1.1 400 Bad Request
{ "error": { "code": "invalid_phone", "message": "phone must be a Sri Lankan mobile number…", "field": "phone" } }| Status | Codes | Meaning |
|---|---|---|
| 400 | invalid_json, validation_error, invalid_phone | Fix the request; don't retry as-is |
| 401 | invalid_api_key, revoked_api_key | Missing, wrong or revoked key |
| 403 | api_not_enabled, venue_inactive | The venue's plan doesn't include the API, or the account is suspended |
| 404 | not_found | No customer with that phone number, or no bill with that billNo |
| 409 | bill_conflict | That billNo was already recorded for a different phone number |
| 429 | rate_limited | More than 120 requests a minute for this key; wait for Retry-After seconds |
| 5xx | server_error | Temporary; retry with backoff. Retrying is safe because customers are matched by phone |
Code examples
curl
curl -X POST https://cblk.site/api/v1/customers \
-H "Authorization: Bearer $CLOUDBUZZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone":"0771234567","name":"Nimal Perera","consent":{"sms":true,"method":"pos_checkbox"}}'JavaScript (Node 18+)
const res = await fetch("https://cblk.site/api/v1/customers", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.CLOUDBUZZ_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ phone: "0771234567", name: "Nimal Perera", consent: { sms: true, method: "pos_checkbox" } }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { created, customer } = await res.json();Python
import os, requests
r = requests.post(
"https://cblk.site/api/v1/customers",
headers={"Authorization": f"Bearer {os.environ['CLOUDBUZZ_API_KEY']}"},
json={"phone": "0771234567", "name": "Nimal Perera", "consent": {"sms": True, "method": "pos_checkbox"}},
timeout=15,
)
r.raise_for_status()
print(r.json()["customer"]["smsStatus"])Questions about an integration? Contact Cloud Buzz. Venue staff can see recent failed API calls under Settings → POS integration. Venue sign-in