For the complete documentation index, see llms.txt. This page is also available as Markdown.

ledgerService_batchGetObjects - SUI

Example code for the ledgerService_batchGetObjects gRPC method. Complete guide on how to use ledgerService_batchGetObjects gRPC method in GetBlock Web3 documentation.

Returns multiple objects by ID in a single call. More efficient than calling GetObject repeatedly when fetching many objects — saves both round trips and per-call overhead. Each entry in the request may have its own read_mask for fine-grained field control.

Service: sui.rpc.v2.LedgerService Proto file: sui/rpc/v2/ledger_service.proto Full method path: sui.rpc.v2.LedgerService/BatchGetObjects

Request Fields

Field
Type
Required
Description

requests

repeated GetObjectRequest

Yes

Array of GetObjectRequest entries, each with its own object_id, optional version, and optional read_mask

Request Example

# 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/ledger_service.proto \
  -H "x-grpc-web: 1" \
  -d '{
    "requests": [
        {
            "object_id": "0xc8ec1d6e3a7e9d2f5a8c3e7b1d4f9a6c2e5b8d3f7a1c4e9b2d4f6a8c0e2f4b6d",
            "read_mask": {
                "paths": [
                    "object_id",
                    "version",
                    "object_type"
                ]
            }
        },
        {
            "object_id": "0x1111111111111111111111111111111111111111111111111111111111111111",
            "read_mask": {
                "paths": [
                    "object_id",
                    "version",
                    "object_type"
                ]
            }
        }
    ]
}' \
  go.getblock.io:443/<ACCESS-TOKEN> \
  sui.rpc.v2.LedgerService/BatchGetObjects

Response Example

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

Response Fields

Field
Type
Description

objects

repeated Object

Array of objects, one per request entry. Missing or errored entries are still returned in order

objects[].object_id

ObjectId

Object ID

objects[].version

string

Object version

objects[].object_type

string

Move type

Use Cases

  • Bulk loading owned-objects pages in wallet UIs

  • Indexer enrichment — fetching detailed object data after ListOwnedObjects returns IDs

  • DEX backends loading multiple pool objects in one call

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

INVALID_ARGUMENT

3

Empty requests list or too many requests in a single batch (provider-imposed limit)

SDK Integration

Was this helpful?