How to use Aptos Indexer API?

This guide explains how to use the Aptos Indexer API. Sign up for the Nodit Console and get an Endpoint for the Aptos Indexer API to start calling the Aptos Indexer API.

1. Setting up Nodit Console

In this chapter, you will configure the Nodit Console environment to use the Aptos Indexer API. The Nodit Console lets you connect to the Aptos network, obtain an API key, and query various data with ease. The setup covers everything from signing up for Nodit to connecting an Aptos node and issuing an API Key.

1-1. Sign-up for Nodit

Click the link below to go to the sign-up page. You can sign up quickly with a Google account or by entering an email address directly.

▶ Link to Nodit Sign-up

Nodit Signup

1-2. Get Indexer API Endpoint

The API Endpoint is the destination URL for Indexer API calls, assigned per node connected to your project. You can find the API Endpoint in the [Endpoint] tab on the Projects page, or by clicking the [Copy Endpoint] button in the chain list on the Chains page. Click the Indexer API Endpoint button for the target network (Aptos Mainnet) and copy the value to use it. Note that the Indexer API Endpoint includes your API Key, so take care not to expose it externally.

Nodit Console project endpoint
Nodit chains endpoint

You are now ready to call the Aptos Indexer API with Nodit. The next chapter shows how to call the Aptos Indexer API through Nodit.

2. Exploring Aptos Indexer API

In this chapter, you will learn how to query data using the Aptos Indexer API and write a simple query to retrieve real data. If you are unsure what query to write, you can use the Query Templates provided by Nodit.

▶ Link to Query Templates (Coin)

▶ Link to Query Templates (NFT)

In this guide, you 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 query and subscription capabilities against connected databases. You can use Hasura to test the Indexer API easily.

Click the link below to access Hasura Cloud.

▶ Link to Hasura Cloud

Enter the Indexer API Endpoint you copied in Chapter 1 to connect.

hasura

Similar to the Nodit documentation, the center of the page is where you write and execute queries and view responses, while the left side shows the schema and available fields.

Paste the query provided above, then click the run button (▶️) to check the response.

hasura