getOwnersForToken (BETA)
Get the owner(s) for a token.
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

Fetch (JS)
Axios (JS)
Postman
Curl
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/v2/${apiKey}/getOwnersForToken`;
10
const contractAddr = "0x04b14e3383d42685ae16af3c47b21b2d5941d27e";
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/v2/${apiKey}/getOwnersForToken`;
6
const contractAddr = "0x04b14e3383d42685ae16af3c47b21b2d5941d27e";
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/v2/demo/getOwnersForToken?contractAddress=0x04b14e3383d42685ae16af3c47b21b2d5941d27e&tokenId=867
2
RequestType: GET
Copied!
1
curl 'https://eth-mainnet.g.alchemy.com/v2/demo/getOwnersForToken/?contractAddress=0x04b14e3383d42685ae16af3c47b21b2d5941d27e&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":["0x0000000000000000000000006ecc67f821c87d232ce09c25fa0a89588375be45"]}
Copied!