Links

Search Assets

Search for assets by a variety of parameters.

Overview

This method will return assets based on the custom search criteria passed in. This can define compressed or standard NFTs.
This method is optimal for most custom use cases. Example: token gating.
The page parameter in the request starts at 1 .
post
https://rpc.helius.xyz
/?api-key=<api_key>
searchAssets

Examples

Searching Compressed Assets in Wallet
const url = `https://mainnet.helius-rpc.com/?api-key=<api_key>`
const searchAssets = async () => {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 'my-id',
method: 'searchAssets',
params: {
ownerAddress: '2k5AXX4guW9XwRQ1AKCpAuUqgWDpQpwFfpVFh3hnm2Ha',
compressed: true,
page: 1, // Starts at 1
limit: 1000
},
}),
});
const { result } = await response.json();
console.log("Search Assets: ", result);
};
searchAssets();
Drip Haus Collection Assets in Wallet
const url = `https://mainnet.helius-rpc.com/?api-key=<api_key>`
const searchAssets = async () => {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 'my-id',
method: 'searchAssets',
params: {
ownerAddress: '2k5AXX4guW9XwRQ1AKCpAuUqgWDpQpwFfpVFh3hnm2Ha',
compressed: true,
grouping: ["collection", "DRiP2Pn2K6fuMLKQmt5rZWyHiUZ6WK3GChEySUpHSS4x"],
page: 1, // Starts at 1
limit: 1000
},
}),
});
const { result } = await response.json();
console.log("Drip Haus Assets: ", result);
};
searchAssets();