# suix_getAllBalances

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://sui-mainnet.g.alchemy.com/v2/{apiKey}

Returns the total balance for each coin type owned by the specified address, including the number of coin objects and any locked amounts.


Reference: https://www.alchemy.com/docs/chains/sui/sui-api-endpoints/suix-get-all-balances

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| owner | string | Yes | The owner's Sui address. |

## Result

**result** (object[]): A list of balance entries, one for each coin type the address owns.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "suix_getAllBalances",
  "params": [
    "0xe883a1df96561884e46d8e29cfb4e127bb6fd2719c33af1c16239a25a469e0a6"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "coinType": "0x2::sui::SUI",
      "coinObjectCount": 5,
      "totalBalance": "5000000000",
      "lockedBalance": {}
    }
  ],
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://sui-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "suix_getAllBalances",
  "params": [
    "0xe883a1df96561884e46d8e29cfb4e127bb6fd2719c33af1c16239a25a469e0a6"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'suix_getAllBalances',
    params: ['0xe883a1df96561884e46d8e29cfb4e127bb6fd2719c33af1c16239a25a469e0a6']
  })
};

fetch('https://sui-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://sui-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "suix_getAllBalances",
    "params": ["0xe883a1df96561884e46d8e29cfb4e127bb6fd2719c33af1c16239a25a469e0a6"]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sui-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"suix_getAllBalances\",\n  \"params\": [\n    \"0xe883a1df96561884e46d8e29cfb4e127bb6fd2719c33af1c16239a25a469e0a6\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	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))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://sui-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"suix_getAllBalances\",\n  \"params\": [\n    \"0xe883a1df96561884e46d8e29cfb4e127bb6fd2719c33af1c16239a25a469e0a6\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://sui-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"suix_getAllBalances\",\n  \"params\": [\n    \"0xe883a1df96561884e46d8e29cfb4e127bb6fd2719c33af1c16239a25a469e0a6\"\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: suix_getAllBalances
summary: Get all coin balances for an address
description: |
  Returns the total balance for each coin type owned by the specified address, including the number of coin objects and any locked amounts.
params:
  - name: owner
    required: true
    description: The owner's Sui address.
    schema:
      type: string
result:
  name: result
  description: A list of balance entries, one for each coin type the address owns.
  schema:
    type: array
    items:
      type: object
      properties:
        coinType:
          type: string
          description: The full type tag of the coin (e.g., 0x2::sui::SUI).
        coinObjectCount:
          type: integer
          description: The number of coin objects for this coin type.
        totalBalance:
          type: string
          description: The total balance, summed across all coin objects of this type.
        lockedBalance:
          type: object
          description: Locked balance breakdown if any.
examples:
  - name: Get all balances
    params:
      - name: owner
        value: '0xe883a1df96561884e46d8e29cfb4e127bb6fd2719c33af1c16239a25a469e0a6'
    result:
      name: result
      value:
        - coinType: 0x2::sui::SUI
          coinObjectCount: 5
          totalBalance: '5000000000'
          lockedBalance: {}
```
