[Yandex Cloud documentation](../../../index.md) > [Yandex SIEM](../../index.md) > [Step-by-step guides](../index.md) > [Queries](index.md) > Working with templates

# Working with query templates

{% note info %}

This feature is in the [Preview](../../../overview/concepts/launch-stages.md) stage. To get access, contact [tech support](https://center.yandex.cloud/support) or your account manager.

{% endnote %}

You can save frequently used queries as templates and quickly integrate them in investigations.

The following template categories are available:

* **Personal**: Templates created by the user and available across investigations.
* **Instance**: Templates available to all users, but restricted to a specific investigation.
* **Global**: Templates available to all users across all investigations.

## Accessing the templates panel {#open-templates-panel}

To open the templates panel:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open an investigation.
  1. Click **Query data** on the right side of the screen.
  1. Navigate to the **Templates** tab.

{% endlist %}

## Navigating template folders {#navigate-template-folders}

Templates within each category can be organized into folders. Users can create and give names to folders to facilitate navigation and group templates by threat type, event source, investigation phase, or other criteria.

To access a folder:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open the templates panel.
  1. Select a category.
  1. Select the relevant folder from the list.

{% endlist %}

## Searching for a template {#search-template}

To find a template:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open the templates panel.
  1. Enter a search query in the search field.
  1. The results will be displayed automatically.

  The system will search for keywords across template names and contents.

{% endlist %}

## Inserting a template into a query {#insert-template}

To insert a template into your current query:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open the templates panel.
  1. Find the required template.
  1. Click the template.
  1. Select **Insert into query**.

  The template text will be added to the query editor.

{% endlist %}

## Creating a new query from a template {#create-query-from-template}

To create a new query from a template:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open the templates panel.
  1. Find the required template.
  1. Click the template.
  1. Select **New query from template**.

  This will create a new tab pre-populated with a query from the selected template.

{% endlist %}

## Saving a query as a template {#save-as-template}

To save your current query as a template:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open the query you want to save.
  1. In the actions menu, select **Save as template**.
  1. Enter a name for the template.
  1. Select a folder to save it to:
     * **Personal**: For personal use.
     * **Instance**: For all instance users.
  1. Click **Save query as template**.

{% endlist %}

## Creating a template folder {#create-template-folder}

To create a folder for templates:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open the templates panel.
  1. Select either the **Personal** or **Instance** category.
  1. Click **New folder**.
  1. Enter a name for the directory.
  1. Click **Create**.

{% endlist %}

## Managing templates {#manage-templates}

### Renaming a template {#rename-template}

To rename a template:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open the templates panel.
  1. Find the desired template.
  1. Right-click the template.
  1. Select **Rename**.
  1. Enter a new name.
  1. Click **Save**.

{% endlist %}

### Deleting a template {#delete-template}

To delete a template:

{% list tabs group=instructions %}

- Cloud Center UI {#cloud-center}

  1. Open the templates panel.
  1. Find the desired template.
  1. Right-click the template.
  1. Select **Delete**.
  1. Confirm the deletion.

  {% note info %}

  Deletion is restricted to the **Personal** and **Instance** categories. You cannot delete any shared templates.

  {% endnote %}

{% endlist %}

#### Useful links {#see-also}

* [Investigations](../../concepts/investigations.md)
* [Queries](../../concepts/queries.md)
* [Managing queries](manage-queries.md)
* [Working with a database schema and datasets](work-with-schema-datasets.md)