Records & Data Requests

Retrieve a domain's content records or domain data without initiating a new resolution request.

Introduction

A domain's content records or domain data can be retrieved without initiating a resolution request that queries the ENS smart contracts by returning the data contained within the domain's record from the API's database. The details on this database are briefly explain in Domain Resolution. Via this method, the content records and domain data returned will be based off previous resolutions, initiated either by standard resolution requests described on Resolving a Domain, the creation or update of records based on observed transactions from the contract listeners, or regular background updates to the database.

Records Request

Overview

The Records Request, a GET request to the /domain/records endpoint, is a request used to obtain the current value for a given domain's ipns, ipfs, ipnsCache, and address records from the database, even when they are null. This differs from the standard domain resolution request which excludes null records and tailors the response based on the available content.

Request Spec
  /domain/records/{domain}:
    get:
      summary: Retrieve an ENS Domain's content records without initiating a resolution request.
      parameters:
        - in: path
          name: domain
          required: true
          description: An ENS domain name.
          schema:
            type: string

Sending the Request

Sending a request to the /domain/records endpoint requires a valid API Key to be provided in the x-api-key header, and that an ENS domain name be provided.

Domain Records Request
curl -x GET "x-api-key: Your-API-Key" https://api.sgr-a.xyz/domain/records/ethereum.eth

When a Domain Records Request completes successfully, the returned output will contain a success message for confirmation, along with the values for all content records fetched from the database, regardless of if they are null or have a value assigned.

Record Request Output
{
    "message": "Domain records fetched successfully",
    "records": {
        "ipns": "IPNS_NAME" OR null,
        "ipfs": "IPFS_CID" OR null,
        "ipnsCache": "CACHED_IPFS_CID" OR null,
        "address": "ETH_WALLET_ADDRESS" OR null
    }
}

Domain Data Request

Overview

The Domain Data Request, a GET request to the /domain/data endpoint, is a request used to obtain the domain data recorded in the database for a given domain. The domain data include the domain's name, tld, namehash, owner, along with both a wrapped and unwrapped tokenId. Since the wrapped status of an ENS domain is not currently monitored or recorded, both the wrapped and unwrapped tokenIds are recorded, where wrapped is when the domain takes the form of an ERC-1155 token, and unwrapped is when the domain takes the form of an ERC-721 token. The domain will always correspond to one of these two tokenIds.

Request Spec
  /domain/data/{domain}:
    get:
      summary: Fetch an ENS Domain's domain data.
      parameters:
        - in: path
          name: domain
          required: true
          description: An ENS domain name.
          schema:
            type: string

Sending the Request

Sending a request to the /domain/data endpoint requires a valid API Key to be provided in the x-api-key header, and that an ENS domain name be provided.

Domain Data Request
curl -x GET "x-api-key: Your-API-Key" https://api.sgr-a.xyz/domain/data/ethereum.eth

When a Domain Data Request completes successfully, the returned output will contain a success message for confirmation, along with the values for all domain data fetched from the database.

Data Request Output
{
    "message": "Domain data fetched successfully",
    "data": {
        "name": "NAME",
        "tld": ".eth",
        "namehash": "NAMEHASH",
        "owner": "OWNER_ADDRESS",
        "wrapped_tokenId": "1155_tokenId",
        "unwrapped_tokenId": "721_tokenId"
    }
}

Last updated