Skip to content
Alchemy Logo

Sui API Quickstart

The Sui API enables you to interact with the Sui blockchain via a collection of JSON-RPC endpoints. You can query block and transaction data, interact with Move-based smart contracts, manage assets, and more.

Unlike Ethereum-based chains, Sui uses an object-centric data model, optimized for parallel execution and scalability. This quickstart helps you make your first request to the network.


The Sui API lets you send queries and transactions to the Sui blockchain through a JSON-RPC interface. With Sui’s object-based architecture and horizontal scalability, you benefit from high throughput and low-latency reads and writes.

Alchemy’s Sui API provides consistent and performant access to:

  • Retrieving account and object data
  • Querying blocks, transactions, and events
  • Simulating and broadcasting transactions
  • Accessing Move smart contract modules and functions

Select a package manager to manage your project's dependencies. The choice between npm and yarn depends on your preference or project requirements.

npmyarn
Begin with npm by following the npm documentation.For yarn, refer to yarn's installation guide.

Open your terminal and run the following commands:

mkdir sui-api-quickstart
cd sui-api-quickstart
npm init --yes

This creates a new directory named sui-api-quickstart and initializes a Node.js project within it.

Install Axios, a popular HTTP client, to make API requests:

npm install axios
# Or with yarn
# yarn add axios

Create an index.js file in your project directory and paste the following code:

const axios = require('axios');
 
const url = `https://sui-mainnet.alchemy-blast.com/v2/${yourAPIKey}`;
 
const payload = {
jsonrpc: '2.0',
id: 1,
method: 'sui_getLatestCheckpointSequenceNumber',
params: []
};
 
axios.post(url, payload)
.then(response => {
console.log('Latest checkpoint sequence number:', response.data.result);
})
.catch(error => {
console.error('Error fetching checkpoint:', error);
});
 

Replace yourAPIKey with your actual Alchemy API key from the Alchemy Dashboard.

Run the following command:

node index.js

You should see the latest checkpoint sequence number on Sui printed to your console:

Latest checkpoint sequence number: 1029433

You've made your first request to the Sui API. You can now explore the JSON-RPC methods available on Sui and start building your dApps.

Was this page helpful?