NameStone is shutting down August 3, 2026.Read the announcement
Set Domain
Set Domain
This POST route sets domain records. It should only be used for domains already enabled in NameStone. To enable a new domain use enable-domain.
Parameters
ParameterTypeRequiredDescription
domainstringYesThe domain (e.g. "testbrand.eth").
addressstringNoThe Ethereum address the name points to.
contenthashstringNoThe link for an IPFS or IPNS website.
text_recordsobjectNoAn object containing key-value pairs representing the text records to be set.
Curl Example
curl -X POST \ -H 'Content-Type: application/json' \ -H 'Authorization: YOUR_API_KEY' \ -d '{ "domain":"testbrand.eth", "address":"0xE997d9b785Dd99832d21b3Ce5A34fCacC6D53C57", "coin_types": { "2147483785": "0x534631Bcf33BDb069fB20A93d2fdb9e4D4dD42CF", "2147492101": "0x534631Bcf33BDb069fB20A93d2fdb9e4D4dD42CF", "2147525809": "0x534631Bcf33BDb069fB20A93d2fdb9e4D4dD42CF", "2147483658": "0x534631Bcf33BDb069fB20A93d2fdb9e4D4dD42CF" }, "text_records": { "com.twitter":"namestonehq", "com.github":"aslobodnik", "com.discord":"superslobo", "url":"https://www.namestone.com", "location":"📍 nyc", "description":"APIs are cool", "avatar":"https://raw.githubusercontent.com/aslobodnik/profile/main/pic.jpeg" } }' \ https://namestone.com/api/public_v1/set-domain
SDK Example
import NameStone, { AuthenticationError, NetworkError, TextRecords } from '@namestone/namestone-sdk';

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

// Define the domain parameters
const domain = "testbrand.eth";
const address = "0xE997d9b785Dd99832d21b3Ce5A34fCacC6D53C57";

// Define the text records
const textRecords: TextRecords = {
  "com.twitter": "namestonehq",
  "com.github": "aslobodnik",
  "com.discord": "superslobo",
  "url": "https://www.namestone.com",
  "location": "📍 nyc",
  "description": "APIs are cool",
  "avatar": "https://raw.githubusercontent.com/aslobodnik/profile/main/pic.jpeg"
};

// Use an immediately invoked async function to allow top-level await
(async () => {
  try {
    const response = await ns.setDomain({domain:domain, address:address, text_records:textRecords});

    console.log("Domain set successfully:", response);
  } 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);
    }
  }
})();