---
title: "create query"
method: POST
path: "/queries"
tags: ["query"]
---

# create query

`POST /queries`

## Request body

- QueryAPIModifyQuery
  - `description` string — The description of the query
  - `emailConfig` QueryAPIEmailConfig
    - `preferAttachment` boolean — If true, prefer sending query results as attachment (if possible within 10MB limit). Otherwise results will be sent via link
    - `recipients` string[] — List of email addresses to send the query results to
    - `sendEmpty` boolean — If true, sends an email even if the query returned no rows
  - `name` string, required — The name of the query
  - `schedule` QueryAPISchedule
    - `cron` string — The cron expression
    - `disabled` boolean — Disable the schedule
    - `rateMinutes` integer
    - `timeoutMinutes` integer
  - `sql` string, required — The raw sql of the query

## Response `200`

OK response.

- QueryAPIQuery
  - `createdAt` string
  - `description` string — The description of the query
  - `emailConfig` QueryAPIEmailConfig
    - `preferAttachment` boolean — If true, prefer sending query results as attachment (if possible within 10MB limit). Otherwise results will be sent via link
    - `recipients` string[] — List of email addresses to send the query results to
    - `sendEmpty` boolean — If true, sends an email even if the query returned no rows
  - `id` string — The generated ID of the query
  - `managed` boolean — Determines if the query is managed by panther
  - `name` string — The name of the query
  - `schedule` QueryAPISchedule
    - `cron` string — The cron expression
    - `disabled` boolean — Disable the schedule
    - `rateMinutes` integer
    - `timeoutMinutes` integer
  - `sql` string — The raw sql of the query
  - `updatedAt` string

## Other responses

- `400` — bad_request: Bad Request response.
- `409` — exists: Conflict response.

---

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