> ## Documentation Index
> Fetch the complete documentation index at: https://docs.towns.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useAdminRedact

Hook to redact any message in a channel if you're an admin.

## Imports

```ts theme={null}
import { useAdminRedact } from '@towns-protocol/react-sdk'
```

## Examples

### Redact a message

You can use `adminRedact` to redact a message in a stream.

```ts theme={null}
import { useAdminRedact } from '@towns-protocol/react-sdk'

const { adminRedact } = useAdminRedact(streamId)
adminRedact({ eventId: messageEventId })
```

### Redact a message reaction

You can also use `redact` to redact a message reaction in a stream.

```ts theme={null}
import { useRedact } from '@towns-protocol/react-sdk'

const { redact } = useRedact(streamId)
redact({ eventId: reactionEventId })
```

## Definition

```ts theme={null}
function useAdminRedact(
  streamId: string,
  config?: ActionConfig<Channel["adminRedact"]>,
): {
    data: {
        eventId: string;
    } | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    adminRedact: (eventId: string) => Promise<{
        eventId: string;
    }>;
}
```

**Source:** [useAdminRedact](https://github.com/towns-protocol/towns/blob/main/packages/react-sdk/src/useAdminRedact.ts)

## Parameters

### streamId

* **Type:** `string`

The id of the stream to redact the message in.

### config

* **Type:** `ActionConfig<Channel["adminRedact"]>`
* **Optional**

Configuration options for the action.

## Return Type

The `redact` action and its loading state.

```ts theme={null}
{
    data: {
        eventId: string;
    } | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    adminRedact: (eventId: string) => Promise<{
        eventId: string;
    }>;
}
```
