getOwnersForToken
Get the owner(s) for a token.
This endpoint is currently in BETA.
This endpoint is supported on the following chains and networks:
  • Ethereum: Mainnet, Goerli
  • Polygon: Mainnet and Mumbai
To see chain support across all features, check out the feature matrix.

Parameters

  • contractAddress: string - The address of the contract that the token belongs to. We currently support both ERC721 and ERC1155 contracts.
  • tokenId: string - The ID of the token. Can be in hex or decimal format.

Returns

  • owners: string[] - A list of strings representing addresses of the owners.
    • For ERC721 tokens the list will contain just a single owner.
    • For ERC1155 tokens the list may contain multiple owners if the ERC1155 token in question is semi-fungible or fungible.

Example

Request

Alchemy SDK
Fetch (JS)
Axios (JS)
Postman
Curl
1
// Github: https://github.com/alchemyplatform/alchemy-sdk-js
2
// Setup: npm install @alch/alchemy-sdk
3
import { Network, initializeAlchemy, getOwnersForNft } from "@alch/alchemy-sdk";
4
5
// Optional Config object, but defaults to demo api-key and eth-mainnet.
6
const settings = {
7
apiKey: "demo", // Replace with your Alchemy API Key.
8
network: Network.ETH_MAINNET, // Replace with your network.
9
maxRetries: 10,
10
};
11
12
const alchemy = initializeAlchemy(settings);
13
14
// Print total NFT count returned in the response:
15
const ownersForNft = await getOwnersForNft(
16
alchemy,
17
"0x5180db8F5c931aaE63c74266b211F580155ecac8",
18
"1590"
19
);
20
console.log(ownersForNft);
Copied!
1
import fetch from 'node-fetch';
2
3
var requestOptions = {
4
method: 'GET',
5
redirect: 'follow'
6
};
7
8
const apiKey = "demo"
9
const baseURL = `https://eth-mainnet.alchemyapi.io/nft/v2/${apiKey}/getOwnersForToken`;
10
const contractAddr = "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D";
11
const tokenId = "867";
12
const fetchURL = `${baseURL}?contractAddress=${contractAddr}&tokenId=${tokenId}`;
13
14
fetch(fetchURL, requestOptions)
15
.then(response => response.json())
16
.then(response => JSON.stringify(response, null, 2))
17
.then(result => console.log(result))
18
.catch(error => console.log('error', error));
Copied!
1
import axios from 'axios';
2
3
// replace with your Alchemy api key
4
const apiKey = "demo";
5
const baseURL = `https://eth-mainnet.alchemyapi.io/nft/v2/${apiKey}/getOwnersForToken`;
6
const contractAddr = "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D";
7
const tokenId = "867";
8
9
var config = {
10
method: 'get',
11
url: `${baseURL}?contractAddress=${contractAddr}&tokenId=${tokenId}`,
12
headers: { }
13
};
14
15
axios(config)
16
.then(response => console.log(JSON.stringify(response.data, null, 2)))
17
.catch(error => console.log(error));
Copied!
1
URL: https://eth-mainnet.g.alchemy.com/nft/v2/demo/getOwnersForToken?contractAddress=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&tokenId=867
2
RequestType: GET
Copied!
1
curl 'https://eth-mainnet.g.alchemy.com/nft/v2/demo/getOwnersForToken/?contractAddress=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&tokenId=867'
Copied!
If you're having trouble running requests via Alchemy Web3.js, Fetch, or Axios, please refer to: NFT API Quickstart Guide

Response

1
{"owners":["0x54be3a794282c030b15e43ae2bb182e14c409c5e"]}
Copied!