Skip to main content
If you are building a decentralized application, chances are that you will need to query on-chain data. Since building a full indexer is not always feasible, the community has created a set of APIs that you can use to query data from the NEAR blockchain. These APIs provide a simple way to access on-chain data without having to run your own indexer or node. They are designed to be easy to use and provide a wide range of functionality, from querying account balances to exploring transactions and blocks.

FastNEAR API

The FastNEAR API allows to easily query the NEAR blockchain to get an account’s assets, map keys into account IDs, explore a block’s transactions, etc.

Use Cases

Account Assets

Query all assets of an account (including fungible and non-fungible tokens)

Latest Blocks

Query the last block produced

Key Mapping

Map Public Key to Account ID or Full Access Public Key to Account ID

Staking Info

Know a user’s staking pools (validators)

Token Holders

Query the top holders of a token

Examples

Query all fungible tokens owned by an account:
curl https://api.fastnear.com/v1/account/root.near/ft
Response:
{
  "tokens": [
    {
      "contract_id": "usdt.tether-token.near",
      "balance": "1000000",
      "metadata": {
        "name": "Tether USD",
        "symbol": "USDT",
        "decimals": 6
      }
    }
  ]
}

FastNEAR Documentation

View complete API documentation and more examples

NearBlocks API

NearBlocks API provides an endpoint to query actions that happened on a NEAR account.

Use Cases

Account Balance

Query an account’s current balance

Contract Calls

Query all function calls to a specific contract

Supply Metrics

Get total NEAR supply and circulating supply

Transaction Count

Query the number of total transactions on NEAR

Examples

Get all transactions where somebody called create_drop on Keypom:
curl -X GET "https://api.nearblocks.io/v1/account/v2.keypom.near/txns?method=create_drop"
Filter by specific sender:
curl -X GET "https://api.nearblocks.io/v1/account/v2.keypom.near/txns?method=create_drop&from=gagdiez.near"

NearBlocks API Documentation

Explore the complete API reference and interactive documentation

Pikespeak API

The Pikespeak API allows you to fetch blockchain events and aggregated analytics on wallets, validators, delegators, money transfers, dApps activity, and more.

Use Cases

Account Balances

Query current and historical account balances

Active Wallets

Query the most active wallets by transaction count

Historic Events

Query historic account events and activities

Validator Stats

Get validator and delegator analytics
To access the Pikespeak API you’ll need to register and create an account. Once you’re registered, under the My Account page you can get your API key.

Examples

Check the account balance for root.near:
curl -X GET https://api.pikespeak.ai/account/balance/root.near \
  -H "accept: application/json" \
  -H "x-api-key: YOUR-PIKESPEAK-API-KEY"
Response:
{
  "account_id": "root.near",
  "balance": "1000000000000000000000000",
  "balance_near": "1000"
}

Pikespeak Documentation

View full API documentation and get your API key

The Graph

The Graph gives developers tools to process blockchain events and make the resulting data easily available via a GraphQL API, known individually as a subgraph.
Graph Node is now able to process NEAR events, which means that NEAR developers can now build subgraphs to index their smart contracts.

Key Features

GraphQL API

Query blockchain data using flexible GraphQL queries

Custom Indexing

Define custom data schemas and indexing logic

Decentralized

Run on The Graph’s decentralized network

Multi-Chain

Index data across multiple blockchain networks

How It Works

1

Define your schema

Create a GraphQL schema that defines the data you want to index.
2

Write mapping logic

Write TypeScript code to transform blockchain events into your schema.
3

Deploy your subgraph

Deploy to The Graph’s hosted service or decentralized network.
4

Query with GraphQL

Use GraphQL to query your indexed data from your application.

The Graph NEAR Cookbook

Learn how to build NEAR subgraphs with The Graph

SubQuery

SubQuery is a fast, flexible, and reliable open-source data indexer that provides you with custom APIs for your web3 project across NEAR and many other chains.

Key Features

Fast Indexing

High-performance indexing for real-time data access

Custom APIs

Build custom GraphQL APIs tailored to your needs

Multi-Chain

Index data from NEAR and other blockchain networks

Open Source

Fully open-source and community-driven

How It Works

1

Install SubQuery CLI

Install the SubQuery CLI tool to start building your indexer.
2

Initialize project

Create a new SubQuery project for NEAR Protocol.
3

Define mappings

Write TypeScript mapping functions to process blockchain data.
4

Deploy and query

Deploy your SubQuery project and query via GraphQL.

SubQuery NEAR Guide

Get started with SubQuery on NEAR Protocol

Choosing the Right API

Best for: Simple queries, prototyping, quick integrationsRecommended APIs:
  • FastNEAR - Account assets, token balances
  • NearBlocks - Transaction history, account info
  • Pikespeak - Analytics and aggregated data
Start with these APIs if you need quick access to common data without setting up infrastructure.

Comparison Table

FeatureFastNEARNearBlocksPikespeakThe GraphSubQuery
Setup RequiredNoneNoneAPI KeySubgraphIndexer
Query LanguageRESTRESTRESTGraphQLGraphQL
Real-time DataYesYesYesYesYes
Custom LogicNoNoNoYesYes
CostFreeFreePaid PlansFree/PaidFree/Paid
Best ForAssetsTransactionsAnalyticsCustomCustom

Getting Help

NEAR Discord

Join the community for support and discussions

Build an Indexer

Learn to build your own indexer with NEAR Lake

BigQuery Dataset

Query historical data with SQL

Build docs developers (and LLMs) love