API and webhooks
Call the REST API with a scoped key, receive signed events at your own URL and give another system a URL to post to.
REST over HTTPS at https://kabaido.ai/api/v1, scoped to your workspace by the key, with money in integer minor units. The machine readable description is the OpenAPI document at https://kabaido.ai/api/v1/openapi.json (version 1.0.0).
Keys#
Create
In Settings, open Integrations, then Kabaido API. Choose New key, name it after the system that will use it and tick its scopes. It needs the Admin role or above.
Copy
Copy the key. This is the only time the full key is shown: Kabaido stores a hash of it.
Send
Send it as a Bearer token.
bash curl "https://kabaido.ai/api/v1/products?search=blade&limit=50" \ -H "Authorization: Bearer kbd_your_key_here"
A key begins kbd_, belongs to one workspace and works on the REST API only. The connector refuses a key: a person signs in to it.
Scopes#
| Scope | Allows |
|---|---|
products:read | List and search products |
products:write | Bulk upsert products by SKU |
quotes:read | List quotes and read one with its lines |
quotes:write | Used by the connector only. No REST route writes a quote |
orders:read | List orders and read one with its lines |
customers:read | List customers and read one with its contacts |
customers:write | Upsert customers |
stock:read | Read stock lines, locations and the movement ledger |
stock:write | Record a stock movement through the ledger |
suppliers:read | Read suppliers and their contacts |
purchase_orders:read | Read purchase orders with their lines and receipts |
Resources#
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /api/v1/products | products:read | List products |
| POST | /api/v1/products/bulk | products:write | Bulk upsert products |
| GET | /api/v1/quotes | quotes:read | List quotes |
| GET | /api/v1/quotes/{id} | quotes:read | Get a quote with lines |
| GET | /api/v1/orders | orders:read | List orders |
| GET | /api/v1/orders/{id} | orders:read | Get an order with lines |
| GET | /api/v1/stock/lines | stock:read | List stock lines |
| GET | /api/v1/stock/lines/{id} | stock:read | Get a stock line with its movements |
| GET | /api/v1/stock/locations | stock:read | List stock locations |
| GET | /api/v1/stock/movements | stock:read | List stock movements |
| POST | /api/v1/stock/movements | stock:write | Record a stock movement |
| GET | /api/v1/suppliers | suppliers:read | List suppliers |
| GET | /api/v1/suppliers/{id} | suppliers:read | Get a supplier with contacts |
| GET | /api/v1/purchase-orders | purchase_orders:read | List purchase orders |
| GET | /api/v1/purchase-orders/{id} | purchase_orders:read | Get a purchase order with lines and receipts |
| GET | /api/v1/customers | customers:read | List customers |
| POST | /api/v1/customers | customers:write | Upsert customers |
| GET | /api/v1/customers/{id} | customers:read | Get a customer with contacts |
A list returns its rows and next_cursor. Pass that back as cursor for the next page. Null means you have everything.
Errors#
| Status | Means |
|---|---|
| 400 | The query, the body or the cursor is not valid |
| 401 | The key is missing, unknown or revoked |
| 403 | The key lacks the scope |
| 404 | Not in your workspace or the product the route needs is off |
| 409 | A stock movement would take a balance below zero |
| 429 | The key's rate limit. Wait and retry |
| 500 | A fault on our side. Retry with a backoff |
Webhooks#
Kabaido posts a signed JSON event to each endpoint that subscribes to it. Add an endpoint in Settings, under Integrations, then Custom outbound webhook. The URL must be https and the signing secret is shown once.
| Event | Fires when |
|---|---|
quote.created | A quote is created |
quote.sent | A quote is sent to the customer |
quote.accepted | A quote is accepted |
quote.declined | A quote is declined |
order.created | An order is created |
order.updated | An order changes status, is edited or is emailed |
order.cancelled | An order is cancelled |
design.saved | A design is saved |
design.exported | A design is exported |
quote.superseded | A quote is replaced by a new version |
quote.expired | A quote passes its valid until date |
quote.viewed | The customer opens the quote |
order.invoiceable | An order is fulfilled, so an invoice can be raised |
purchase_order.sent | A purchase order is sent to the supplier |
purchase_order.received | Goods are received against a purchase order |
{
"event": "quote.accepted",
"data": {
"quote_id": "7f0c0000-0000-0000-0000-000000000000",
"number": "Q-1042",
"customer_id": "3a1e0000-0000-0000-0000-000000000000",
"total_minor": 58200,
"currency": "GBP"
},
"org_id": "00000000-0000-0000-0000-000000000000"
}X-Kabaido-Event carries the event name. X-Kabaido-Signature is t=<unix seconds>,v1=<hex>, where the hex is an HMAC SHA-256 of the timestamp, a full stop and the raw body, keyed by the signing secret.
import { createHmac, timingSafeEqual } from "node:crypto";
// header: the X-Kabaido-Signature value, "t=<unix seconds>,v1=<hex>"
// rawBody: the request body exactly as received, before any JSON parsing
export function verify(secret: string, header: string, rawBody: string): boolean {
const match = /^t=(\d+),v1=([0-9a-f]+)$/.exec(header.trim());
if (!match) return false;
const [, t, v1] = match;
if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false; // five minutes
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
const received = Buffer.from(v1, "hex");
return received.length === expected.length && timingSafeEqual(received, expected);
}import hashlib, hmac, re, time
# header: the X-Kabaido-Signature value; raw_body: the body bytes as received
def verify(secret: str, header: str, raw_body: bytes) -> bool:
match = re.fullmatch(r"t=(\d+),v1=([0-9a-f]+)", header.strip())
if not match:
return False
t, v1 = match.groups()
if abs(time.time() - int(t)) > 300: # five minutes
return False
expected = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(v1, expected)A delivery succeeds on any 2xx answer. A failed one is tried again and Recent deliveries on the endpoint shows each status, with Retry to send one now. Answer fast and do the work after.
Inbound endpoints#
An inbound endpoint is a URL another system posts JSON to. You choose what each post does when you create it, under Custom inbound endpoint.
| Action | What a post does |
|---|---|
| Upsert customers | Create or update customers matched by external id or email domain. |
| Upsert products | Create or update catalogue products by SKU, with the same validation as the import wizard. |
| ERP order status | An ERP such as EFACS posts an order status update; the matched order moves with it. |
| Order invoice | Your accounting system posts the invoice it raised. Wire it from Xero, QuickBooks or Sage through the automation you already run; Kabaido records the reference, it never issues an invoice. |
| Purchase order acknowledgement | A supplier or a broker posts our purchase order number, their reference and confirmed dates; the order moves to acknowledged. |
| Supplier invoice | Your accounting system posts the supplier's invoice against our purchase order number; the three way match runs and a variance is raised where it does not agree. |
The URL carries a long random token. Pausing or deleting the endpoint revokes it at once.
Updated Something missing or unclear? Tell us