Get Assets by Group
Get a list of assets by a group key and value.
Last updated
Was this helpful?
Get a list of assets by a group key and value.
Last updated
Was this helpful?
This will return the asset information for a specific group provided (i.e. Collection). This can return compressed or standard NFTs. You can use this endpoint to fetch mint lists for an NFT collection
The page
parameter in the request starts at 1
NFT Collection Page
NFT Mintlist
Token Gated dApps
const url = "https://mainnet.helius-rpc.com/?api-key=<api-key>"
const getAssetsByGroup = async () => {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 'my-id',
method: 'getAssetsByGroup',
params: {
groupKey: 'collection',
groupValue: 'J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w',
page: 1, // Starts at 1
limit: 1000,
},
}),
});
const { result } = await response.json();
console.log("Assets by Group: ", result.items);
};
getAssetsByGroup();
const url = "https://mainnet.helius-rpc.com/?api-key=<api-key>"
const getAssetsByGroup = async () => {
console.time("getAssetsByGroup"); // Start the timer
let page = 1;
let assetList = [];
while (page) {
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: "my-id",
method: "getAssetsByGroup",
params: {
groupKey: "collection",
groupValue: "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w",
page: page,
limit: 1000,
},
}),
});
const { result } = await response.json();
assetList.push(...result.items);
if (result.total !== 1000) {
page = false;
} else {
page++;
}
}
const resultData = {
totalResults: assetList.length,
results: assetList,
};
console.log("Mad Lads Assets: ", resultData);
};
getAssetsByGroup();
The version of the JSON-RPC protocol.
An ID to identify the request.
The name of the DAS method to invoke.
POST / HTTP/1.1
Host: mainnet.helius-rpc.com
Content-Type: application/json
Accept: */*
Content-Length: 380
{
"jsonrpc": "2.0",
"id": "text",
"method": "getAssetsByGroup",
"params": {
"groupKey": "collection",
"groupValue": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w",
"page": 1,
"limit": 100,
"sortBy": {
"sortBy": "created",
"sortDirection": "asc"
},
"before": "string",
"after": "string",
"options": {
"showUnverifiedCollections": true,
"showCollectionMetadata": true,
"showGrandTotal": true,
"showInscription": true
}
}
}
{
"jsonrpc": "2.0",
"result": {
"total": 1,
"limit": 1,
"page": 1,
"items": [
{
"interface": "ProgrammableNFT",
"id": "JEGruwYE13mhX2wi2MGrPmeLiVyZtbBptmVy9vG3pXRC",
"authorities": [
{
"address": "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW",
"scopes": [
"full"
]
}
],
"compression": {
"eligible": false,
"compressed": false,
"data_hash": "",
"creator_hash": "",
"asset_hash": "",
"tree": "",
"seq": 0,
"leaf_id": 0
},
"grouping": [
{
"group_key": "collection",
"group_value": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w"
}
],
"royalty": {
"royalty_model": "creators",
"target": null,
"percent": 0.042,
"basis_points": 420,
"primary_sale_happened": true,
"locked": false
},
"creators": [
{
"address": "5XvhfmRjwXkGp3jHGmaKpqeerNYjkuZZBYLVQYdeVcRv",
"share": 0,
"verified": true
}
],
"ownership": {
"frozen": true,
"delegated": false,
"delegate": null,
"ownership_model": "single",
"owner": "3F21SJs4FMpsakrxmd8GjgfQZG6BN6MVsvXcm5Yc6Jcf"
},
"supply": {
"print_max_supply": 0,
"print_current_supply": 0,
"edition_nonce": 254
},
"mutable": true,
"burnt": false
}
]
}
}