Sui API Overview
Welcome to the Sui API Quickstart and Reference Guide. dRPC serves Sui's native gRPC API (sui.rpc.v2): reading checkpoints, transactions, objects and balances, executing and simulating transactions, resolving SuiNS names, and streaming chain data.
This page includes:
- A Quickstart Guide to help you set up and make your first Sui gRPC request.
- A detailed list of all Sui gRPC methods, grouped by service.
Sui API Quickstart#
1. Create a dRPC account and get an API key
Sign up at drpc.org (opens in a new tab) and copy your API key from the dashboard.
2. Connection details
All Sui gRPC methods are served at a single TLS endpoint. Send two metadata values with every call:
| Parameter | Value |
|---|---|
| Endpoint | grpc.drpc.live:443 (TLS) |
x-drpc-key | Your dRPC API key |
x-drpc-chain | sui |
Requests and responses are the standard Sui protobuf messages from MystenLabs/sui-apis (opens in a new tab). See the gRPC Guide for details and error codes.
3. Make your first request with grpcurl
grpcurl (opens in a new tab) works without proto files, because the endpoint supports gRPC server reflection:
export DRPC_KEY=<your dRPC key>
grpcurl -H "x-drpc-key: $DRPC_KEY" -H "x-drpc-chain: sui" -d '{}' \
grpc.drpc.live:443 sui.rpc.v2.LedgerService/GetServiceInfoYou should see the chain id, the current epoch and the latest checkpoint height.
4. Call Sui from Node.js
Clone the protos and install the gRPC packages:
mkdir sui-drpc-quickstart && cd sui-drpc-quickstart
npm init --yes
npm install @grpc/grpc-js @grpc/proto-loader
git clone https://github.com/MystenLabs/sui-apisCreate index.js:
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
const packageDefinition = protoLoader.loadSync('sui/rpc/v2/ledger_service.proto', {
includeDirs: ['sui-apis/proto'],
keepCase: true,
longs: String,
enums: String,
});
const sui = grpc.loadPackageDefinition(packageDefinition).sui.rpc.v2;
const client = new sui.LedgerService('grpc.drpc.live:443', grpc.credentials.createSsl());
const metadata = new grpc.Metadata();
metadata.add('x-drpc-key', 'YOUR_DRPC_API_KEY');
metadata.add('x-drpc-chain', 'sui');
client.GetServiceInfo({}, metadata, (error, response) => {
if (error) {
console.error('Error:', error);
return;
}
console.log('Latest checkpoint:', response.checkpoint_height);
});Run it:
node index.jsField masks
Many methods accept a read_mask (a google.protobuf.FieldMask) that selects which fields to return. If you omit it, the server applies a method-specific default that returns a minimal subset of fields, for example only digest for GetTransaction. Pass * to request all fields. The default for each method is listed on its page.
Sui gRPC API Methods#
All methods belong to the sui.rpc.v2 package. ListCheckpoints, ListTransactions, ListEvents and all Subscribe* methods are server-streaming.
Ledger Service#
Reads ledger data: checkpoints, transactions, objects, epochs and events, and node service info.
GetServiceInfo : Returns chain id, current epoch, latest checkpoint and available data range.
GetObject : Returns an object by id, at the latest or a specific version.
BatchGetObjects : Returns several objects in one call.
GetTransaction : Returns an executed transaction by digest.
BatchGetTransactions : Returns several executed transactions by digest.
GetCheckpoint : Returns a checkpoint by sequence number or digest, or the latest one.
GetEpoch : Returns information about an epoch, by default the current one.
ListCheckpoints : Streams checkpoints in a range, with optional transaction filters.
ListTransactions : Streams executed transactions in a range, with optional filters.
ListEvents : Streams events in a range, with optional filters.
State Service#
Reads live state indexes: balances, owned objects, dynamic fields and coin information.
GetBalance : Returns the balance of one coin type owned by an address.
ListBalances : Returns the balances of all coin types owned by an address.
ListOwnedObjects : Lists objects owned by an address, with an optional type filter.
GetCoinInfo : Returns metadata, supply and regulation info for a coin type.
ListDynamicFields : Lists the dynamic fields of an object.
Transaction Execution Service#
Executes signed transactions and simulates transactions without committing them.
ExecuteTransaction : Submits a signed transaction for execution.
SimulateTransaction : Simulates a transaction without submitting it.
Move Package Service#
Reads Move packages, their versions, datatypes and function signatures.
GetPackage : Returns a Move package with its modules.
GetDatatype : Returns the layout of a Move struct or enum.
GetFunction : Returns the signature of a Move function.
ListPackageVersions : Lists all versions of a Move package.
Name Service#
Resolves SuiNS names to addresses and addresses back to names.
LookupName : Resolves a SuiNS name to an address.
ReverseLookupName : Returns the SuiNS name linked to an address.
Signature Verification Service#
Verifies user signatures against personal messages or transaction data.
VerifySignature : Verifies a user signature against a message or transaction.
Subscription Service#
Streams checkpoints, transactions and events in real time as they are executed.
SubscribeCheckpoints : Streams new checkpoints in real time.
SubscribeTransactions : Streams new transactions in real time, with optional filters.
SubscribeEvents : Streams new events in real time, with optional filters.