Retrieve NFT Details Using the NFT API

ยท

This guide explains how to use the NFT API to retrieve comprehensive details about a specific NFT, including its metadata, collection information, contract details, and attributes.

Request Address

To fetch NFT details, send a GET request to the following endpoint:

https://web3.okx.com/api/v5/mktplace/nft/asset/detail

Request Parameters

ParameterTypeRequiredDescription
chainStringYesChain name (refer to Supported blockchains for details)
contractAddressStringYesCollection contract address (must be a valid contract address)
tokenIdStringYesNFT's token ID

Response Parameters

ParameterTypeDescription
nameStringThe name of the NFT
tokenIdStringThe token ID of the NFT
tokenUriStringMetadata storage address
imageStringCached URL of the NFT image
imagePreviewUrlStringCached URL of the NFT preview image
imageThumbnailUrlStringCached URL of the NFT thumbnail image
animationUrlStringCached URL of the animation resource (if applicable)
attributesObjectToken attributes (see attributes model)
assetContractsObjectToken asset contract details (see asset contract model)
collectionObjectToken collection details (see collection model)

Example Request

curl -X GET "https://web3.okx.com/api/v5/mktplace/nft/asset/detail?chain=ethereum&contractAddress=0x...&tokenId=123"

Example Response

{
  "name": "Example NFT",
  "tokenId": "123",
  "tokenUri": "ipfs://Qm...",
  "image": "https://example.com/image.png",
  "imagePreviewUrl": "https://example.com/preview.png",
  "imageThumbnailUrl": "https://example.com/thumbnail.png",
  "animationUrl": "https://example.com/animation.mp4",
  "attributes": {
    "trait_type": "value"
  },
  "assetContracts": {
    "address": "0x...",
    "name": "Example Collection"
  },
  "collection": {
    "name": "Example Collection",
    "description": "A sample NFT collection"
  }
}

FAQs

What is an NFT's token URI?

The token URI points to the metadata storage location (e.g., IPFS or centralized servers) containing details like the NFT's name, description, and image link.

Can I retrieve NFTs from any blockchain?

๐Ÿ‘‰ Yes, but check the supported blockchains first.

How do I verify an NFT's contract address?

Ensure the address matches a deployed smart contract on a blockchain explorer like Etherscan.

What if my NFT has an animation?

The animationUrl field will include the resource link if the NFT has dynamic media.

Are there rate limits for this API?

๐Ÿ‘‰ Refer to the API documentation for rate limits.

Conclusion

This API provides a streamlined way to access NFT details, making it easier for developers to integrate NFT data into applications. For further assistance, explore our comprehensive documentation.

๐Ÿ‘‰ Discover more Web3 API features here.