Skip to main content

qn_fetchNFTsByCollection (v2) RPC Method

Returns aggregated data on NFTs within a given collection.

Updated on
Nov 2, 2023

qn_fetchNFTsByCollection (v2) RPC Method

Please note that this RPC method requires the Token and NFT API v2 bundle add-on enabled on your QuickNode endpoint.

Parameters

array
array
An array with the first element being:
object
A custom object with the following fields:
collection
string
The contract address of the NFT Collection
tokens
string
An array of strings that optionally limit the results to specific tokens within a collection. You may submit up to 20 token IDs in this parameter. If you do not want to limit results to specific tokens, please omit this parameter from your request
page
integer
The page number you would like returned. Page numbers start at 1 and end at totalPages. If omitted, defaults to the first page (page 1). If the page number requested is higher than totalPages, an empty assets array will be returned. If the page number requested is less than 1, an invalid params response will be returned
perPage
integer
The maximum amount of NFT tokens to return on each page. You can request up to 100 items per page. If omitted, defaults to 40 items per page
omitFields
array
Optionally omit specific properties of objects from the assets array of the response. Any property of the asset object can be omitted. If omitFields is not included in the request, response will return all available fields by default

Returns

object
The custom response object, or null if no NFTs are found:
collection
The contract address we checked for NFTs
tokens
An array of objects representing NFTs with the following shape:
collectionName
The name of this NFT's collection
collectionAddress
The contract address that this NFT lives in
chain
It states on which chain this aggregation happened on
network
It states on which network this aggregation happened on
collectionTokenId
The token id of this NFT in its collection
name
The name of this specific NFT
description
The description of this specific NFT
traits
The traits refer to the different attributes of NFTs
value
The specific value associated with each trait of the NFT which can be present in the form of text, numbers, or even images, depending on the type of NFT
trait_type
The type of trait associated with each NFT. It includes attributes like the color, rarity, or any other defining characteristic that sets the NFT apart from others in its collection
imageUrl
The URL where the image for this NFT can be seen
totalPages
The total number of results pages available
pageNumber
The page number of results that were returned with this response
totalItems
The total number of results
Request
1
curl https://docs-demo.quiknode.pro/ \
2
-X POST \
3
-H "Content-Type: application/json" \
4
--data '{
5
"id":67,
6
"jsonrpc":"2.0",
7
"method":"qn_fetchNFTsByCollection",
8
"params": [{
9
"collection": "0x60E4d786628Fea6478F785A6d7e704777c86a7c6",
10
"omitFields": [
11
"imageUrl",
12
"traits"
13
],
14
"page": 1,
15
"perPage": 10
16
}]
17
}'
18
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free