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

# Save query worker

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

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

Save a query for a user for a fabric.

## Path parameters

- `fabric` string, string, required

## Request body

- UserQueriesCreateUserQueries
  - `query` UserQueriesCreateDataFormat: Specify the query parameters.
    - `name` string, required: Name for the query.
    - `parameter` object: bindVars for the query.
    - `value` string: Value of the query.
    - `type` 'c8ql' | 'sql': Query language.

## Response `200`

Successfully saved query.

- QueryWorkersPostRestqlRc200
  - `code` integer: HTTP response code.
  - `error` boolean: Flag if there is an error in response. *False* for this response.
  - `result` object
    - `userid` string: The userid
    - `tenant` string: The tenant
    - `fabric` string: The fabric
    - `name` string: Query name
    - `value` string: The query being saved
    - `_key` string: The key for this record
    - `type` string: Record Type

## 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 the GeoFabric.

---

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