How to get NFT transactions via Covalent API
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 NFT Transactions.
Get NFT Transactions real-time
GET /v1/{chain_id}/tokens/{address}/nft_transactions/{token_id}/
Returns a list of transactions given a NFT contract and a token ID on a blockchain network.
PATH PARAMETERS
- 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, and250
for Fantom Opera Mainnet. - address — in this field you need to enter the smart contract address.
- token_id — in this field you need to enter the token id number.
QUERY-STRING PARAMETERS
- page-number — in this field you need to enter the specific page to be returned.
- page-size — in this field you need to enter the number of results per page.
- 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 Sandbox’s LAND token. So I filled in the fields with the following data:
chain_id — 1
address — 0x50f5474724e0ee42d9a4e711ccfb275809fd6d4a
token_id — 21685
page-number — 1
page-size — 10
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.
Thanks to this section of the Covalent API, we can get all the data on transactions involving the selected NTF token: when was block signed at; from which address to which address was the transaction; all information about gas fees and more other very useful information.
Blockchain research can become much easier thanks to the Covalent API, and you can process the large amounts of data that the Covalent API retrieves from the blockchain much more efficiently, but how exactly you use it depends only on your skills and imagination!