# Quick Filters

List, create, and delete saved filters, globally or for a single workflow. Reviewers can pick from available quick filters under Certification *Filters* > *Saved Filters*.

| Method            | Syntax                                     |
| ----------------- | ------------------------------------------ |
| GET, POST, DELETE | `{Veza URL}/api/preview/awf/quick_filters` |

> Requests require a [Veza API key](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/authentication) for authentication.

### Examples

#### Add a quick filter

Add a quick filter by specifying an optional `workflow_id` and a single `source` or `destination` node property, corresponding to a Review interface column.

Filters can also apply to `abstract_permissions` or `concrete_permissions` (see [List Quick Filters](#list-all-quick-filters) example response).

Valid filter operators are:

* `co` "contains"
* `eq` "equals"
* `ne` "not equals"
* `sw` "starts with"
* `ew` "ends with"

With a `workflow_id` specified, the filter will only apply to certifications on that workflow. Otherwise, reviewers can apply the quick filter to any certification:

```shell
POST {Veza URL}/api/preview/awf/quick_filters
{
    "name": "custom filter",
    "filter": "source.type co \"admin\"",
    "workflow_id": "ad78350a-bfe5-4eff-a160-dccbe28c6961"
}
```

A successful response will contain the filter id, for example:

```json
{
    "id": "41761624-cb9c-4668-be69-3b0f359a45e3"
}
```

#### List all quick filters

```shell
GET {Veza URL}/api/preview/awf/quick_filters
```

Including a `workflow_id` in the query returns quick filters with a matching `workflow_id` and quick filters with no `workflow_id`:

```shell
GET {Veza URL}/api/preview/awf/quick_filters?workflow_id=78be0b3d-d6f4-4e5d-98c4-7b1db1a88575
```

Example response:

```shell
{
    "values": [
        {
            "id": "4a1dbf1a-282f-4faf-81f2-6ee3752b5cb2",
            "name": "User type = admin",
            "workflow_id": "78be0b3d-d6f4-4e5d-98c4-7b1db1a88575",
            "filter": "source.type eq \"admin\""
        },
        {
            "id": "69b131b0-8af5-4ab1-9099-91c03ca54555",
            "name": "abstract permissions include delete",
            "workflow_id": "",
            "filter": "abstract_permissions co \"Delete\""
        },
        {
            "id": "88e5d197-6555-4e3f-a48d-43713b340a2c",
            "name": "destination org filter",
            "workflow_id": "",
            "filter": "destination.google_cloud_organization_name eq \"acme\""
        },
        {
            "id": "df944da1-76fe-42e0-829e-b8bf0a200f39",
            "name": "concrete permissions include abort multipart upload",
            "workflow_id": "78be0b3d-d6f4-4e5d-98c4-7b1db1a88575",
            "filter": "concrete_permissions co \"s3:AbortMultipartUpload\""
        },
        {
            "id": "f722936d-a8f7-4b38-acb2-a41e12ec2673",
            "name": "User type is AwsIamUser",
            "workflow_id": "78be0b3d-d6f4-4e5d-98c4-7b1db1a88575",
            "filter": "source.type co \"AwsIamUser\""
        }
    ]
}
```

#### Remove quick filter by quick filter id

```shell
DELETE {Veza URL}/api/preview/awf/quick_filters/d31cfa3f-1999-4789-8ec1-a844c03dd622
```
