Lilwa API Gateway
Power your logistics with our unified delivery API
The Lilwa Delivery API Gateway provides programmatic access to Kenya's fastest last-mile logistics network. Integrate delivery, tracking, payments, and real-time ETA calculations into your application with a single, unified REST API.
30-min Delivery
Guaranteed delivery across 15+ counties
Real-time Tracking
GPS + SMS updates for every order
Enterprise SLA
99.9% uptime with 24/7 support
π Quick Start
Get up and running in minutes with our simple API architecture.
# Base URL
BASE_URL="https://api.lilwadelivery.com/v2"
# Authentication
API_KEY="your_api_key_here"
# Test your connection
curl -X GET https://api.lilwadelivery.com/v2/health \
-H "Authorization: Bearer $API_KEY"
# Response
{
"status": "operational",
"version": "2.0.0",
"region": "africa-east-1"
}
π Authentication
All API requests require a valid API key. Include it in the Authorization header.
# Request
curl -X GET "https://api.lilwadelivery.com/v2/orders" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
# Response
{
"success": true,
"data": { ... },
"meta": {
"rate_limit": 1000,
"remaining": 999,
"reset": 3600
}
}
π‘ API Endpoints
Complete REST API for delivery logistics integration.
/v2/deliveries
Submit a new delivery request with full order details, multiple stops, and special instructions.
{
"pickup": {
"address": "NHL Building, Mumias Road, Bungoma",
"lat": 0.5700,
"lng": 34.5600,
"contact_name": "API Pro",
"contact_phone": "+254712345678"
},
"dropoff": {
"address": "Kakamega Town, Opposite Golf Hotel",
"lat": 0.2827,
"lng": 34.7519,
"contact_name": "Jane Smith",
"contact_phone": "+254798765432"
},
"service_type": "food",
"items": [
{
"name": "Beef Pilau",
"quantity": 2,
"price": 450
}
],
"payment_method": "mpesa",
"delivery_instructions": "Call on arrival",
"is_multi_stop": false
}
Response
{
"success": true,
"data": {
"order_id": "LD-1234567890",
"status": "pending",
"estimated_delivery_time": "2024-03-15T14:30:00Z",
"delivery_fee": 299,
"tracking_url": "https://track.lilwadelivery.com/LD-1234567890"
}
}
/v2/deliveries/{order_id}/track
Get live GPS coordinates and status updates for any active delivery.
{
"success": true,
"data": {
"order_id": "LD-1234567890",
"status": "on_the_way",
"rider": {
"name": "Michael K.",
"phone": "+254701234567",
"rating": 4.8,
"vehicle": "Motorcycle"
},
"location": {
"lat": 0.2850,
"lng": 34.7525,
"updated_at": "2024-03-15T14:15:00Z"
},
"eta_minutes": 12,
"progress": 65
}
}
/v2/eta/calculate
Calculate estimated delivery time based on traffic, distance, and historical data.
{
"origin": { "lat": 0.5700, "lng": 34.5600 },
"destination": { "lat": 0.2827, "lng": 34.7519 },
"service_type": "food",
"time_of_day": "14:00"
}
/v2/payments/process
Initiate and verify M-Pesa, card, or bank payments.
{
"order_id": "LD-1234567890",
"payment_method": "mpesa",
"amount": 750,
"callback_url": "https://your-app.com/webhooks/payment"
}
π Webhooks
Receive real-time updates for order status changes, delivery completion, and payment confirmations.
{
"event": "delivery.completed",
"timestamp": "2024-03-15T14:30:00Z",
"data": {
"order_id": "LD-1234567890",
"status": "delivered",
"delivered_at": "2024-03-15T14:28:00Z",
"signature_url": "https://cdn.lilwadelivery.com/signatures/123.png",
"proof_of_delivery": "https://cdn.lilwadelivery.com/pod/123.jpg"
}
}
Order confirmed
Rider en route
Successfully delivered
Payment verified
πΊοΈ Maps & Tracking Integration
Embed live tracking maps directly into your application using our WebSocket or REST-based tracking.
React Component Example
import { useEffect, useState } from "react";
import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet";
function LilwaTracking({ orderId }) {
const [location, setLocation] = useState(null);
useEffect(() => {
const ws = new WebSocket(`wss://track.lilwadelivery.com/ws/${orderId}`);
ws.onmessage = (event) => {
setLocation(JSON.parse(event.data));
};
return () => ws.close();
}, [orderId]);
return (
{location &&
Rider is here! ETA: {location.eta} min
}
);
}
π» SDK Examples
Python
import requests
import os
API_KEY = os.environ.get("LILWA_API_KEY")
BASE_URL = "https://api.lilwadelivery.com/v2"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Create delivery
delivery_data = {
"pickup": {
"address": "NHL Building, Bungoma",
"lat": 0.5700,
"lng": 34.5600
},
"dropoff": {
"address": "Kakamega Town",
"lat": 0.2827,
"lng": 34.7519
},
"service_type": "food"
}
response = requests.post(
f"{BASE_URL}/deliveries",
json=delivery_data,
headers=headers
)
print(response.json())
PHP (Laravel / Guzzle)
<?php
$apiKey = getenv('LILWA_API_KEY');
$baseUrl = 'https://api.lilwadelivery.com/v2';
$client = new GuzzleHttp\Client([
'headers' => [
'Authorization' => 'Bearer ' . $apiKey,
'Content-Type' => 'application/json'
]
]);
$response = $client->post($baseUrl . '/deliveries', [
'json' => [
'pickup' => [
'address' => 'NHL Building, Bungoma',
'lat' => 0.5700,
'lng' => 34.5600
],
'dropoff' => [
'address' => 'Kakamega Town',
'lat' => 0.2827,
'lng' => 34.7519
]
]
]);
$order = json_decode($response->getBody(), true);
?>
React.js
import { useState } from "react";
import axios from "axios";
const API_KEY = process.env.REACT_APP_LILWA_API_KEY;
function DeliveryRequest() {
const [order, setOrder] = useState(null);
const [loading, setLoading] = useState(false);
const createDelivery = async () => {
setLoading(true);
try {
const response = await axios.post(
"https://api.lilwadelivery.com/v2/deliveries",
{
pickup: { address: "Bungoma Town", lat: 0.5700, lng: 34.5600 },
dropoff: { address: "Kakamega Town", lat: 0.2827, lng: 34.7519 },
service_type: "food"
},
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);
setOrder(response.data.data);
} catch (error) {
console.error(error);
} finally {
setLoading(false);
}
};
return (
<button onClick={createDelivery} disabled={loading}>
{loading ? "Creating..." : "Request Delivery"}
</button>
);
}
Node.js
const axios = require("axios");
const API_KEY = process.env.LILWA_API_KEY;
const BASE_URL = "https://api.lilwadelivery.com/v2";
async function createDelivery() {
try {
const response = await axios.post(
`${BASE_URL}/deliveries`,
{
pickup: { address: "NHL Building, Bungoma", lat: 0.5700, lng: 34.5600 },
dropoff: { address: "Kakamega Town", lat: 0.2827, lng: 34.7519 },
service_type: "food"
},
{
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json"
}
}
);
console.log("Order created:", response.data);
return response.data;
} catch (error) {
console.error("API Error:", error.response?.data || error.message);
}
}
createDelivery();
βοΈ Deployment Options
Flexible deployment to match your infrastructure needs.
Cloud (SaaS)
Fully managed API with automatic scaling, 99.9% uptime SLA, and global CDN.
Hosted on AWS East Africa
Automatic backups included
On-Premise
Deploy within your own infrastructure. Full control over data and compliance.
Docker/Kubernetes ready
HIPAA/GDPR compliant options