NFT API endpoints
The latest documentation for endpoints is always on the DevPortal: https://partner.socios.com/devportal/apis/f59193f0-b4ea-4eb7-83f8-8b1f2858f181/test
Locales used to translate the current entity. Using the Locale
HTTP header should be preferred. The HTTP header version is used in priority if it is given
["en"]
GET /nft/1.0.0/user/nfts HTTP/1.1
Host: api-public.socios.com
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
Successfully retrieved list of User's nft's (simple paginationMode enabled)
{
"data": [
{
"summary": {
"collectibleId": "d6f09e6f-bea5-4db2-9e27-87c42ec08e00",
"name": "My NFT",
"description": "My NFT description",
"imageUrl": "https://foo.bar/baz.png",
"animationUrl": "https://foo.bar/baz.gif",
"externalUrl": "https://foo.bar/my-nft",
"backgroundColor": "51FF00",
"metadataUrl": "https://foo.bar/my-nft/metadata.json",
"supplyPosition": 1,
"totalSupply": 10
},
"blockchain": {
"tokenId": "10003555322666223325234212",
"blockchainType": "DEPRECATED - ethereum_mainnet",
"networkType": "polygon",
"collectionId": "bd1b361a-80ab-465a-bb31-c02b330608f1",
"smartContractAddress": "text",
"isVerifiedSmartContract": true
}
}
],
"metadata": {
"total_items": 588,
"current_page": 2,
"last_page": 4,
"cursor": "text"
}
}
⬇️ ALTERNATIVE: Retrieve User NFT Balance ⬇️ The following code will allow you to check how many NFT from a specific collection a user holds.
import { abi as erc721ABI } from './ERC721ABI.json';
async function getNFTBalance() {
const balance = await client.readContract({
address: '0xYourNFTAddress', // Replace with the actual NFT contract address
abi: erc721ABI, // ERC-721 ABI
functionName: 'balanceOf', // Standard ERC-721 function to get balance
args: ['0xUserWalletAddress'], // User's address whose NFT balance you want to check
});
return balance.toString();
}
// Example usage
getNFTBalance().then(console.log);
The id of nft to be retrieved
Locales used to translate the current entity. Using the Locale
HTTP header should be preferred. The HTTP header version is used in priority if it is given
["en"]
GET /nft/1.0.0/nft/{id} HTTP/1.1
Host: api-public.socios.com
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
Successfully retrieved one nft data
{
"data": {
"id": "d6f09e6f-bea5-4db2-9e27-87c42ec08e00",
"summary": {
"name": "text",
"description": "text",
"imageUrl": "text",
"blockchainTokenId": "text"
},
"smartContract": {
"name": "External SmartContract",
"blockchainType": "DEPRECATED - ethereum_mainnet",
"networkType": "polygon"
},
"currentOwner": {
"blockchainType": "DEPRECATED - ethereum_mainnet",
"blockchainAddress": "1.0765045074494785E+48",
"networkType": "polygon"
},
"attributeValues": {
"id": "text",
"value": "text",
"maxValue": 1,
"traitType": "text",
"displayType": "text",
"applyTo": "text",
"attribute": []
}
}
}
Last updated