How to get external NFT metadata via Covalent API

Makedonskiy
4 min readApr 21, 2021

In this quick tutorial, I’ll show you how to get a wide variety of data from the blockchain network using the Covalent API. How to get your own Covalent API for this actions, what information can be extracted using the covalent API in Covalent Docs, and much more

Before you start working with the Covalent API in Covalent Docs, you need to get your API key. To get it, you need to go to https://www.covalenthq.com/ and register your account.

After completing the quick registration procedure, you will be able to receive your API key. It will look like this ( I hid the last few characters of my key because I’m greedy):

So now that you have obtained the required API key, you can start working in Covalent Docs.

Then I recommend that you familiarize yourself with the Overview tab to understand exactly what Covalent Docs are and how teams work. Then, by going to the Changelog tab,
You need to enter your API key before starting to get the information correctly. Some commands from ClassA can work without obtaining an API key, such as Get token balances for address and Get historical portfolio value over time.

Having done all the preparatory steps before working with the API, you can start working with more interesting options. In this article, we will cover the section Get external NFT Metadata:

Get external NFT metadata real-time

GET /v1/{chain_id}/tokens/{address}/nft_metadata/{token_id}/

Given a NFT contract address and a token ID, fetch and return the external metadata.

Both ERC751 as well as ERC1155 are supported.

PATH PARAMENTRS

  1. chain_id — in this field you need to enter the network in which you are going to work. Currently supports 1 for Ethereum Mainnet, 137 for Polygon/Matic Mainnet, 80001 for Polygon/Matic Mumbai Testnet, 56 for Binance Smart Chain, 43114 for Avalanche C-Chain Mainnet, 43113 for Fuji C-Chain Testnet, and 250 for Fantom Opera Mainnet.
  2. address — in this field you need to enter the NFT contract address
  3. token_id — in this field you need to enter the ID of the token

QUERY-STRING PARAMETERS

  1. format — in this field you need to enter the format of response. CSV or JSON

As an example, I decided to consider one of the Polkamon NTF tokens. So I filled in the fields with the following data:

chain_id — 1

address — 0x85f0e02cb992aa1f9f47112f815f519ef1a59e2d

token_id — 1000153384

format — JSON

And then click TRY button

If everything was entered correctly, you will receive the following response:

You can find out exactly how to read the answer received a little below in the MODEL tab:

There is a large table with a description of all possible commands, as well as an example of a response in the tab EXAMPLE.

You should explore these two tabs for a deeper understanding and quality data analytics.

So, for example, having familiarized yourself with the commands, you can find the description of the NTF token right in the response code, as well as find a link to the image of this NTF:

"Adorning both glimmer and self-confidence, the Unidragon is stalwart and courageous. None stands above such a character except for the Bitcoin Unidragon."
https://assets.polkamon.com/images/Unimons_T11C03H01B01G00.jpg

Thus, using the covalent API, you can start exploring the blockchain in a variety of ways, getting a huge amount of data. Everything will depend only on your abilities and imagination!

--

--