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

# Fine-Grained Scan Methods

> These methods provide a convenient interface for scanning for a single, specific risk. Each method constructs a temporary, single-rule Policy object internally for the scan.

### `check_policy_violation()`

Scans text against a custom list of keywords or rules. This policy is applicable to both prompts and responses.

**Signature:**

```python theme={null}
def check_policy_violation(self, text: str, interaction_type: InteractionType, action: Action, rules: List[str], **kwargs) -> ApiResult
```

**Parameters:**

* `text` (`str`): The input text to scan.
* `interaction_type` (`InteractionType`): The context of the text (`PROMPT` or `RESPONSE`).
* `action` (`Action`): The action to take if a rule is matched (`BLOCK` or `FLAG`).
* `rules` (`List[str]`): A list of forbidden keywords or phrases to detect.
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_secrets_keys()`

Scans text for hardcoded secrets and keys. This policy is applicable **only to responses**.

**Signature:**

```python theme={null}
def check_secrets_keys(self, text: str, action: Action, patterns: Optional[List[Tuple[str, str]]] = None, **kwargs) -> ApiResult
```

**Parameters:**

* `text` (`str`): The input text to scan.
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `patterns` (`Optional[List[Tuple[str, str]]]`): A list of `(name, regex_pattern)` tuples to whitelist specific patterns, preventing them from being flagged as secrets.
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_pii()`

Scans text for Personally Identifiable Information. This policy is applicable to both prompts and responses.

**Signature:**

```python theme={null}
def check_pii(self, text: str, interaction_type: InteractionType, action: Action, **kwargs) -> ApiResult
```

**Parameters:**

* `text` (`str`): The input text to scan.
* `interaction_type` (`InteractionType`): The context of the text (`PROMPT` or `RESPONSE`).
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_toxicity()`

Scans text for toxic content. This policy is applicable to both prompts and responses.

**Signature:**

```python theme={null}
def check_toxicity(self, text: str, interaction_type: InteractionType, action: Action, **kwargs) -> ApiResult
```

**Parameters:**

* `text` (`str`): The input text to scan.
* `interaction_type` (`InteractionType`): The context of the text (`PROMPT` or `RESPONSE`).
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_competitor_mention()`

Scans text for mentions of specific competitor names. This policy is applicable to both prompts and responses.

**Signature:**

```python theme={null}
def check_competitor_mention(self, text: str, interaction_type: InteractionType, action: Action, competitors: List[str], **kwargs) -> ApiResult
```

**Parameters:**

* `text` (`str`): The input text to scan.
* `interaction_type` (`InteractionType`): The context of the text (`PROMPT` or `RESPONSE`).
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `competitors` (`List[str]`): A list of competitor names to detect.
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_banned_topics()`

Scans text for forbidden topics. This policy is applicable **only to prompts**.

**Signature:**

```python theme={null}
def check_banned_topics(self, prompt: str, action: Action, topics: List[str], **kwargs) -> ApiResult
```

**Parameters:**

* `prompt` (`str`): The input prompt to scan.
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `topics` (`List[str]`): A list of forbidden topics.
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_prompt_injection()`

Scans text for prompt injection attacks. This policy is applicable **only to prompts**.

**Signature:**

```python theme={null}
def check_prompt_injection(self, prompt: str, action: Action, **kwargs) -> ApiResult
```

**Parameters:**

* `prompt` (`str`): The input prompt to scan.
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_unsafe_prompt()`

Scans text for requests for harmful or unethical content. This policy is applicable **only to prompts**.

**Signature:**

```python theme={null}
def check_unsafe_prompt(self, prompt: str, action: Action, **kwargs) -> ApiResult
```

**Parameters:**

* `prompt` (`str`): The input prompt to scan.
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_unsafe_response()`

Scans text to ensure it does not contain harmful or unethical content. This policy is applicable **only to responses**.

**Signature:**

```python theme={null}
def check_unsafe_response(self, text: str, action: Action, **kwargs) -> ApiResult
```

**Parameters:**

* `text` (`str`): The input response to scan.
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).

### `check_system_prompt_leak()`

Scans text for content matching a confidential system prompt. This policy is applicable **only to responses**.

**Signature:**

```python theme={null}
def check_system_prompt_leak(self, text: str, action: Action, system_prompt: str, **kwargs) -> ApiResult
```

**Parameters:**

* `text` (`str`): The input response to scan.
* `action` (`Action`): The action to take (`BLOCK` or `FLAG`).
* `system_prompt` (`str`): The system prompt string to check for leakage against.
* `*kwargs`: Optional platform overrides (`asset_id`, `session_id`, `save`).
