Skip to main content

Indexer API

The Indexer API allows you to interact with the Calimero shard's indexer service to fetch data about accounts, transactions, and other blockchain-related information. Here's a guide on how to use the Indexer API:

Prerequisites

Before using the Indexer API, ensure you have access to the Calimero console.

Configuration

To make calls to the Indexer API, you need to configure the following parameters:

Endpoint

The API endpoint is constructed using the following parts:

  • networkId: This can be either testnet (with the suffix: -calimero-testnet) or mainnet (with the suffix: -calimero).
  • shardId: This is the unique identifier of your shard and consists of the user-defined shard name and network suffix. All parts are required. The endpoint URL is as follows:
https://api.calimero.network/api/v1/shards/{{shardId}}/indexer-graphql/graphql

You can find the endpoint URL in the Calimero Console.

Authorization Token

Follow the steps provided here to generate an auth token for your Calimero shard.

The authorization token must be provided in the header of your API request:

Authorization: {{token}}

Dashboard Structure

The Indexer API schema is available here.

Structure

Example Usage

Here's an example of how to make a request to the Indexer API using different tools:

Postman

  • Method: POST

  • URL Parameters:

    • networkId: testnet
    • shardId: test-calimero-testnet (make sure to include the complete shard ID)
    https://api.calimero.network/api/v1/shards/test-calimero-testnet/indexer-graphql/graphql
  • Headers:

    • Include the Authorization header with the value of the token generated in the previous step.
  • Body:

    • A GraphQL query.
  • Query:

    query accounts{
    allAccounts{
    totalCount
    }
    }
  • Response:

    • If the API call is correct, a status 200 will be returned with the response body:
    {
    "data": {
    "allAccounts": {
    "totalCount": 4
    }
    }
    }

Apollo Studio

  1. Login to Apollo Studio and create a new project.

  2. Open the Explorer and set the following configuration details:

    • Endpoint URL and authorization token.

    Configuration Details

  3. Enter your GraphQL query in the Explorer.

    Query

With these examples, you can start using the Indexer API to fetch data from the Calimero shard's indexer service.