# getBalance

Return balance of a specific asset for the given account.

If the asset is omited from a request to MainNet, all asset and token balances will be returned.

## **Input Arguments**

<table><thead><tr><th width="358">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>params:</code> <a href="/pages/Hkx26oe9iQ96gUiDBFtq#balancerequest"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a><code>BalanceRequest[]</code></td><td>A list of Balance Request Objects, specifying which addresses, and which assets to query</td></tr></tbody></table>

### BalanceRequest

<table><thead><tr><th width="298">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>address: string</code></td><td>Address to check balance(s)</td></tr><tr><td><code>contracts: string[]</code></td><td>contracts is a list of contract hash</td></tr></tbody></table>

## **Success Response**

<table><thead><tr><th width="340">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>[address: string]:</code> <a href="/pages/Hkx26oe9iQ96gUiDBFtq#balanceresponse"><img src="http://localhost:8080/assets/images/info.svg" alt="i"></a><code>BalanceResponse[]</code></td><td>This key is the actual address of the query eg. "NdJqYNVK99srFABQDLPdrpz2By1RX1sLvr"</td></tr></tbody></table>

### BalanceResponse

<table><thead><tr><th width="295">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>contract: string</code></td><td>contract of the given hash</td></tr><tr><td><code>symbol: string</code></td><td>Symbol of the given contract</td></tr><tr><td><code>amount: string</code></td><td>Double Value of the balance represented as a String</td></tr></tbody></table>

## Example

### Request

```js
neolineN3.getBalance()
.then((results) => {
    Object.keys(results).forEach(address => {
        const balances = results[address];
        balances.forEach(balance => {
            const { contract, symbol, amount } = balance

            console.log('Address: ' + address);
            console.log('contract: ' + contract);
            console.log('Asset symbol: ' + symbol);
            console.log('Amount: ' + amount);
        });
    });
})
.catch((error) => {
    const {type, description, data} = error;
    switch(type) {
        case 'NO_PROVIDER':
            console.log('No provider available.');
            break;
        case 'CONNECTION_DENIED':
            console.log('The user rejected the request to connect with your dApp');
            break;
        default:
            // Not an expected error object.  Just write the error to the console.
            console.error(error);
            break;
    }
});
```

### Response

```js
[
    {
        "symbol": "NEO",
        "amount": "5000000",
        "contract": "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5"
    },
    {
        "symbol": "GAS",
        "amount": "10063.4476161",
        "contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf"
    }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tutorial.neoline.io/reference/neo3-provider-api-legacy/read-methods/getbalance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
