# System dictionaries

System dictionaries are admin-managed word lists that are visible to every user on the platform.

## Dictionary Groups

System dictionaries are organized into **groups**. Each group represents a content category (e.g. "Profanity", "Brand Safety") with one dictionary per supported language. CollieAI ships with **21 system groups** covering **23 languages**.

Groups are automatically seeded from the `dictionaries/` directory on startup. Each language subdirectory (e.g. `dictionaries/en/`, `dictionaries/ru/`) contains text files following the naming convention `{group-slug}-{lang}.txt`.

### System Groups

| Group                       | Description                                                                                            |
| --------------------------- | ------------------------------------------------------------------------------------------------------ |
| Content Safety              | Profanity, hate speech, CSAM, drugs, extremism, brand safety, self-harm, violence, weapons (substring) |
| Content Safety (Unordered)  | Same categories optimized for unordered phrase matching                                                |
| Prompt Security             | Prompt injection patterns and code/API secret detection (substring)                                    |
| Prompt Security (Unordered) | Prompt injection phrases for unordered matching                                                        |

Each group contains one consolidated dictionary per language (23 languages).

## How Users See System Dictionaries

Regular users see system dictionaries marked with a **lock icon** and a **"System" badge**. They are read-only for non-admins. Users can:

* **View** the dictionary and its words.
* **Use in rules** -- reference a system dictionary or group when configuring rule conditions.
* **Copy** -- duplicate the dictionary to create their own editable version.

Users cannot edit or delete system dictionaries.

## Managing System Dictionaries

Admins manage system dictionaries from **Admin > Dictionaries** (`/app/admin/dictionaries`). The page uses a split-panel layout.

### Left Panel -- Dictionary List

* **Create** button to add a new dictionary.
* **Delete** button to remove a dictionary.
* Each entry shows the dictionary name, **word count**, and **rules count** (how many rules reference it).

### Right Panel -- Dictionary Detail

Select a dictionary on the left to open its detail view. Editable fields:

| Field              | Description                                         |
| ------------------ | --------------------------------------------------- |
| **Name**           | Display name of the dictionary                      |
| **Description**    | Optional explanation of its purpose                 |
| **Words**          | The word list content (one word or phrase per line) |
| **Case sensitive** | Toggle whether matching respects letter case        |

Save your changes or discard them using the action buttons.

## API Reference

All endpoints require admin authentication. Non-admins receive a `403 Forbidden` response.

### List system dictionary groups

```http
GET /api/v1/admin/dictionary-groups
```

Returns all system dictionary groups with their available languages and dictionary counts.

### List system dictionaries

```http
GET /api/v1/admin/dictionaries
```

Returns all system dictionaries.

### Create a system dictionary

```http
POST /api/v1/admin/dictionaries
```

Request body:

```json
{
  "name": "Profanity filter",
  "description": "Common profane words and phrases",
  "content": "word1\nword2\nword3",
  "case_sensitive": false
}
```

### Update a system dictionary

```http
PUT /api/v1/admin/dictionaries/{id}
```

Accepts the same fields as creation. Returns the updated dictionary.

### Delete a system dictionary

```http
DELETE /api/v1/admin/dictionaries/{id}
```

Permanently removes the dictionary.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.collieai.io/admin-panel/system-dictionaries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
