Fetch All NFTs by Collection
Guide on how to fetch all NFTs by a collection
Endpoint
GET https://rest-v1.ludo.ninja/contracts/{blockchain}/{contractAddress}/nfts
Path Parameters
blockchain ━ String, The blockchain in where the address exists on.
contractAddress ━ String, The address to fetch all NFTs from.
Query Parameters
pageSize ━ Integer (Int32), Number of the NFTs output.
pageToken ━ String, The token of the specific page that contains the NFT.
Returns a JSON object with the properties below
nfts ━ Array, An array of objects each containing the following fields
id ━ String, The contract address along with the token ID of the NFT.
address ━ String, The contract address of the NFT.
tokenId ━ String, The token ID of the NFT.
blockchain ━ String, The blockchain of where the NFT exists on.
name ━ String, The name of the NFT.
description ━ String, The description of the NFT.
originalUrls ━ Array, Urls that host the NFT data.
ownerAddresses ━ Array, The address that currently holds the NFT.
creatorsAddresses ━ Array, The address that has created the NFT Collection.
attributes ━ Array, An array of the NFT attributes with the following properties below
name ━ String, Name of the attribute.
value ━ String, Value of the attribute.
How to fetch all NFTs by collection using Ludo API
In this guide we will be looking into how to fetch all NFTs by collection, the endpoint requires 2 parameters values in order for the request to succeed and they are blockchain and contractAddress, you can use additional parameters such pageSize and pageToken to customize the request in order to get specific results that you need.
We will be sending a request with the address we will be using below on the ethereum blockchain
0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D
Below is an example of how to send a request to fetch all NFTs by an address using Ludo API
curl --request GET \
--url https://rest-v1.ludo.ninja/contracts/ethereum/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/nfts \
--header 'accept: application/json'
const options = {method: 'GET', headers: {accept: 'application/json'}};
fetch('https://rest-v1.ludo.ninja/contracts/ethereum/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/nfts', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import requests
url = "https://rest-v1.ludo.ninja/contracts/ethereum/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/nfts"
headers = {"accept": "application/json"}
response = requests.get(url, headers=headers)
print(response.text)
Below is an example of how to send a request with additional parameters such as pageSize with the value being 5
https://rest-v1.ludo.ninja/contracts/ethereum/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/nfts?pageSize=5
After a successful result you will get a response of the NFTs that are within that collection.
Updated almost 2 years ago