Dukene API Documentation

Integrate your platform with Dukene to sync products, manage inventory, and receive real-time M-Pesa & WhatsApp order updates.

Overview

The Dukene Supplier API lets external suppliers and merchants sync catalog data, manage live inventory, and automate fulfillment inside the Kenyan commerce ecosystem.

RESTful API

Standard HTTP methods with predictable JSON payloads.

OAuth 2.0

Secure authorization with granular access tokens.

Real-time Webhooks

Instant notifications for M-Pesa payments and orders.

Base API URL:https://api.dukene.co.ke/api/v1

Authentication

All API requests must be authenticated using OAuth 2.0 access tokens passed in the authorization header.

HTTP HEADERSRequired headers
Authorization: Bearer YOUR_ACCESS_TOKEN
X-Supplier-ID: your-supplier-id
Content-Type: application/json

Security Note: Never expose access tokens or client secrets in client-side code or public repositories.

OAuth 2.0 Flow

Dukene uses the authorization code flow to securely grant access to merchant stores.

Step 1: Authorization URL

GETAuthorize merchant
GET https://your-platform.com/oauth/authorize?
  client_id=DUKENE_CLIENT_ID
  &redirect_uri=https://api.dukene.co.ke/api/v1/oauth/callback
  &state=RANDOM_STATE_STRING
  &scope=products.read products.write orders.read inventory.write
  &response_type=code

Step 2: Exchange Code for Token

POSTToken request
POST https://your-platform.com/oauth/token
Content-Type: application/json

{
  "grant_type": "authorization_code",
  "code": "AUTHORIZATION_CODE",
  "client_id": "DUKENE_CLIENT_ID",
  "client_secret": "DUKENE_CLIENT_SECRET",
  "redirect_uri": "https://api.dukene.co.ke/api/v1/oauth/callback"
}

Available Scopes

products.read: Read product catalog and inventory data.
products.write: Create and update products.
orders.read: Read order status and fulfillment data.
inventory.write: Update stock levels and availability.

API Endpoints

GET/products

Fetch products and catalog data from Dukene.

POST/orders

Create a new order or submit fulfillment updates.

PATCH/inventory/:id

Update stock counts and variant availability.

Webhooks

Dukene sends event notifications to your server whenever important actions occur (e.g., M-Pesa confirmation).

JSON PAYLOADorder.created event
{
  "event": "order.created",
  "order_id": "ord_12345",
  "store_id": "store_67890",
  "total": 2499,
  "currency": "KES"
}

Pro Tip: Validate webhook signatures using your client secret before processing payloads.

Best Practices

Store access tokens securely on the server-side.
Retry transient network failures with exponential backoff.
Store webhook event IDs to prevent duplicate processing.
Log `X-Request-ID` headers for faster troubleshooting.

Ready to integrate?

Start with authentication, then connect your catalog and webhook endpoint.

Visit FAQ