---
title: "Submit an ad hoc stream query and get the result"
method: POST
path: "/_fabric/{fabric}/_api/streamapps/query/{appName}"
tags: ["Stream Workers"]
---

# Submit an ad hoc stream query and get the result

`POST /_fabric/{fabric}/_api/streamapps/query/{appName}`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/macrometa/apis/macrometa-api-reference/docs/_fabric/:fabric/_api/streamapps/query/:appName/post.ts> (a function with typed inputs; its response is checked against the schema)

Submit an ad hoc stream query and get the resulting records from a store.

## Path parameters

- `fabric` string, required
- `appName` string, required

## Request body

- StreamAppQueryRequest
  - `query` string

## Response `200`

Successfully ran query.

- StreamAppQueryResponse
  - `records` array[]
    - object[]

## Other responses

- `400`: Failed due to missing or malformed data. Verify that all parameters are complete.
- `422`: Failed to run query because there is an error in the stream application definition

---

[API](https://skmtc.dev/macrometa/apis/macrometa-api-reference.md) - [All operations](https://skmtc.dev/macrometa/apis/macrometa-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/macrometa/apis/macrometa-api-reference/revisions/2006b6d7f31d?raw)
