---
title: "Copy a saved query"
method: POST
path: "/api/osquery/saved_queries/{id}/copy"
tags: ["Security Osquery API"]
---

# Copy a saved query

`POST /api/osquery/saved_queries/{id}/copy`

**Spaces method and path for this operation:**

<div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/osquery/saved_queries/{id}/copy</span></div>

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Create a copy of a saved query with a unique name by appending a `_copy` suffix. If the name already exists, a numeric suffix is added (e.g., `_copy_2`).

## Path parameters

- `id` string, required — The ID of a saved query.

## Response `200`

Indicates a successful call.

- SecurityOsqueryAPICopySavedQueryResponse — The response for copying a saved query.
  - `data` object, required
    - `created_at` string, date-time
    - `created_by` string, nullable
    - `created_by_profile_uid` string
    - `description` string — The saved query description.
    - `ecs_mapping` SecurityOsqueryAPIECSMapping — Map osquery results columns or static values to Elastic Common Schema (ECS) fields
    - `id` string, required — The ID of a saved query.
    - `interval` union
      - integer
      - string
    - `platform` string — Restricts the query to a specified platform. The default is all platforms. To specify multiple platforms, use commas. For example, `linux,darwin`.
    - `query` string — The SQL query you want to run.
    - `removed` boolean — Indicates whether the query is removed.
    - `saved_object_id` string, required
    - `snapshot` boolean — Indicates whether the query is a snapshot.
    - `timeout` integer
    - `updated_at` string, date-time
    - `updated_by` string, nullable
    - `updated_by_profile_uid` string

---

[API](https://skmtc.net/elastic/apis/kibana-apis.md) · [All operations](https://skmtc.net/elastic/apis/kibana-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/kibana-apis/revisions/531c9e2a7d23/schema)
