Create Country (Admin)
curl --request POST \
--url https://crypto.westminister.tech/api/v1/auth/countries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"country": {
"display_name": "Kenya",
"alpha2_code": "KE",
"alpha3_code": "KEN",
"official_name": "Republic of Kenya",
"numeric_code": "404",
"phone_code": "+254",
"nationality": "Kenyan",
"region": "Africa",
"subregion": "Eastern Africa",
"default_fiat_currency": "KES",
"supports_mpesa": false,
"supports_bank_payout": true,
"is_active": true,
"sort_order": 0
}
}
'import requests
url = "https://crypto.westminister.tech/api/v1/auth/countries"
payload = { "country": {
"display_name": "Kenya",
"alpha2_code": "KE",
"alpha3_code": "KEN",
"official_name": "Republic of Kenya",
"numeric_code": "404",
"phone_code": "+254",
"nationality": "Kenyan",
"region": "Africa",
"subregion": "Eastern Africa",
"default_fiat_currency": "KES",
"supports_mpesa": False,
"supports_bank_payout": True,
"is_active": True,
"sort_order": 0
} }
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({
country: {
display_name: 'Kenya',
alpha2_code: 'KE',
alpha3_code: 'KEN',
official_name: 'Republic of Kenya',
numeric_code: '404',
phone_code: '+254',
nationality: 'Kenyan',
region: 'Africa',
subregion: 'Eastern Africa',
default_fiat_currency: 'KES',
supports_mpesa: false,
supports_bank_payout: true,
is_active: true,
sort_order: 0
}
})
};
fetch('https://crypto.westminister.tech/api/v1/auth/countries', 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/countries",
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([
'country' => [
'display_name' => 'Kenya',
'alpha2_code' => 'KE',
'alpha3_code' => 'KEN',
'official_name' => 'Republic of Kenya',
'numeric_code' => '404',
'phone_code' => '+254',
'nationality' => 'Kenyan',
'region' => 'Africa',
'subregion' => 'Eastern Africa',
'default_fiat_currency' => 'KES',
'supports_mpesa' => false,
'supports_bank_payout' => true,
'is_active' => true,
'sort_order' => 0
]
]),
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/countries"
payload := strings.NewReader("{\n \"country\": {\n \"display_name\": \"Kenya\",\n \"alpha2_code\": \"KE\",\n \"alpha3_code\": \"KEN\",\n \"official_name\": \"Republic of Kenya\",\n \"numeric_code\": \"404\",\n \"phone_code\": \"+254\",\n \"nationality\": \"Kenyan\",\n \"region\": \"Africa\",\n \"subregion\": \"Eastern Africa\",\n \"default_fiat_currency\": \"KES\",\n \"supports_mpesa\": false,\n \"supports_bank_payout\": true,\n \"is_active\": true,\n \"sort_order\": 0\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/countries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"country\": {\n \"display_name\": \"Kenya\",\n \"alpha2_code\": \"KE\",\n \"alpha3_code\": \"KEN\",\n \"official_name\": \"Republic of Kenya\",\n \"numeric_code\": \"404\",\n \"phone_code\": \"+254\",\n \"nationality\": \"Kenyan\",\n \"region\": \"Africa\",\n \"subregion\": \"Eastern Africa\",\n \"default_fiat_currency\": \"KES\",\n \"supports_mpesa\": false,\n \"supports_bank_payout\": true,\n \"is_active\": true,\n \"sort_order\": 0\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://crypto.westminister.tech/api/v1/auth/countries")
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 \"country\": {\n \"display_name\": \"Kenya\",\n \"alpha2_code\": \"KE\",\n \"alpha3_code\": \"KEN\",\n \"official_name\": \"Republic of Kenya\",\n \"numeric_code\": \"404\",\n \"phone_code\": \"+254\",\n \"nationality\": \"Kenyan\",\n \"region\": \"Africa\",\n \"subregion\": \"Eastern Africa\",\n \"default_fiat_currency\": \"KES\",\n \"supports_mpesa\": false,\n \"supports_bank_payout\": true,\n \"is_active\": true,\n \"sort_order\": 0\n }\n}"
response = http.request(request)
puts response.read_body{
"country": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "Kenya",
"official_name": "Republic of Kenya",
"alpha2_code": "KE",
"alpha3_code": "KEN",
"numeric_code": "404",
"phone_code": "+254",
"nationality": "Kenyan",
"region": "Africa",
"subregion": "Eastern Africa",
"default_fiat_currency": "KES",
"supports_mpesa": true,
"supports_bank_payout": true,
"sort_order": 123,
"is_active": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}Countries
Create Country (Admin)
Admin only. Send nested { "country": { ... } } or the same fields at the root. alpha2_code and alpha3_code must be unique.
POST
/
api
/
v1
/
auth
/
countries
Create Country (Admin)
curl --request POST \
--url https://crypto.westminister.tech/api/v1/auth/countries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"country": {
"display_name": "Kenya",
"alpha2_code": "KE",
"alpha3_code": "KEN",
"official_name": "Republic of Kenya",
"numeric_code": "404",
"phone_code": "+254",
"nationality": "Kenyan",
"region": "Africa",
"subregion": "Eastern Africa",
"default_fiat_currency": "KES",
"supports_mpesa": false,
"supports_bank_payout": true,
"is_active": true,
"sort_order": 0
}
}
'import requests
url = "https://crypto.westminister.tech/api/v1/auth/countries"
payload = { "country": {
"display_name": "Kenya",
"alpha2_code": "KE",
"alpha3_code": "KEN",
"official_name": "Republic of Kenya",
"numeric_code": "404",
"phone_code": "+254",
"nationality": "Kenyan",
"region": "Africa",
"subregion": "Eastern Africa",
"default_fiat_currency": "KES",
"supports_mpesa": False,
"supports_bank_payout": True,
"is_active": True,
"sort_order": 0
} }
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({
country: {
display_name: 'Kenya',
alpha2_code: 'KE',
alpha3_code: 'KEN',
official_name: 'Republic of Kenya',
numeric_code: '404',
phone_code: '+254',
nationality: 'Kenyan',
region: 'Africa',
subregion: 'Eastern Africa',
default_fiat_currency: 'KES',
supports_mpesa: false,
supports_bank_payout: true,
is_active: true,
sort_order: 0
}
})
};
fetch('https://crypto.westminister.tech/api/v1/auth/countries', 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/countries",
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([
'country' => [
'display_name' => 'Kenya',
'alpha2_code' => 'KE',
'alpha3_code' => 'KEN',
'official_name' => 'Republic of Kenya',
'numeric_code' => '404',
'phone_code' => '+254',
'nationality' => 'Kenyan',
'region' => 'Africa',
'subregion' => 'Eastern Africa',
'default_fiat_currency' => 'KES',
'supports_mpesa' => false,
'supports_bank_payout' => true,
'is_active' => true,
'sort_order' => 0
]
]),
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/countries"
payload := strings.NewReader("{\n \"country\": {\n \"display_name\": \"Kenya\",\n \"alpha2_code\": \"KE\",\n \"alpha3_code\": \"KEN\",\n \"official_name\": \"Republic of Kenya\",\n \"numeric_code\": \"404\",\n \"phone_code\": \"+254\",\n \"nationality\": \"Kenyan\",\n \"region\": \"Africa\",\n \"subregion\": \"Eastern Africa\",\n \"default_fiat_currency\": \"KES\",\n \"supports_mpesa\": false,\n \"supports_bank_payout\": true,\n \"is_active\": true,\n \"sort_order\": 0\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/countries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"country\": {\n \"display_name\": \"Kenya\",\n \"alpha2_code\": \"KE\",\n \"alpha3_code\": \"KEN\",\n \"official_name\": \"Republic of Kenya\",\n \"numeric_code\": \"404\",\n \"phone_code\": \"+254\",\n \"nationality\": \"Kenyan\",\n \"region\": \"Africa\",\n \"subregion\": \"Eastern Africa\",\n \"default_fiat_currency\": \"KES\",\n \"supports_mpesa\": false,\n \"supports_bank_payout\": true,\n \"is_active\": true,\n \"sort_order\": 0\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://crypto.westminister.tech/api/v1/auth/countries")
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 \"country\": {\n \"display_name\": \"Kenya\",\n \"alpha2_code\": \"KE\",\n \"alpha3_code\": \"KEN\",\n \"official_name\": \"Republic of Kenya\",\n \"numeric_code\": \"404\",\n \"phone_code\": \"+254\",\n \"nationality\": \"Kenyan\",\n \"region\": \"Africa\",\n \"subregion\": \"Eastern Africa\",\n \"default_fiat_currency\": \"KES\",\n \"supports_mpesa\": false,\n \"supports_bank_payout\": true,\n \"is_active\": true,\n \"sort_order\": 0\n }\n}"
response = http.request(request)
puts response.read_body{
"country": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "Kenya",
"official_name": "Republic of Kenya",
"alpha2_code": "KE",
"alpha3_code": "KEN",
"numeric_code": "404",
"phone_code": "+254",
"nationality": "Kenyan",
"region": "Africa",
"subregion": "Eastern Africa",
"default_fiat_currency": "KES",
"supports_mpesa": true,
"supports_bank_payout": true,
"sort_order": 123,
"is_active": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}⌘I