Docs

Examples

Replace YOUR_API_KEY with a key from Settings → API Keys.

Create an order (curl)

Create an order on your Orders board. Link catalog products by productId (look them up with GET /public/v1/products) so the order is connected to inventory, or send free-text lines with your own unitPrice.

Creating the order does not deduct stock — that happens when you move it to Delivered.

curl -X POST "https://crm.api.kushicorp.com/public/v1/orders" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customerName": "Ada Obi",
    "phone": "08012345678",
    "address": "12 Marina, Lagos",
    "source": "shopify",
    "items": [ { "productId": "PRODUCT_ID", "qty": 2 } ]
  }'
# → { "id": "…", "reference": "A1B2C3D4", "status": "Pending", "total": 55000 }

JavaScript (fetch)

// Create an order from another system
await fetch('https://crm.api.kushicorp.com/public/v1/orders', {
  method: 'POST',
  headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    customerName: 'Ada Obi',
    phone: '08012345678',
    items: [{ productId: 'PRODUCT_ID', qty: 1 }]
  })
});

// List pending orders, look up products / stock
await fetch('https://crm.api.kushicorp.com/public/v1/orders?status=Pending', { headers: { Authorization: 'Bearer YOUR_API_KEY' } });
await fetch('https://crm.api.kushicorp.com/public/v1/products', { headers: { Authorization: 'Bearer YOUR_API_KEY' } });
await fetch('https://crm.api.kushicorp.com/public/v1/stock', { headers: { Authorization: 'Bearer YOUR_API_KEY' } });

Mark an order delivered:

curl -X PATCH "https://crm.api.kushicorp.com/public/v1/orders/ORDER_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{ "status": "Delivered", "paymentStatus": "paid" }'

Plain HTML order form

Drop an order form on your own landing page — no framework needed. It posts straight to your Orders board:

<form id="order-form">
  <input name="customerName" placeholder="Full name" required />
  <input name="phone" placeholder="Phone" required />
  <input name="address" placeholder="Delivery address" />
  <button type="submit">Order now</button>
</form>

<script>
  document.getElementById('order-form').addEventListener('submit', async (e) => {
    e.preventDefault();
    const data = Object.fromEntries(new FormData(e.target).entries());
    await fetch('https://crm.api.kushicorp.com/public/v1/orders', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        ...data,
        source: 'website',
        items: [{ name: 'Wireless earbuds', qty: 1, unitPrice: 18000 }]
      })
    });
    e.target.reset();
    alert('Thanks! Your order is in — we\'ll call to confirm.');
  });
</script>

Tip: for a full storefront (product pages, pay-on-delivery checkout, order tracking) you don't need to build any of this — share your Kushi store link instead. The API is for pushing orders in from tools you already use.