Search Names
Search Names
This GET route fetches all names for a domain that start with a string. Ordered alphabetically.
Parameters
  • domain (string): The domain for the user name.
  • name (string): The string names will start with. For example, 'ro' will return 'rob' and 'robert' and other names starting with 'ro'.
  • 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.
  • exact_match (1 or 0)(Optional): route will only return names that are an exact match
  • offset (integer)(Optional): Offset the returned names window. Default 0.
Curl Example
curl -X GET \ -H 'Authorization: YOUR_API_KEY' \ 'https://namestone.xyz/api/public_v1/search-names?domain=example.xyz&name=ro'
SDK Example
import NameStone, { AuthenticationError, NetworkError, NameData } from './namestone-sdk';

// Initialize the NameStone instance
const ns = new NameStone(<YOUR_API_KEY_HERE>);

// Define the search parameters
const domain = "example.xyz";
const name = "ro";

// Use an immediately invoked async function to allow top-level await
(async () => {
  try {
    const response: NameData[] = await ns.searchNames({domain:domain, name:name});

    if (response.length > 0) {
      console.log(`Found ${response.length} name(s) matching the search criteria:`);
      response.forEach((nameData, index) => {
        console.log(`\nResult ${index + 1}:`);
        console.log(JSON.stringify(nameData, null, 2));
      });
    } else {
      console.log(`No names found matching '${name}' in the domain '${domain}'.`);
    }
  } 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":"robert", "address":"0x57632Ba9A844af0AB7d5cdf98b0056c8d87e3A85", "domain":"testbrand.eth", "textRecords":{ "avatar":"https://imagedelivery.net/UJ5oN2ajUBrk2SVxlns2Aw/71cec612-fe0b-46a4-3d1c-e3eaf53d4600/public", "com.twitter":"namestonehq", "com.discord":"superslobo", "location":"📍 nyc", "url":"https://namestone.xyz", "description":"Brand Choice" } } ]