> ## 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.

# Jail

> Jail isolates a member with a server role, stores their prior roles, and later attempts to restore those that still exist and are manageable by the bot. It does not schedule release; a moderator must run `unjail`.

## Setup, permissions, and effects

`.jail setup` creates or reuses the `Jailed` role and `jail` text channel, stores configuration per server, and enables the module. Setup allows the Jail role into the Jail channel and **attempts** to deny it access in other channels; the Jail channel denies visibility to `@everyone` and allows the bot. It does not automatically add overwrites for staff roles. Both `.jail` and `/jail` recheck that the invoking member has `Manage Roles` and `Manage Channels` (native or granted through Headless Fake Permissions) and that Headless has the native permissions. The resource and permission checks run before automatic setup; command overrides do not bypass them. Setup attempts to change overwrites across all channels and does not roll back earlier changes when some writes fail.

### `.jail setup`

```headless-command Syntax theme={null}
.jail setup
```

```headless-command Example theme={null}
.jail setup
```

## Jailing a member

`.jail @member [reason]` and `/jail member:@member reason:...` apply the role. The reason is optional and is stored as `No reason provided` when omitted. Before changing roles, Headless rejects bots, protects the server owner (unless the owner is acting), and checks that the target is below both the bot and moderator in role hierarchy. It stores prior role IDs and separately records which ones it will try to remove; it removes only unmanaged roles below the bot. The persistent record is saved before Discord role changes, so a permission failure can leave a record even if punishment was only partially applied. After applying the role, Headless attempts a DM and creates a case and log; a failed DM does not undo the punishment.

### `.jail`

```headless-command Syntax theme={null}
.jail [user_query] [reason=No reason provided]
```

```headless-command Example theme={null}
.jail @member Harassment
```

### `/jail`

```headless-command Syntax theme={null}
/jail member:<member> [reason:<reason>]
```

```headless-command Example theme={null}
/jail member:@member reason:Harassment
```

## Releasing a member and checking status

`.unjail @member [reason]` or `/unjail member:@member reason:...` removes the Jail role if present and re-adds saved roles that still exist, are not managed, and remain below the bot's highest role. Deleted roles or roles the bot cannot manage are skipped. Without an earlier record, the command can remove Jail but has no roles to restore. The stored record is removed only after Discord accepts the changes; each release creates its own case and log. `.jail status` displays configuration and up to eight active members; `.jail setup` repairs or prepares the system. The root `.jail` command may also run setup automatically when Jail is disabled before showing status.

### `.jail status`

```headless-command Syntax theme={null}
.jail status
```

```headless-command Example theme={null}
.jail status
```

### `.unjail`

```headless-command Syntax theme={null}
.unjail <user_query> [reason=No reason provided]
```

```headless-command Example theme={null}
.unjail @member Appeal accepted
```

### `/unjail`

```headless-command Syntax theme={null}
/unjail member:<member> [reason:<reason>]
```

```headless-command Example theme={null}
/unjail member:@member reason:Appeal accepted
```

> [!WARNING]
>
> Setup writes the Jail role's overwrites across server channels and may leave partial changes. Also, `.jail @member` may run setup before validating its target when Jail is disabled or missing resources. Review status and permissions before invoking it; deleted, managed, or otherwise unmanageable roles cannot be restored.

**Additional warning:**

The owner exception is asymmetric: `.jail` allows that target when the server owner or Headless owner is acting, but `.unjail` uses the common moderation check that blocks the server owner. If this occurs, removing the role may require an authorized manual intervention.

**Note:**

The server prefix may vary; examples use `.`. Slash commands register Manage Roles as the user's default permission. The `.jail` prefix group applies Manage Roles and Manage Channels; `.unjail` requires Manage Roles. The bot must also have whichever permissions the role or channel operations require.

## Steps

**1. Audit current permissions**

Check bot hierarchy and review the Jail role's overwrites in every category and channel that may be affected. Decide explicitly which staff roles should retain access to the Jail channel; setup does not grant staff access automatically.

**2. Prepare the system deliberately**

Run `.jail setup` with Manage Roles and Manage Channels for both your account and Headless. Verify the channel, role, and overwrites manually; synchronization failures can leave partial changes.

**3. Test the full cycle**

Use a test account below the moderator and bot in role hierarchy, confirm access to the intended channel, then run `unjail`. Check restored roles, the moderation case, and logs.

## Command details

> **Registered commands**
>
> The prefix group accepts `.prison` as an alias; `.jail setup` also accepts `create`, `repair`, and `on`, while `.jail status` accepts `list` and `info`. Prefix `.unjail` has the `.free` alias. The only slash commands in this workflow are `/jail` and `/unjail`; setup and status have no slash subcommands.

> **Isolation scope**
>
> Headless does not configure a timed release or automatic appeal. The Jail role's overwrite also disables reactions and thread creation. If some channel permissions could not be changed, verify effective access before relying on isolation.

## Related pages

* [Moderation setup](/docs/en/security/moderation.md)
* [Moderation cases](/docs/en/moderation/cases.md)


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