Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.2

Get NFTs by Traits

POSThttps://deep-index.moralis.io/api/v2.2/nft/:address/nfts-by-traits

Get NFTs by traits for a given contract.

PATH PARAMS
addressstringrequired
The address of the NFT contract
QUERY PARAMS
chainstring
The chain to query
formatstring
The format of the token ID
limitnumber
The desired page size of the result.
cursorstring
The cursor returned in the previous response (used for getting the next page).
normalizeMetadataboolean
The option to enable metadata normalization. Learn more about metadata normalization here.
media_itemsboolean
Should preview media data be returned? Learn more about media items here.
BODY PARAM
jsonrequired
traits
Responses
API KEY
// Dependencies to install:
// $ npm install node-fetch --save
// add "type": "module" to package.json

import fetch from 'node-fetch';

const options = {
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
"traits": {
"body": "astronaut",
"skin": "purple"
}
})
};

fetch('https://deep-index.moralis.io/api/v2.2/nft/0x524cab2ec69124574082676e6f654a18df49a048/nfts-by-traits?chain=eth&format=decimal&media_items=false', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Response Example
{
"page": "2",
"page_size": "100",
"cursor": "",
"result": {
"token_address": "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB",
"token_id": "15",
"owner_of": "0x9c83ff0f1c8924da96cb2fcb7e093f78eb2e316b",
"token_hash": "502cee781b0fb40ea02508b21d319ced",
"block_number": "88256",
"block_number_minted": "88256",
"contract_type": "ERC721",
"token_uri": "",
"metadata": "",
"normalized_metadata": "",
"media": "",
"minter_address": "0x9c83ff0f1c8924da96cb2fcb7e093f78eb2e316b",
"last_token_uri_sync": "",
"last_metadata_sync": "",
"amount": "1",
"name": "CryptoKitties",
"symbol": "RARI",
"possible_spam": "false",
"verified_collection": "false",
"rarity_rank": 21669,
"rarity_label": "Top 98%",
"rarity_percentage": 98,
"last_sale": {
"transaction_hash": "string",
"block_timestamp": "string",
"buyer_address": "string",
"seller_address": "string",
"price": "string",
"price_formatted": "string",
"usd_price_at_sale": "string",
"current_usd_value": "string",
"token_id": "string",
"payment_token": {
"token_name": "string",
"token_symbol": "string",
"token_logo": "string",
"token_decimals": "string",
"token_address": "string"
}
}
}
}