nft
API Context
Endpoint: https://api.onesource.io/federation/{chain}/graphql
Auth Header: x-bp-token: BP-{YOUR_API_KEY}
Method: POST | Content-Type: application/json
Look up a specific NFT by its contract address and token ID.
Returns null if the NFT doesn't exist or hasn't been minted.
Schema Definition
nft(
contract: AddressString!
tokenId: TokenId!
): NFT
Arguments
| Argument | Type | Description |
|---|---|---|
contract | The NFT contract address (0x-prefixed, 42 characters). | |
tokenId | The token ID within the contract (as a string to support uint256 values). |
Return Type
| Type | Description |
|---|---|
NFT interface | Base interface for non-fungible tokens (NFTs). Implemented by SingleHolderNFT (ERC-721) and MultiHolderNFT (ERC-1155). Contains fields common to all NFT types regardless of ownership model. |
Common Use Cases
- Build NFT detail pages by looking up a specific token with its full metadata, media, and ownership information.
- Verify NFT ownership and authenticity for marketplace listings, gating, or wallet displays.
- Display NFT artwork and media with optimized thumbnails at various preset sizes for galleries and collection viewers.
- Check whether an NFT has been burned by inspecting the
burnedfield andburnTransaction. - Retrieve mint provenance by accessing the
mintTransactionfield for historical analysis or verification. - Differentiate between ERC-721 and ERC-1155 NFTs using inline fragments to access standard-specific fields like
holderorholdersCount.
Example
Query
Look Up an ERC-721 NFT with Metadata and Media
query GetNFTDetails($contract: AddressString!, $tokenId: TokenId!) {
nft(contract: $contract, tokenId: $tokenId) {
tokenId
name
standard
contract {
address
name
symbol
standards
}
metadata {
description
image
attributes {
traitType
value
}
}
media {
url
contentType
thumbnails(preset: MEDIUM) {
url
width
height
}
}
... on SingleHolderNFT {
holder {
address
}
burned
mintTransaction {
hash
timestamp
}
}
... on MultiHolderNFT {
totalSupply
holdersCount
holders(first: 5) {
entries {
address {
address
}
balance
}
}
}
}
}
Variables
{
"contract": "0xC9041f80DCe73721A5f6a779672Ec57EF255d27c",
"tokenId": "42141102"
}
Response
{
"data": {
"nft": {
"tokenId": "42141102",
"name": "Singular Focus",
"standard": "ERC721",
"contract": {
"address": "0xC9041f80DCe73721A5f6a779672Ec57EF255d27c",
"name": "Art Blocks",
"symbol": "BLOCKS",
"standards": ["ERC721"]
},
"metadata": {
"description": "The Partition is formed by a set of recursive subdivisions of the canvas...",
"image": "ipfs://QmExample123abc456def789ghi",
"attributes": [
{
"traitType": "Artist",
"value": "Example Artist"
},
{
"traitType": "Collection",
"value": "Curated"
}
]
},
"media": [
{
"url": "https://media.onesource.io/nft/1/42141102.png",
"contentType": "image/png",
"thumbnails": [
{
"url": "https://media.onesource.io/thumbnails/medium/1/42141102.png",
"width": 300,
"height": 300
}
]
}
],
"holder": {
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2"
},
"burned": false,
"mintTransaction": {
"hash": "0x9f8e7d6c5b4a3210fedcba9876543210fedcba9876543210fedcba9876543210",
"timestamp": "2025-03-20T16:45:22Z"
}
}
}
}
Implementation Notes
note
- Both
contractandtokenIdarguments are required to uniquely identify an NFT. ThetokenIdis a string to support the fulluint256range. - The
nftquery returnsnullif the NFT doesn't exist or hasn't been minted. Always handle the null case in your application. - The return type is the
NFTinterface, which resolves to eitherSingleHolderNFT(ERC-721) orMultiHolderNFT(ERC-1155). Use inline fragments (... on SingleHolderNFT,... on MultiHolderNFT) to access type-specific fields. - For ERC-721 NFTs, the
holderfield returns the single current owner. For ERC-1155 NFTs, useholdersCountand the paginatedholdersfield to access multiple owners and their balances. - The
metadatafield contains parsed token metadata includingdescription,image, andattributes. This data is fetched and cached from the token URI — it may benullif the metadata hasn't been fetched yet or the URI is unreachable. - The
mediaarray contains processed media files with pre-generatedthumbnailsat various presets (SMALL,MEDIUM,LARGE,ORIGINAL). Use thumbnails for performant rendering in galleries and lists. - To search and filter across multiple NFTs, use the
nftsquery with pagination and filtering support.