# record.getContentHash

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

Reads the content hash of an ENS name (ENSIP-7), decoded into its protocol, value and URI. Options, result, errors and examples for record.getContentHash.

Source: https://ensforge.com/docs/reference/sdk/record/get-content-hash

<ApiMeta kind="Read" stability="stable" since="1.0.0" source="packages/sdk/src/actions/record/getContentHash/index.ts#L57" batchable />

Reads the content hash of an ENS name (ENSIP-7), decoded into its protocol, value and URI.

## When to use [#when-to-use]

Use to find the website or content a name points to, such as an IPFS site.

## Details [#details]

- Supports `ipfs`, `ipns`, `bzz` (Swarm), `onion`, `onion3`, `sia` (Skynet) and `ar` (Arweave).
- Turn the URI into an HTTP URL through the client's gateways with
  `ContentHash.toGatewayUrl(uri, ens.config.gateways)`.
- Returns `null` when the record is not set or cannot be decoded, unless `strict` is set.

## Signature [#signature]

```ts
function getContentHash(
  client: Like,
  options: getContentHash.Options,
): Promise<getContentHash.ReturnType>
```

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

`record.getContentHash.request(options)` builds a deferred read for `Actions.batch`. See [Look up many at once](/docs/sdk/look-up-many-at-once).

## Parameters [#parameters]

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `name` (required) | `string` |  | ENS name to read. Normalized automatically. |

Also takes the [read options](/docs/reference/sdk/client#read-options).

## Returns [#returns]

Resolves to `Decoded | null`. The decoded content hash, or `null` when not set.

| Field | Type | Description |
| --- | --- | --- |
| `protocol` | `Protocol` |  |
| `value` | `string` | The identifier without scheme, e.g. a CID. |
| `uri` | `string` | `protocol://value`. |

## Errors [#errors]

| Error | Codes | When |
| --- | --- | --- |
| [`InvalidInputError`](/docs/reference/errors/invalid-input-error) | [`INVALID_NAME`](/docs/reference/errors/INVALID_NAME) | the name cannot be normalized. |
| [`NotFoundError`](/docs/reference/errors/not-found-error) | [`RECORD_NOT_FOUND`](/docs/reference/errors/RECORD_NOT_FOUND), [`RESOLVER_NOT_FOUND`](/docs/reference/errors/RESOLVER_NOT_FOUND) | with `strict`. |
| [`UnsupportedError`](/docs/reference/errors/unsupported-error) | [`RESOLVER_PROFILE_UNSUPPORTED`](/docs/reference/errors/RESOLVER_PROFILE_UNSUPPORTED) | with `strict` when the resolver supports none of the records. |
| [`GatewayError`](/docs/reference/errors/gateway-error) | [`GATEWAY_REQUEST_FAILED`](/docs/reference/errors/GATEWAY_REQUEST_FAILED), [`GATEWAY_RESPONSE_INVALID`](/docs/reference/errors/GATEWAY_RESPONSE_INVALID), [`OFFCHAIN_LOOKUP_INVALID`](/docs/reference/errors/OFFCHAIN_LOOKUP_INVALID) | an off-chain gateway fails. |
| [`DnsError`](/docs/reference/errors/dns-error) |  | a DNS name's DNSSEC proof does not verify. |
| [`NetworkError`](/docs/reference/errors/network-error) | [`RPC_REQUEST_FAILED`](/docs/reference/errors/RPC_REQUEST_FAILED), [`RPC_TIMEOUT`](/docs/reference/errors/RPC_TIMEOUT), [`RATE_LIMITED`](/docs/reference/errors/RATE_LIMITED) | the RPC request fails. |

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

See [How errors work](/docs/sdk/errors-explained).

## Examples [#examples]

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Reading a website"
const site = await ens.record.getContentHash({ name: "vitalik.eth" })
site?.uri // "ipfs://…"
```
</Tab>

<Tab>
```ts title="Reading with a bare viem client"
import { Actions } from "@ensforge/sdk"

const site = await Actions.record.getContentHash(publicClient, { name: "vitalik.eth" })
```
</Tab>

<Tab>
```ts title="Reading in an Effect program"
import { Actions } from "@ensforge/sdk/effect"

const site = yield* Actions.record.getContentHash(ens, { name: "vitalik.eth" })
```
</Tab>
</Tabs>

## Example response [#example-response]

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

```ts
await ens.record.getContentHash({ name: "ens.eth" })
```

```json
{
  "protocol": "bzz",
  "value": "f5909b5286d9279a1f6a23d5155ddd72bb0f28f56b6b82c32de54a6529e6b1b0",
  "uri": "bzz://f5909b5286d9279a1f6a23d5155ddd72bb0f28f56b6b82c32de54a6529e6b1b0"
}
```

## See also [#see-also]

- [`record.get`](/docs/reference/sdk/record/get) to read several records