Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Skip to Content
ensforgeSDK

record.getText

Reads one text record of an ENS name, such as url, avatar or com.twitter. Parameters, return value, errors and examples for record.getText in @ensforge/sdk.

ReadBatchablestable
Since v1.0.0View source

Reads one text record of an ENS name, such as url, avatar or com.twitter.

When to use

Use to read a single profile field. Use record.get to read several records in one call.

Details

  • Resolves through the Universal Resolver, so ENSv1, ENSv2, wildcard and off-chain (CCIP-Read) names all work.
  • Returns null when the record, the resolver, or the resolver's text support is missing, unless strict is set.
  • Calls made in the same tick are batched into one multicall where possible.

Signature

function getText(client: Like, options: getText.Options): Promise<getText.ReturnType>

Call it as ens.record.getText(options) on a client, or Actions.record.getText(client, options).

record.getText.request(options) builds a deferred read for Actions.batch. See Look up many at once.

In React, use useText.

Parameters

OptionTypeDefaultDescription
name (required)stringENS name to read. Normalized automatically.
key (required)stringText record key, e.g. url, avatar, com.twitter.

Also takes the read options.

Returns

Resolves to string | null. The record value, or null when it is not set.

Errors

ErrorCodesWhen
InvalidInputErrorINVALID_NAMEthe name cannot be normalized.
NotFoundErrorRECORD_NOT_FOUND, RESOLVER_NOT_FOUNDwith strict.
UnsupportedErrorRESOLVER_PROFILE_UNSUPPORTEDwith strict when the resolver supports none of the records.
GatewayErrorGATEWAY_REQUEST_FAILED, GATEWAY_RESPONSE_INVALID, OFFCHAIN_LOOKUP_INVALIDan off-chain gateway fails.
DnsErrora DNS name's DNSSEC proof does not verify.
NetworkErrorRPC_REQUEST_FAILED, RPC_TIMEOUT, RATE_LIMITEDthe RPC request fails.

It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).

See How errors work.

Examples

Reading a profile URL
const url = await ens.record.getText({ name: "nick.eth", key: "url" })

Example response

Recorded from Ethereum mainnet on 2026-11-18 at block 26443964. Values change as the chain does.

await ens.record.getText({ name: "vitalik.eth", key: "url" })
"https://vitalik.ca"

See also

Was this page helpful?