---
type: api
title: Delete a saved query
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/kibana/v8/operation/operation-osquerydeletesavedquery
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/kibana/v8/operation/operation-osquerydeletesavedquery
products:
  - Kibana
---

# Delete a saved query

Authentication: required

- Server: `https://{kibana_url}`

## Paths

- `DELETE` `/api/osquery/saved_queries/{id}`
- `DELETE` `/s/{space_id}/api/osquery/saved_queries/{id}`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.
- `id` (string) — required
  Example: `3c42c847-eb30-4452-80e0-728584042334`

## Description

Delete a saved query using the query ID.

## Response

OK

`application/json`

Type: `object`

## Code examples

#### Console

```console
DELETE kbn:/api/osquery/saved_queries/3c42c847-eb30-4452-80e0-728584042334
```

#### curl

```curl
curl -X DELETE "${KIBANA_URL}/api/osquery/saved_queries/3c42c847-eb30-4452-80e0-728584042334" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{}
```

