# Get query spec results (async)

Submit an assessment query specification for asynchronous execution, returning full result rows.

This is the async equivalent of [Get query spec results](/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/getassessmentqueryspecresult.md), for queries that may take longer than the synchronous request timeout allows.

The response contains an `AsyncTask` with a task ID. Poll the task using `GetAssessmentAsyncTask` until `state` reaches `COMPLETE` (3), then check `status` for `SUCCEEDED` (1) or `FAILED` (2).

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

### Workflow

1. Submit the query using this endpoint. The request body uses the same `GetAssessmentQuerySpecResultRequest` as the synchronous endpoint.
2. The response includes an `AsyncTask` with an `id` field.
3. Poll the task status using [GetAssessmentAsyncTask](/4yItIzMvkpAvMVFAamTf/developers/api/query-builder/getassessmentasynctask.md) (`GET /api/v1/assessments/async_tasks/{id}`).
4. When `state` = `3` (COMPLETE) and `status` = `1` (SUCCEEDED), the `result` field contains the query output.

### AsyncTask state and status values

**State** (task lifecycle):

| Value | Name           | Description               |
| ----- | -------------- | ------------------------- |
| 0     | UNKNOWN\_STATE | Default/unset             |
| 1     | PENDING        | Queued, not yet started   |
| 2     | IN\_PROGRESS   | Executing                 |
| 3     | COMPLETE       | Finished (check `status`) |

**Status** (outcome when complete):

| Value | Name            | Description        |
| ----- | --------------- | ------------------ |
| 0     | UNKNOWN\_STATUS | Default/unset      |
| 1     | SUCCEEDED       | Result available   |
| 2     | FAILED          | See `error_reason` |
| 3     | CANCELED        | Task was canceled  |

### Migration note

Several fields on `GetAssessmentQuerySpecResultRequest` are deprecated. Use `relates_to_exp` instead of `destination_node_types`, `required_intermediate_node_types`, `avoided_intermediate_node_types`, `raw_permissions`, `effective_permissions`, and `no_relation`.


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
