> For the complete documentation index, see [llms.txt](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/listassessmentqueries.md).

# List saved queries

ListAssessmentQueries retrieves a list of all built-in and user-created queries.

By default, this endpoint returns only the queries that are currently enabled. When the `risks_only` parameter is set to true, it will only return queries with a risk level.

To indicate whether each query has at least one [rule](/4yItIzMvkpAvMVFAamTf/features/insights/rules-and-alerts.md) with an action attached, such as a **Send Alert** notification or a **Create Review** certification, set `include_has_action` to `true`. The response then populates a `has_action` field (`true` or `false`) for each query. When `include_has_action` is omitted, `has_action` is absent and should be treated as "not computed" rather than `false`. Use the `action_filter` parameter to return only queries with a given action state: `0` (the default) returns all queries, `1` returns only queries with actions, and `2` returns only queries without actions.

{% openapi src="/files/Aco9gj4MY2XoNiD4zIjr" path="/api/v1/assessments/queries" method="get" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-0d9d5973a247f0dc34943ed932d00eb6f5a41e3e%2Fopenapi.yaml?alt=media)
{% endopenapi %}

Sample request

```bash
curl -X 'GET' \
"$BASE_URL/api/v1/assessments/queries?page_size=1&risks_only=true&filter=name+co+%22User%22" \
-H "authorization: Bearer $VEZA_TOKEN"
```

Sample response:

```json
{
  "values": [
    {
      "id": "95ccaca3-c9f6-4711-9219-887e5c102701",
      "name": "AWS IAM Groups with iam:CreateAccessKey permission",
      "description": "AWS IAM Groups with iam:CreateAccessKey permission",
      "result_type": "NUMBER",
      "query_type": "SYSTEM_CREATED",
      "raw_permissions": {
        "values": [],
        "operator": "AND"
      },
      "effective_permissions": {
        "values": [],
        "operator": "AND"
      },
      "variables": [
        "AWS_ACCOUNT_LIST"
      ],
      "source_node_types": {
        "nodes": [
          {
            "node_type": "AwsIamGroup",
            "tags": [],
            "conditions": [],
            "condition_expression": {
              "specs": [
                {
                  "fn": "IN",
                  "property": "aws_account_id",
                  "value": [
                    "527398259632",
                    "877042069677",
                    "340069577982",
                    "241721837758",
                    "998048473876",
                    "973979857296"
                  ],
                  "not": false,
                  "value_property_name": "",
                  "value_property_from_other_node": false
                }
              ],
              "child_expressions": [],
              "operator": "AND",
              "not": false
            },
            "node_id": "",
            "excluded_tags": [],
            "count_conditions": [],
            "direct_relationship_only": false,
            "node_type_grouping_constraint": null
          }
        ],
        "nodes_operator": "AND"
      },
      "required_intermediate_node_types": {
        "nodes": [],
        "nodes_operator": "AND"
      },
      "avoided_intermediate_node_types": {
        "nodes": [],
        "nodes_operator": "AND"
      },
      "destination_node_types": {
        "nodes": [],
        "nodes_operator": "AND"
      },
      "no_relation": false,
      "access_filter": null,
      "created_by": "",
      "visibility": "PUBLIC",
      "owners": [],
      "node_relationship_type": "CONFIGURED",
      "integration_types": [
        "aws"
      ],
      "labels": [],
      "created_at": "2023-02-01T04:32:18.126875729Z",
      "updated_at": "2023-04-07T16:00:52.761867936Z",
      "source_type": "AwsIamGroup",
      "destination_types": [],
      "relates_to_exp": {
        "specs": [
          {
            "node_types": {
              "nodes": [
                {
                  "node_type": "AwsIamGroupedPermission",
                  "tags": [],
                  "conditions": [],
                  "condition_expression": {
                    "specs": [
                      {
                        "fn": "LIST_CONTAINS",
                        "property": "permissions",
                        "value": "iam:CreateAccessKey",
                        "not": false,
                        "value_property_name": "",
                        "value_property_from_other_node": false
                      },
                      {
                        "fn": "EXISTS",
                        "property": "deny",
                        "value": null,
                        "not": true,
                        "value_property_name": "",
                        "value_property_from_other_node": false
                      }
                    ],
                    "child_expressions": [],
                    "operator": "AND",
                    "not": false
                  },
                  "node_id": "",
                  "excluded_tags": [],
                  "count_conditions": [],
                  "direct_relationship_only": false,
                  "node_type_grouping_constraint": null
                }
              ],
              "nodes_operator": "AND"
            },
            "required_intermediate_node_types": null,
            "avoided_intermediate_node_types": null,
            "raw_permissions": null,
            "effective_permissions": null,
            "no_relation": false,
            "direction": "ANY_DIRECTION"
          }
        ],
        "child_expressions": [],
        "operator": "AND",
        "not": false,
        "and_op_type": "INFERRED"
      },
      "all_entity_condition": {
        "specs": [],
        "child_expressions": [],
        "operator": "AND",
        "not": false
      },
      "risk_level": "WARNING",
      "risk_suppressed_constraints": null,
      "analysis_type": "UNSET",
      "result": 0,
      "result_evaluated_at": null,
      "result_evaluated": false
    }
  ],
  "next_page_token": "eyJOZXh0Q3Vy==",
  "has_more": true
}
```

See [Parameters](/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/parameters.md) for more information about the saved query object.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/listassessmentqueries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
