How to use Aptos Indexer API?
Have you never used the Aptos Indexer API before? Don't worry! By reading this guide and following the steps one by one, you will naturally learn how to use the Aptos Indexer API and where you can apply it.
This guide proceeds through the following three main steps.
- Setting up the environment for using Nodit
- Trying out the Indexer API
- Utilizing the Indexer API in a Dapp
1. Setting up Nodit Console
In the first chapter, we set up the Nodit console environment to use the Aptos Indexer API. Using the Nodit console, you can connect to the Aptos network, issue an API key, and easily query various data. The setup process covers everything from signing up for Nodit to connecting an Aptos node and issuing an API Key.
1.1. Sign-up for Nodit
Let's start by signing up first.
Click the link below to go to the sign-up page. You can sign up quickly with a Google account, or sign up by entering your email address directly.
1.2. Connect to Aptos Networks
After signing up, during your first login you will go through an onboarding process to create a project and connect the nodes needed for the project. In this guide, we will be using the Aptos Indexer API. Therefore, make sure to select Aptos Mainnet and Testnet, and click the Go to Nodit button.
If you have successfully completed the onboarding process, a new project will be created with the nodes you just selected connected.
As shown in the figure below, if the Aptos Mainnet and Testnet cards appear under Connected Nodes on the project Overview page, the connection has been completed successfully.
Don't worry if you missed selecting Aptos on the onboarding screen! You can additionally connect or disconnect nodes for the desired chain on the Node Dashboard page.
For more details on node management, check the documentation link below.
1.3. Get Indexer API Endpoint
The API Endpoint is the destination URL for Indexer API calls, and is assigned per node connected to your project. The API Endpoint address can be found on the project Overview page or the Nodes page. Click the 'Indexer API Endpoint' button for the target network (Aptos Mainnet or Aptos Testnet) you want to call the Indexer API for, then copy the value and store it securely before use. Note that the Indexer API Endpoint includes the API Key, so be careful not to expose it externally.
Now everything is ready for you to use Nodit! Shall we start using the Indexer API in earnest?
2. Exploring Aptos Indexer API
In this chapter, you will learn how to query data using the Aptos Indexer API. You will also write a simple query and retrieve actual data. If you are not sure what query to write, try using the Query Templates provided by Nodit!
▶ Link to Query Templates (Coin)
▶ Link to Query Templates (NFT)
In this session, we will query the list of Fungible Assets held by a specific account. Copy the query below and use it in the steps that follow.
query FA_Balances {
current_fungible_asset_balances(
limit: 10
offset: 0
where: {
owner_address: {
# You can change the below address
_eq: "0x0000000000000000000000000000000000000000000000000000000000000001"
}
}
)
{
owner_address
amount
asset_type
token_standard
metadata {
asset_type
creator_address
decimals
name
symbol
token_standard
maximum_v2
supply_v2
}
}
}
▶️ Link to Query template of "Get Fungible Asset Balances by Account"
2. Try out using Hasura Cloud
Hasura is an open-source engine that provides real-time querying and subscription capabilities for connected databases. Using Hasura, you can easily test the Indexer API.
Click the link below to access Hasura Cloud.
Enter the Indexer API Endpoint you copied in Chapter 1 to connect.
Similar to the Nodit documentation, the middle section of this page shows query writing, calling, and response viewing, while the left section displays the schema and fields.
Now copy and paste the query provided above, and click the run button (▶️) to check the response!
Congratulations! You can now successfully query data using the Aptos Indexer API. Use what you have learned in this guide to write queries tailored to your own project and apply the Aptos Indexer API. It will make implementing your project much easier!






