Access to real-time and historical NFT data is essential if you want to analyze the market and build NFT-based Web3 projects. However, obtaining the necessary information without proper resources is easier said than done. Fortunately, this is where NFT data tools enter the equation, serving as crucial components for individual investors and Web3 developers alike. But with numerous options available, what is the best tool for acquiring, analyzing, and integrating NFT data into Web3 projects? For the answer to this query, join us in this article as we explore the industry’s leading tool for NFT data analytics: Moralis’ NFT API!
Overview
We’ll kickstart today’s article by giving you an overview of the best tool for NFT data analytics: Moralis’ NFT API. From there, we’ll dive deeper into this tool and cover some prominent features of this industry-leading interface. Next, we’re going to walk you through a tutorial on how to get all NFT transfers of a wallet in three straightforward steps:
- Get a Moralis API Key
- Write the Code Calling the
getWalletNFTTransfers()
Endpoint - Run the Code
Lastly, we’ll dive into some prominent NFT API use cases to top things off!
What’s more, if you’re serious about building Web3 projects, please check out some additional tools Moralis offers. For instance, the NFT API works perfectly with other interfaces, including the Wallet API, Token API, etc. With these APIs, you can build Web3 projects both faster and smarter, enabling you to save a lot of development time and resources.
So, if you haven’t already, take this opportunity and sign up with Moralis. You can create an account free of charge, and you’ll gain immediate access to all our industry-leading APIs! In turn, you can start leveraging the full power of blockchain technology today!
Nevertheless, without further delay, join us below as we jump straight into the ultimate tool for NFT data analytics: Moralis’ NFT API!
Introducing Moralis’ NFT API – The Ultimate Tool For NFT Data Analytics
Moralis’ NFT API is the ultimate tool for NFT data analytics. The interface supports more than three million NFT collections, including everything from tokens that dropped just seconds ago to established projects like Doodles, CryptoPunks, and Pudgy Penguins. In addition, the NFT API is chain agnostic, and you can effortlessly fetch data from all major EVM chains, such as Ethereum, Polygon, BNB Smart Chain (BSC), Arbitrum, Avalanche, and many others.
With this industry-leading Web3 development tool, you can seamlessly track NFT transfers, fetch NFT metadata, avoid scams with advanced spam detection, set up real-time alerts, get on-chain price data, and much more. As a result, when working with Moralis’ NFT API, it has never been easier to get NFT data and build NFT projects!
However, you don’t have to take our word for it. Many industry leaders, including MetaMask, 1inch, NFTrade, Lens, and others, trust Moralis as their preferred NFT API provider. Just check out the following testimonials:
Nevertheless, to highlight the power of this premier NFT data analytics tool further, let’s dive into the most prominent features of the NFT API in the following section!
Moralis’ NFT API Features – NFT Data Analytics
Moralis’ NFT API contains features that allow you to seamlessly find, analyze, and integrate the NFT data into your Web3 projects. To show you how it works and illustrate the power of this tool, we’ll dive deeper into five prominent features:
- Real-Time and Historical NFT Data
- Advance Spam Detection
- Optimized Image Previews
- Alerts and Notifications
- Cross-Chain Compatability
Real-Time and Historical NFT Data
Moralis’ NFT API lets you easily fetch real-time and historical data for all NFTs across all major EVM chains. With only single lines of code, you can get real-time transfers, enriched metadata, NFT ownership data, on-chain price data, historical transfers, and much more.
As such, with these features, you can seamlessly analyze NFTs and build everything from Web3 wallets to NFT analytics platforms without breaking a sweat!
To give you a few examples of how it works, here are three prominent endpoints of the NFT API:
getWalletNFTs()
– Get all NFTs owned by a wallet:
const response = await Moralis.EvmApi.nft.getWalletNFTs({ "chain": "0x1", "address": "0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326" });
To learn more about this, check out our tutorial on how to get all NFTs owned by an address.
getNFTMetadata()
– Fetch the metadata of an NFT by contract address and ID:
const response = await Moralis.EvmApi.nft.getNFTMetadata({ "chain": "0x1", "address": "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB", "tokenId": "1" });
If you want to learn more about this, check out our guide on how to get ERC-721 on-chain metadata.
getWalletNFTTransfers()
– Query an array of NFT transfers by wallet:
const response = await Moralis.EvmApi.nft.getWalletNFTTransfers({ "chain": "0x1", "address": "0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326" });
We’ll return to getWalletNFTTransfers()
in the ”NFT Data Analytics Tutorial” section and show you how you can call this endpoint in practice.
Also, if you want to explore all endpoints, check out our official NFT API documentation page!
Advanced Spam Detection
New NFTs and collections are minted regularly. And while many of the tokens you come across are legit, this is not the case for all NFTs. The market is, unfortunately, littered with NFT spam and scams, and spotting them can be a hassle without proper tools. Fortunately, this is precisely why we introduced our advanced spam detection feature.
With our advanced spam detection feature, you can effortlessly protect your platforms from undesirable NFTs via collection spam indicators!
Whenever you query a token, our NFT API will automatically detect and flag it as possible spam if something seems fishy. And this is determined by several factors, including compliance with standards, honeypot activity, if it’s a copycat token, etc.
All you have to look for is the possible_spam
parameter, and it can look something like this:
With this feature, you can easily detect NFT spam and programmatically remove unwanted tokens when building your NFT projects!
If you want to explore this further, check out our guide on how to identify NFT and ERC-20 spam and scam tokens!
Optimized Image Previews
Most NFTs feature images, and if you’re building an NFT project, you’ll likely want to display these media items to your users. And the easiest way to do so is to leverage the NFT API’s optimized image previews feature!
With the NFT API, you can effortlessly generate low, medium, and high-resolution thumbnails for NFT images. You can then easily integrate this data into your projects to improve the user experience of your platforms by providing images optimized for various use cases.
The optimized image previews feature is supported by all endpoints returning NFTs. All you have to do is call one while including a media_items
parameter set to true
. Here’s an example of what it might look like for the getWalletNFTs()
endpoint:
const response = await Moralis.EvmApi.nft.getWalletNFTs({ "chain": "0x1", "mediaItems": true, "address": "0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e" });
In return, your response will contain a media
object with links to images in various formats. This is an example of what the response might look like:
"media": { "//... "media_collection": { "low": { "height": 100, "width": 100, "url": "https://nft-preview-media.s3.us-east-1.amazonaws.com/evm/0x1/0x67f4797d84acfe5e42110051b46fa09e14a3e3f0/0x671b6db8623437fb85e50f8e1700fd28f43f4b9de146d00c01f0e42575419a98/low.jpeg" }, "medium": { /... }, "high": { //... } }, "original_media_url": "ipfs://QmNXaj3YeSfyefxgDwPV3gDNNXXvPsrQEX7tRH5Yfx5VG3" },
For a more in-depth explanation of how this works, check out our NFT image API article!
Alerts and Notifications
Moralis’ NFT tool (the NFT API) also works perfectly in combination with the Streams API. With these two tools, you can seamlessly set up streams to get real-time notifications on NFT trades, NFT mints, marketplace orders, and much more.
As a result, you can get NFT data analytics instantly as soon as something important happens on-chain and effortlessly integrate this functionality into your Web3 projects to keep your users up-to-date!
Cross-Chain Compatability
The NFT API is fully cross-chain compatible. As such, you can essentially imagine an Ethereum NFT API, BSC NFT API, Polygon NFT API, Avalanche NFT API, etc., all rolled into one single interface.
So, by utilizing the NFT API, you can effortlessly access NFT data analytics across all major EVM chains and seamlessly build cross-chain-compatible dapps in a heartbeat!
NFT Data Analytics Tutorial: How to Get NFT Transfers in 3 Steps
Now, with an overview of Moralis’ NFT API, let’s take a closer look at how you can use this industry-leading tool to get NFT data. To do so, we’ll use the getWalletNFTTransfers()
endpoint as an example and show you how to get all NFT transfers of a wallet in three straightforward steps:
- Get a Moralis API Key
- Write the Code Calling the
getWalletNFTTransfers()
Endpoint - Run the Code
However, before you can start the tutorial, you need to take care of a few prerequisites!
Prerequisites
This will be a JavaScript tutorial. Consequently, before you can continue, make sure you have the following ready:
- Node.js v14+
- NPM/Yarn
Step 1: Get a Moralis API Key
The first thing you’ll need is a Moralis API key. As such, if you haven’t already, make sure to sign up with Moralis straight away!
With an account at your disposal, go to the admin panel, click on the ”Settings” tab, scroll down to the ”API Keys” section, and copy your key:
Please keep it for now, as we’ll use it in the next section to initialize the Moralis SDK!
Step 2: Write the Code Calling the getWalletNFTTransfers()
Endpoint
Open your preferred integrated development environment, set up a new project, launch a terminal, and run the following command in the root folder to install the Moralis SDK:
npm install moralis @moralisweb3/common-evm-utils
From here, create a new ”index.js” file and add the following code:
const Moralis = require("moralis").default; const { EvmChain } = require("@moralisweb3/common-evm-utils"); const runApp = async () => { await Moralis.start({ apiKey: "YOUR_API_KEY", // ...and any other configuration }); const address = "0x26fcbd3afebbe28d0a8684f790c48368d21665b5"; const chain = EvmChain.ETHEREUM; const response = await Moralis.EvmApi.nft.getWalletNFTTransfers({ address, chain, }); console.log(response.toJSON()); }; runApp();
Next, you need to make a few adjustments to the code. You can start by replacing YOUR_API_KEY
with the key you copied during the initial step:
You can then configure the address
and chain
consts to fit your query:
We then pass along both address
and chain
as parameters when calling the getWalletNFTTransfers()
endpoint:
And that’s it; you’re now ready to run the code!
Step 3: Run the Code
Open a new terminal, cd
into the root folder of the project, and run this command to execute the script:
node index.js
Doing so will give you an array of all NFT transfers for the specified address/wallet. This is an example of what it might look like:
{ //... { "block_number": "18409806", "block_timestamp": "2023-10-23T01:48:35.000Z", "block_hash": "0xea88727cadaea1578ab3cd3b26ae238fb2e6f82e056c0e1e57d7c6270f2cd91c", "transaction_hash": "0x34455829dc9ca3a5fa880c163d6f6c2e9266b163b0ae015b894b2dceb63c8d47", "transaction_index": 4, "log_index": 996, "value": "0", "contract_type": "ERC1155", "transaction_type": "Single", "token_address": "0x148932fc33d97ae4f85443d2f6af25cacddd6062", "token_id": "0", "from_address": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae", "from_address_label": "EthDev", "to_address": "0x1f9090aae28b8a3dceadf281b0f12828e676c326", "to_address_label": "rsync-builder", "amount": "1", "verified": 1, "operator": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae", "possible_spam": false, "verified_collection": false }, //... }
As you can see from the response above, you get a bunch of information for each transaction, including a block number, time stamp, to and from addresses, etc. What’s more, each token also has the possible_spam
parameter indicating whether or not a token is potential spam:
Congratulations! You now know how to get all NFT transfers of a wallet in no time! We’d like to mention that you can essentially follow the same steps for any of our other endpoints. All it requires are some minor configurations during the second step!
Use Cases for NFT Data Analytics: What Can You Build with Moralis?
With the power of Moralis’ NFT API, there are a lot of things you can do and build. And to give you some inspiration, here are three prominent NFT API use cases:
- NFT Data Analytics Platforms: As the NFT API gives you access to real-time and historical NFT data, you can easily use this tool to build analytics platforms. For instance, by querying the NFT balance and real-time transfers of a prominent trader, you can seamlessly set up features to analyze and mimic their strategy. And with advanced spam detection, you can effortlessly remove potential scams and spam NFTs from your platforms.
- NFT Marketplaces: With access to real-time NFT data analytics, including NFT balances, optimized image previews, etc., you can also build your own NFT marketplace. Some prominent examples of already-existing platforms include OpenSea, Blur, etc.
- Gaming Platforms: You can also leverage the NFT API to build your own gaming platform by integrating enriched metadata, images, and so on. A few examples of NFT-based games include Tryhards, Axie Infinity, and The Sandbox.
However, the use cases above are only three prominent examples, and there’s a lot more you can do with the NFT API. In fact, the only thing stopping you is your imagination!
Summary: Best Tool for NFT Data Analytics
In today’s article, we introduced you to the industry’s premier tool for NFT data analytics: Moralis’ NFT API. In doing so, we learned that the NFT API supports more than three million NFT collections across all major EVM chains, including Ethereum, Polygon, BSC, and many others!
What’s more, we also discovered some of the NFT API’s most prominent features:
- Real-Time and Historical NFT Data
- Advance Spam Detection
- Optimized Image Previews
- Alerts and Notifications
- Cross-Chain Compatability
If you have followed along this far, you have now familiarized yourself with the industry’s leading tool for NFT data analytics!
If you liked this NFT API tutorial, consider checking out more content here on the blog. For instance, please read our guide on Polygon PoS vs Polygon zkEVM or explore the best crypto wallet history API. Also, if you want to use the NFT API yourself, remember to sign up with Moralis. Creating your account is free, and you can instantly leverage all our premier APIs!