curl --request POST \
--url https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant": {
"email": "merchant2@gmail.com",
"phone_number": "+254700000021",
"first_name": "John",
"last_name": "Merchant Two",
"password": "secret",
"kyc_status": "approved",
"is_active": true,
"pin": "123456"
},
"sub_merchants": [
{
"email": "merchant2.branch1@gmail.com",
"phone_number": "+254700000022",
"first_name": "Bob",
"last_name": "Branch One",
"password": "secret",
"kyc_status": "approved",
"is_active": true,
"pin": "654321"
},
{
"email": "merchant2.branch2@gmail.com",
"phone_number": "+254700000023",
"first_name": "Carol",
"last_name": "Branch Two",
"password": "secret",
"kyc_status": "approved",
"is_active": true
}
]
}
'import requests
url = "https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants"
payload = {
"merchant": {
"email": "merchant2@gmail.com",
"phone_number": "+254700000021",
"first_name": "John",
"last_name": "Merchant Two",
"password": "secret",
"kyc_status": "approved",
"is_active": True,
"pin": "123456"
},
"sub_merchants": [
{
"email": "merchant2.branch1@gmail.com",
"phone_number": "+254700000022",
"first_name": "Bob",
"last_name": "Branch One",
"password": "secret",
"kyc_status": "approved",
"is_active": True,
"pin": "654321"
},
{
"email": "merchant2.branch2@gmail.com",
"phone_number": "+254700000023",
"first_name": "Carol",
"last_name": "Branch Two",
"password": "secret",
"kyc_status": "approved",
"is_active": True
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchant: {
email: 'merchant2@gmail.com',
phone_number: '+254700000021',
first_name: 'John',
last_name: 'Merchant Two',
password: 'secret',
kyc_status: 'approved',
is_active: true,
pin: '123456'
},
sub_merchants: [
{
email: 'merchant2.branch1@gmail.com',
phone_number: '+254700000022',
first_name: 'Bob',
last_name: 'Branch One',
password: 'secret',
kyc_status: 'approved',
is_active: true,
pin: '654321'
},
{
email: 'merchant2.branch2@gmail.com',
phone_number: '+254700000023',
first_name: 'Carol',
last_name: 'Branch Two',
password: 'secret',
kyc_status: 'approved',
is_active: true
}
]
})
};
fetch('https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants', 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://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants",
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([
'merchant' => [
'email' => 'merchant2@gmail.com',
'phone_number' => '+254700000021',
'first_name' => 'John',
'last_name' => 'Merchant Two',
'password' => 'secret',
'kyc_status' => 'approved',
'is_active' => true,
'pin' => '123456'
],
'sub_merchants' => [
[
'email' => 'merchant2.branch1@gmail.com',
'phone_number' => '+254700000022',
'first_name' => 'Bob',
'last_name' => 'Branch One',
'password' => 'secret',
'kyc_status' => 'approved',
'is_active' => true,
'pin' => '654321'
],
[
'email' => 'merchant2.branch2@gmail.com',
'phone_number' => '+254700000023',
'first_name' => 'Carol',
'last_name' => 'Branch Two',
'password' => 'secret',
'kyc_status' => 'approved',
'is_active' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants"
payload := strings.NewReader("{\n \"merchant\": {\n \"email\": \"merchant2@gmail.com\",\n \"phone_number\": \"+254700000021\",\n \"first_name\": \"John\",\n \"last_name\": \"Merchant Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"123456\"\n },\n \"sub_merchants\": [\n {\n \"email\": \"merchant2.branch1@gmail.com\",\n \"phone_number\": \"+254700000022\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch One\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"654321\"\n },\n {\n \"email\": \"merchant2.branch2@gmail.com\",\n \"phone_number\": \"+254700000023\",\n \"first_name\": \"Carol\",\n \"last_name\": \"Branch Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant\": {\n \"email\": \"merchant2@gmail.com\",\n \"phone_number\": \"+254700000021\",\n \"first_name\": \"John\",\n \"last_name\": \"Merchant Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"123456\"\n },\n \"sub_merchants\": [\n {\n \"email\": \"merchant2.branch1@gmail.com\",\n \"phone_number\": \"+254700000022\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch One\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"654321\"\n },\n {\n \"email\": \"merchant2.branch2@gmail.com\",\n \"phone_number\": \"+254700000023\",\n \"first_name\": \"Carol\",\n \"last_name\": \"Branch Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant\": {\n \"email\": \"merchant2@gmail.com\",\n \"phone_number\": \"+254700000021\",\n \"first_name\": \"John\",\n \"last_name\": \"Merchant Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"123456\"\n },\n \"sub_merchants\": [\n {\n \"email\": \"merchant2.branch1@gmail.com\",\n \"phone_number\": \"+254700000022\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch One\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"654321\"\n },\n {\n \"email\": \"merchant2.branch2@gmail.com\",\n \"phone_number\": \"+254700000023\",\n \"first_name\": \"Carol\",\n \"last_name\": \"Branch Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Merchant and sub-merchants created successfully",
"merchant": {
"id": "62704522-04c8-4db6-8cf1-1255e884bd1e",
"email": "merchant2@gmail.com",
"phone_number": "+254700000021",
"first_name": "John",
"last_name": "Merchant Two",
"role": "vendor",
"kyc_status": "approved",
"is_active": true,
"parent_vendor_id": null
},
"merchant_wallets": [
{
"id": "01a60e92-3793-45c6-a27a-afab2958b107",
"network": "ethereum",
"address": 5.6437659633536495e+47,
"is_default": true,
"wallet_type": "hot"
},
{
"id": "e0220e37-3d56-4ac3-8549-cca565236242",
"network": "tron",
"address": "TTmhiFeU5qooGQ6JhY4ifGzsmMrkqt8HZV",
"is_default": false,
"wallet_type": "hot"
},
{
"id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"network": "solana",
"address": "4Nd1mY2LxK8vJ3pQ9wR7tY6uI5oP4aS3dF2gH1jK0lM",
"is_default": false,
"wallet_type": "hot"
}
],
"sub_merchants": [
{
"merchant": {
"id": "95b426cc-5580-4545-835f-4c4ac0c3b751",
"email": "merchant2.branch1@gmail.com",
"phone_number": "+254700000022",
"first_name": "Bob",
"last_name": "Branch One",
"role": "subvendor",
"kyc_status": "approved",
"is_active": true,
"parent_vendor_id": "62704522-04c8-4db6-8cf1-1255e884bd1e"
},
"wallets": [
{
"id": "d5a200f8-287f-46d4-84f9-734da9fe31b9",
"network": "ethereum",
"address": 5.709907295736517e+47,
"is_default": true,
"wallet_type": "hot"
},
{
"id": "5c364855-01ef-461c-9356-d92cae6cf09a",
"network": "tron",
"address": "TGTbSMSvYz23i8LafRr4PiXCr2BJjELBps",
"is_default": false,
"wallet_type": "hot"
}
]
},
{
"merchant": {
"id": "d514129a-14c1-4cb7-bded-b5ed4e6e87c5",
"email": "merchant2.branch2@gmail.com",
"phone_number": "+254700000023",
"first_name": "Carol",
"last_name": "Branch Two",
"role": "subvendor",
"kyc_status": "approved",
"is_active": true,
"parent_vendor_id": "62704522-04c8-4db6-8cf1-1255e884bd1e"
},
"wallets": [
{
"id": "b01c4541-569d-44c9-a5bb-98690ee6170a",
"network": "ethereum",
"address": 1.1323842145198482e+48,
"is_default": true,
"wallet_type": "hot"
},
{
"id": "4c8873e4-44af-456d-a0cf-b5151d0c5427",
"network": "tron",
"address": "TLhjr7rh95vy2MYy7ZHWf7SpecrKE38LfG",
"is_default": false,
"wallet_type": "hot"
}
]
}
]
}Create Master Merchant And Sub-Merchants In One Call
Creates a master merchant and zero or more sub-merchants. Each user receives best-effort default wallets on ethereum, tron, and solana.
Duplicate contact guard: All master and sub-merchant email/phone_number values are validated before any insert. Conflicts return 409 with no users or wallets created. Master and sub-merchant users are inserted in a single transaction when validation passes.
Partial wallet failures are returned per master (merchant_wallet_errors) and per sub-merchant (wallet_errors on each sub entry) after users are committed.
curl --request POST \
--url https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant": {
"email": "merchant2@gmail.com",
"phone_number": "+254700000021",
"first_name": "John",
"last_name": "Merchant Two",
"password": "secret",
"kyc_status": "approved",
"is_active": true,
"pin": "123456"
},
"sub_merchants": [
{
"email": "merchant2.branch1@gmail.com",
"phone_number": "+254700000022",
"first_name": "Bob",
"last_name": "Branch One",
"password": "secret",
"kyc_status": "approved",
"is_active": true,
"pin": "654321"
},
{
"email": "merchant2.branch2@gmail.com",
"phone_number": "+254700000023",
"first_name": "Carol",
"last_name": "Branch Two",
"password": "secret",
"kyc_status": "approved",
"is_active": true
}
]
}
'import requests
url = "https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants"
payload = {
"merchant": {
"email": "merchant2@gmail.com",
"phone_number": "+254700000021",
"first_name": "John",
"last_name": "Merchant Two",
"password": "secret",
"kyc_status": "approved",
"is_active": True,
"pin": "123456"
},
"sub_merchants": [
{
"email": "merchant2.branch1@gmail.com",
"phone_number": "+254700000022",
"first_name": "Bob",
"last_name": "Branch One",
"password": "secret",
"kyc_status": "approved",
"is_active": True,
"pin": "654321"
},
{
"email": "merchant2.branch2@gmail.com",
"phone_number": "+254700000023",
"first_name": "Carol",
"last_name": "Branch Two",
"password": "secret",
"kyc_status": "approved",
"is_active": True
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchant: {
email: 'merchant2@gmail.com',
phone_number: '+254700000021',
first_name: 'John',
last_name: 'Merchant Two',
password: 'secret',
kyc_status: 'approved',
is_active: true,
pin: '123456'
},
sub_merchants: [
{
email: 'merchant2.branch1@gmail.com',
phone_number: '+254700000022',
first_name: 'Bob',
last_name: 'Branch One',
password: 'secret',
kyc_status: 'approved',
is_active: true,
pin: '654321'
},
{
email: 'merchant2.branch2@gmail.com',
phone_number: '+254700000023',
first_name: 'Carol',
last_name: 'Branch Two',
password: 'secret',
kyc_status: 'approved',
is_active: true
}
]
})
};
fetch('https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants', 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://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants",
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([
'merchant' => [
'email' => 'merchant2@gmail.com',
'phone_number' => '+254700000021',
'first_name' => 'John',
'last_name' => 'Merchant Two',
'password' => 'secret',
'kyc_status' => 'approved',
'is_active' => true,
'pin' => '123456'
],
'sub_merchants' => [
[
'email' => 'merchant2.branch1@gmail.com',
'phone_number' => '+254700000022',
'first_name' => 'Bob',
'last_name' => 'Branch One',
'password' => 'secret',
'kyc_status' => 'approved',
'is_active' => true,
'pin' => '654321'
],
[
'email' => 'merchant2.branch2@gmail.com',
'phone_number' => '+254700000023',
'first_name' => 'Carol',
'last_name' => 'Branch Two',
'password' => 'secret',
'kyc_status' => 'approved',
'is_active' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants"
payload := strings.NewReader("{\n \"merchant\": {\n \"email\": \"merchant2@gmail.com\",\n \"phone_number\": \"+254700000021\",\n \"first_name\": \"John\",\n \"last_name\": \"Merchant Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"123456\"\n },\n \"sub_merchants\": [\n {\n \"email\": \"merchant2.branch1@gmail.com\",\n \"phone_number\": \"+254700000022\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch One\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"654321\"\n },\n {\n \"email\": \"merchant2.branch2@gmail.com\",\n \"phone_number\": \"+254700000023\",\n \"first_name\": \"Carol\",\n \"last_name\": \"Branch Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant\": {\n \"email\": \"merchant2@gmail.com\",\n \"phone_number\": \"+254700000021\",\n \"first_name\": \"John\",\n \"last_name\": \"Merchant Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"123456\"\n },\n \"sub_merchants\": [\n {\n \"email\": \"merchant2.branch1@gmail.com\",\n \"phone_number\": \"+254700000022\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch One\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"654321\"\n },\n {\n \"email\": \"merchant2.branch2@gmail.com\",\n \"phone_number\": \"+254700000023\",\n \"first_name\": \"Carol\",\n \"last_name\": \"Branch Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant\": {\n \"email\": \"merchant2@gmail.com\",\n \"phone_number\": \"+254700000021\",\n \"first_name\": \"John\",\n \"last_name\": \"Merchant Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"123456\"\n },\n \"sub_merchants\": [\n {\n \"email\": \"merchant2.branch1@gmail.com\",\n \"phone_number\": \"+254700000022\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch One\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true,\n \"pin\": \"654321\"\n },\n {\n \"email\": \"merchant2.branch2@gmail.com\",\n \"phone_number\": \"+254700000023\",\n \"first_name\": \"Carol\",\n \"last_name\": \"Branch Two\",\n \"password\": \"secret\",\n \"kyc_status\": \"approved\",\n \"is_active\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Merchant and sub-merchants created successfully",
"merchant": {
"id": "62704522-04c8-4db6-8cf1-1255e884bd1e",
"email": "merchant2@gmail.com",
"phone_number": "+254700000021",
"first_name": "John",
"last_name": "Merchant Two",
"role": "vendor",
"kyc_status": "approved",
"is_active": true,
"parent_vendor_id": null
},
"merchant_wallets": [
{
"id": "01a60e92-3793-45c6-a27a-afab2958b107",
"network": "ethereum",
"address": 5.6437659633536495e+47,
"is_default": true,
"wallet_type": "hot"
},
{
"id": "e0220e37-3d56-4ac3-8549-cca565236242",
"network": "tron",
"address": "TTmhiFeU5qooGQ6JhY4ifGzsmMrkqt8HZV",
"is_default": false,
"wallet_type": "hot"
},
{
"id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"network": "solana",
"address": "4Nd1mY2LxK8vJ3pQ9wR7tY6uI5oP4aS3dF2gH1jK0lM",
"is_default": false,
"wallet_type": "hot"
}
],
"sub_merchants": [
{
"merchant": {
"id": "95b426cc-5580-4545-835f-4c4ac0c3b751",
"email": "merchant2.branch1@gmail.com",
"phone_number": "+254700000022",
"first_name": "Bob",
"last_name": "Branch One",
"role": "subvendor",
"kyc_status": "approved",
"is_active": true,
"parent_vendor_id": "62704522-04c8-4db6-8cf1-1255e884bd1e"
},
"wallets": [
{
"id": "d5a200f8-287f-46d4-84f9-734da9fe31b9",
"network": "ethereum",
"address": 5.709907295736517e+47,
"is_default": true,
"wallet_type": "hot"
},
{
"id": "5c364855-01ef-461c-9356-d92cae6cf09a",
"network": "tron",
"address": "TGTbSMSvYz23i8LafRr4PiXCr2BJjELBps",
"is_default": false,
"wallet_type": "hot"
}
]
},
{
"merchant": {
"id": "d514129a-14c1-4cb7-bded-b5ed4e6e87c5",
"email": "merchant2.branch2@gmail.com",
"phone_number": "+254700000023",
"first_name": "Carol",
"last_name": "Branch Two",
"role": "subvendor",
"kyc_status": "approved",
"is_active": true,
"parent_vendor_id": "62704522-04c8-4db6-8cf1-1255e884bd1e"
},
"wallets": [
{
"id": "b01c4541-569d-44c9-a5bb-98690ee6170a",
"network": "ethereum",
"address": 1.1323842145198482e+48,
"is_default": true,
"wallet_type": "hot"
},
{
"id": "4c8873e4-44af-456d-a0cf-b5151d0c5427",
"network": "tron",
"address": "TLhjr7rh95vy2MYy7ZHWf7SpecrKE38LfG",
"is_default": false,
"wallet_type": "hot"
}
]
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Response
Merchant and sub-merchants created
Merchant user summary (master vendor or subvendor branch).
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Present when one or more master default wallets failed.
Show child attributes
Show child attributes