---
title: "Create Query"
method: POST
path: "/preview/queries/"
tags: ["Queries"]
---

# Create Query

`POST /preview/queries/`

## Query parameters

- `query_id` string, uuid, nullable

## Request body

- QueryCreateRequest
  - `query` QueryCreate, required
    - `folder_id` string, uuid, nullable
    - `flags` QueryFlags
    - `tags` object, nullable
    - `meta` object, nullable
    - `name` string, nullable
    - `description` string, nullable
    - `slug` string, nullable

## Response `200`

Successful Response

- QueryResponse
  - `count` integer
  - `query` Query
    - `folder_id` string, uuid, nullable
    - `flags` QueryFlags
    - `tags` object, nullable
    - `meta` object, nullable
    - `name` string, nullable
    - `description` string, nullable
    - `created_at` string, date-time, nullable
    - `updated_at` string, date-time, nullable
    - `deleted_at` string, date-time, nullable
    - `created_by_id` string, uuid, nullable
    - `updated_by_id` string, uuid, nullable
    - `deleted_by_id` string, uuid, nullable
    - `slug` string, nullable
    - `id` string, uuid, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2026-02-13** `72fe88316d15` — 1 breaking, 7 info
  - removed `subschema #1` from the `query/flags` request property `anyOf` list
  - added the new optional request property `query/folder_id`
  - added `#/components/schemas/QueryFlags` to the `query/flags` request property `anyOf` list
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - …4 more
- **2026-01-14** `53da4c9de2b7` — 2 breaking, 2 info
  - request property `query/tags/anyOf[subschema #1]/additionalProperties/` list-of-types was narrowed by removing types `integer, null and number` from media type `application/json`
  - response property `query/anyOf[subschema #1: Query]/flags/anyOf[subschema #1]/additionalProperties/` list-of-types was widened by adding types `object` to media type `application/json` of response `200`
  - request property `query/flags/anyOf[subschema #1]/additionalProperties/` list-of-types was widened by adding types `object` to media type `application/json`
  - response property `query/anyOf[subschema #1: Query]/tags/anyOf[subschema #1]/additionalProperties/` list-of-types was narrowed by removing types `integer, null and number` from media type `application/json` of response `200`
- **2025-11-05** `e62506c24377` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/preview/queries/post.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agenta-ai/agenta-api/revisions/42bb75a1c2e6/schema)
