Convert Address to Name
Learn how to retrieve a name for an address using the REST API.
Example
Using CURL
curl -H "X-API-Key: YOUR_API_KEY" \
https://www.aptosnames.com/api/mainnet/v3/name/0x1234...abcdef
Using JavaScript
export async function convertAddressToName() {
// Replace "0x1234...abcdef" with the address you want to lookup.
const address = "0x1234...abcdef";
// Replace "mainnet" or "testnet" with your desired network
const network = "mainnet";
// Replace "YOUR_API_KEY" with your actual API key
const apiKey = "YOUR_API_KEY";
const response = await fetch(`https://www.aptosnames.com/api/${network}/v3/name/${address}`, {
headers: {
"X-API-Key": apiKey,
},
});
const { name } = await response.json();
return name;
}