# getBalance

## <mark style="color:blue;">Example</mark>

{% tabs %}
{% tab title="TypeScript" %}

```javascript
const balances = await akashicPay.getBalance();
```

{% endtab %}

{% tab title="PHP" %}

```php
$balances = akashicPay->getBalance();
```

{% endtab %}

{% tab title="Java" %}

```java
APBalanceResult balances = akashicPay.getBalance(l2Address);
```

{% endtab %}

{% tab title="C#" %}

```csharp
var balance = await akashicPay.GetBalanceAsync();
```

{% endtab %}

{% tab title="Go" %}

```go
bal, err := ap.GetBalance()
```

{% endtab %}
{% endtabs %}

## <mark style="color:blue;">Return Example</mark>

Returns an array of objects, one for each native currency *and* one for each token with a non-zero balance. In the example below the caller has no USDT balance of ETH, hence there is no object for that instance.

Note: An object is always returned for [native currencies](https://docs.akashicpay.com/introduction/terminology#coins). [Tokens](https://docs.akashicpay.com/introduction/terminology#tokens) are only shown if you posses a non-zero amount.

{% tabs %}
{% tab title="TypeScript" %}

```javascript
[
  {
    "coinSymbol": NetworkSymbol.Ethereum_Sepolia,
    "balance": "5.000000000000000000"
  },
  {
    "coinSymbol": NetworkSymbol.Tron_Shasta,
    "balance": "34.000000"
  },
  {
    "coinSymbol": NetworkSymbol.Tron_Shasta,
    "tokenSymbol": TokenSymbol.USDT,
    "balance": "100.500000"
  },
]
```

{% endtab %}

{% tab title="PHP" %}

```php
[
  {
    "coinSymbol": NetworkSymbol::ETHEREUM_SEPOLIA,
    "balance": "5.000000000000000000"
  },
  {
    "coinSymbol": NetworkSymbol::TRON_SHASTA,
    "balance": "34.000000"
  },
  {
    "coinSymbol": NetworkSymbol::TRON_SHASTA,
    "tokenSymbol": TokenSymbol::USDT,
    "balance": "100.500000"
  },
]
```

{% endtab %}

{% tab title="Java" %}

```java
[
  {
    "coinSymbol": APNetworkSymbol.SEP,
    "balance": "5.000000000000000000"
  },
  {
    "coinSymbol": APNetworkSymbol.TRX_SHASTA,
    "balance": "34.000000"
  },
  {
    "coinSymbol": APNetworkSymbol.TRX_SHASTA,
    "tokenSymbol": APTokenSymbol.USDT,
    "balance": "100.500000"
  },
]
```

{% endtab %}

{% tab title="C#" %}

```csharp

  "Balances": [
    {
      "NetworkSymbol": EthSepNetworkSymbol,
      "TokenSymbol": ApTokenSymbol.Native,
      "Balance": "0.00123123"
    },
    {
      "NetworkSymbol": EthSepNetworkSymbol,
      "TokenSymbol": ApTokenSymbol.Usdt,
      "Balance": "150.52"
    },
    {
      "NetworkSymbol": TronShastaNetworkSymbol,
      "TokenSymbol": ApTokenSymbol.Native,
      "Balance": "1200.4"
    },
    {
      "NetworkSymbol": TronShastaNetworkSymbol,
      "TokenSymbol": ApTokenSymbol.Usdt,
      "Balance": "353.56"
    }
  ]
}
```

{% endtab %}

{% tab title="Go" %}
{% code overflow="wrap" %}

```go
[
  {
    NetworkSymbol: akashicpay.Ethereum_Sepolia,
    Balance: "5.000000000000000000"
  },
  {
    NetworkSymbol: akashicpay.Tron_Shasta,
    Balance: "34.000000"
  },
  {
    NetworkSymbol: akashicpay.Tron_Shasta,
    TokenSymbol: akashicpay.USDT,
    Balance: "100.500000"
  },
]
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# 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://docs.akashicpay.com/sdk/functions/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.
