Help & Support

Block Accounts

This guide explains how to block and unblock an Account on Lens.

A Lens Account can block other Lens accounts from interacting with them, directly or indirectly. This is achieved by rejecting on-chain transactions that involve the blocking Account.

The Lens API also honors the block status in features that are currently off-chain, such as reactions.

Fetch Blocked Accounts

Use the paginated fetchAccountsBlocked action to get a list of accounts that are blocked by the current account.

Example
import { fetchAccountsBlocked } from "@lens-protocol/client/actions";
const result = await fetchAccountsBlocked(client);
if (result.isErr()) {  return console.error(result.error);}
// items: Array<AccountBlocked>: [{blockedAt: Date, account: Account}, ...]const { items, pageInfo } = result.value;

Continue with the Pagination guide for more information on how to handle paginated results.

Block Account

1

Block Specific Account

You MUST be authenticated as Account Owner or Account Manager to make this request.

Use the blockAccount action to block an account.

Block Account
import { evmAddress } from "@lens-protocol/client";import { blockAccount } from "@lens-protocol/client/actions";
const result = await blockAccount(sessionClient, {  account: evmAddress("0x1234..."),});
if (result.isErr()) {  return console.error(result.error);}

2

Handle Result

Then, handle the result using the adapter for the library of your choice:

import { handleWith } from "@lens-protocol/client/viem";
// …
const result = await blockAccount(sessionClient, {  account: evmAddress("0x1234..."),}).andThen(handleWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

That's it—the account is now blocked.

Unblock Account

1

Unblock Specific Account

You MUST be authenticated as Account Owner or Account Manager to make this request.

Use the unblockAccount action to unblock an account.

Unblock Account
import { evmAddress } from "@lens-protocol/client";import { unblockAccount } from "@lens-protocol/client/actions";
const result = await unblockAccount(sessionClient, {  account: evmAddress("0x1234..."),});
if (result.isErr()) {  return console.error(result.error);}

2

Handle Result

Then, handle the result using the adapter for the library of your choice:

import { handleWith } from "@lens-protocol/client/viem";
// …
const result = await unblockAccount(sessionClient, {  account: evmAddress("0x1234..."),}).andThen(handleWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

That's it—the account is now unblocked.