Skip to main content


What Is Pagination?

Pagination is the process of dividing the responses from an API into multiple pages of results. This allows for faster response times for end users by reducing the amount of data that needs to be returned with each request.

API pagination is used to control the amount of data that is returned for each request, as well as the order of the data.

What Is Cursor Pagination?

Cursor pagination uses a pointer, or cursor, to identify a specific item in the dataset. This pointer is sent with requests to the server, and in response, it sends back the data after the given item.

It’s ideal if you want to pull a long list of records from the API since its performance remains constant.

Cursor Pagination With Moralis API

Every request will return a cursor that can be used to get the next result until there are no more results to return.

NodeJS example

const Moralis = require("moralis").default;
const { EvmChain } = require("@moralisweb3/common-evm-utils");
const init = async () => {
const address = "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB"; //Cryptopunks contract address
const chain = EvmChain.ETHEREUM;
await Moralis.start({
// ...and any other configuration
let cursor = null;
let owners = {};
do {
const response = await Moralis.EvmApi.nft.getNFTOwners({
limit: 100,
cursor: cursor,
disableTotal: false,
`Got page ${} of ${Math.ceil( / response.pagination.pageSize
)}, ${} total`
for (const NFT of response.result) {
if (NFT.ownerOf.checksum in owners) {
amount: NFT.amount,
owner: NFT.ownerOf,
tokenId: NFT.tokenId,
tokenAddress: NFT.tokenAddress,
} else {
owners[NFT.ownerOf.checksum] = [
amount: NFT.amount,
owner: NFT.ownerOf,
tokenId: NFT.tokenId,
tokenAddress: NFT.tokenAddress,
cursor = response.pagination.cursor;
} while (cursor != "" && cursor != null);
console.log("owners:", owners, "total owners:", Object.keys(owners).length);

Python example

import requests
import time

def get_nft_owners(offset, cursor):
print("offset", offset)
url = '<address_here>/owners?chain=polygon&format=decimal'
if cursor:
url = url + "&cursor=%s" % cursor

print("api_url", url)
headers = {
"Content-Type": "application/json",
statusResponse = requests.request("GET", url, headers=headers)
data = statusResponse.json()
print("HTTP headers:", statusResponse.headers)
print("nr results", len(data['result']))
raise SystemExit

cursor = data['cursor']
print(data['page'], data['total'])
return cursor

cursor = None
for j in range(0, 10):
cursor = get_nft_owners(j*500, cursor)
Limit param

The limit param can only be set in the initial call, you cannot change the limit value after the first result.