Tokens
The tokens
query retrieves a paginated list of NFT/token assets with flexible filtering and sorting. This is the primary method for fetching multiple tokens from collections or across the entire index.
Arguments
Pagination Controls
Argument | Type | Default | Description |
---|---|---|---|
first | Int | 10 | Number of tokens to return. |
skip | Int | 0 | Legacy pagination offset. |
after | String | - | Cursor for next page. |
Core Filters
Argument | Type | Description |
---|---|---|
where | TokenFilter | Filter by metadataStatus , burned , name_like , etc. |
whereContract | ContractFilter | Filter by contract properties id , name , type , etc. |
Sorting Options
Argument | Type | Options |
---|---|---|
orderBy | TokenOrderBy | CONTRACT , COLLECTION_HOLDERS , TOKEN_ID , NAME , CREATED_AT , CREATED_BLOCK |
orderDirection | OrderDirection | ASC , DESC |
Example
Fetch First 10 Collection Tokens
query Tokens($first: Int, $whereContract: ContractFilter, $orderBy: TokenOrderBy) {
tokens(first: $first, whereContract: $whereContract, orderBy: $orderBy) {
tokens {
tokenID
image {
url
}
name
}
}
}
Variables
{
"first": "10",
"whereContract": {
"id": "0x49cF6f5d44E70224e2E23fDcdd2C053F30aDA28B"
},
"orderBy": "TOKEN_ID"
}
Response
This response is an example only and may not reflect current data.
{
"data": {
"tokens": {
"tokens": [
{
"tokenID": "1",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/1.png"
},
"name": "CloneX #1"
},
{
"tokenID": "2",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/2.png"
},
"name": "CloneX #2"
},
{
"tokenID": "3",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/3.png"
},
"name": "CloneX #3"
},
{
"tokenID": "4",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/4.png"
},
"name": "CloneX #4"
},
{
"tokenID": "5",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/5.png"
},
"name": "CloneX #5"
},
{
"tokenID": "6",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/6.png"
},
"name": "CloneX #6"
},
{
"tokenID": "7",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/7.png"
},
"name": "CloneX #7"
},
{
"tokenID": "8",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/8.png"
},
"name": "CloneX #8301"
},
{
"tokenID": "9",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/9.png"
},
"name": "CloneX #1174"
},
{
"tokenID": "10",
"image": {
"url": "https://clonex-assets.rtfkt.com/images/10.png"
},
"name": "CloneX #19995"
}
]
}
}
}
Response Fields
The query returns a Tokens!
object containing:
tokens
: Array ofToken
objects.tokenID
: Unique identifier for each token in the array.image
/url
: URL for NFT media parsed from tokenURI for each token in the array.name
: Name of NFT for each token in the array.
Common Use Cases
- Collection Browsing: Display tokens from a specific contract.
- Marketplace Listings: Show filtered tokens for sale.
- Data Analysis: Study token distributions/metadata.
- Wallet Integration: Load all tokens owned by an address.
Best Practices
- Always include
first
to limit response size. - Use
where
filters before sorting for better performance. - Request
count
only when needed for UI pagination. - Combine with
contract
query for collection context.
Related Queries
token
: For single token lookups.contract
: To verify collection details.