NFT Owners Endpoint returns duplicate tokens

results = []
offset = 0

while True:
    r = requests.get(f'https://deep-index.moralis.io/api/v2/nft/0xfcb1315c4273954f74cb16d5b663dbf479eec62e/owners?chain=eth&format=decimal&offset={offset}', headers={'X-API-Key': *****})
    data = r.json()
    offset += 500

    if (len(data["result"])) == 0:
        break

    results.extend(data['result'])

API Key censored for security.

I am trying to grab a list of every owner of my project with their corresponding token ids with the above Python snippet. For some reason itโ€™s returning duplicates in its response and outright omitting token IDs that should exist. Even stranger, itโ€™s non-deterministic - running the script twice will immediately show different sets of duplicates and omit other random tokens from the output. Is there something Iโ€™m doing wrong here?

1 Like

Iโ€™ll need more time to check, for now it looks like I donโ€™t get deterministic output either.