Introduction
BebaAPI is a product of Anzil Software Ltd that provides an elaborate API to allow developers, shipping companies, an e-commerce stores integrate pickup and delivery functionality into their applications. PikieGlobal implements bebaAPI to provide a reliable platform for delivering products to customers from virtually any online shop or business through our network of courier companies and riders. Pikie intends to create a network of Partners throughout Africa to expand its reach to millions of customers intending to transport cargo within a country (inland).
Getting Started
To use our APIs or invoke an API endpoint, the api user will need to register for an account. Available accounts are sandbox and production accounts. Sandbox account will be used to test our APIs. Production accounts will be used for users intending to go live. An account activation link will be sent in an email to the email address you used in registering for a Developer account.
Creating an app
The first time a user logs in into the developer account, after account activation, the sandbox/production apps page opens from the user can create an app. The app keys include the client key and client secret, as well as the date they were issued and their expiry period. Sandbox keys do not expire.
Authentication
To authorize, use this code:
require 'oauth2'
client = OAuth2::Client.new('client_key', 'client_secret')
token = client.client_credentials.get_token
import requests
CLIENT_ID = "YOUR_CLIENT_KEY"
CLIENT_SECRET = "YOUR_CLIENT_SECRET"
requests.post(
'https://sandbox.pikieglobal.com/api/v1/oauth2/token',
headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN','Content-type: application/x-www-form-urlencoded'},
data={
'grant_type': 'client_credentials'
}
)
# With CURL, you can just pass the correct header with each request
$ curl -X POST https://sandbox.pikieglobal.com/api/v1/oauth2/token
-H 'Content-type: application/x-www-form-urlencoded'
-H 'Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
-d "grant_type=client_credentials"
var request = require("request");
var client_key = "YOUR_CLIENT_KEY",;
var client_secret = "YOUR_CLIENT_SECRET";
var endpoint = "https://sandbox.pikieglobal.com/api/v1/oauth2/token";
var auth = "Basic " + Buffer.from(client_key + ":" + client_secret).toString("base64");
var bodyString = {"grant_type": "client_credentials"};
const options = {
uri: '',
port: 443,
method: 'POST',
headers: {"Authorization": auth,'Content-Type': 'application/json'},
body: bodyString,
json: true // Automatically parses the JSON string in the response
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Be sure to replace
xxxxxxxxxxxxxxxxxx
with your base 64 encoded string of client_key:client_secret.
Our endpoints will be secured using token based authentication on API calls. To make an API call, you will need to authenticate your app. We have provided an OAuth2 API for you to generate an access token. We support client_credentials grant type. An access token expires in 3600 seconds or 1 hour. To authorize your API call to the OAuth2 API, you will need a Basic Auth over HTTPS authorization token. The Basic Auth string is a base64 encoded string of your app’s client key and client secret.
Authorization: Basic xxxxxxxxxxxxxxxxxx
Beba APIs
Get All Couriers
require 'httparty'
request = HTTParty.get("https://sandbox.pikieglobal.com/api/v1/couriers",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
)
import requests
requests.get(
'https://sandbox.pikieglobal.com/api/v1/couriers',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
)
curl -X GET https://sandbox.pikieglobal.com/api/v1/couriers
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const options= {};
beba.getCouriers(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"courier_info": [
{
"courier_id": "1",
"courier_name": "Food Post",
"courier_type": "corporate",
"offer_expedited_service": "true",
"service_id": "1",
"service_name": "General Deliveries",
"courier_phone": "254700000000",
"courier_email": "johndoe@gmail.com",
"courier_address": "Waiyaki Way, Kikuyu, Kenya",
"courier_latitude": "-1.2605989",
"courier_longitude": "36.71186179999995",
"courier_city": "Kikuyu",
"courier_country": "Kenya",
"country_code": "KEN"
},
{
"courier_id": "2",
"courier_name": "Postero Services",
"courier_type": "corporate",
"offer_expedited_service": "false",
"service_id": "1",
"service_name": "General Deliveries",
"courier_phone": "254712345678",
"courier_email": "janedoe@gmail.com",
"courier_address": "Westlands, Nairobi, Kenya",
"courier_latitude": "-1.2675001",
"courier_longitude": "36.81202200000007",
"courier_city": "Nairobi",
"courier_country": "Kenya",
"country_code": "KEN"
}
]
}
This is used to fetch couriers. Couriers represent Corporate entities while Drivers represent individual entities
HTTP Request
GET https://sandbox.pikieglobal.com/api/v1/couriers
Get a Specific Courier
require 'httparty'
request = HTTParty.get("https://sandbox.pikieglobal.com/api/v1/couriers",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
)
import requests
requests.get(
'https://sandbox.pikieglobal.com/api/v1/couriers',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
)
curl -X GET https://sandbox.pikieglobal.com/api/v1/couriers/{courier_id}
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const options= {
"courier_id": ""
};
beba.getSpecificCourier(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"courier_info": [
{
"courier_id": "1",
"courier_name": "Food Post",
"courier_type": "corporate",
"service_id": "1",
"service_name": "General Deliveries",
"courier_phone": "254700000000",
"courier_email": "johndoe@gmail.com",
"courier_address": "Waiyaki Way, Kikuyu, Kenya",
"courier_latitude": "-1.2605989",
"courier_longitude": "36.71186179999995",
"courier_city": "Kikuyu",
"courier_country": "Kenya",
"country_code": "KEN"
},
]
}
This is used to retrieve a specific couriers based on courier id.
HTTP Request
GET https://sandbox.pikieglobal.com/api/v1/couriers/{courier_id}
URL Parameters
Parameter | Description |
---|---|
courier_id | The User ID of the Courier registered on PikieGlobal |
Get a Specific Driver
require 'httparty'
request = HTTParty.get("https://sandbox.pikieglobal.com/api/v1/drivers/{driver_id}",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
)
import requests
requests.get(
'https://sandbox.pikieglobal.com/api/v1/drivers/{driver_id}',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
)
curl -X GET https://sandbox.pikieglobal.com/api/v1/drivers/{driver_id}
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const options= {
"driver_id": "",
};
beba.getSpecificDriver(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"driver_info": [
{
"driver_id": "13",
"driver_name": "Jane Doe",
"driver_phone": "254720000000",
"driver_type": "2",
"ride_count": "13",
"is_busy": "0",
"last_seen": "2019-10-02 21:19:08"
}
]
}
This is used to retrieve a specific driver based on driver id.
HTTP Request
GET https://sandbox.pikieglobal.com/api/v1/drivers/{driver_id}
URL Parameters
Parameter | Description |
---|---|
driver_id | The User ID of a Driver registered on PikieGlobal |
Get Items for a Specific Courier
require 'httparty'
request = HTTParty.get("https://sandbox.pikieglobal.com/api/v1/couriers/items/{courier_id}",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
)
import requests
requests.get(
'https://sandbox.pikieglobal.com/api/v1/couriers/items/{courier_id}',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
)
curl -X GET https://sandbox.pikieglobal.com/api/v1/couriers/items/{courier_id}
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const options= {
"courier_id": "",
};
beba.getCourierItems(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"courier_info": [
{
"id": "13",
"name": "TV",
"dimensions": "2x2x7",
"weight": "2",
"active": "1",
"courier_id": "1",
"created_at": "2019-10-02 21:19:08"
}
]
}
This is used to retrieve a specific courier shippable items based on courier id.
HTTP Request
GET https://sandbox.pikieglobal.com/api/v1/couriers/items/{courier_id}
URL Parameters
Parameter | Description |
---|---|
courier_id | The Courier ID of a Courier registered on PikieGlobal |
Get Rates
require 'httparty'
request = HTTParty.post("https://sandbox.pikieglobal.com/api/v1/rates",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
body: {
'pickup_latitude' => '',
'pickup_longitude' => '',
'delivery_latitude' => '',
'delivery_longitude' => '',
'total_weight' => '',
'courier_id' => '',
'delivery_time' => '',
'vehicle_type' => '',
}
)
import requests
requests.post(
'https://sandbox.pikieglobal.com/api/v1/rates',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
data={
'pickup_latitude': '',
'pickup_longitude': '',
'delivery_latitude': '',
'delivery_longitude': '',
'total_weight': '',
'courier_id': '',
'delivery_time': ''
'vehicle_type': ''
}
)
#requests.get('https://sketchfab.com/v2/users/me', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})
curl -X POST https://sandbox.pikieglobal.com/api/v1/rates
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
-d "pickup_latitude=yourPickupLatitude&pickup_longitude=yourPickupLongitude&
delivery_latitude=yourDeliveryLatitude&delivery_longitude=yourDeliveryLongitude&
total_weight=yourItemTotalWeight&courier_id=yourCourierId&delivery_time=yourDeliveryTime&vehicle_type=yourVehicleType"
var beba = require('beba-node-sdk');
const options= {
'pickup_latitude': '',
'pickup_longitude': '',
'delivery_latitude': '',
'delivery_longitude': '',
'total_weight': '',
'courier_id': '',
'delivery_time': '',
'vehicle_type': '',
};
beba.getRates(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"currency_code": "KES",
"shipping_rate": {
"company": "Postero Services",
"distance": "7.1 KM",
"weight": "500 KG",
"shipping_cost": 1221,
"same_hour_delivery": 1221,
"same_day_delivery": 1021,
"next_day_delivery": 721,
"extended_delivery": ""
}
}
This is used to estimate shipping rate based on pickup and delivery coordinates(distance), weight and time of delivery
HTTP Request
POST https://sandbox.pikieglobal.com/api/v1/rates
Request Parameters
Parameter | Example | Description |
---|---|---|
pickup_latitude | -1.2173611 | Business Latitude |
pickup_longitude | 36.9000374 | Business Longitude |
delivery_latitude | -1.2476927 | Client Latitude |
delivery_longitude | 36.872455 | Client Longitude |
total_weight | 25 | Total weight in KG |
courier_id | 5 | The id of the courier |
delivery_time | 3 | Check available Delivery times |
vehicle_type | 1 | Check available Vehicle Types |
Items |
[
|
This are the items to be shipped via expedited service Delivery times |
vehicle_type | 1 | Check available Vehicle Types |
Get Countries
require 'httparty'
request = HTTParty.get("https://sandbox.pikieglobal.com/api/v1/countries",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
}
)
import requests
requests.get(
'https://sandbox.pikieglobal.com/api/v1/countries',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
)
curl -X GET https://sandbox.pikieglobal.com/api/v1/countries
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const options= {};
beba.getCountries(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"countries": [
{
"country_name": "KENYA",
"country_code": "KEN",
"currency_code": "KES",
"is_active": "1"
},
{
"country_name": "GHANA",
"country_code": "GHA",
"currency_code": "GHS",
"is_active": "1"
}
]
}
This is used to obtain list of beba supported countries
HTTP Request
GET https://sandbox.pikieglobal.com/api/v1/countries
Get Services
require 'httparty'
request = HTTParty.get("https://sandbox.pikieglobal.com/api/v1/services",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
}
)
import requests
requests.get(
'https://sandbox.pikieglobal.com/api/v1/services',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
)
#requests.get('https://sketchfab.com/v2/users/me', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'})
curl -X GET https://sandbox.pikieglobal.com/api/v1/services
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const options= {};
beba.getCountries(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"services": [
{
"service_id": "1",
"service_name": "General Deliveries",
"service_description": "For general item deliveries",
"is_active": "1"
},
{
"service_id": "2",
"service_name": "Food Deliveries",
"service_description": "Food deliveries from restaurants",
"is_active": "1"
}
]
}
This is used to obtain list of all supported services on beba Platform
HTTP Request
GET https://sandbox.pikieglobal.com/api/v1/services
Services
Service Id | Meaning | Description |
---|---|---|
1 | General Deliveries | For general item deliveries |
2 | Food Deliveries | Food deliveries from restaurants |
Get Payment Options
require 'httparty'
request = HTTParty.post("https://sandbox.pikieglobal.com/api/v1/payment-options",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
body: {
"country_code" => "",
}
)
import requests
requests.post(
'https://sandbox.pikieglobal.com/api/v1/payment-options',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
data={
'country_code': 'YOUR_COUNTRY_CODE',
}
)
curl -X POST https://sandbox.pikieglobal.com/api/v1/payment-options
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
-d "country_code=yourCountryCode"
var beba = require('beba-node-sdk');
const options= {
"country_code":"",
};
beba.getPaymentOptions(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"payment_details": [
{
"payment_method": "mpesa",
"payment_description": "Mobile payment option in Kenya",
"country_code": "KEN",
"is_active": "1"
},
{
"payment_method": "bank",
"payment_description": "Bank Transfer",
"country_code": "KEN",
"is_active": "1"
}
]
}
This is used to obtain list of payment methods available per country
HTTP Request
POST https://sandbox.pikieglobal.com/api/v1/payment-options
Request Parameters
Parameter | Example | Description |
---|---|---|
country_code | KEN | Three letter Country codes (ISO alpha-3) e.g KEN, GHA |
category_id | 1 | Check available Service Categories |
Get Order Status
require 'httparty'
request = HTTParty.get("https://sandbox.pikieglobal.com/api/v1/order-status/{unique_id}",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
)
import requests
requests.get(
'https://sandbox.pikieglobal.com/api/v1/order-status/{unique_id}',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
)
curl -X GET https://sandbox.pikieglobal.com/api/v1/order-status/{unique_id}
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const options= {
"unique_id": "",
};
beba.getOrderStatus(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"order_detail": [
{
"unique_id": "4b455712-66b5-487e-8847-44c84b430692",
"order_status": "PENDING"
}
]
}
This is used to obtain the status of an order based on unique id. Use the Unique id that was used to create the shipment
HTTP Request
GET https://sandbox.pikieglobal.com/api/v1/order-status/{unique_id}
URL Parameters
Parameter | Description |
---|---|
unique_id | The Unique id that was used to create the shipment |
Order Status
Id | Status | Description |
---|---|---|
1 | PENDING | Order has been received but has not been assigned to a driver |
2 | ONGOING | Order has been assigned to a driver but the driver has not accepted the order |
3 | ACCEPTED | Order has been accepted by a driver but the order has not yet been delivered |
4 | DELIVERED | Order has been delivered to the customer by driver |
5 | CANCELLED | Order has been cancelled by driver |
Get Order Detail
require 'httparty'
request = HTTParty.get("https://sandbox.pikieglobal.com/api/v1/order-detail/{unique_id}",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
)
import requests
requests.get(
'https://sandbox.pikieglobal.com/api/v1/order-detail/{unique_id}',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
)
curl -X GET https://sandbox.pikieglobal.com/api/v1/order-detail/{unique_id}
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const options= {
"unique_id": "",
};
beba.getOrderDetail(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"order_detail": [
{
"driver_id": "13",
"driver_name": "Jane Doe",
"driver_phone": "254710123456",
"driver_type": "1",
"latitude": "-1.2236783333333",
"longitude": "36.895973333333",
"is_busy": "1",
"last_seen": "2019-12-12 11:53:09",
"order_status": "ACCEPTED",
"tracking_number": "f61ae518-bcb2-4135-9db8-588f3243549f"
}
]
}
This is used to obtain the order detail as well as tracking information of an order based on unique id/tracking number. Use the Unique id that was used to create the shipment.
HTTP Request
GET https://sandbox.pikieglobal.com/api/v1/order-detail/{unique_id}
URL Parameters
Parameter | Description |
---|---|
unique_id | The Unique id that was used to create the shipment |
Get Nearby Drivers
require 'httparty'
request = HTTParty.post("https://sandbox.pikieglobal.com/api/v1/nearby-drivers",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
body: {
"radius" => "",
"current_latitude" => "",
"current_longitude" => "",
}
)
import requests
requests.post(
'https://sandbox.pikieglobal.com/api/v1/nearby-drivers',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
data={
'radius': 'RADIUS_IN_KM',
'current_latitude': 'YOUR_CURRENT_LATITUDE',
'current_longitude': 'YOUR_CURRENT_LONGITUDE',
}
)
curl -X POST https://sandbox.pikieglobal.com/api/v1/nearby-drivers
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
-d "radius=yourRadius¤t_latitude=yourCurrentLatitude¤t_longitude=yourCurrentLongitude"
var beba = require('beba-node-sdk');
const options= {
"radius": "",
"current_latitude":"",
"current_longitude":""
};
beba.getNearbyDrivers(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"distance_metric": "KM",
"radius": "12 KM",
"driver_data": [
{
"driver_id": "13",
"driver_name": "Jane Doe",
"phone_number": "254712345678",
"driver_type": "2",
"latitude": "-1.2174066666667",
"longitude": "36.900068333333",
"is_busy": "0",
"distance": "0.006123",
"last_seen": "2019-10-20 00:30:01"
},
{
"driver_id": "8",
"driver_name": "John Doe",
"phone_number": "254700000000",
"driver_type": "2",
"latitude": "-1.2173628",
"longitude": "36.9000445",
"is_busy": "0",
"distance": "0.000806",
"last_seen": "2019-10-01 22:21:05"
}
]
}
This is used to obtain details of nearby drivers based on radius and current location.
HTTP Request
POST https://sandbox.pikieglobal.com/api/v1/nearby-drivers
Request Parameters
Parameter | Example | Description |
---|---|---|
radius | 20 | The distance in KM from the current user/business location |
current_latitude | -1.2173628 | The current user/business latitude |
current_longitude | 36.9000445 | The current user/business longitude |
Get Nearby Couriers
require 'httparty'
request = HTTParty.post("https://sandbox.pikieglobal.com/api/v1/nearby-couriers",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
body: {
"radius" => "",
"current_latitude" => "",
"current_longitude" => "",
}
)
import requests
requests.post(
'https://sandbox.pikieglobal.com/api/v1/nearby-couriers',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
data={
'radius': 'RADIUS_IN_KM',
'current_latitude': 'YOUR_CURRENT_LATITUDE',
'current_longitude': 'YOUR_CURRENT_LONGITUDE',
}
)
curl -X POST https://sandbox.pikieglobal.com/api/v1/nearby-couriers
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
-d "radius=yourRadius¤t_latitude=yourCurrentLatitude¤t_longitude=yourCurrentLongitude"
var beba = require('beba-node-sdk');
const options= {
"radius": "",
"current_latitude":"",
"current_longitude":""
};
beba.getNearbyCouriers(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "success",
"distance_metric": "KM",
"radius": "12 KM",
"courier_data": [
{
"courier_id": "2",
"courier_name": "Postal Services Kenya",
"courier_phone": "254728986084",
"courier_email": "basilndonga@gmail.com",
"latitude": "-1.2675001",
"longitude": "36.81202200000007",
"country_code": "KEN",
"courier_address": "Westlands, Nairobi, Kenya",
"distance": "11.260923"
}
]
}
This is used to obtain details of nearby drivers based on radius and current location.
HTTP Request
POST https://sandbox.pikieglobal.com/api/v1/nearby-couriers
Request Parameters
Parameter | Example | Description |
---|---|---|
radius | 20 | The distance in KM from the current user/business location |
current_latitude | -1.2173628 | The current user/business latitude |
current_longitude | 36.9000445 | The current user/business longitude |
Create Corporate Shipment
require 'httparty'
request = HTTParty.post("https://sandbox.pikieglobal.com/api/v1/shipments/corporate",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
item_detail = [
{
item_name: "Beef Fry",
item_quantity: 2,
unit_cost: 40,
unit_weight: 2.4,
unit_volume: "",
},
{
item_name: "Ugali Matumbo",
item_quantity: 5,
unit_cost: 50,
unit_weight: 0.8,
unit_volume: "",
},
{
item_name: "Italian Pizza",
item_quantity: 6,
unit_cost: 20,
unit_weight: 3.2,
unit_volume: "",
},
],
body: {
"unique_id"=> "45684e0b-8c73-41be-a118-fc7ab1c17694",
"courier_id"=> "5",
"service_id"=> "1",
"business_name" => 'Wireman Enterprises',
"business_phone" => '254700123456',
"business_email" => 'johndoe@gmail.com',
"business_city" => 'Nairobi, Kenya',
"pickup_address" => "Safari Park Fly Over, Thika Road, Nairobi, Kenya",
"pickup_latitude" => "-1.2256562",
"pickup_longitude" => "36.88495850000004",
"pickup_country" => "KENYA",
"customer_name" => "Jane Doe",
"customer_phone" => "254721123456",
"customer_email" => "janedoe@gmail.com",
"customer_city" => "Nairobi, Kenya",
"delivery_address" => "Naivas, Outer Ring Road, Nairobi, Kenya",
"delivery_latitude" => "-1.2476927",
"delivery_longitude" => "36.872455",
"delivery_country" => "KENYA",
"business_hours" => "8.00 AM - 5.00 PM",
"currency_code" => "KES",
"item_detail" => item_detail,
"delivery_time" => 3,
"vehicle_type" => 1,
}
)
import requests
requests.post(
'https://sandbox.pikieglobal.com/api/v1/shipments',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
item_detail = [
{
item_name: "Beef Fry",
item_quantity: 2,
unit_cost: 40,
unit_weight: 2.4,
unit_volume: "",
},
{
item_name: "Ugali Matumbo",
item_quantity: 5,
unit_cost: 50,
unit_weight: 0.8,
unit_volume: "",
},
{
item_name: "Italian Pizza",
item_quantity: 6,
unit_cost: 20,
unit_weight: 3.2,
unit_volume: "",
},
];
data={
"unique_id": "45684e0b-8c73-41be-a118-fc7ab1c17694",
"courier_id": "5",
"service_id": "1",
"business_name" : 'Wireman Enterprises',
"business_phone" : '254700123456',
"business_email" : 'johndoe@gmail.com',
"business_city" : 'Nairobi, Kenya',
"pickup_address" : "Safari Park Fly Over, Thika Road, Nairobi, Kenya",
"pickup_latitude" : "-1.2256562",
"pickup_longitude" : "36.88495850000004",
"pickup_country" : "KENYA",
"customer_name" : "Jane Doe",
"customer_phone" : "254721123456",
"customer_email" : "janedoe@gmail.com",
"customer_city" : "Nairobi, Kenya",
"delivery_address" : "Naivas, Outer Ring Road, Nairobi, Kenya",
"delivery_latitude" : "-1.2476927",
"delivery_longitude" : "36.872455",
"delivery_country" : "KENYA",
"business_hours" : "8.00 AM - 5.00 PM",
"currency_code" : "KES",
"item_detail" : item_detail,
"delivery_time" : 3,
"vehicle_type" : 1,
}
)
curl -X POST https://sandbox.pikieglobal.com/api/v1/shipments
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
-d "unique_id=yourUniqueId"
-d "courier_id=yourCourierId"
-d "service_id=yourServiceId"
-d "business_name=yourBusinessName"
-d "business_phone=yourBusinessPhone"
-d "business_email=yourBusinessEmail"
-d "business_city=yourBusinessCity"
-d "pickup_address=yourPickupAddress"
-d "pickup_latitude=yourPickupLatitude"
-d "pickup_longitude=yourPickupLongitude"
-d "pickup_country=yourPickupCountry"
-d "customer_name=yourCustomerName"
-d "customer_phone=yourCustomerPhone"
-d "customer_email=yourCustomerEmail"
-d "customer_city=yourCustomerCity"
-d "delivery_address=yourDeliveryAddress"
-d "delivery_latitude=yourDeliveryLatitude"
-d "delivery_longitude=yourDeliveryLongitude"
-d "delivery_country=yourDeliveryCountry"
-d "business_hours=yourBusinessHours"
-d "currency_code=yourCurrencyCode"
-d "item_detail=yourItemDetailArray"
-d "delivery_time=yourDeliveryTime"
-d "vehicle_type=yourVehicleType"
var beba = require('beba-node-sdk');
let item_detail = [
{
item_name: "Beef Fry",
item_quantity: 2,
unit_cost: 40,
unit_weight: 2.4,
unit_volume: "",
},
{
item_name: "Ugali Matumbo",
item_quantity: 5,
unit_cost: 50,
unit_weight: 0.8,
unit_volume: "",
},
{
item_name: "Italian Pizza",
item_quantity: 6,
unit_cost: 20,
unit_weight: 3.2,
unit_volume: "",
},
];
const options= {
"unique_id": "45684e0b-8c73-41be-a118-fc7ab1c17694",
"courier_id": "5",
"service_id": "1",
"business_name" : 'Wireman Enterprises',
"business_phone" : '254700123456',
"business_email" : 'johndoe@gmail.com',
"business_city" : 'Nairobi, Kenya',
"pickup_address" : "Safari Park Fly Over, Thika Road, Nairobi, Kenya",
"pickup_latitude" : "-1.2256562",
"pickup_longitude" : "36.88495850000004",
"pickup_country" : "KENYA",
"customer_name" : "Jane Doe",
"customer_phone" : "254721123456",
"customer_email" : "janedoe@gmail.com",
"customer_city" : "Nairobi, Kenya",
"delivery_address" : "Naivas, Outer Ring Road, Nairobi, Kenya",
"delivery_latitude" : "-1.2476927",
"delivery_longitude" : "36.872455",
"delivery_country" : "KENYA",
"business_hours" : "8.00 AM - 5.00 PM",
"currency_code" : "KES",
"item_detail" : item_detail,
"delivery_time" : 3,
"vehicle_type" : 1,
};
beba.createCorporateShipment(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "Shipment Successfully Created",
"order_status": "ONGOING",
"courier_type": "2",
"order_date": "2019-11-15 17:47:09",
"unique_id": "71f5f877-2fd3-452f-86e0-e2aaa262b926"
}
This is used to create a shipment request to a single courier.
HTTP Request
POST https://sandbox.pikieglobal.com/api/v1/shipments/corporate
Request Parameters
Id | Parameter | Type | Required | Description |
---|---|---|---|---|
1 | unique_id | string | true | Universally unique identifier |
2 | courier_id | number | true | Required. Check couriers |
3 | service_id | number | true | Service Category id. Check Services |
4 | business_name | string | true | Name of Business that prepared order |
5 | business_phone | string | true | Phone number of that prepared order |
6 | business_email | string | true | Email of business that prepared order |
7 | business_city | string | true | City of business that prepared order |
8 | pickup_address | string | true | Address of Point of pickup |
9 | pickup_latitude | string | true | Latitude of Point of pickup |
10 | pickup_longitude | string | true | Longitude of Point of pickup |
11 | pickup_country | string | false | Country of Point of pickup |
12 | customer_name | string | true | Name of Customer that made an order |
13 | customer_phone | string | true | Phone number of Customer that made an order |
14 | customer_email | string | false | Email Address of Customer that made an order |
15 | customer_city | string | true | City of Customer that made an order |
16 | delivery_address | string | true | Address of Point of delivery |
17 | delivery_latitude | string | true | Latitude of Point of delivery |
18 | delivery_longitude | string | true | Longitude of Point of delivery |
19 | delivery_country | string | false | Country of Point of delivery |
20 | business_hours | string | true | Business hours e.g 8.00 AM - 5 .00 PM |
21 | currency_code | string | true | 3 character ISO-4217 Currency codes. Check currency codes |
22 | item_detail | array | true | Array of items |
23 | delivery_time | number | true | Speed of delivery. Check available delivery times |
24 | vehicle_type | number | true | Type of Vehicle e.g Truck. Check available vehicle types |
Create Driver Shipment
require 'httparty'
request = HTTParty.post("https://sandbox.pikieglobal.com/api/v1/shipments/driver",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
item_detail = [
{
item_name: "Beef Fry",
item_quantity: 2,
unit_cost: 40,
unit_weight: 2.4,
unit_volume: "",
},
{
item_name: "Ugali Matumbo",
item_quantity: 5,
unit_cost: 50,
unit_weight: 0.8,
unit_volume: "",
},
{
item_name: "Italian Pizza",
item_quantity: 6,
unit_cost: 20,
unit_weight: 3.2,
unit_volume: "",
},
],
body: {
"unique_id"=> "45684e0b-8c73-41be-a118-fc7ab1c17694",
"driver_id"=> "62",
"service_id"=> "1",
"shipping_mode" => "2",
"business_name" => 'Wireman Enterprises',
"business_phone" => '254700123456',
"business_email" => 'johndoe@gmail.com',
"business_city" => 'Nairobi, Kenya',
"pickup_address" => "Safari Park Fly Over, Thika Road, Nairobi, Kenya",
"pickup_latitude" => "-1.2256562",
"pickup_longitude" => "36.88495850000004",
"pickup_country" => "KENYA",
"customer_name" => "Jane Doe",
"customer_phone" => "254721123456",
"customer_email" => "janedoe@gmail.com",
"customer_city" => "Nairobi, Kenya",
"delivery_address" => "Naivas, Outer Ring Road, Nairobi, Kenya",
"delivery_latitude" => "-1.2476927",
"delivery_longitude" => "36.872455",
"delivery_country" => "KENYA",
"business_hours" => "8.00 AM - 5.00 PM",
"currency_code" => "KES",
"item_detail" => item_detail,
"delivery_time" => 3,
"vehicle_type" => 1,
}
)
import requests
requests.post(
'https://sandbox.pikieglobal.com/api/v1/shipments',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
item_detail = [
{
item_name: "Beef Fry",
item_quantity: 2,
unit_cost: 40,
unit_weight: 2.4,
unit_volume: "",
},
{
item_name: "Ugali Matumbo",
item_quantity: 5,
unit_cost: 50,
unit_weight: 0.8,
unit_volume: "",
},
{
item_name: "Italian Pizza",
item_quantity: 6,
unit_cost: 20,
unit_weight: 3.2,
unit_volume: "",
},
];
data={
"unique_id": "45684e0b-8c73-41be-a118-fc7ab1c17694",
"driver_id": "",
"service_id": "1",
"shipping_mode": "1",
"business_name" : 'Wireman Enterprises',
"business_phone" : '254700123456',
"business_email" : 'johndoe@gmail.com',
"business_city" : 'Nairobi, Kenya',
"pickup_address" : "Safari Park Fly Over, Thika Road, Nairobi, Kenya",
"pickup_latitude" : "-1.2256562",
"pickup_longitude" : "36.88495850000004",
"pickup_country" : "KENYA",
"customer_name" : "Jane Doe",
"customer_phone" : "254721123456",
"customer_email" : "janedoe@gmail.com",
"customer_city" : "Nairobi, Kenya",
"delivery_address" : "Naivas, Outer Ring Road, Nairobi, Kenya",
"delivery_latitude" : "-1.2476927",
"delivery_longitude" : "36.872455",
"delivery_country" : "KENYA",
"business_hours" : "8.00 AM - 5.00 PM",
"currency_code" : "KES",
"item_detail" : item_detail,
"delivery_time": : 3,
"vehicle_type": : 1,
}
)
curl -X POST https://sandbox.pikieglobal.com/api/v1/shipments
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
-d "unique_id=yourUniqueId"
-d "driver_id=yourCourierId"
-d "service_id=yourServiceId"
-d "shipping_mode=yourShippingMode"
-d "business_name=yourBusinessName"
-d "business_phone=yourBusinessPhone"
-d "business_email=yourBusinessEmail"
-d "business_city=yourBusinessCity"
-d "pickup_address=yourPickupAddress"
-d "pickup_latitude=yourPickupLatitude"
-d "pickup_longitude=yourPickupLongitude"
-d "pickup_country=yourPickupCountry"
-d "customer_name=yourCustomerName"
-d "customer_phone=yourCustomerPhone"
-d "customer_email=yourCustomerEmail"
-d "customer_city=yourCustomerCity"
-d "delivery_address=yourDeliveryAddress"
-d "delivery_latitude=yourDeliveryLatitude"
-d "delivery_longitude=yourDeliveryLongitude"
-d "delivery_country=yourDeliveryCountry"
-d "business_hours=yourBusinessHours"
-d "currency_code=yourCurrencyCode"
-d "item_detail=yourItemDetailArray"
-d "delivery_time=yourDeliveryTime"
-d "vehicle_type=yourVehicleType"
var beba = require('beba-node-sdk');
let item_detail = [
{
item_name: "Beef Fry",
item_quantity: 2,
unit_cost: 40,
unit_weight: 2.4,
unit_volume: "",
},
{
item_name: "Ugali Matumbo",
item_quantity: 5,
unit_cost: 50,
unit_weight: 0.8,
unit_volume: "",
},
{
item_name: "Italian Pizza",
item_quantity: 6,
unit_cost: 20,
unit_weight: 3.2,
unit_volume: "",
},
];
const options= {
"unique_id": "45684e0b-8c73-41be-a118-fc7ab1c17694",
"courier_id": "5",
"service_id": "1",
"shipping_mode": "1",
"business_name" : 'Wireman Enterprises',
"business_phone" : '254700123456',
"business_email" : 'johndoe@gmail.com',
"business_city" : 'Nairobi, Kenya',
"pickup_address" : "Safari Park Fly Over, Thika Road, Nairobi, Kenya",
"pickup_latitude" : "-1.2256562",
"pickup_longitude" : "36.88495850000004",
"pickup_country" : "KENYA",
"customer_name" : "Jane Doe",
"customer_phone" : "254721123456",
"customer_email" : "janedoe@gmail.com",
"customer_city" : "Nairobi, Kenya",
"delivery_address" : "Naivas, Outer Ring Road, Nairobi, Kenya",
"delivery_latitude" : "-1.2476927",
"delivery_longitude" : "36.872455",
"delivery_country" : "KENYA",
"business_hours" : "8.00 AM - 5.00 PM",
"currency_code" : "KES",
"item_detail" : item_detail,
"delivery_time": : 3,
"vehicle_type": : 1,
};
beba.createDriverShipment(options,function(data){
console.log(data);
})
Response:
{
"status_code": 0,
"status_desc": "Shipment Successfully Created",
"order_status": "ONGOING",
"courier_type": "2",
"order_date": "2019-11-15 17:47:09",
"unique_id": "71f5f877-2fd3-452f-86e0-e2aaa262b926"
}
This is used to create a shipment request to a single driver or all drivers.
HTTP Request
POST https://sandbox.pikieglobal.com/api/v1/shipments/corporate
Request Parameters
Id | Parameter | Type | Required | Description |
---|---|---|---|---|
1 | unique_id | string | true | Universally unique identifier |
2 | driver_id | number | true | Required. Check drivers |
3 | service_id | number | true | Service Category id. Check Services |
4 | shipping_mode | number | true | Check available shipping modes |
5 | business_name | string | true | Name of Business that prepared order |
6 | business_phone | string | true | Phone number of that prepared order |
7 | business_email | string | true | Email of business that prepared order |
8 | business_city | string | true | City of business that prepared order |
9 | pickup_address | string | true | Address of Point of pickup |
10 | pickup_latitude | string | true | Latitude of Point of pickup |
11 | pickup_longitude | string | true | Longitude of Point of pickup |
12 | pickup_country | string | false | Country of Point of pickup |
13 | customer_name | string | true | Name of Customer that made an order |
14 | customer_phone | string | true | Phone number of Customer that made an order |
15 | customer_email | string | false | Email Address of Customer that made an order |
16 | customer_city | string | true | City of Customer that made an order |
17 | delivery_address | string | true | Address of Point of delivery |
18 | delivery_latitude | string | true | Latitude of Point of delivery |
19 | delivery_longitude | string | true | Longitude of Point of delivery |
20 | delivery_country | string | false | Country of Point of delivery |
21 | business_hours | string | true | Business hours e.g 8.00 AM - 5 .00 PM |
22 | currency_code | string | true | 3 character ISO-4217 Currency codes. Check currency codes |
23 | item_detail | array | true | Array of items |
24 | delivery_time | number | true | Speed of delivery. Check available delivery times |
25 | vehicle_type | number | true | Type of Vehicle e.g Truck. Check available vehicle types |
Cancel a Specific Shipment
require 'httparty'
request = HTTParty.delete("https://sandbox.pikieglobal.com/api/v1/shipments/{unique_id}",
headers: {
"Authorization" => "Bearer [YOUR_ACCESS_TOKEN]",
"Content-Type" => "application/json"
},
)
import requests
requests.delete(
'https://sandbox.pikieglobal.com/api/v1/shipments/{unique_id}',
headers={
'Content-Type: application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
)
curl -X DELETE https://sandbox.pikieglobal.com/api/v1/shipments/{unique_id}
-H "Content-Type: application/json"
-H "Authorization: Bearer [YOUR_ACCESS_TOKEN]"
var beba = require('beba-node-sdk');
const request_options={
"unique_id":" "
};
beba.cancelShipment(request_options,function(data){
console.log(data);
})
The above command returns JSON structured like this:
{
"status_code": 0,
"status_desc": "Shipment Deleted Successfully",
}
This endpoint deletes a specific shipment based on its unique id.
HTTP Request
DELETE https://sandbox.pikieglobal.com/api/v1/shipments/{unique_id}
URL Parameters
Parameter | Description |
---|---|
unique_id | The Unique id that was used to create the shipment |
Courier Types
Id | Type | Description |
---|---|---|
1 | Corporate Drivers | Drivers working for a corporate organization e.g Shipping Company |
2 | Individual Drivers | Drivers not affiliated to any corporate organization |
Delivery Times
Duration | Description |
---|---|
1 | Same hour deliveries i.e Deliveries to be made within an hour |
2 | Same day deliveries i.e Deliveries to be made within a day |
3 | Next day deliveries i.e Deliveries to be made the next day |
4 | Extended deliveries i.e Deliveries to be made at a specified time e.g 7 days |
5 | Expedited Services i.e Deliveries to be made fast by expedited services |
Vehicle Types
Type | Description |
---|---|
1 | Truck |
2 | Car |
3 | Bike |
4 | Others |
Shipping Modes
Mode | Description |
---|---|
1 | Send to Single Driver/ Courier |
2 | Send to all Drivers i.e to a pool of drivers so that any nearby driver can accept the order |
Standard Units
Id | Metric | Unit | Description | Example |
---|---|---|---|---|
1 | Radius | KM | Distance is measured in Kilometers | 20 |
2 | Weight | KG | Weight is measured in Kilograms | 0.015 |
3 | Volume | CBM | Volume is measured in Cubic Meters | 0.65 |
Response Codes
Code | Response | Description |
---|---|---|
400 | Bad Request | Missing Parameter. |
401 | Unauthorized | Wrong Credentials. |
404 | Not Found | The specified resouce could not be found. |
500 | Internal Server Error | We had a problem with our server. Try again later. |
503 | Service Unavailable | System is temporarily offline for maintenance. Please try again later. |
Going Live
Requirements
Businesses intending to use this API Should provide the following KYC details:
Mandatory Documents | |
---|---|
1 | Certificate of Incorporation/Business Licence. |
2 | Tax Certificate. |
3 | Proof of Address. |
4 | Completed Testcases |
Onboarding
The above documents and testcases should be scanned and emailed to our onboarding team on api-feedback@pikieglobal.com. For queries contact +254 728 986 084 / +453 183 4040