Update External Wallet Priority
curl --request PUT \
--url https://api.example.com/v1/wallet/external/priority \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-client-key: <x-client-key>' \
--data '
{
"wallets": [
{
"id": 123,
"priority": 123
}
]
}
'import requests
url = "https://api.example.com/v1/wallet/external/priority"
payload = { "wallets": [
{
"id": 123,
"priority": 123
}
] }
headers = {
"x-client-key": "<x-client-key>",
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-client-key': '<x-client-key>',
Authorization: '<authorization>',
'Content-Type': 'application/json'
},
body: JSON.stringify({wallets: [{id: 123, priority: 123}]})
};
fetch('https://api.example.com/v1/wallet/external/priority', 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://api.example.com/v1/wallet/external/priority",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'wallets' => [
[
'id' => 123,
'priority' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-client-key: <x-client-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://api.example.com/v1/wallet/external/priority"
payload := strings.NewReader("{\n \"wallets\": [\n {\n \"id\": 123,\n \"priority\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-client-key", "<x-client-key>")
req.Header.Add("Authorization", "<authorization>")
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.put("https://api.example.com/v1/wallet/external/priority")
.header("x-client-key", "<x-client-key>")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"wallets\": [\n {\n \"id\": 123,\n \"priority\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/wallet/external/priority")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-client-key"] = '<x-client-key>'
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"wallets\": [\n {\n \"id\": 123,\n \"priority\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true
}
{
"message": "Not authenticated"
}
{
"message": "Invalid priority configuration"
}
Wallet
Update External Wallet Priority
Update the priority order of external wallets for transaction funding
PUT
/
v1
/
wallet
/
external
/
priority
Update External Wallet Priority
curl --request PUT \
--url https://api.example.com/v1/wallet/external/priority \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-client-key: <x-client-key>' \
--data '
{
"wallets": [
{
"id": 123,
"priority": 123
}
]
}
'import requests
url = "https://api.example.com/v1/wallet/external/priority"
payload = { "wallets": [
{
"id": 123,
"priority": 123
}
] }
headers = {
"x-client-key": "<x-client-key>",
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-client-key': '<x-client-key>',
Authorization: '<authorization>',
'Content-Type': 'application/json'
},
body: JSON.stringify({wallets: [{id: 123, priority: 123}]})
};
fetch('https://api.example.com/v1/wallet/external/priority', 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://api.example.com/v1/wallet/external/priority",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'wallets' => [
[
'id' => 123,
'priority' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-client-key: <x-client-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://api.example.com/v1/wallet/external/priority"
payload := strings.NewReader("{\n \"wallets\": [\n {\n \"id\": 123,\n \"priority\": 123\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-client-key", "<x-client-key>")
req.Header.Add("Authorization", "<authorization>")
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.put("https://api.example.com/v1/wallet/external/priority")
.header("x-client-key", "<x-client-key>")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"wallets\": [\n {\n \"id\": 123,\n \"priority\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/wallet/external/priority")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-client-key"] = '<x-client-key>'
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"wallets\": [\n {\n \"id\": 123,\n \"priority\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true
}
{
"message": "Not authenticated"
}
{
"message": "Invalid priority configuration"
}
Update the priority order of external wallets for transaction funding. When a transaction is initiated, wallets are checked sequentially in this order until one with sufficient balance is found to fund the entire transaction. Only one wallet funds each transaction — partial funding from multiple wallets is not supported.
Authentication
string
required
Your public API client key
string
required
Bearer token for authentication
Request Body
array
required
Response
boolean
Whether priority update was successful
{
"success": true
}
{
"message": "Not authenticated"
}
{
"message": "Invalid priority configuration"
}
curl -X PUT "https://dev.api.baanx.com/v1/wallet/external/priority" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"wallets": [
{
"id": 552,
"priority": 1
},
{
"id": 551,
"priority": 2
}
]
}'
import requests
url = "https://dev.api.baanx.com/v1/wallet/external/priority"
headers = {
"x-client-key": "YOUR_CLIENT_KEY",
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
current = requests.get(url, headers=headers).json()
updated_priorities = []
for index, wallet in enumerate(current):
updated_priorities.append({
"id": wallet['id'],
"priority": index + 1
})
data = {"wallets": updated_priorities}
response = requests.put(url, headers=headers, json=data)
if response.status_code == 200:
print("Priority updated successfully!")
async function updateExternalWalletPriority(
priorities: Array<{ id: number; priority: number }>
): Promise<boolean> {
const response = await fetch(
'https://dev.api.baanx.com/v1/wallet/external/priority',
{
method: 'PUT',
headers: {
'x-client-key': 'YOUR_CLIENT_KEY',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({ wallets: priorities })
}
);
const result = await response.json();
return result.success;
}
await updateExternalWalletPriority([
{ id: 552, priority: 1 },
{ id: 551, priority: 2 }
]);
Important Notes
Single-Wallet Funding: Only ONE wallet funds each transaction. The platform checks wallets in priority order and uses the first one with sufficient balance to cover the ENTIRE transaction cost. Partial funding from multiple wallets is NOT supported.
Update All Wallets: You must provide priority values for ALL registered external wallets. Partial updates may result in unexpected behavior.
Unique Priorities: Each wallet must have a unique priority value. Duplicate priorities will cause validation errors.
Transaction Failure: If ALL priority wallets have insufficient balance to cover the full transaction cost, the transaction will fail. Ensure at least one wallet always has adequate funds.
Related Endpoints
- Get External Wallet Priority - View current priority order
- Get External Wallets - View all registered external wallets
- Withdraw from Credit Wallet - Uses priority order for destination wallet
- Withdraw from Reward Wallet - Uses priority order for destination wallet
Was this page helpful?
⌘I