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

# user_templates

# `prefect.server.utilities.user_templates`

Utilities to support safely rendering user-supplied templates

## Functions

### `register_user_template_filters` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L117](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L117)</sup>

```python theme={null}
register_user_template_filters(filters: dict[str, Any]) -> None
```

Register additional filters that will be available to user templates

### `validate_user_template` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L123](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L123)</sup>

```python theme={null}
validate_user_template(template: str) -> None
```

### `matching_types_in_templates` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L161](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L161)</sup>

```python theme={null}
matching_types_in_templates(templates: list[str], types: set[str]) -> list[str]
```

### `maybe_template` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L173](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L173)</sup>

```python theme={null}
maybe_template(possible: str) -> bool
```

### `render_user_template` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L177](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L177)</sup>

```python theme={null}
render_user_template(template: str, context: dict[str, Any]) -> str
```

### `render_user_template_sync` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L189](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L189)</sup>

```python theme={null}
render_user_template_sync(template: str, context: dict[str, Any]) -> str
```

## Classes

### `UserTemplateEnvironment` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L68](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L68)</sup>

### `TemplateSecurityError` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L97](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L97)</sup>

Raised when extended validation of a template fails.

### `TemplateRenderError` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user\_templates.py#L106](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/utilities/user_templates.py#L106)</sup>

Raised when a user-supplied template fails to render.
