Get Names
Get Names
This GET route fetches all names for a user or domain. Ordered alphabetically.
API_Key is optional. If it is not included it will not get private names.
If it is included it will get only your names (public and private).
API_Key is optional. If it is not included it will not get private names.
If it is included it will get only your names (public and private).
Parameters
domain
(string)(Optional): The domain for the user name. If not included route will return all names for all domains tied to your API key.address
(string)(Optional): The address of the user (or addresses of users separated by commas). If not included route will return all names.text_records
(1 or 0)(Optional): Whether or not the the route returns text records. 1 by default.limit
(integer)(Optional): Number of names returned in request. Default 50.offset
(integer)(Optional): 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