September 14, 2023

Free NFT API – Best NFT Tools & Data Endpoints

Table of Contents

Today’s article will cover the Moralis NFT API, as it stands out as the industry’s premier interface. This free NFT API features several endpoints, allowing you to get all the NFT data your projects require. To give you a sneak peek and a quick example, here’s all the code you need to get all tokens owned by a user address: 

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 = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  const chain = EvmChain.ETHEREUM;

  const response = await Moralis.EvmApi.nft.getWalletNFTs({
    address,
    chain,
  });

  console.log(response.toJSON());
};

runApp();

You just need to add your Moralis API key, configure the address and chain variables, and run the code. Doing so will give you a response containing an array of NFTs:

{
  "total": 1456,
  "page": 1,
  "page_size": 100,
  "cursor": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21QYXJhbXMiOnsid2FsbGV0QWRkcmVzcyI6IjB4ZDhkYTZiZjI2OTY0YWY5ZDdlZWQ5ZTAzZTUzNDE1ZDM3YWE5NjA0NSJ9LCJrZXlzIjpbIjE2NjMyMzgxNzUuMDc3Il0sIndoZXJlIjp7Im93bmVyX29mIjoiMHhkOGRhNmJmMjY5NjRhZjlkN2VlZDllMDNlNTM0MTVkMzdhYTk2MDQ1In0sImxpbWl0IjoxMDAsIm9mZnNldCI6MCwib3JkZXIiOltdLCJ0b3RhbCI6MTQ1NiwicGFnZSI6MSwidGFpbE9mZnNldCI6MSwiaWF0IjoxNjY2NjgyNTUyfQ.E5DkWYvRTaFnVhgedRuT3IW-rb2V-ikFKwP2cg2Qf78",
  "result": [
    {
      "token_address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
      "token_id": "4765809967066625256798886812262830659450023020194524584471225959000376492819",
      "amount": "1",
      "owner_of": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "token_hash": "ba6d44b5f16be94283cecffeb784b7ca",
      "block_number_minted": "15572796",
      "block_number": "15573017",
      "contract_type": "ERC721",
      "name": "Ethereum Name Service",
      "symbol": "ENS",
      "token_uri": null,
      "metadata": null,
      "last_token_uri_sync": null,
      "last_metadata_sync": "2022-09-20T06:06:08.153Z",
      "minter_address": null
    },
    {
      "token_address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
      "token_id": "84453794918345416145331514647027903846664455083247396107154093349515123913389",
      "amount": "1",
      "owner_of": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "token_hash": "7c0212cd3daf1b6b64f193c6dc102fb4",
      "block_number_minted": "15572811",
      "block_number": "15573017",
      "contract_type": "ERC721",
      "name": "Ethereum Name Service",
      "symbol": "ENS",
      "token_uri": null,
      "metadata": null,
      "last_token_uri_sync": null,
      "last_metadata_sync": "2022-09-20T06:09:09.838Z",
      "minter_address": null
    }
  ],
  "status": "SYNCED"
}

If you’d like to learn more about how this works, join us in this article as we explore the industry’s #1 NFT API!  

Overview

It doesn’t matter if you’re building an NFT marketplace, Web3 wallet, or NFT game; you’ll need a seamless way to get and integrate NFT data into your projects. However, retrieving data from a blockchain like Ethereum typically demands a massive amount of engineering resources and time. Fortunately, you can streamline this process by using a free NFT API. But what exactly are NFT APIs? And how do they work? If you’re looking for the answer to these questions, then join us in this article as we explore the industry’s premier option: the Moralis NFT API!

In today’s article, we’ll kick things off by exploring the ins and outs of NFT APIs. From there, we’ll jump straight into the Moralis NFT API, as it stands out as the industry’s leading interface. In doing so, we are going to cover some of the tool’s most prominent features and give you a quick introduction to how you can use it to fetch NFT data in a heartbeat. Lastly, to top things off, we’ll cover some prominent NFT API use cases! 

What’s more, if you’re serious about building Web3 projects, you’ll likely want to check out some additional tools Moralis offers. For instance, with the Price API, you can effortlessly fetch the price for any token. And with the Streams API, you can set up instant customizable updates whenever something important happens on-chain. 

If you want access to these industry-leading APIs, don’t forget to sign up with Moralis. You can create your Moralis account entirely for free and leverage blockchain technology’s full power today!

Moralis Homepage - Get Started Using Moralis NFT API for Free

What is an NFT API? 

Before we delve into the definition of an NFT API, we initially need to find out what an API is. 

So, what is an API? An API – which is an acronym for application programming interface – is essentially a set of rules enabling two decoupled software systems to communicate with each other. It acts as an intermediary layer that defines methods and data formats you can use to request information and functionality from other services, components, or systems. 

So, what is an API in an NFT context? 

An NFT API provides a set of protocols and rules enabling software systems to get and interact with on-chain NFT data. An NFT API basically abstracts the complexity of querying blockchain networks by introducing an intuitive interface, allowing you to effortlessly get and integrate NFT data into your projects. 

Graphic art illustration showing components of a free NFT API

Using an NFT API significantly reduces the amount of code you need to write, and it additionally aids in creating more consistency within the Web3 ecosystem. This means you can save a lot of time and development resources as you don’t have to reinvent the wheel when building your projects. 

All in all, an NFT API makes your work as a developer significantly easier. And by using an NFT API, you can build and scale your projects faster and more effectively! 

Best Free NFT API 

When choosing the best free NFT API, there are many things you need to consider, including NFT coverage, scalability capabilities, performance, price, supported chains, etc. And there are a lot of options on the market to choose from. However, among the top candidates, the Moralis NFT API stands out as the premier alternative! 

But why is that? 

The Moralis NFT API is free to use and offers unmatched performance through ultra-fast CDNs. It features over three million NFT collections, including everything from established projects like PudgyPenguins and CryptoPunks to NFTs that just dropped a few seconds ago. Also, Moralis’ free NFT API supports more than ten EVM-compatible blockchain networks. Some prominent examples include Ethereum, Polygon, BNB Smart Chain, and many others.

Moralis NFT API Marketing Material

The NFT API also provides many features, making it stand out compared to other competitors. With only a single line of code, you can do everything from fetching all NFTs owned by a wallet to tracking NFT trades by marketplace. However, we’ll cover the features of Moralis’ free NFT API further in the next section. 

Furthermore, all of Moralis’ APIs are built to scale. Consequently, as your Web3 projects grow and experience increased adoption, you don’t have to worry about performance, as the NFT API has no trouble handling increased traffic! 

Now, let’s take a closer look at what you can do with Moralis’ free NFT API! 

Moralis NFT API Features and Endpoints 

As we previously mentioned, you can use Moralis’ free NFT API to do everything from querying all NFTs owned by a wallet to tracking NFT trades by marketplace. In the following sections, we’ll explore five features and briefly cover how they work in practice! 

However, the features and endpoints we cover in the sections below are just a few examples, and there’s much more to Moralis’ free NFT API. As such, if you’d like to explore it in further detail, check out the official NFT API documentation.

Nevertheless, with no further ado, let’s start by showing you how to get the NFT balance of a Web3 wallet! 

Get NFT Balance 

With Moralis’ free NFT API, you can seamlessly get the NFT balance of any user address in a heartbeat. All you need is a single API call to the getWalletNFT() endpoint while passing chain and address as parameters: 

const response = await Moralis.EvmApi.nft.getWalletNFTs({
  address,
  chain,
});

If you’d like to learn more about this, please check out our guide on how to get all NFT tokens owned by a user address

Fetch NFT Metadata 

In addition to getting the NFT balance of a user, you can also use Moralis’ free NFT API to query individual tokens for metadata. Here, all you need to do is call the getNFTMetadata() endpoint while passing the contract address, chain, and tokenId as parameters:  

const response = await Moralis.EvmApi.nft.getNFTMetadata({
  address,
  chain,
  tokenId,
});

To get a more detailed breakdown, please check out our tutorial on how to get ERC-721 on-chain metadata

Get NFT Transfers 

You can leverage the Moralis free NFT API to get all transfers of a particular NFT. To do so, you simply need a single API call to the getNFTTransfers() endpoint while passing the token address, tokenId, and chain as parameters: 

const response = await Moralis.EvmApi.nft.getNFTTransfers({
  address,
  tokenId,
  chain,
});

Query NFT Collections 

You can also use Moralis’ free NFT API to query all the collections owned by an address. All you have to do is call the getWalletNFTCollections() endpoint while passing the address and chain as parameters:  

const response = await Moralis.EvmApi.nft.getWalletNFTCollections({
  address,
  chain,
});

Fetch NFT Owners 

Lastly, you can use the Moralis NFT API to get all NFT owners by contract address. To get this data, you simply need to call the getNFTOwners() endpoint while passing the contract address and chain as parameters: 

const response = await Moralis.EvmApi.nft.getNFTOwners({
  address,
  chain,
});

Tutorial: How to Use Moralis’ Free NFT API 

Now, with an overview of some of the features and endpoints of Moralis’ free NFT API, we’ll take the following section to give you a more in-depth tutorial on how it actually works. If this sounds intriguing, join us below as we show you how to get an NFT balance by user address! 

  • Prerequisites: Before you get going, you need to install and set up Node v14+ and NPM/Yarn. You also need to set up a new project in your IDE and install the Moralis SDK by running the terminal command below in the project’s root folder: 
npm install moralis @moralisweb3/common-evm-utils
  • Step 1 – Get a Moralis API Key: Sign up with Moralis, navigate to the ”Settings” tab, and copy your API key:
Step 1 - Copy Your Moralis Web3 NFT API Key to Get Started for Free
  • Step 2 – Call the getWalletNFTs() Endpoint: Create a new ”index.js” file in your project’s root folder. From there, copy and paste 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 = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";

  const chain = EvmChain.ETHEREUM;

  const response = await Moralis.EvmApi.nft.getWalletNFTs({
    address,
    chain,
  });

  console.log(response.toJSON());
};

runApp();

Replace YOUR_API_KEY with the key you fetched during the first step. Next, configure the address and chain parameters to fit your query:  

Free NFT API Code Snippets Showing Where to Paste API Key
  • Step 3 – Run the Script: Lastly, open a new terminal and run the following command to execute the code:
node index.js

In return, you’ll get a response containing an array of all NFTs held by the wallet in question. It will look something like this: 

{
  "total": 1456,
  "page": 1,
  "page_size": 100,
  "cursor": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21QYXJhbXMiOnsid2FsbGV0QWRkcmVzcyI6IjB4ZDhkYTZiZjI2OTY0YWY5ZDdlZWQ5ZTAzZTUzNDE1ZDM3YWE5NjA0NSJ9LCJrZXlzIjpbIjE2NjMyMzgxNzUuMDc3Il0sIndoZXJlIjp7Im93bmVyX29mIjoiMHhkOGRhNmJmMjY5NjRhZjlkN2VlZDllMDNlNTM0MTVkMzdhYTk2MDQ1In0sImxpbWl0IjoxMDAsIm9mZnNldCI6MCwib3JkZXIiOltdLCJ0b3RhbCI6MTQ1NiwicGFnZSI6MSwidGFpbE9mZnNldCI6MSwiaWF0IjoxNjY2NjgyNTUyfQ.E5DkWYvRTaFnVhgedRuT3IW-rb2V-ikFKwP2cg2Qf78",
  "result": [
    {
      "token_address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
      "token_id": "4765809967066625256798886812262830659450023020194524584471225959000376492819",
      "amount": "1",
      "owner_of": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "token_hash": "ba6d44b5f16be94283cecffeb784b7ca",
      "block_number_minted": "15572796",
      "block_number": "15573017",
      "contract_type": "ERC721",
      "name": "Ethereum Name Service",
      "symbol": "ENS",
      "token_uri": null,
      "metadata": null,
      "last_token_uri_sync": null,
      "last_metadata_sync": "2022-09-20T06:06:08.153Z",
      "minter_address": null
    },
    {
      "token_address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",
      "token_id": "84453794918345416145331514647027903846664455083247396107154093349515123913389",
      "amount": "1",
      "owner_of": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "token_hash": "7c0212cd3daf1b6b64f193c6dc102fb4",
      "block_number_minted": "15572811",
      "block_number": "15573017",
      "contract_type": "ERC721",
      "name": "Ethereum Name Service",
      "symbol": "ENS",
      "token_uri": null,
      "metadata": null,
      "last_token_uri_sync": null,
      "last_metadata_sync": "2022-09-20T06:09:09.838Z",
      "minter_address": null
    }
  ],
  "status": "SYNCED"
}

That’s it; it doesn’t have to be more difficult than that to use the Moralis NFT API. You can follow the same procedure to get other data types; you only need to alter the endpoint and the parameters during the second step!

Free NFT API Use Cases 

NFTs are incredibly dynamic, and they can be used to represent ownership of virtually any unique item. As you can imagine, NFTs have a lot of different use cases. Hence, as a Web3 developer, you’ll find that a free NFT API can come in handy in many situations! 

However, what are some specific instances in which you actually need an NFT API? To answer this question, we’ll take the following three sections to explore a few prominent use cases when you, as a developer, will benefit greatly from a free NFT API! 

Build an NFT Marketplace 

An NFT marketplace is a digital platform where you can buy and sell NFTs. There’s a wide range of NFT marketplaces with their own niches and reputations. Some prominent examples include NFTrade, OpenSea, and Rarible.

When building an NFT marketplace, you need access to NFT data. This includes everything from the balance of your users to the metadata of the NFT. Without this information, you couldn’t do simple things, such as display tokens to users. As such, it would result in a poor user experience, which is why you need to leverage a free NFT API! 

To give you a real-life example, check out the following testimonial from NFTrade – a booming NFT marketplace leveraging the Moralis NFT API to get the data they need: 

NFTrade Testimonial - How Moralis NFT API Helped NFTrade

Create a Web3 Wallet 

Web3 wallets are digital platforms allowing you to store assets like fungible tokens and NFTs. They also act as gateways for the Web3 ecosystem, enabling you to interact with dapps and other blockchain-based projects. There are many prominent crypto wallets on the market, and some examples include Phantom, Rainbow, and MetaMask. 

One of the core functions of a Web3 wallet is to give users an overview of their assets. Consequently, when building a crypto wallet, you need access to your users’ NFTs so your app can display their assets. What’s more, the wallet also needs access to marketplace data so it can show the total value of all holdings. And the easiest way to get this information is to leverage a free NFT API! 

For instance, MetaMask – one of the most prominent wallet providers – is using the Moralis NFT API so they can focus on serving their users: 

MetaMask Testimonial - Statement from MetaMask on How they use Moralis NFT API

Develop an NFT Game

An NFT game is a video game that uses NFTs as a core part of the experience. Within these games, NFTs are used to represent characters, items, weapons, skins, plots of land, etc. Some already-established NFT games include CryptoKitties, Try Hards, and Axie Infinity.

A core part of developing an NFT game is to access these tokens and their metadata. The metadata usually contains a bunch of critical information about aesthetics and other stats. Consequently, as you can imagine, you need an easy way to access and integrate this data into the game dynamics. And to cut development time, you can leverage an NFT API so you don’t have to reinvent the wheel. 

Just check out the following testimonial from Try Hards using Moralis’ NFT API to save time and resources: 

Conclusion: The Best Free NFT API

Among the top free NFT APIs on the market, the Moralis NFT API stands out as the premier option. The Moralis NFT API offers unmatched performance and features over three million NFT collections and counting. This tool is cross-chain compatible, supporting ten-plus EVM-compatible chains. Consequently, when working with Moralis, you don’t limit yourself to one ecosystem. 

The Moralis NFT API also provides an abundance of features. And with a single line of code, you can do everything from fetching all NFTs of an address to tracking NFT trades by marketplace. Also, all of the APIs offered by Moralis are built to scale. As such, when your projects grow, you don’t have to worry about performance issues, as the NFT API has no problem handling increased traffic! 

If you liked this tutorial, consider reading more articles here on the Web3 blog. For instance, learn how to write a smart contract in Solidity or read up on OpenSea gas fees

Furthermore, if you want to check our other helpful development tools, visit Moralis’ testnet faucets page. This page features a curated list of testnet faucets you can use when developing Web3 projects. To learn more, check out one of our articles on either a Linea Goerli faucet or a MATIC faucet

Also, remember to sign up with Moralis straight away if you want access to these industry-leading development tools. You can get an account for free, and you’ll be able to save an abundance of time and resources immediately!

NFT API
Unlock the full potential of your NFT projects with this industry-leading NFT API! Fast, easy, and free.
NFT API
Related Articles
September 17, 2022

How to Set Up a Self-Hosted Web3 Server

February 5, 2024

What’s the Best Altcoin API to Set Up Altcoin Data Feeds?

May 17, 2024

Ethereum Nodes – Free RPC Nodes for ETH Mainnet & Testnets

November 22, 2022

Exploring the Ultimate ERC20 Token API

November 23, 2022

Deploying Lambda Functions – How to Deploy AWS Lambda Function Tutorial

September 12, 2023

How to Get All NFT Tokens Owned by a User Address

October 15, 2022

NodeJS Web3 Tutorial – Create Dapps Using a NodeJS Web3 Example

November 2, 2022

The Ultimate Blockchain Tech Stack Guide

October 12, 2023

Rinkeby Faucet Guide – What is the Rinkeby Faucet and Testnet?