Quickstart
Estimated completion time: 10 minutes.
Using our Multi-Chain Data APIs, you can get NFT data from Ethereum and Polygon in less than 5 minutes. No previous blockchain experience needed - just follow along. ✌️
Quickstart covers:
-
How to retrieve NFTs owned by an account/wallet
-
How to retrieve NFTs from a contract
-
How to retrieve details of an NFT
-
How to retrieve all NFTs
Prerequisites
- Sign up to get a free API key.
1. How to retrieve NFTs owned by an account/wallet
Using our Retrieve NFTs owned by an account API you can retrieve NFTs owned by an account/wallet. It currently supports Ethereum and Polygon. It can be useful for building a gallery, creating a user NFT profile page, adding an NFT portfolio section to your app, checking if a user owns a specific NFT and then unlocking specific activity, etc.
- Set
account_address
to the account/wallet address which NFTs you want to see. We'll use0x51688cd36c18891167e8036bde2a8fb10ec80c43
- Pick the
chain
you want to query, e.g.ethereum
orpolygon
. We'll useethereum
. - Add your API key to
Authorization
. This will be automatically prefilled if you are signed in (top right of this page). Sign up if you don't have an API key yet - it's free.
curl --request GET \
--url 'https://api.nftport.xyz/v0/accounts/0x51688cd36c18891167e8036bde2a8fb10ec80c43?chain=ethereum&include=metadata' \
--header 'Authorization: <<apiKey>>'
import requests
url = "https://api.nftport.xyz/v0/accounts/0x51688cd36c18891167e8036bde2a8fb10ec80c43?chain=ethereum&include=metadata"
headers = {
"Authorization": "<<apiKey>>"
}
response = requests.get(url, headers=headers)
print(response.json())
const options = {
method: 'GET',
headers: {'Content-Type': 'application/json', Authorization: "<<apiKey>>}
};
fetch('https://api.nftport.xyz/v0/accounts/account_address?chain=ethereum', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
It's also possible to have more granular control over the response and set filters. For this, see the API reference and more code samples: Retrieve NFTs owned by an account API.
2. How to retrieve NFTs from a contract
Using our Retrieve contract NFTs API you can get all NFTs for a given contract address. Currently, Ethereum (Mainnet and Goerli) and Polygon are supported. Using this API you can import all NFTs from a given contract to your application or showcase NFTs in a particular collection.
- Set
contract_address
to the contract address which NFTs you want to see. We'll use0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D
- the Bored Ape Yacht Club contract. - Pick the
chain
you want to query, e.g.ethereum
orpolygon
. We'll useethereum
. - Add your API key to
Authorization
. This will be automatically prefilled if you are signed in (top right of this page). Sign up if you don't have an API key yet - it's free.
curl --request GET \
--url 'https://api.nftport.xyz/v0/nfts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D?chain=ethereum&include=metadata' \
--header 'Authorization: <<apiKey>>'
import requests
url = "https://api.nftport.xyz/v0/nfts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D?chain=ethereum&include=metadata"
headers = {
"Authorization": "<<apiKey>>"
}
response = requests.get(url, headers=headers)
print(response.json())
const options = {
method: 'GET',
headers: {'Content-Type': 'application/json', Authorization: <<apiKey>>}
};
fetch('https://api.nftport.xyz/v0/nfts/contract_address?chain=ethereum', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
It's also possible to have more granular control over the response and set filters. For this, see the API reference and more code samples: Retrieve contract NFTs API.
3. How to retrieve details of an NFT
Using our Retrieve NFT details API you can get all details for a given NFT. Currently Ethereum (Mainnet and Goerli) and Polygon are supported.
- Set
contract_address
from which you want to retreive details of an NFT. We'll use0x23581767a106ae21c074b2276d25e5c3e136a68b
- the Moonbirds contract, on theethereum
chain. - Set
token_id
of the NFT from the above contract. We'll use1446
. - Add your API key to
Authorization
. This will be automatically prefilled if you are signed in (top right of this page). Sign up if you don't have an API key yet - it's free.
curl --request GET \
--url 'https://api.nftport.xyz/v0/nfts/0x23581767a106ae21c074b2276d25e5c3e136a68b/1446?chain=ethereum' \
--header 'Authorization: <<apiKey>>'
import requests
url = "https://api.nftport.xyz/v0/nfts/0x23581767a106ae21c074b2276d25e5c3e136a68b/1446?chain=ethereum"
headers = {
"Authorization": "<<apiKey>>"
}
response = requests.get(url, headers=headers)
print(response.json())
const options = {
method: 'GET',
headers: {'Content-Type': 'application/json', Authorization: '<<apiKey>>'}
};
fetch('https://api.nftport.xyz/v0/nfts/contract_address/token_id?chain=ethereum', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
It's also possible to have more granular control over the response and set filters. For this, see the API reference and more code samples: Retrieve NFT details API.
4. How to retrieve all NFTs (optional)
Using our Retrieve all NFTs API you can query all ERC721 and ERC1155 NFTs that have been minted on a given chain. Currently, Ethereum (Mainnet and Goerli) and Polygon are supported.
You can run various analytics with the data, import all NFTs to your application/marketplace, keep track of all the created NFTs, etc.
Non-enterprise users can fetch only the last 3 months of data using this endpoint. If you want to get all NFT data, contact us.
- Pick the
chain
you want to query, e.g.ethereum
orpolygon
. - Choose the level of detail with
include
, e.g.file_information
orcontract_information
. See other options in the Retrieve All NFTs API reference. - Add your API key to
Authorization
. This will be automatically prefilled if you are signed in (top right of this page). Sign up if you don't have an API key yet - it's free.
curl --request GET \
--url 'https://api.nftport.xyz/v0/nfts?chain=ethereum&include=metadata' \
--header 'Authorization: <<apiKey>>'
import requests
url = "https://api.nftport.xyz/v0/nfts?chain=ethereum&include=metadata"
headers = {
"Authorization": "<<apiKey>>"
}
response = requests.get(url, headers=headers)
print(response.json())
const options = {
method: 'GET',
headers: {'Content-Type': 'application/json', Authorization: '<<apiKey>>'}
};
fetch('https://api.nftport.xyz/v0/nfts?chain=polygon&include=default', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
It's also possible to have more granular control over the response and set filters. For this, see the API reference and more code samples: Retrieve all NFTs API.
Join the Community for Support and to Build Together
Join our Discord community if you need support from our team and a space to discuss NFT related topics, voice feature requests, and engage with other like-minded NFT developers.
Updated about 2 years ago