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 NFT Traits by Collection

GEThttps://deep-index.moralis.io/api/v2.2/nft/:address/traits

Get NFT traits for a given collection

PATH PARAMS
addressstringrequired
The address of the NFT contract
QUERY PARAMS
chainstring
The chain to query
Responses
API KEY
import Moralis from 'moralis';

try {
await Moralis.start({
apiKey: "YOUR_API_KEY"
});

const response = await Moralis.EvmApi.nft.getNFTTraitsByCollection({
"chain": "0x1",
"address": "0x524cab2ec69124574082676e6f654a18df49a048"
});

console.log(response.raw);
} catch (e) {
console.error(e);
}
Response Example
{
"trait_type": "Background",
"values": [
{
"trait_value": "Lavendar",
"count": 18593,
"percentage": 85.8,
"rarity_label": "Top 4% trait"
}
]
}