Get Names
Get Names
This GET route returns a list of names (subdomains) associated with a specific domain and/or address. Names are fetched in alphabetical order.
Including an API key is optional but recommended when interacting with your own domains.
Note: Names may not be discoverable if the domain is using NameStone's resolver and the domain owner has marked them private. Include your API key to ensure access to all subnames for your domain. Review your domain's privacy settings in the admin panel.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
domain | string | No | The domain (e.g. "testbrand.eth"). If omitted, the route will return all subnames for all domains tied to your API key. |
address | string | No | One or more Ethereum addresses (separated by commas). If omitted, the route will return all names. |
text_records | 1 or 0 | No | Whether or not the route returns text records. 1 by default. |
limit | integer | No | Number of names returned in request. Default 50. |
offset | integer | No | Offset the returned names window. Default 0. |
Curl Example
curl -X GET \
-H 'Authorization: YOUR_API_KEY' \
'https://namestone.com/api/public_v1/get-names?domain=testbrand.eth&address=0x57632Ba9A844af0AB7d5cdf98b0056c8d87e3A85'
SDK Example
import NameStone, { AuthenticationError, NetworkError, NameData } from '@namestone/namestone-sdk';
// Initialize the NameStone instance
const ns = new NameStone(<YOUR_API_KEY_HERE>);
// Define the query parameters
const domain = "testbrand.eth";
const address = "0x57632Ba9A844af0AB7d5cdf98b0056c8d87e3A85";
// Use an immediately invoked async function to allow top-level await
(async () => {
try {
const response: NameData[] = await ns.getNames({domain:domain, address:address});
if (response.length > 0) {
console.log(`Found ${response.length} name(s):`);
response.forEach((nameData, index) => {
console.log(`\nName ${index + 1}:`);
console.log(JSON.stringify(nameData, null, 2));
});
} else {
console.log("No names found for the specified domain and address.");
}
} catch (error) {
if (error instanceof AuthenticationError) {
console.error("Authentication failed:", error.message);
} else if (error instanceof NetworkError) {
console.error("Network error:", error.message);
} else {
console.error("An unexpected error occurred:", error);
}
}
})();
Example Return
[
{
"name":"namestone",
"address":"0x57632Ba9A844af0AB7d5cdf98b0056c8d87e3A85",
"domain":"testbrand.eth",
"text_records":{
"avatar":"https://imagedelivery.net/UJ5oN2ajUBrk2SVxlns2Aw/71cec612-fe0b-46a4-3d1c-e3eaf53d4600/public",
"com.twitter":"namestonehq",
"com.discord":"superslobo",
"location":"📍 nyc",
"url":"https://namestone.com",
"description":"Brand Choice"
}
"coin_types": {
"2147483785": "0x534631Bcf33BDb069fB20A93d2fdb9e4D4dD42CF",
"2147492101": "0x534631Bcf33BDb069fB20A93d2fdb9e4D4dD42CF",
"2147525809": "0x534631Bcf33BDb069fB20A93d2fdb9e4D4dD42CF",
"2147483658": "0x534631Bcf33BDb069fB20A93d2fdb9e4D4dD42CF"
},
}
]
NameStone supports multichain address resolution to any L2 chain permitted within ENS.