/v2/app/coin/balance
This API allows you to query balances for different currencies the user owns.
The API only returns balances for transactions that have been successfully mined on the blockchain and doesn't include any pending transactions. Once the transaction(mint or transfer) succeeds on the blockchain, it can take more than 30s for the API to return the updated data.
Response
The response will be a JSON object with a list of balances for the requested currencies. The response will look like this:
{
"status": "SUCCESS",
"balances": [
{
"currency": "0x1456b21890f920110190063921f6bc7f7b027fa6",
"balance": "1.12",
"name": "MetaKeep",
"symbol": "MK"
},
{
"currency": "0x0186b21890f920110190063921f6bc7f7b027fa6",
"balance": "100041.234567",
"name": "VEuBtTAtPu",
"symbol": "ZBVS",
"locked": "10.12"
}
]
}
Here is the description of the fields in the response:
- balance: User balance for the currency. The balance is returned as a string to avoid any precision issues.
- name: Name of the currency.
- symbol: Symbol of the currency.
- locked: Locked balance for the currency(only valid for currencies created using MetaKeep APIs). The locked balance is returned as a string to avoid any precision. Note that
balance
=locked
balance +unlocked
balance.
As an example, here are some sample requests to get balances:
{
"coins": {
"currencies":[
// wETH: https://polygonscan.com/token/0x7ceb23fd6bc0add59e62ac25578270cff1b9f619
"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
// MATIC ERC20: https://polygonscan.com/address/0x0000000000000000000000000000000000001010
"0x0000000000000000000000000000000000001010"
]
},
"of": {
"email": "[email protected]"
}
}
The API does not support fetching all currencies owned by the user
We recommend using a third party provider to fetch the list of all currencies owned by the user.
Api Error Status
You can find error status returned by the api here.
Ā© Copyright 2024, Passbird Research Inc.