getMintedNfts - SDK

The getMintedNfts method gets all the NFTs minted by a specified owner address.

Don’t have an API key?

Start using this method in your app today.

Description

The getMintedNfts method gets all the NFTs minted by a specified owner address.

Parameters

NameTypeDescription          Example
ownerstringAddress for the NFT owner (can be in ENS format)."vitalik.eth" or "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
optionsObjectAn optional object with the following properties:

1. contractAddresses: An array of NFT contract addresses to filter mints by. If omitted, defaults to all contract addresses.

2. tokenType: ENUM option to filter mints by ERC721 vs ERC1155 contracts. If omitted, defaults to all NFTs.

3. pageKey: Optional page key from an existing response to use for pagination.
{ contractAddresses: ["0x1F02bF9dDe7C79137a08B2Dd4FC964BfD2499734"], tokenType: "ERC721" }

Response

The getMintedNfts method returns a Promise<TransfersNftResponse> object that contains the NFT mints by the specified owner address.

TransfersNftResponse object properties

The returned object has the following fields:

PropertyTypeDescription
nftsarray of objectsAn array of the transfer objects. Each transfer object contains information about the transferred NFT.
pageKey?stringOptional page key to use to fetch the next group of NFTs. undefined if all the transfers are already included in the response.

nfts properties

Each mint object has the following fields:

PropertyTypeDescription
contractobjectThe NFT's underlying contract and relevant contract metadata.

Parameters in the contract include:

1. address: string The address of the NFT contract.
2. tokenType: object The type of the token in the contract
3. name: string The name of the contract.
4. symbol: string The symbol of the contract.
5. totalSupply?: string The number of NFTs in the contract as an integer string. This field is only available on ERC-721 contracts.
6. openSeaMetadata: object OpenSea's metadata for the contract.
7. contractDeployer?: string The address that deployed the NFT contract.
8. deployedBlockNumber?: numberThe block number the NFT contract deployed in.
9. isSpam: boolean Whether the NFT contract is marked as spam.
10. spamClassifications: array Potential reasons why an NFT Contract was classified as spam.
tokenIdstringThe unique identifier of the token. This could be in hexadecimal or decimal format.
tokenTypestringThe type of NFT, e.g.,ERC721, ERC1155, UNKNOWN
namestringThe NFT name.
descriptionstringThe NFT description.
timeLastUpdatedstringWhen the NFT was last updated in the blockchain. Represented in ISO-8601 format.
rawobjectThe raw metadata for the NFT based on the metadata URI on the NFT contract.

1. tokenUri?: string: The raw token URI on the NFT contract.
2. metadata: string: The raw metadata parsed from the raw token URI.
3. error?: string: Error message if the raw metadata could not be fetched.
tokenUristringURIs for accessing the NFT's metadata blob.
imageobjectMedia URLs and information for the NFT. Parameters in this object include:

1. cachedUrl: string: URL of the image stored in Alchemy's cache.
2. thumbnailUrl: string: URL of a thumbnail-sized image.
3. pngUrl: string: URL of the image in png format.
4. contentType: string: The type of the media image.
acquiredAtobjectTime at which the user most recently acquired the NFT. Only available when specifying orderBy: NftOrdering.TRANSFERTIME in the request.

1. blockTimestamp?: string: Timestamp of the block at which an NFT was last acquired.
2. blockNumber?: number: Block number of the block at which an NFT was last acquired.
collectionobjectCollection metadata for the NFT, if available. Parameters include:

1. name: string: The name of the collection.
2. slug?: string: The OpenSea human-readable slug of the collection.
3. externalUrl?: string: The external URL for the collection.
4. bannerImageUrl?: string: The banner image URL for the collection.
mintobjectMint information for the NFT. Parameters include:

1. mintAddress?: string: The address that the NFT was minted to.
2. blockNumber?: number: The block number that the NFT was minted on.
3. timestamp?: string: The timestamp the NFT was minted on.
4. transactionHash?: string: The transaction hash of the transaction that minted the NFT.
fromstringThe address the NFT was sent from. For minted NFTs, this field is set to 0x0000000000000000000000000000000000000000.
tostringThe address the NFT was sent or minted to.
transactionHashstringThe transaction hash where the transfer or mint occurred.
blockNumberstringThe block number as a hex string of when the transfer or mint occurred.

Example Request and Response

Prerequisite: You will need to install the Alchemy SDK before making requests with it.

The commands for installing it using npm or yarn are given below:

npm install alchemy-sdk@latest
yarn add alchemy-sdk@latest

Request

Here is an example of how to make a getMintedNfts request using the Alchemy SDK:

// Imports the Alchemy SDK
const { Alchemy, Network } = require("alchemy-sdk");

// Configures the Alchemy SDK
const config = {
  apiKey: "demo", // Replace with your API key
  network: Network.ETH_MAINNET, // Replace with your network
};

// Creates an Alchemy object instance with the config to use for making requests
const alchemy = new Alchemy(config);

// Example of using the new getMintedNfts method
const main = async () => {
  // Address for the NFT owner (can be in ENS format).
  let address = "vitalik.eth";

  // Additional options for the request. (Optional)
  let options = {
    /**
     * List of NFT contract addresses to filter mints by. If omitted, defaults to
     * all contract addresses.
     */
    contractAddresses: ["0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"],
    /**
     * Filter mints by ERC721 vs ERC1155 contracts. If omitted, defaults to all
     * NFTs.
     */
    tokenType: "ERC721",
  };

  // Calling the getMintedNfts method
  let mintedNfts = await alchemy.nft.getMintedNfts(address, options);

  // Logging the response to the console
  console.log(mintedNfts);
};

main();

Response

And here is an example of what a successful response to this request might look like:

{
    "nfts": [
        {
            "contract": {
                "address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",
                "tokenType": "ERC721",
                "contractDeployer": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8",
                "deployedBlockNumber": 9380410,
                "openSeaMetadata": {
                    "floorPrice": 0.001,
                    "collectionName": "ENS: Ethereum Name Service",
                    "collectionSlug": "ens",
                    "safelistRequestStatus": "verified",
                    "imageUrl": "https://i.seadn.io/gae/0cOqWoYA7xL9CkUjGlxsjreSYBdrUBE0c6EO1COG4XE8UeP-Z30ckqUNiL872zHQHQU5MUNMNhfDpyXIP17hRSC5HQ?w=500&auto=format",
                    "description": "Ethereum Name Service (ENS) domains are secure domain names for the decentralized world. ENS domains provide a way for users to map human readable names to blockchain and non-blockchain resources, like Ethereum addresses, IPFS hashes, or website URLs. ENS domains can be bought and sold on secondary markets.",
                    "externalUrl": "https://ens.domains",
                    "twitterUsername": "ensdomains",
                    "lastIngestedAt": "2023-09-18T10:20:40.000Z"
                },
                "spamClassifications": []
            },
            "tokenId": "111352653673047713804124050598355152059184664886497242203777472800304891334469",
            "tokenType": "ERC721",
            "tokenUri": "https://metadata.ens.domains/mainnet/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/0xf62f5e56fe8da20b0f4596383d464ebbaf1968de230cfb3dd53fc91800228f45",
            "image": {},
            "raw": {
                "tokenUri": "https://metadata.ens.domains/mainnet/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/0xf62f5e56fe8da20b0f4596383d464ebbaf1968de230cfb3dd53fc91800228f45",
                "metadata": {},
                "error": "Centralized gateway timed out, try again with a higher tokenUri timeout"
            },
            "collection": {
                "name": "ENS: Ethereum Name Service",
                "slug": "ens",
                "externalUrl": "https://ens.domains"
            },
            "mint": {},
            "timeLastUpdated": "2023-09-21T14:06:39.073Z",
            "from": "0x0000000000000000000000000000000000000000",
            "to": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
            "transactionHash": "0xc5bc4cf983e98ad9708dee356a17196aa367228f9ec87f81e622c81adaa6211e",
            "blockNumber": "0xe88086"
        },
        {
            "contract": {
                "address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",
                "tokenType": "ERC721",
                "contractDeployer": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8",
                "deployedBlockNumber": 9380410,
                "openSeaMetadata": {
                    "floorPrice": 0.001,
                    "collectionName": "ENS: Ethereum Name Service",
                    "collectionSlug": "ens",
                    "safelistRequestStatus": "verified",
                    "imageUrl": "https://i.seadn.io/gae/0cOqWoYA7xL9CkUjGlxsjreSYBdrUBE0c6EO1COG4XE8UeP-Z30ckqUNiL872zHQHQU5MUNMNhfDpyXIP17hRSC5HQ?w=500&auto=format",
                    "description": "Ethereum Name Service (ENS) domains are secure domain names for the decentralized world. ENS domains provide a way for users to map human readable names to blockchain and non-blockchain resources, like Ethereum addresses, IPFS hashes, or website URLs. ENS domains can be bought and sold on secondary markets.",
                    "externalUrl": "https://ens.domains",
                    "twitterUsername": "ensdomains",
                    "lastIngestedAt": "2023-09-18T10:20:40.000Z"
                },
                "spamClassifications": []
            },
            "tokenId": "103040680624633360426956226800459505851045291463662393946817594920946384752224",
            "tokenType": "ERC721",
            "tokenUri": "https://metadata.ens.domains/mainnet/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/0xe3cef55f7067b9353a1b591cd3ea3af56e998792eb10d19a1b96f0a09917ce60",
            "image": {},
            "raw": {
                "tokenUri": "https://metadata.ens.domains/mainnet/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/0xe3cef55f7067b9353a1b591cd3ea3af56e998792eb10d19a1b96f0a09917ce60",
                "metadata": {},
                "error": "Centralized gateway timed out, try again with a higher tokenUri timeout"
            },
            "collection": {
                "name": "ENS: Ethereum Name Service",
                "slug": "ens",
                "externalUrl": "https://ens.domains"
            },
            "mint": {},
            "timeLastUpdated": "2023-09-21T14:06:39.076Z",
            "from": "0x0000000000000000000000000000000000000000",
            "to": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
            "transactionHash": "0x9f21fad5549aaf94e7731f5c4649353926cf7520b96891b8b511d099020fb887",
            "blockNumber": "0xf47bcd"
        },
        {
            "contract": {
                "address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",
                "tokenType": "ERC721",
                "contractDeployer": "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8",
                "deployedBlockNumber": 9380410,
                "openSeaMetadata": {
                    "floorPrice": 0.001,
                    "collectionName": "ENS: Ethereum Name Service",
                    "collectionSlug": "ens",
                    "safelistRequestStatus": "verified",
                    "imageUrl": "https://i.seadn.io/gae/0cOqWoYA7xL9CkUjGlxsjreSYBdrUBE0c6EO1COG4XE8UeP-Z30ckqUNiL872zHQHQU5MUNMNhfDpyXIP17hRSC5HQ?w=500&auto=format",
                    "description": "Ethereum Name Service (ENS) domains are secure domain names for the decentralized world. ENS domains provide a way for users to map human readable names to blockchain and non-blockchain resources, like Ethereum addresses, IPFS hashes, or website URLs. ENS domains can be bought and sold on secondary markets.",
                    "externalUrl": "https://ens.domains",
                    "twitterUsername": "ensdomains",
                    "lastIngestedAt": "2023-09-18T10:20:40.000Z"
                },
                "spamClassifications": []
            },
            "tokenId": "79362104341617195787435013155216554898816343870453146709166302825328240112628",
            "tokenType": "ERC721",
            "tokenUri": "https://metadata.ens.domains/mainnet/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/0xaf755bf78de2496dbb4f4c665d1437ed11cd5c8835e8e32b16f3bf500cb633f4",
            "image": {},
            "raw": {
                "tokenUri": "https://metadata.ens.domains/mainnet/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85/0xaf755bf78de2496dbb4f4c665d1437ed11cd5c8835e8e32b16f3bf500cb633f4",
                "metadata": {},
                "error": "Token uri responded with a non 200 response code"
            },
            "collection": {
                "name": "ENS: Ethereum Name Service",
                "slug": "ens",
                "externalUrl": "https://ens.domains"
            },
            "mint": {},
            "timeLastUpdated": "2023-09-21T14:06:38.973Z",
            "from": "0x0000000000000000000000000000000000000000",
            "to": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
            "transactionHash": "0xe3c78eca914f215644922e15d080b4198d552885a64958f4bec6516ace149b43",
            "blockNumber": "0xf47bcd"
        }
    ]
}

Code Sandbox

You can test the getMintedNfts method using the code sandbox below:

Use Cases

Some of the use cases for getMintedNfts are:

  • NFT Collector Portfolio: NFT collectors could use the API to retrieve information about all NFTs they have minted and display them as part of their online portfolio.

  • NFT Market Analysis: An NFT market analysis platform could use the API to gather data on NFTs minted by a specific creator and analyze their popularity and market demand.

  • NFT Creator Monitoring: NFT contract owners or administrators could use the API to monitor the NFTs minted by a specific creator and ensure that they comply with the rules and regulations set by the NFT contract.

  • NFT Creator Stats: An NFT creator could use the API to retrieve information about all their NFTs minted and view statistics such as the total number of NFTs minted.

  • NFT Creator Tracking: Investors or fans of a specific NFT creator could use the API to track their NFT creation activity and stay updated on their latest NFT releases.

Related Methods

Here are the methods related to getMintedNfts:

ReadMe