Introduction
In this tutorial, you’ll learn how to retrieve ownership data for NFT collections using the Moralis API. This includes getting all unique owners of a collection, finding who owns a specific token, and analyzing ownership distribution. This is essential for building collection analytics, whale tracking, or ownership verification tools. We’ll use the following Moralis API endpoint:- Get NFT Owners - Fetch ownership data for NFT collections and individual tokens
Prerequisites
- Node.js v18+ installed
- A Moralis API key (get one free)
Step 1: Set Up Your Project
Create a new directory for your project and initialize it:Step 2: Create the Script
Create a file calledindex.js and add the following code:
YOUR_API_KEY with your actual Moralis API key.
Step 3: Run the Script
Execute the script to fetch the owners:Example Response
Understanding the Response
| Field | Description |
|---|---|
token_id | The unique token ID |
owner_of | Current owner’s wallet address |
amount | Quantity owned (1 for ERC721) |
block_number_minted | Block when the NFT was minted |
contract_type | Token standard (ERC721 or ERC1155) |
Next Steps
- Get NFT Metadata - Get detailed NFT metadata
- Get NFT Floor Prices - Fetch collection floor prices
- NFT Metadata - explore detailed metadata
- NFT Media Images (CDN) - learn how we store NFT images

