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

# Filter Operations

> Operations for saving and managing search filters.

Operations for saving and managing search filters.

<Note>
  **See also**

  `find_saved_filter()` and `find_saved_filters()` are in [Configuration](/sgc/api/client/mixins/config).
</Note>

Bases: `StashClientProtocol`

Mixin for filter-related client methods.

## Functions

### save\_filter

```python theme={null}
save_filter(
    input_data: SaveFilterInput | dict[str, Any],
) -> SavedFilter
```

Save or update a filter.

Parameters:

| Name         | Type                                | Description                           | Default    |
| ------------ | ----------------------------------- | ------------------------------------- | ---------- |
| `input_data` | `SaveFilterInput \| dict[str, Any]` | SaveFilterInput object or dictionary. | *required* |

Returns:

| Type          | Description                                   |
| ------------- | --------------------------------------------- |
| `SavedFilter` | SavedFilter object with the saved filter data |

Examples:

Save a new filter:

```python theme={null}
from stash_graphql_client.types import SaveFilterInput, FilterMode

input_data = SaveFilterInput(
    mode=FilterMode.SCENES,
    name="My Favorite Scenes",
    find_filter={"per_page": 25},
    object_filter={"is_missing": "performers"}
)
saved_filter = await client.save_filter(input_data)
```

Update an existing filter:

```python theme={null}
input_data = SaveFilterInput(
    id="123",
    mode=FilterMode.SCENES,
    name="Updated Filter Name"
)
saved_filter = await client.save_filter(input_data)
```

### destroy\_saved\_filter

```python theme={null}
destroy_saved_filter(
    input_data: DestroyFilterInput | dict[str, Any],
) -> bool
```

Delete a saved filter.

Parameters:

| Name         | Type                                   | Description                              | Default    |
| ------------ | -------------------------------------- | ---------------------------------------- | ---------- |
| `input_data` | `DestroyFilterInput \| dict[str, Any]` | DestroyFilterInput object or dictionary. | *required* |

Returns:

| Type   | Description                                 |
| ------ | ------------------------------------------- |
| `bool` | True if the filter was successfully deleted |

Examples:

```python theme={null}
from stash_graphql_client.types import DestroyFilterInput

input_data = DestroyFilterInput(id="123")
success = await client.destroy_saved_filter(input_data)
```

Using a dictionary:

```python theme={null}
success = await client.destroy_saved_filter({"id": "123"})
```
