API
This API lets external systems (your website, app or ERP) automatically create orders in your KambaChat account. Orders …
# KambaChat API — for developers
This API lets external systems (your website, app or ERP) automatically create orders in your KambaChat account. Orders land in your dashboard and follow the normal flow: confirm and complete.
> Availability (GEO) — Storefronts are exclusive to Angola. This API creates orders in your digital storefront, so it applies to Angola sellers. International users: KambaChat focuses on WhatsApp, Facebook and Instagram AI automation — the storefront and orders API are not available outside Angola.
1. Authentication
Authentication uses a secret key in the header of every request.
1. Create a key in Dashboard → Settings → API Keys: give it a name and (optional) expiry, then click Create Key.
2. The key (af_...) is shown only once. It's stored hashed (SHA-256) — never recoverable. Keep it secret.
3. Send it on every request in the header: Authorization: Bearer af_...
Security
- The key is never stored in plaintext — only its hash.
- You can set an expiry (30/90/365 days) and delete a key any time (revokes instantly).
- Rate limits: 60/min per IP and 120/min per key.
- Never expose the key in the frontend/browser — use it server-side only.
2. Create an order
POST /api/webhooks/orders
Creates an order in your account (status Pending) and sends you a dashboard notification.
| Field | Type | Required | Description |
|---|---|---|---|
| customerName | string | ✅ | Customer name |
| customerPhone | string | ✅ | Customer phone |
| customerEmail | string | — | Customer email |
| address | string | — | Customer address (optional) |
| notes | string | — | Order notes |
| channel | string | — | Source channel (e.g. WHATSAPP, default WHATSAPP) |
| items | array | — | Items: list of { productId, quantity } (total is computed from products) |
| total | number | — | Total (used only if you don't send items) |
Example
```bash
curl -X POST https://kambachat.com/api/webhooks/orders \
-H "Authorization: Bearer af_xxxxxxxx..." \
-H "Content-Type: application/json" \
-d '{
"customerName": "Ana Silva",
"customerPhone": "+244923000000",
"customerEmail": "ana@exemplo.com",
"address": "Kilamba, Luanda",
"channel": "WHATSAPP",
"notes": "Cliente VIP — contactar por WhatsApp",
"items": [
{ "productId": "PRODUCT_ID_1", "quantity": 2 },
{ "productId": "PRODUCT_ID_2", "quantity": 1 }
]
}'
```
Response (201)
```json
{ "success": true, "orderNumber": "WA12345678", "orderId": "ckx...", "total": 7500 }
```
The productIds must belong to your account. If you send items, the total is recomputed from the real product prices.
3. Get the public catalog
GET /api/webhooks/orders?store=SLUG
Returns the storefront's public data (name, active products, AI config) by *slug*. No key needed (public).
```bash
curl "https://kambachat.com/api/webhooks/orders?store=a-minha-loja"
```
4. Status codes
| Code | Meaning |
|---|---|
| 401 | Missing, invalid or expired key |
| 404 | Storefront not found (none → see GEO rule) |
| 429 | Too many requests (rate limit) |
| 201 | Order created successfully |