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/detailRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| chain | String | Yes | Chain name (refer to Supported blockchains for details) |
| contractAddress | String | Yes | Collection contract address (must be a valid contract address) |
| tokenId | String | Yes | NFT's token ID |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| name | String | The name of the NFT |
| tokenId | String | The token ID of the NFT |
| tokenUri | String | Metadata storage address |
| image | String | Cached URL of the NFT image |
| imagePreviewUrl | String | Cached URL of the NFT preview image |
| imageThumbnailUrl | String | Cached URL of the NFT thumbnail image |
| animationUrl | String | Cached URL of the animation resource (if applicable) |
| attributes | Object | Token attributes (see attributes model) |
| assetContracts | Object | Token asset contract details (see asset contract model) |
| collection | Object | Token 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.