GetBalance
curl --request POST \
--url https://api.mpcvault.com/v1/getBalance \
--header 'Content-Type: application/json' \
--header 'x-mtoken: <api-key>' \
--data '
{
"walletAddress": "8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj",
"chainId": "137",
"tokenAddress": "<string>"
}
'import requests
url = "https://api.mpcvault.com/v1/getBalance"
payload = {
"walletAddress": "8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj",
"chainId": "137",
"tokenAddress": "<string>"
}
headers = {
"x-mtoken": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-mtoken': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
walletAddress: '8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj',
chainId: '137',
tokenAddress: '<string>'
})
};
fetch('https://api.mpcvault.com/v1/getBalance', 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.mpcvault.com/v1/getBalance",
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([
'walletAddress' => '8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj',
'chainId' => '137',
'tokenAddress' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-mtoken: <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://api.mpcvault.com/v1/getBalance"
payload := strings.NewReader("{\n \"walletAddress\": \"8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj\",\n \"chainId\": \"137\",\n \"tokenAddress\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-mtoken", "<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://api.mpcvault.com/v1/getBalance")
.header("x-mtoken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"walletAddress\": \"8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj\",\n \"chainId\": \"137\",\n \"tokenAddress\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mpcvault.com/v1/getBalance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-mtoken"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"walletAddress\": \"8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj\",\n \"chainId\": \"137\",\n \"tokenAddress\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"balance": "<string>",
"error": {
"message": "<string>",
"executeSigningRequestsErrorCode": "EXECUTE_SIGNING_REQUESTS_ERROR_CODE_UNSPECIFIED",
"serviceErrorCode": "SERVICE_ERROR_CODE_UNSPECIFIED"
}
}Wallets
GetBalance
Get native or token balance for a wallet address.
POST
/
v1
/
getBalance
GetBalance
curl --request POST \
--url https://api.mpcvault.com/v1/getBalance \
--header 'Content-Type: application/json' \
--header 'x-mtoken: <api-key>' \
--data '
{
"walletAddress": "8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj",
"chainId": "137",
"tokenAddress": "<string>"
}
'import requests
url = "https://api.mpcvault.com/v1/getBalance"
payload = {
"walletAddress": "8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj",
"chainId": "137",
"tokenAddress": "<string>"
}
headers = {
"x-mtoken": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-mtoken': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
walletAddress: '8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj',
chainId: '137',
tokenAddress: '<string>'
})
};
fetch('https://api.mpcvault.com/v1/getBalance', 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.mpcvault.com/v1/getBalance",
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([
'walletAddress' => '8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj',
'chainId' => '137',
'tokenAddress' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-mtoken: <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://api.mpcvault.com/v1/getBalance"
payload := strings.NewReader("{\n \"walletAddress\": \"8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj\",\n \"chainId\": \"137\",\n \"tokenAddress\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-mtoken", "<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://api.mpcvault.com/v1/getBalance")
.header("x-mtoken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"walletAddress\": \"8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj\",\n \"chainId\": \"137\",\n \"tokenAddress\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mpcvault.com/v1/getBalance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-mtoken"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"walletAddress\": \"8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj\",\n \"chainId\": \"137\",\n \"tokenAddress\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"balance": "<string>",
"error": {
"message": "<string>",
"executeSigningRequestsErrorCode": "EXECUTE_SIGNING_REQUESTS_ERROR_CODE_UNSPECIFIED",
"serviceErrorCode": "SERVICE_ERROR_CODE_UNSPECIFIED"
}
}Returns the balance for a wallet address—native token or a specific ERC-20/SPL token. Balance is a string for precision; use the token’s decimals to convert (e.g. ETH 18, USDC 6, SOL 9).
Authorizations
Your API token. Required for all API requests.
Body
application/json
Type of the network.
Available options:
NETWORK_TYPE_UNKNOWN, NETWORK_TYPE_EVM, NETWORK_TYPE_BITCOIN, NETWORK_TYPE_TRON, NETWORK_TYPE_APTOS, NETWORK_TYPE_SUI, NETWORK_TYPE_SOLANA, NETWORK_TYPE_TON, NETWORK_TYPE_STELLAR Wallet address.
Example:
"8HrKVJeFNGSJ2T2wSU6MxfMvua2MYgwH1FbRsdfrgthj"
Chain id of the network. Required for NETWORK_TYPE_EVM (omitting it is rejected). Defaults to 1 (Aptos mainnet) for NETWORK_TYPE_APTOS. Optional for NETWORK_TYPE_SOLANA. Ignored for the other network types. Custom EVM networks are not supported.
Example:
"137"
Token address,if not set, it will return the balance of the native token.
Was this page helpful?