The Get Balance API retrieves the current wallet balance for a user identified by their clientId. This endpoint returns the available balance in the default currency (USD) along with the timestamp of the last balance update.
Method Endpoint Authentication GET /api/v1/get-balanceSignature Required
This endpoint requires Signature-based Authentication . You must include the following headers:
Header Description x-signatureHMAC-SHA256 signature of the request x-timestampUnix timestamp (seconds) when the request was generated
Note: See Overview for detailed information on how signature authentication works and how to generate signatures.
Parameter Type Required Description clientIdstring Yes The unique client identifier
GET /api/v1/get-balance?clientId=CLIENT_001
{
" status " : " success " ,
" message " : " Balance retrieved successfully " ,
" data " : {
" userId " : 123 ,
" clientId " : " CLIENT_001 " ,
" balance " : 1500.50 ,
" updatedAt " : " 2026-02-01T14:30:00.000Z "
}
}
Field Type Description statusstring Always "success" for successful requests messagestring Human-readable success message data.userIdinteger Internal user ID data.clientIdstring Client identifier data.balancenumber Current wallet balance (as float) data.updatedAtstring | null ISO 8601 timestamp of last balance update, or null if unavailable
{
" status " : " failed " ,
" message " : " Validation failed " ,
" data " : {
" errors " : {
" clientId " : [ " The clientId field is required. " ]
}
}
}
{
" status " : " failed " ,
" message " : " User not found " ,
" data " : null
}
{
" status " : " error " ,
" message " : " Invalid signature " ,
" data " : null
}
{
" status " : " failed " ,
" message " : " Failed to get balance " ,
" data " : {
" error " : " Database connection failed "
}
}
curl -X GET " https://wdcf.xerve.online/api/v1/get-balance?clientId=CLIENT_001 " \
-H " x-signature: YOUR_SIGNATURE " \
-H " x-timestamp: 1706802000 "
Note: To generate the signature, refer to the Overview documentation.
import axios from ' axios ' ;
// Import your signature generation function (see Overview)
import { generateSignature } from ' ./signature-utils ' ;
const API_BASE_URL = ' https://wdcf.xerve.online ' ;
const CLIENT_SECRET = ' your-secret-key ' ;
async function getBalance ( clientId : string ) {
const timestamp = Math . floor ( Date . now () / 1000 ) ;
const payload = { clientId };
// Generate signature (see Overview for implementation)
const signature = generateSignature ( {
method : ' GET ' ,
path : ' /api/v1/get-balance ' ,
payload ,
secret : CLIENT_SECRET ,
timestamp
} ) ;
try {
const response = await axios . get (
`${ API_BASE_URL } /api/v1/get-balance ` ,
{
params : payload ,
headers : {
' x-signature ' : signature ,
' x-timestamp ' : timestamp . toString ()
}
}
) ;
console . log ( ' Balance: ' , response . data . data . balance ) ;
console . log ( ' Updated at: ' , response . data . data . updatedAt ) ;
return response . data ;
} catch ( error : any ) {
console . error ( ' Error: ' , error . response ?. data || error . message ) ;
throw error ;
}
}
// Usage
getBalance ( ' CLIENT_001 ' ) ;
import requests
# Import your signature generation function (see Overview)
from signature_utils import generate_signature
import time
API_BASE_URL = 'https://wdcf.xerve.online'
CLIENT_SECRET = 'your-secret-key'
def get_balance(client_id: str):
timestamp = int(time.time())
payload = {"clientId": client_id}
# Generate signature (see Overview for implementation)
signature = generate_signature(
method="GET",
path="/api/v1/get-balance",
payload=payload,
secret=CLIENT_SECRET,
timestamp=timestamp
)
headers = {
"x-signature": signature,
"x-timestamp": str(timestamp)
}
response = requests.get(
f"{API_BASE_URL}/api/v1/get-balance",
params=payload,
headers=headers
)
response.raise_for_status()
data = response.json()
print(f"Balance: {data['data']['balance']}")
print(f"Updated at: {data['data']['updatedAt']}")
return data
# Usage
if __name__ == "__main__":
get_balance("CLIENT_001")
Default Currency : The balance is returned in the default currency (USD). Multi-currency support may be added in future versions.Wallet Auto-Creation : If the user exists but doesn't have a wallet, the system will automatically create one when calling endpoints that require wallet operations (like credit/debit).Real-time Balance : The balance reflects the current state at the time of the request. For high-frequency trading applications, consider implementing caching strategies.Precision : The balance is returned as a float. For financial calculations, consider using decimal types to avoid floating-point precision issues.Overview - Authentication and signature generation guideV1 Generate Auth Token API - Authenticate users before checking balanceV1 Credit Balance API - Add funds to user walletV1 Debit Balance API - Deduct funds from user walletV1 Get Transactions API - Retrieve transaction historyError Code Possible Causes Resolution 400 Missing or invalid clientId Ensure clientId is provided and valid 401 Invalid signature or expired timestamp Verify signature generation and ensure timestamp is current 404 User not found Check that the clientId exists; may need to call generate-auth-token first 500 Database error or wallet service failure Check server logs and retry