curl --request POST \
--url https://portal.urbnbox.io/api/vendor/v1/orders \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"external_reference": "SHOP-ORDER-1001",
"client_name": "Jane Mwangi",
"client_phone": "+254712345678",
"fulfillment_type": "delivery",
"address": "Kenyatta Avenue, Nairobi",
"items": [
{
"product_id": "PRODUCT_ID",
"quantity": 2
}
]
}
'import requests
url = "https://portal.urbnbox.io/api/vendor/v1/orders"
payload = {
"external_reference": "SHOP-ORDER-1001",
"client_name": "Jane Mwangi",
"client_phone": "+254712345678",
"fulfillment_type": "delivery",
"address": "Kenyatta Avenue, Nairobi",
"items": [
{
"product_id": "PRODUCT_ID",
"quantity": 2
}
]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_reference: 'SHOP-ORDER-1001',
client_name: 'Jane Mwangi',
client_phone: '+254712345678',
fulfillment_type: 'delivery',
address: 'Kenyatta Avenue, Nairobi',
items: [{product_id: 'PRODUCT_ID', quantity: 2}]
})
};
fetch('https://portal.urbnbox.io/api/vendor/v1/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://portal.urbnbox.io/api/vendor/v1/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'external_reference' => 'SHOP-ORDER-1001',
'client_name' => 'Jane Mwangi',
'client_phone' => '+254712345678',
'fulfillment_type' => 'delivery',
'address' => 'Kenyatta Avenue, Nairobi',
'items' => [
[
'product_id' => 'PRODUCT_ID',
'quantity' => 2
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://portal.urbnbox.io/api/vendor/v1/orders"
payload := strings.NewReader("{\n \"external_reference\": \"SHOP-ORDER-1001\",\n \"client_name\": \"Jane Mwangi\",\n \"client_phone\": \"+254712345678\",\n \"fulfillment_type\": \"delivery\",\n \"address\": \"Kenyatta Avenue, Nairobi\",\n \"items\": [\n {\n \"product_id\": \"PRODUCT_ID\",\n \"quantity\": 2\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://portal.urbnbox.io/api/vendor/v1/orders")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_reference\": \"SHOP-ORDER-1001\",\n \"client_name\": \"Jane Mwangi\",\n \"client_phone\": \"+254712345678\",\n \"fulfillment_type\": \"delivery\",\n \"address\": \"Kenyatta Avenue, Nairobi\",\n \"items\": [\n {\n \"product_id\": \"PRODUCT_ID\",\n \"quantity\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://portal.urbnbox.io/api/vendor/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_reference\": \"SHOP-ORDER-1001\",\n \"client_name\": \"Jane Mwangi\",\n \"client_phone\": \"+254712345678\",\n \"fulfillment_type\": \"delivery\",\n \"address\": \"Kenyatta Avenue, Nairobi\",\n \"items\": [\n {\n \"product_id\": \"PRODUCT_ID\",\n \"quantity\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ID": "<string>",
"Status": "draft",
"FulfillmentType": "<string>",
"ClientName": "<string>",
"ClientPhone": "<string>",
"Address": "<string>",
"ClientLat": 123,
"ClientLng": 123,
"ScheduledAt": "2023-11-07T05:31:56Z",
"TotalKES": 123,
"DeliveryFeeKES": 123,
"PublicToken": "<string>",
"IsCOD": true,
"CODAmountKES": 123,
"CreatedAt": "2023-11-07T05:31:56Z",
"UpdatedAt": "2023-11-07T05:31:56Z"
}<string><string>Create a delivery order
Creates a delivery or pickup order for products in the vendor’s UrbnBox catalogue and reserves their stock. When external_reference matches an existing order, that order is returned instead of a new one (still 201).
curl --request POST \
--url https://portal.urbnbox.io/api/vendor/v1/orders \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"external_reference": "SHOP-ORDER-1001",
"client_name": "Jane Mwangi",
"client_phone": "+254712345678",
"fulfillment_type": "delivery",
"address": "Kenyatta Avenue, Nairobi",
"items": [
{
"product_id": "PRODUCT_ID",
"quantity": 2
}
]
}
'import requests
url = "https://portal.urbnbox.io/api/vendor/v1/orders"
payload = {
"external_reference": "SHOP-ORDER-1001",
"client_name": "Jane Mwangi",
"client_phone": "+254712345678",
"fulfillment_type": "delivery",
"address": "Kenyatta Avenue, Nairobi",
"items": [
{
"product_id": "PRODUCT_ID",
"quantity": 2
}
]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_reference: 'SHOP-ORDER-1001',
client_name: 'Jane Mwangi',
client_phone: '+254712345678',
fulfillment_type: 'delivery',
address: 'Kenyatta Avenue, Nairobi',
items: [{product_id: 'PRODUCT_ID', quantity: 2}]
})
};
fetch('https://portal.urbnbox.io/api/vendor/v1/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://portal.urbnbox.io/api/vendor/v1/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'external_reference' => 'SHOP-ORDER-1001',
'client_name' => 'Jane Mwangi',
'client_phone' => '+254712345678',
'fulfillment_type' => 'delivery',
'address' => 'Kenyatta Avenue, Nairobi',
'items' => [
[
'product_id' => 'PRODUCT_ID',
'quantity' => 2
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://portal.urbnbox.io/api/vendor/v1/orders"
payload := strings.NewReader("{\n \"external_reference\": \"SHOP-ORDER-1001\",\n \"client_name\": \"Jane Mwangi\",\n \"client_phone\": \"+254712345678\",\n \"fulfillment_type\": \"delivery\",\n \"address\": \"Kenyatta Avenue, Nairobi\",\n \"items\": [\n {\n \"product_id\": \"PRODUCT_ID\",\n \"quantity\": 2\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://portal.urbnbox.io/api/vendor/v1/orders")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_reference\": \"SHOP-ORDER-1001\",\n \"client_name\": \"Jane Mwangi\",\n \"client_phone\": \"+254712345678\",\n \"fulfillment_type\": \"delivery\",\n \"address\": \"Kenyatta Avenue, Nairobi\",\n \"items\": [\n {\n \"product_id\": \"PRODUCT_ID\",\n \"quantity\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://portal.urbnbox.io/api/vendor/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_reference\": \"SHOP-ORDER-1001\",\n \"client_name\": \"Jane Mwangi\",\n \"client_phone\": \"+254712345678\",\n \"fulfillment_type\": \"delivery\",\n \"address\": \"Kenyatta Avenue, Nairobi\",\n \"items\": [\n {\n \"product_id\": \"PRODUCT_ID\",\n \"quantity\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ID": "<string>",
"Status": "draft",
"FulfillmentType": "<string>",
"ClientName": "<string>",
"ClientPhone": "<string>",
"Address": "<string>",
"ClientLat": 123,
"ClientLng": 123,
"ScheduledAt": "2023-11-07T05:31:56Z",
"TotalKES": 123,
"DeliveryFeeKES": 123,
"PublicToken": "<string>",
"IsCOD": true,
"CODAmountKES": 123,
"CreatedAt": "2023-11-07T05:31:56Z",
"UpdatedAt": "2023-11-07T05:31:56Z"
}<string><string>Authorizations
Vendor API key. Keys begin with the ubx_ prefix and identify vendor accounts.
Body
Customer's full name
Customer's WhatsApp number
1Show child attributes
Show child attributes
Your order ID. A repeat value returns the existing order
delivery, scheduled_delivery, self_pickup, scheduled_pickup Delivery address. Required for delivery and scheduled_delivery
Delivery latitude. When omitted, the address is geocoded
Delivery longitude
Required for scheduled_delivery and scheduled_pickup
Who collects the order. Required for self_pickup and scheduled_pickup
Collector's phone. Required for self_pickup and scheduled_pickup
Response
Order created, or the existing order with the same external_reference
Order fields are returned with capitalised names.
draft, confirmed, assigned, packing, dispatched, delivered, cancelled Items plus delivery fee, in whole KES
Whole KES