> For the complete documentation index, see [llms.txt](https://docs.getblock.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.getblock.io/api-reference/sui-sui/stateservice-listownedobjects-sui.md).

# StateService/ListOwnedObjects - SUI

Returns objects owned by an address. Paginated; an optional `object_type` filter narrows the result to a specific Move type (e.g. all NFTs of a given collection).

**Service**: `sui.rpc.v2.StateService`\
**Proto file**: [`sui/rpc/v2/state_service.proto`](https://github.com/MystenLabs/sui-apis/blob/main/proto/sui/rpc/v2/state_service.proto)\
**Full method path**: `sui.rpc.v2.StateService/ListOwnedObjects`

## Request Fields

| Field        | Type      | Required | Description                                                                    |
| ------------ | --------- | -------- | ------------------------------------------------------------------------------ |
| owner        | Address   | Yes      | 32-byte address (hex `0x...`)                                                  |
| object\_type | string    | No       | Filter results to a specific Move type (e.g. `0x2::coin::Coin<0x2::sui::SUI>`) |
| page\_size   | uint32    | No       | Maximum objects per page                                                       |
| page\_token  | string    | No       | Pagination token from a previous response                                      |
| read\_mask   | FieldMask | No       | Field paths to include for each object                                         |

## Request Example

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

```bash
# Clone the official proto files first (one-time setup):
#   git clone https://github.com/MystenLabs/sui-apis.git && cd sui-apis

grpcurl \
  -import-path proto \
  -proto sui/rpc/v2/state_service.proto \
  -H "x-grpc-web: 1" \
  -d '{
    "owner": "0xb871a42470b59c7184033a688f883cf24eb5e66eae1db62319bab27adb30b873",
    "object_type": "0x2::coin::Coin<0x2::sui::SUI>",
    "page_size": 50,
    "read_mask": {
        "paths": [
            "object_id",
            "version",
            "object_type"
        ]
    }
}' \
  shared.eu-central-1.getblock.io:443/<ACCESS-TOKEN> \
  sui.rpc.v2.StateService/ListOwnedObjects
```

{% endtab %}

{% tab title="TypeScript (@grpc/grpc-js)" %}

```typescript
import * as grpc from '@grpc/grpc-js';
import * as protoLoader from '@grpc/proto-loader';
import * as path from 'path';

const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/state_service.proto');
const ACCESS_TOKEN = '<ACCESS-TOKEN>';

const packageDef = protoLoader.loadSync(PROTO_PATH, {
    includeDirs: [path.join(__dirname, 'protos/proto')],
    keepCase: true, longs: String, enums: String, defaults: true,
});
const proto = grpc.loadPackageDefinition(packageDef) as any;
const ServiceClient = proto.sui.rpc.v2.StateService;

const metadata = new grpc.Metadata();
metadata.add('authorization', `Bearer ${ACCESS_TOKEN}`);

const client = new ServiceClient('shared.eu-central-1.getblock.io:443', grpc.credentials.createSsl());

const request = {
    "owner": "0xb871a42470b59c7184033a688f883cf24eb5e66eae1db62319bab27adb30b873",
    "object_type": "0x2::coin::Coin<0x2::sui::SUI>",
    "page_size": 50,
    "read_mask": {
        "paths": [
            "object_id",
            "version",
            "object_type"
        ]
    }
};

client.ListOwnedObjects(request, metadata, (err: any, response: any) => {
    if (err) {
        console.error('Error:', err);
        return;
    }
    console.log(JSON.stringify(response, null, 2));
});
```

{% endtab %}

{% tab title="Python (grpcio)" %}

```python
# First generate Python stubs from the proto files (one-time setup):
#   pip install grpcio grpcio-tools
#   python -m grpc_tools.protoc -I=proto --python_out=. --grpc_python_out=. \
#       proto/sui/rpc/v2/state_service.proto

import grpc
from sui.rpc.v2 import sui_rpc_v2_state_service_pb2, sui_rpc_v2_state_service_pb2_grpc
from google.protobuf.json_format import ParseDict, MessageToJson

ACCESS_TOKEN = '<ACCESS-TOKEN>'

channel = grpc.secure_channel('shared.eu-central-1.getblock.io:443', grpc.ssl_channel_credentials())
stub = sui_rpc_v2_state_service_pb2_grpc.StateServiceStub(channel)

metadata = [('authorization', f'Bearer {ACCESS_TOKEN}')]

# Build the request message from a dict via ParseDict for readability
request_data = {
    "owner": "0xb871a42470b59c7184033a688f883cf24eb5e66eae1db62319bab27adb30b873",
    "object_type": "0x2::coin::Coin<0x2::sui::SUI>",
    "page_size": 50,
    "read_mask": {
        "paths": [
            "object_id",
            "version",
            "object_type"
        ]
    }
}
request = ParseDict(request_data, sui_rpc_v2_state_service_pb2.StateRequest())
# (Use the appropriate <Method>Request type — adjust as needed for the specific method.)

response = stub.ListOwnedObjects(request, metadata=metadata)
print(response)
```

{% endtab %}

{% tab title="Rust (tonic)" %}

```rust
// Add to Cargo.toml:
//   tonic = "0.12"
//   prost = "0.13"
//   tokio = { version = "1", features = ["full"] }
// Plus a build.rs invoking tonic_build on the Sui proto files.

use tonic::{transport::Channel, Request};
use sui_rpc_v2::state_service_client::StateServiceClient;
// Plus the relevant <Method>Request type import from sui_rpc_v2.

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let channel = Channel::from_static("https://shared.eu-central-1.getblock.io").connect().await?;
    let mut client = StateServiceClient::with_interceptor(channel, |mut req: Request<()>| {
        req.metadata_mut().insert("authorization", "Bearer <ACCESS-TOKEN>".parse().unwrap());
        Ok(req)
    });

    let request_json = r#"{
    "owner": "0xb871a42470b59c7184033a688f883cf24eb5e66eae1db62319bab27adb30b873",
    "object_type": "0x2::coin::Coin<0x2::sui::SUI>",
    "page_size": 50,
    "read_mask": {
        "paths": [
            "object_id",
            "version",
            "object_type"
        ]
    }
}"#;
    let request = Request::new(serde_json::from_str(request_json)?);

    let response = client.list_owned_objects(request).await?;
    println!("Response: {:?}", response.into_inner());
    Ok(())
}
```

{% endtab %}
{% endtabs %}

## Response Example

Responses are encoded in Protocol Buffers binary format on the wire. The example below shows the protobuf JSON encoding for readability.

{% code overflow="wrap" %}

```json
{
    "objects": [
        {
            "object_id": "0xc8ec1d6e3a7e9d2f5a8c3e7b1d4f9a6c2e5b8d3f7a1c4e9b2d4f6a8c0e2f4b6d",
            "version": "12345",
            "object_type": "0x2::coin::Coin<0x2::sui::SUI>"
        },
        {
            "object_id": "0x2222222222222222222222222222222222222222222222222222222222222222",
            "version": "12346",
            "object_type": "0x2::coin::Coin<0x2::sui::SUI>"
        }
    ],
    "next_page_token": "cGFnZTI="
}
```

{% endcode %}

## Response Fields

| Field                   | Type            | Description                                 |
| ----------------------- | --------------- | ------------------------------------------- |
| objects                 | repeated Object | Objects owned by the address                |
| objects\[].object\_id   | ObjectId        | Object ID                                   |
| objects\[].version      | string          | Object version                              |
| objects\[].object\_type | string          | Move type                                   |
| next\_page\_token       | string          | Pagination cursor; empty when no more pages |

## Use Cases

* Wallet UIs enumerating all coins, NFTs, and Move objects owned by a user
* DEX wallets fetching all coin objects of a specific type before constructing a swap
* NFT galleries filtering by collection (via `object_type`)

## Error Handling

gRPC uses status codes rather than JSON-RPC numeric error codes. The most relevant for this method:

| Status Code         | Numeric | Cause                                                                               |
| ------------------- | ------- | ----------------------------------------------------------------------------------- |
| UNAUTHENTICATED     | 16      | Missing or invalid `<ACCESS-TOKEN>` in the URL path                                 |
| INVALID\_ARGUMENT   | 3       | Request fields are missing, malformed, or fail validation                           |
| UNAVAILABLE         | 14      | Node is overloaded or temporarily unable to handle the request — retry with backoff |
| DEADLINE\_EXCEEDED  | 4       | Request did not complete within the timeout window                                  |
| RESOURCE\_EXHAUSTED | 8       | Rate limit exceeded for your plan                                                   |

## SDK Integration

{% tabs %}
{% tab title="@mysten/sui (TypeScript)" %}

```typescript
// The Mysten Labs TypeScript SDK provides higher-level wrappers around the
// gRPC API. Use @mysten/sui for typed client access:

import { SuiClient } from '@mysten/sui/client';

const client = new SuiClient({
    url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/'
});

// Refer to the @mysten/sui API reference for the typed wrapper of this method;
// raw gRPC call to sui.rpc.v2.StateService/ListOwnedObjects is available as shown in the
// Request Example tabs above.
```

{% endtab %}

{% tab title="pysui (Python)" %}

```python
# pysui is the community-maintained Python SDK for Sui (Mysten Labs does not
# yet publish an official Python SDK). For raw gRPC access, use grpcio with
# the generated proto stubs as shown in the Request Example tabs above.

from pysui import SuiConfig, SyncClient

config = SuiConfig.user_config(
    rpc_url='https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/'
)
client = SyncClient(config)

# Consult pysui docs for the wrapper of StateService.ListOwnedObjects.
```

{% endtab %}
{% endtabs %}
