Search
Generic filters
Share on facebook
Share on twitter
Share on linkedin

NFT API Alternatives – Comparing Alchemy’s NFT API with Moralis’ NFT API

In the following article, we break down all you need to know about NFT API alternatives. If you want to get straight to work, check out the following GitHub NFT API:

Full NFT API Documentation – https://github.com/nft-api/nft-api


Non-fungible tokens (NFTs) gained huge recognition in 2021. As such, NFT API alternatives have quickly risen to the forefront of NFT development. Moreover, NFTs are already being adopted by everyone from sports to showbiz celebrities. What is more, even companies such as Visa jumped in on the NFT train as well. Thus, it may be the digital art and collectibles that will onboard the general public to the blockchain sphere. Furthermore, where there’s interest, there are also huge opportunities. This means that the majority of celebrities, influencers, and companies will be eager to launch their own NFTs and NFT marketplaces. This is where digital artists (for the visual part of NFTs) and developers (NFT functionality) will be in high demand. As such, knowing about the best NFT API alternatives will give developers the edge they deserve.     

Luckily, there are some early-adopter blockchain developers eager to make things a lot simpler for other devs. As a result, companies like Alchemy have come to life. Moving forward, we’ll take a closer look at Alchemy’s NFT API, which is definitely one of the mention-worthy NFT API alternatives. However, if you are looking for a holistic Web3 development solution and the most advanced NFT API, Moralis is more likely the right option for you. Throughout the upcoming sections, you’ll have a chance to get acquainted with both of these NFT API alternatives. As such, you will be able to decide which of the two alternatives will be a more suitable choice for your NFT development feats.  

What is an NFT API?

Before we take a closer look at the two above-mentioned NFT API alternatives, we need to ensure that you all understand the basics. As such, let’s make sure you can confidently answer “what is an NFT API?”. With that under your belt, you will be able to understand why NFT API is so important. You’ll see why it makes a world of difference when building NFT projects and dealing with NFT token development. Whether you want to create an NFT marketplace, build an NFT trading interface, or even dive into NFT game development, having the ultimate NFT API on your side is priceless. 

So, what is an NFT API? Ok, let’s break this down to “NFT” and “API”. As mentioned in the introductions, “NFT” stands for “non-fungible token”. NFTs are particular types of crypto assets that incorporate uniqueness via metadata (data stored on the blockchain). This makes them perfect for digital art and digital collectibles. Of course, NFTs also have use cases for more serious real-life applications. These include all sorts of certifications and proofs of ownership. 

Furthermore, API stands for “Application Programming Interface”. As such, an API is an interface that enables a piece of software to interact with other pieces of software. Thus, API serves as a tool that allows various sets of instructions to be transferred or translated for mutual understanding. Moreover, a set of APIs contributes to consistent coding in a stable environment. As such, APIs predictably deliver all replicable functions on every request. If we expand that definition on “NFT API”, we get a powerful tool for NFT development. Most importantly, NFT APIs simplify the NFTs’ backend data acquisition.  

Top NFT API Alternatives

Now that you know what an NFT API is, you are ready to learn more about the two mention-worthy NFT API alternatives. We will start with Alchemy’s NFT API and then move on to Moralis’ NFT API. As such, you’ll get to see that Alchemy’s NFT API is a great alternative. However, it offers a rather limited number of NFT endpoints compared to Moralis. Moreover, with Moralis’ NFT API, you get more Web3 development functionality in a single, easy-to-use package. 

Alchemy’s NFT API

Before we take a closer look at Alchemy’s NFT API, we want to do a quick shoutout to them. They have a cool team that does a great job at helping blockchain developers with some pretty awesome tools. In case you want to explore Alchemy’s NFT API on your own, make sure to visit their official website and select the “NFT API” option under “products”:

As you can see in the screenshot above, their NFT API is a newly added feature. As such, some aspects of it are still in a beta phase. Furthermore, when working with Alchemy’s NFT API, relying on their documentation is the way to go. You access the latter by clicking “DOCS” in the top menu. Then select the “NFT API” in the side menu:

There, you also have a video explaining how to interact with their new NFT API. Moreover, as you can see in the side menu in the above screenshot, they currently have two endpoints – “getNFTs” and “getNFTMetadata”. Both of these endpoints are currently available on Ethereum mainnet, Ethereum testnets, Polygon testnet, and Flow mainnet. 

Alchemy’s NFT API – getNFTs 

This endpoint gets all NFTs currently owned by a given address. It takes in the following parameters:

  • owner”:  This is the NFT owner’s address
  • pageKey”: This parameter is optional and serves as a UUID for pagination. When more results are available, a UUID pageKey is returned in the response. You can pass that UUID into pageKey to fetch the next 100 NFTs. Also, note that pageKeys expire after 10 minutes. 
  • contractAddresses”: This is another optional parameter. It is an array of contract addresses used to filter the responses with a max limit of 20 contracts.

Here are also the returns of the “getNFTs” endpoint:

  • ownedNfts”: This is a list of objects representing NFTs owned by the address. It returns a maximum of 100 results per response. Here’s the object’s schema:
    • “contract”: 
      • “address”: address of NFT contract
    • “id”: 
      • “token_id”: token ID of a given NFT
  • pageKey”: As mentioned above, this is optional and returns only if there are more NFTs to fetch with a limit to 100 NFTs per page.
  • totalCount”: This is the total number of NFTs owned by the given address. 
  • blockHash”: This is the canonical head block’s hash at the time of receiving your request.

For examples of the “getNFTs” endpoint, visit Alchemy’s documentation. 

Alchemy’s NFT API – getNFTMetadata 

This endpoint gets metadata associated with a given NFT. It takes in the following parameters:

  • contractAddresses”: This is the address of a given NFT’s contract.
  • tokenId”:  This is an ID for a given NFT.
  • tokenType”: This parameter is optional, though it may help perform requests faster if specified. It enables requests to determine the type of NFT token (“ERC721” or “ERC1155”). 
  • refreshCache”: This is another optional parameter. It is boolean. To refresh the metadata cache (if you think the metadata response is out of date) use “true”. Moreover, adding this parameter may slow down the response.

Here are also the returns of the “getNFTMetadata” endpoint:

  • JSON object with the following fields:
    • “contract”: contract for returned NFT
      • “address”: address of NFT contract
    • “id”: 
      • “tokenId”: ID for NFT
      • “token Metadata”:
        • “tokenType”: “ERC721” or “ERC1155”
  • externalDomainViewUrl”: This is a URL representing the location of the NFT’s original metadata data. 
  • metadata”: This return is not guaranteed. It is relevant metadata for NFT contracts. It is useful for viewing image URLs, traits, and other details.
  • timeLastUpdated”: This is the ISO timestamp of the last cache refresh for the information returned in the metadata field.

For examples of the “getNFTMetadata” endpoint, visit Alchemy’s documentation.

Moralis’ NFT API

Just like Alchemy, Moralis provides you with all the details regarding its NFT API in Moralis’ documentation. The details are under the “Web3 API (Token, Balances, NFTs)” menu option:

Moreover, Moralis currently supports Ethereum, Binance Smart Chain (BSC), Polygon, Avalanche, and Fantom. Aside from full support for listed chains, Moralis also supports their testnets. Also, new reputable programmable blockchains are being added regularly. For instance, full support for Solana is already in the pipeline. Furthermore, Moralis NFT API has a great number of endpoints, with new ones being added. Here’s the full list of NFT API endpoints provided by Moralis:

  • SearchNFTs
  • GetNFTs
  • GetNFTsForContract
  • GetNFTTransfers
  • GetNFTTransfersByBlock
  • GetAllTokenIds
  • GetContractNFTTransfers
  • GetNFTLowestPrice
  • GetNFTMetadata
  • GetNFTOwners
  • GetNFTTrades
  • GetNftTransfersFromToBlock
  • GetTokenAdressTransfers
  • GetTokenAllowance
  • GetTokenIdMetadata
  • GetTokenIdOwners
  • GetWalletTokenIdTransfers

All of the above-listed endpoints are very powerful and they take away all of the complexity behind querying the on-chain data. However, there are some endpoints that you will use more often than others. For instance, “GetNFTs” is the one that you’ll probably be relying on most often. As such, let’s take a closer look at this vital endpoint.

Moralis’ NFT API – GetNFTs

The great thing about the Moralis’ “GetNFTs” endpoint is that it already includes an NFT’s metadata. However, if you are interested in the metadata of a contract behind a specific NFT collection, you’d need to rely on “GetTokenMetadata”.

“GetNFTs” Moralis’ NFT API gets all NFTs from the current user’s address. It supports both ERC721

 and ERC1155 NFT standards. Moreover, it offers you several options, of which “address” is the only required parameter. The “GetNFTs” endpoint returns an object with the number of NFT objects and the array of NFT objects.

Here are the options of “GetNFTs”:

  • address” (required): This is the only required parameter and it is a user’s address (i.e. 0x1a2b3x…).
  • chain” (optional): This is where you can specify the blockchain to get data from. Valid values are tickers or symbols of all supported chains. Moreover, the default value is “Eth”.
  • format” (optional): This is the format of the token ID. Both decimal and hex values are available, though decimal is the default option.
  • offset” (optional): This enables you to set the desired offset.
  • limit” (optional): This enables you to set the desired limit.

Here’s and example Moralis’ SDK for the above endpoint:

const options = { chain: 'matic', address: '0x...' };
const polygonNFTs = await Moralis.Web3API.account.getNFTs(options);

GET /{address}/nft

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/0xaddress/nft?chain=eth&format=decimal' \
  -H 'accept: application/json'
  -H 'X-API-Key: YOUR_API_KEY'

And, here’s what the above example would return:

[
  {
    "token_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
    "token_id": "15",
    "contract_type": "ERC721",
    "owner_of": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
    "block_number": "88256",
    "block_number_minted": "88256",
    "token_uri": "string",
    "metadata": "string",
    "synced_at": "string",
    "amount": "1",
    "name": "CryptoKitties",
    "symbol": "RARI"
  }
]

For details regarding other Moralis NFT API’s endpoints check out Moralis’ documentation. Doing your own digging is also the best way to determine for yourself, which is the best among NFT API alternatives. 

How to Use Moralis NFT API

In order to use Moralis NFT API, you need to first create your free Moralis account. The next step would be to create a Moralis server:

By doing so, you gain complete access to the entire scope of Moralis’ SDK, including Moralis dashboard (database):

This is also where you can access all of the on-chain data. As such, the Moralis dashboard gives you an easy method to index the blockchain. By using the “Sync” feature (accessed via “View Details”), you get to easily sync and index smart contract events:

Once you have the initial setup covered, the best way would be to take on one of the example projects. When NFTs are in question, using any of the links in the first paragraph of the “What is an NFT API?” section above, will get you on the right track. Each of our example projects also guides you through the initial setup. 

Moreover, whether you decide to take on one of our example projects or create your own dApp, you have two options. You can start your project from scratch using publicly available JavaScript (React.js or Next.js), HTML, and CSS templates. This option is a bit more time-consuming but it gives you complete control over the frontend. However, if you are looking for the fastest way to deploy fully functional dApps, starting with the ultimate Ethereum dApp boilerplate is the way to go. By using this practical Web3 boilerplate, you get a wide range of components with a neat UI already set in place. As such, launching your dApp is as easy as cloning our code at GitHub. Whichever path you decide to take, you can fully focus your attention and resources on the frontend. As far as the backend goes, Moralis has got your back.   

NFT API Alternatives – Summary

Pictures can be worth a thousand words, thus we let you take a closer look at the image below. The latter neatly sums up the endpoints and supported chains for both above-covered NFT API alternatives.

As you can see, Alchemy’s NFT API is limited to two endpoints and supports fewer chains. As such, Moralis currently is without a doubt the most obvious choice among all NFT API alternatives. To start using this powerful tool, create your free Moralis account now. Moreover, make sure to visit the Moralis’ YouTube channel and the Moralis’ blog for your free blockchain development education. There you can dive deeper into many popular aspects of this world-changing industry. For instance, some of our latest articles explore gasless transactions, Web3 login and Web3 authentication, Ethereum gas fees, GameFi and play-to-earn (P2E), Web3 wallets, Android SDK alternative, DAO smart contract example, ERC20 contracts, and much more.

On the other hand, there is a more professional approach available as well. By enrolling in Moralis Academy you get to become a blockchain developer even faster. With top-notch courses, a supportive community, and professional mentors at your disposal, you ought to go full-time crypto in no time. 

January 18, 2022
Moralis Blog
Moralis Blog
Become a Moralis Mage
Get the latest information about Moralis Web3 in your email
Search
Generic filters
Related Articles
Become a Web3 Expert
Subscribe to our newsletter and get our E-book Web3 Speed run for FREE