---
title: "Run query worker"
method: POST
path: "/_fabric/{fabric}/_api/restql/execute/{name}"
tags: ["Query Workers"]
---

# Run query worker

`POST /_fabric/{fabric}/_api/restql/execute/{name}`

## 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/restql/execute/:name/post.ts> (a function with typed inputs; its response is checked against the schema)

Run a saved query for a given fabric. If there are more that 100 records (*default batch-size*), the *hasMore* flag is set to *true* and the *id* is set. This *id* is used to query subsequent records.

## Path parameters

- `fabric` string, string, required
- `name` string, string, required

## Request body

- UserQueriesExecuteSavedQueries
  - `bindVars` object: Specify the bindVars of the query.
  - `batchSize` integer: The maximum number of documents returned when fetching data from the query.

## Response `201`

Successfully ran the query.

- QueryWorkersPostRestqlExecuteRc201
  - `code` integer: HTTP response code.
  - `error` boolean: Flag if there is an error in response. *False* for this response.
  - `hasMore` boolean
  - `id` integer
  - `cached` boolean
  - `extra` object
    - `warnings` unknown[]
      - unknown
  - `result` ExamplesIdKeyRevData[]
    - `_id` string: ID of the collection.
    - `_key` string: _key details of collection.
    - `_rev` string: _rev details of collection.
    - `data` string: data in record.

## Other responses

- `400`: Failed due to missing or malformed data. Verify that all parameters are complete.
- `403`: Failed because you do not have access to run the query worker.

---

[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)
