> 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/getassessmentqueryspecdestinationnodes.md). Agents can also search and read this documentation through its [MCP server](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/~gitbook/mcp).

# Get query spec node destinations

List the destination entities, with effective permissions, for one entity in a query spec's results.

Returns the destination entities related to one source entity in the results of a query spec, including the raw and effective permissions between them. The query spec isn't saved; for a saved query, use [Get query node destinations](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/getassessmentquerydestinationnodes.md).

## Endpoint

```sh
POST /api/v1/assessments/query_spec:destination_nodes
```

This endpoint requires one of these built-in [roles](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/administration/administration/users/roles.md): **Administrator**, **Operator**, **Access Reviews Admin**, **Viewer**, **NHI Security Admin**, **Dashboard Viewer**, or **Remediation Owner**. Requests from other roles return `PermissionDenied`.

{% openapi src="/files/Aco9gj4MY2XoNiD4zIjr" path="/api/v1/assessments/query\_spec:destination\_nodes" method="post" %}
[openapi.yaml](https://1967633068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MZDkWMxox3pekd0NsZJ%2Fuploads%2Fgit-blob-7be9b9d3020988e9379a0e5e39ed089aa98633f5%2Fopenapi.yaml?alt=media)
{% endopenapi %}

## Request

Unlike [Get query spec nodes](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/getassessmentqueryspecnodes.md), this endpoint wraps the query spec in a `spec` field:

| Field            | Type           | Required? | Description                                                                                                                                                                               |
| ---------------- | -------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `spec`           | object (body)  | Yes       | The query spec. It must include `relates_to_exp`. For every field, see [Query Builder Parameters](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/parameters.md). |
| `source_node_id` | string (body)  | Yes       | The `id` of the source entity, from the query's results, to list destinations for.                                                                                                        |
| `snapshot_id`    | string (body)  | No        | A Time Machine snapshot ID, to query historical data instead of the current graph.                                                                                                        |
| `order_by`       | string (query) | No        | `risk_score ASC` or `risk_score DESC`.                                                                                                                                                    |

This endpoint isn't paginated: it returns up to 10,000 destinations in one response. Omit `page_size` and `page_token`; a `page_size` greater than `0` is rejected.

## Examples

Set `VEZA_URL` and `VEZA_TOKEN` as described in [API tokens](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/authentication/api-tokens.md).

List the S3 buckets that one IAM user from the [Get query spec nodes](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/getassessmentqueryspecnodes.md#examples) example can change ACLs on:

```bash
curl -X POST "$VEZA_URL/api/v1/assessments/query_spec:destination_nodes" \
  -H "Authorization: Bearer $VEZA_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{
    "spec": {
      "query_type": "SOURCE_TO_DESTINATION",
      "node_relationship_type": "EFFECTIVE_ACCESS",
      "source_node_types": {
        "nodes": [{ "node_type": "AwsIamUser" }]
      },
      "relates_to_exp": {
        "specs": [
          {
            "node_types": { "nodes": [{ "node_type": "S3Bucket" }] },
            "raw_permissions": { "operator": "OR", "values": ["s3:PutBucketAcl"] }
          }
        ]
      }
    },
    "source_node_id": "arn:aws:iam::123456789012:user/jdoe"
  }'
```

Example response (constructed from `AssessmentQueryNodesResponse`; entity properties vary by type and are shortened here):

```json
{
  "values": [
    {
      "id": "arn:aws:s3:::example-logs-bucket",
      "type": "S3Bucket",
      "properties": {
        "aws_account_id": "123456789012",
        "name": "example-logs-bucket",
        "region": "us-east-1"
      },
      "destination_node_count": 0,
      "permissions": [],
      "engagement_access_stats": null,
      "access_stats": null,
      "destination_node_ids": [],
      "risk_level": "NONE",
      "raw_permissions": ["s3:PutBucketAcl", "s3:GetObject"],
      "effective_permissions": ["Metadata", "Read"],
      "unsupported_conditions": {},
      "destination_node_percentage_of_total": 0,
      "tags": [],
      "specified_tags": [],
      "filtered_raw_permissions": [],
      "corresponding_effective_permissions": [],
      "single_entity_access_stats": null,
      "additional_node_properties": null,
      "integration_type": "aws",
      "joined_nodes": {},
      "additional_spec_properties": null
    }
  ],
  "path_values": [],
  "next_page_token": "",
  "has_more": false
}
```

`permissions` and `destination_node_ids` are deprecated; read `raw_permissions` and `effective_permissions` instead.

## Errors and limits

A spec with no `relates_to_exp` (or deprecated `destination_node_types`) returns a validation error on `body.spec` with the description `Must define destination_node_types or relates_to_exp`. A `page_size` greater than `0` returns `InvalidArgument` (HTTP 400) with the description `Must be less than or equal to 0` on `page_size`.

For shared status codes and the error body, see [Troubleshooting](https://docs.veza.com/4yItIzMvkpAvMVFAamTf/developers/api/errors.md).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
