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

# Purge

> Purge deletes messages from the current channel with optional filters. The operation is bounded by the server maximum and logs its result.

## Permissions and limit

The command user needs `Manage Messages`; Headless also needs `Manage Messages`. Configure the maximum in Dashboard → Moderation → Max purge; the runtime default is 500. Requests above the maximum are rejected.

## Prefix filters

Delete all messages, a member's messages, or filter by `bots`, `links`, `images`, `invites`, `embeds`, `mentions`, or `contains <text>`. If a member filter has no amount, the prefix scans that member's deletable messages in the channel; other uses default to the configured limit.

### `.purge — 1`

```headless-command Syntax theme={null}
.purge [args...]
```

```headless-command Example theme={null}
.purge 50
```

Also works: `.purge @member 20` · `.purge links 50`

### `.purge — 2`

```headless-command Syntax theme={null}
.purge [args...]
```

```headless-command Example theme={null}
.purge contains invite 30
```

Also works: `.purge mentions 25`

### `.purge [args...]`

```headless-command Syntax theme={null}
.purge [args...]
```

```headless-command Example theme={null}
.purge 50
```

Also works: `.purge @member 20` · `.purge links 50` · `.purge contains invite 30` · `.purge mentions 25`

> [!WARNING]
>
> Message deletion cannot be undone from Headless. Verify channel, filter, and amount first; filtered scans are bounded by the runtime.

## Slash command

`/purge` accepts an optional amount, member, and `all`, `bots`, `links`, `invites`, `images`, or `embeds` filters. It does not include the prefix command's text or `mentions` filters.

### `/purge`

```headless-command Syntax theme={null}
/purge [amount:<amount>] [member:<member>] [filter_type:<filter_type>]
```

```headless-command Example theme={null}
/purge amount:50 filter_type:links
```

### `/purge`

```headless-command Syntax theme={null}
/purge [amount:<amount>] [member:<member>] [filter_type:<filter_type>]
```

```headless-command Example theme={null}
/purge amount:50 filter_type:links
```

### `.purge — 2`

```headless-command Syntax theme={null}
/purge [amount:<amount>] [member:<member>] [filter_type:<filter_type>]
```

```headless-command Example theme={null}
/purge amount:50 filter_type:links
```

## Steps

**1. Choose channel and filter**

Check the current channel; the prefix command has no channel selector.

**2. Set an explicit bound**

Use a smaller amount for filtered scans and verify the server maximum.

**3. Review the result**

Inaccessible messages or messages subject to Discord limits may remain.

## Deletion limits

> **Old and pinned messages**
>
> Headless skips pinned messages and messages older than 14 days. Discord does not allow bulk deletion for older messages; check the skipped count in the result.

> **Filtered search window**
>
> A prefix filter with an amount scans a bounded window of recent messages, up to 1,500. The exception is `.purge @member` without an amount: it scans that member's deletable messages until it reaches messages older than 14 days. If a bounded filter does not find enough matches, review the channel before rerunning with a smaller amount.

> **Case and log entry**
>
> A completed prefix operation creates a case and schedules its Logs event. Slash records a Logs event but does not create the case made by the prefix route. Access or API failures can leave messages undeleted; the summary does not guarantee every matching message was removed.

## Syntax and examples

#### `.purge — 1`

## Related pages

* [Logs](/docs/en/server/logging.md)
* [Snipes](/docs/en/community/snipes.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.