Cover Image for Non-fungible Token APIs (NFT APIs)

Non-fungible Token APIs (NFT APIs)

NFT

Back in 2021, when Kings of Leon launched an album as an NFT and Grimes and Lindsay Lohan minted themselves onto the blockchain, NFTs went mainstream. The hype cycle has come and gone, but the data problem stayed: analytics and tooling around NFTs still depend on good access to onchain data. This article shows how to access and analyze NFT data using Bitquery APIs.

Note: We will take CryptoKitties as an example and analyze its CK token (0x06012c8cf97bead5deae237070f9587f8e7a266d), an ERC721 (non-fungible) token where 1 CK token represents 1 kitty. CryptoKitties is a useful example precisely because it has a long history on chain: the same queries work for any NFT collection, current or historical.

All queries below run in the Bitquery IDE against the streaming API endpoint https://streaming.bitquery.io/graphql, authenticated with a Bearer access token. See the NFT API docs for setup and more examples.

Basic NFT Metrics

Let's get basic metrics for the CK token: how many transfers happened, and unique sender and receiver counts. The v2 EVM schema exposes NFT transfers alongside fungible transfers, filtered by the token's smart contract:

{
  EVM(network: eth, dataset: combined) {
    Transfers(
      where: {Transfer: {Currency: {SmartContract: {is: "0x06012c8cf97bead5deae237070f9587f8e7a266d"}}}}
    ) {
      count
      senders: count(distinct: Transfer_Sender)
      receivers: count(distinct: Transfer_Receiver)
    }
  }
}

NFT Transfers

Aggregating transfers by month shows a collection's activity over time. CryptoKitties peaked in the 2017-2018 craze and declined steadily after, which the transfer curve makes obvious.

Query result for the CryptoKitties token showing 5,620,703 transfers over 2,045 days between 83,329 senders and 143,051 receivers

Token Transfers By Date

Bitquery GraphQL IDE running a transfers query for the CryptoKitties contract, with monthly counts returned on the right

NFT Senders and Receivers

Digging into senders tells you how many distinct wallets are actively moving a collection. By 2021, unique CK senders had fallen to roughly 650 per month from the craze-era peak. You can rank the largest senders and receivers for any collection:

{
  EVM(network: eth, dataset: combined) {
    Transfers(
      where: {Transfer: {Currency: {SmartContract: {is: "0x06012c8cf97bead5deae237070f9587f8e7a266d"}}}}
      orderBy: {descendingByField: "count"}
      limit: {count: 10}
    ) {
      Transfer {
        Sender
      }
      count
    }
  }
}

NFT Smart Contract Stats

Using our APIs, you can get call and transaction stats for any NFT smart contract. In CryptoKitties' case, the contract had accumulated more than 10.3 million smart contract calls and over 7 million transactions from more than 90,000 unique users by early 2021, with a total supply just under 2 million kitties. The same aggregations run live for any collection today.

You can also chart historical activity, for example unique callers over time:

Horizontal bar chart of CryptoKitties contract methods by call count, led by giveBirth and transfer at around 2 million calls each

Unique Callers By Date

Chart of unique CryptoKitties callers by month, spiking above 55,000 in late 2017 and settling near zero from 2019 onward

NFT Smart Contract Methods

NFTs are created and managed through smart contracts. Using the Calls API, you can see which contract methods get called most and what that says about user behavior. For CryptoKitties, createSaleAuction was called more than a million times, showing the auction feature was the heart of the project. Smart contract events are available the same way through the Events API.

Distribution of Calls Count by Methods

Horizontal bar chart of CryptoKitties contract methods by call count, led by giveBirth and transfer at around 2 million calls each

NFT Transactions

You can get transactions for any NFT asset on Ethereum and other chains, including which addresses spend the most gas on a specific collection. That is useful for market research: the top gas spenders on a competitor's collection are its power users.

Table of the top CryptoKitties callers by gas cost, with the highest at 2,196.80 across 460,641 calls

NFT Trades on Marketplaces and DEXs

NFT trades are where the market data lives. The v2 schema covers NFT trades across marketplaces through the DEXTrades API, filtered by the NFT as the base currency:

{
  EVM(network: eth, dataset: combined) {
    DEXTrades(
      where: {Trade: {Buy: {Currency: {SmartContract: {is: "0x06012c8cf97bead5deae237070f9587f8e7a266d"}}}}}
      orderBy: {descending: Block_Number}
      limit: {count: 10}
    ) {
      Block {
        Time
        Number
      }
      Trade {
        Dex {
          ProtocolName
        }
        Buy {
          Amount
          Currency {
            Symbol
            SmartContract
          }
        }
        Sell {
          Amount
          Currency {
            Symbol
          }
        }
      }
      Transaction {
        Hash
      }
    }
  }
}

Bar chart of CryptoKitties trade counts by month, peaking at 86 in early 2019 and falling away by mid-year

Check the docs for marketplace-specific examples such as OpenSea and Blur trade queries.

Conclusion

NFT projects, marketplaces, and analytics tools all need reliable data access, which Bitquery provides through simple GraphQL APIs, real-time subscriptions, and Kafka streams across 40+ chains. If you are building any NFT-related project, talk to us on our Telegram channel.

Also Read:

About Bitquery

Bitquery provides blockchain data for 40+ chains through one unified schema. Our products include:

  • GraphQL APIs and streams: query historical data or subscribe to real-time updates over WebSocket via the IDE and docs.

  • Kafka and gRPC data streams: complete, low-latency onchain data feeds for trading systems and pipelines.

  • MCP server: connect Claude, Cursor, or any MCP client to Bitquery data and query it in plain English.

  • Coinpath® MoneyFlow: a crypto investigation platform with auto-tracing, entity labels, and case management.

If you have any questions about our products, ask them on our Telegram channel. Also, subscribe to our newsletter below, we will keep you updated with the latest in the cryptocurrency world.

Subscribe to our newsletter

Subscribe and never miss any updates related to our APIs, new developments & latest news etc. Our newsletter is sent once a week on Monday.