NFTScan NFT API Application in NFTFi Development
Tags: web3, nft, api, developer
Published: 2023-09-08 09:13:50

NFTFi is an abbreviation for "NFT" and "Finance," with the aim of "increasing NFT liquidity and providing cash flow." NFTFi is an emerging ecosystem that focuses on decentralized protocols and applications designed to enhance the financial utility of NFTs. It utilizes NFTs as the foundational layer to build economic infrastructure.

In practice, the NFTFi protocol offers DeFi capabilities for NFTs, including the ability to unlock leasing, lending, and fractionalizing NFTs. It also facilitates the creation of derivatives and prediction markets based on them. This transformation equips NFTs, originally lacking in liquidity, with financial attributes, thereby shaping them into new financial instruments and asset allocation forms. This expansion opens up greater possibilities for the applications of NFTs.

In decentralized financial platforms based on NFTs, obtaining comprehensive and reliable NFT data is crucial for implementing various operations such as asset valuation, risk management, and interest calculations.

NFTScan  NFTFi：https://www.nftscan.com/nftfi

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g91uy1jcwphhli2piu3h.png)

It can be said that comprehensive and real-time NFT data support is a vital guarantee for the smooth operation of decentralized financial platforms like NFTFi. Obtaining cross-chain heterogeneous NFT data poses a significant challenge for development teams of platforms like NFTFi. They need to address various issues such as data fragmentation, lack of standardized formats, and real-time updates. Automated and efficient data services can lower the entry barriers and are currently in high demand for development teams.

As a pioneer in NFT data services, NFTScan provides professional and reliable solutions to various platforms. Its extensive APIs and cross-chain support undoubtedly contribute to the thriving development of the entire NFT financial ecosystem. NFTScan has built an NFT index database covering 17 major public blockchains. Developers can easily access standardized and visualized NFT data by simply calling NFTScan's NFT API. The powerful SDK facilitates developers in integrating NFT data services quickly and conveniently, eliminating the need for them to independently obtain and convert heterogeneous assets.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cmsdoyowiizvh85nvofx.png)

**How to Access the NFTScan NFT API**

**Create a NFTScan Developer Account**

Before using the NFTScan API, you need to visit the developer website and create an account. Go to the NFTScan official website and click the “Sign Up” button for NFTScan API registration.

NFTScan Developer: https://developer.nftscan.com/user/signup

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzfa5xj5hphmbqe42gb9.png)
Sign Up (NFTScan Developer Platform)

After logging in, find your unique API KEY on the Dashboard and copy it. Visit the API documentation and input your API KEY as guided. You can then start using the API service. In the API documentation, developers can find various interface modes to choose from based on their needs.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rwim3dfvfpdh9vbaxuus.png)
Dashboard (NFTScan Developer Platform)

In the Dashboard, developers can also view statistics on their API usage, helping to track historical usage data. Moreover, NFTScan provides each registered developer with 1M CU (Call Units) of API calls, allowing access to all NFT API interfaces, and CU never expires.

**View the NFT API Documentation**

After successfully registering as a developer and obtaining your API Key, you need to review the NFTScan API documentation. The API documentation includes all available API endpoints and parameters, along with detailed instructions on how to build requests and handle responses. Carefully read the API documentation and ensure you understand how to use the API to retrieve the data you need.

NFTScan API Documentation: https://docs.nftscan.com

NFTScan API services aim to enhance developers’ experience in obtaining NFT data analysis. NFTScan currently boasts the largest and most comprehensive NFT Collection library, supporting full NFT data for Ethereum, Solana, BNBChain, Bitcoin, Polygon, zkSync, Aptos, Linea, Base、Avalanche, Arbitrum, Optimism, Fantom, Moonbeam, PlatON, Cronos, and Gnosis on 17 blockchains.

The covered NFT data is diverse, providing a complete set of interfaces for accessing ERC721 and ERC1155 assets, transactions, projects, market statistics, and more. It supports over 50 public interfaces for EVM-compatible chains and a set of similar interfaces for Solana, Aptos, and Bitcoin, satisfying developers’ needs to index various types of NFT data.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/egtkskhw2u8ap6dgjrge.png)
NFTScan API Doc

**NFTScan NFT API Building Guide for NFTFi Platform**

Building an NFTFi platform requires more than just basic NFT data retrieval; it also demands real-time data to provide an enhanced user experience and decision support. Key aspects include:

- **Real-time Market Price Data**: Providing real-time market price data for NFT assets that users can track, allowing them to understand the value and fluctuations of their assets.
- **Estimation of NFT Loanable Value**: Using real-time data and algorithms to estimate the loanable value of NFT assets, helping users understand the loan amounts they can access.
- **NFT Market Liquidity**: Offering real-time liquidity data for the NFT market to assist users in determining whether their NFT assets can be easily converted into loans or other digital assets.
- **NFT Market Trends and Analysis**: Providing real-time market trend analysis and charts to aid users in making data-driven decisions.
- **NFT Market News and Updates**: Supplying real-time news and updates related to the NFT market, helping users stay informed about market changes and events.
- **User Interaction Data**: Collecting real-time user interaction data with the platform to enhance user experiences and personalized services.

Therefore, obtaining high-quality and comprehensive NFT project data is the foundation and prerequisite for developing the NFTFi platform. Accessing comprehensive and standardized NFT data will significantly reduce development costs and ensure that the NFTFi platform has robust data support.

**What basic data can be obtained from the NFTScan NFT API?**

- **NFT Metadata**: This includes detailed information about NFTs such as their name, description, images, attributes, etc., which aids in the identification and verification of NFT assets.
- **NFT Holder Data**: Access to data regarding current and historical holders, including addresses and holding durations. This data can help assess asset liquidity and risk levels.
- **NFT Transaction Data**: Information about transactions, including timestamps, prices, transaction parties, etc. This data allows for the visualization of transaction history and tracking of asset movements across different chains, as well as access to historical sales and transfers data.
- **NFT Contract Data**: Access to technical details such as source code, compilation information, contract creators, etc. This information is crucial for compliance and security audits.
- **NFT Circulation Data**: Statistics on issuance, circulation, and locked assets, among others, to gauge market depth and activity of NFTs.
- **NFT Wallet Earnings Data**: Economic data related to participation in activities and earnings from asset holdings. This data is used in designing earning schemes.
- **Integrated Data**: One-stop access to data from different chains and platforms, simplifying the integration process.

**2/ Querying Relevant API Requests**

**1）Collection Top Holder:**
/v2/statistics/collection/holder/{contract_address}
This API primarily returns the distribution of top holders within an NFT Collection. It sorts holders within the specified collection by their holdings and provides a distribution description of the number of NFTs held and the duration of holdings. This information helps analyze the distribution of holders within a project, assess market concentration, and evaluate asset liquidity. You can refer to NFTScan Holders for reference:
https://www.nftscan.com/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d?module=Holders

After entering your API Key and clicking "Try it," the data returned includes 20 items in total. This data includes wallet addresses of top holders, their holdings' values, and the percentage of holdings they represent, among other distribution data.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03elfy2y9f22cq61vh5b.png)

**2) Collection Holding Period Distribution**

/v2/statistics/period/distribution/{contract_address}
This API returns data on the distribution of holding periods for NFTs, calculating the percentage of NFTs held within different time intervals. These holding period distribution data can be useful for observing and analyzing the market liquidity and holder structure of an NFT project. It helps assess the investment value and risk associated with a series of NFTs. Therefore, it is very helpful for NFTFi platform asset evaluation and model building. You can refer to NFTScan Holding Period Distribution for reference:
https://www.nftscan.com/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d?module=Holders

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4xvt5gdunldskc5bg83a.png)


**3) Get Transactions by Contract**

/v2/transactions/{contract_address}
This API allows you to retrieve all historical transaction information related to a specified NFT contract address. It provides comprehensive and reliable query access to contract transaction data, enabling you to obtain information such as the historical transaction prices and transaction flows of NFTs associated with that contract. Transaction details can reconstruct the entire circulation and transaction history of the NFT contract, providing a clear picture of the market activity and trading volume of the NFT project.

Clicking "Try it" returns data: You can see that for the contract address 0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d, the data returned includes detailed information for each transaction. This information comprises the block number where the transaction occurred, timestamp, transaction hash, sender address, recipient address, token ID, token quantity, transaction price, and more.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nguknlvta8n6ci2ozxan.png)

**4) Get All Multi-Chain NFTs by Account**

/v2/assets/chain/{account_address}
This API returns detailed data for multi-chain NFTs held by the specified account address. The data includes information about the NFT's blockchain, contract address, token ID, name, description, image, holding duration, special attributes, and more. NFTs are grouped based on contract addresses. This interface provides an overall view of the account's multi-chain NFT assets. Developers can use a single API call to retrieve complete details of NFTs on different chains held by the account, eliminating the need to query each chain and contract individually. Here, we are querying the multi-chain NFT data held by the account:
0xca1257ade6f4fa6c6834fdc42e030be6c0f5a813 (Whale Address).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cck0u7q13m9tpr0ps9nk.png)

**3/ Constructing Relevant NFT API Requests**

Developing NFT data services using NFTScan's API is highly convenient and efficient. NFTScan provides developers with comprehensive API documentation and parameter descriptions. Developers can choose the appropriate interface based on their business requirements, configure the necessary request parameters, and quickly call the API using code or tools to obtain rich and accurate NFT data. This eliminates the need for developers to manually extract and convert on-chain data. Compared to the complexities of handling on-chain data, NFTScan automates NFT data collection and standardization, significantly reducing the barrier to access usable NFT data. For example, here we make a request:
0xca1257ade6f4fa6c6834fdc42e030be6c0f5a813 for multi-chain NFT details using the endpoint /v2/assets/chain/{account_address}. Below is a simple Python example code:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wcruh6b8mkq5jpswcub.png)

In this example, we first define the API URL by incorporating the address as a path parameter. We then use the requests library to make a GET request to the API, retrieve the response, and finally check the status code. If the request is successful, we print the JSON data from the response. This example demonstrates how to request NFTScan API and obtain multi-chain NFT details for the specified address. Developers can further process and analyze the returned NFT data according to their specific needs.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kboyr8i2f8ex3xo2z1jw.png)

**About NFTScan**

NFTScan is the world’s largest NFT data infrastructure, including a professional NFT explorer and NFT developer platform, supporting the complete amount of NFT data for 17 blockchains including Ethereum, Solana, BNBChain, Arbitrum, Optimism, and other major blockchains, providing NFT API for developers on 16 blockchains.
Official Links:
NFTScan: https://nftscan.com/
Developer: https://developer.nftscan.com/
Twitter: https://twitter.com/nftscan_com
Discord: https://discord.gg/nftscan