---
title: "Upsert a query to a stream"
method: PUT
path: "/api/streams/{name}/queries/{queryId}"
tags: ["significant_events"]
deprecated: true
---

# Upsert a query to a stream

`PUT /api/streams/{name}/queries/{queryId}`

> **Deprecated.**

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

<div><span class="operation-verb put">put</span>&nbsp;<span class="operation-path">/s/{space_id}/api/streams/{name}/queries/{queryId}</span></div>

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

Adds a query to a stream. Noop if the query is already present on the stream.<br/><br/>[Required authorization] Route required privileges: manage_stream.

## Path parameters

- `name` string, required
- `queryId` string, required

## Headers

- `kbn-xsrf` string, required

## Request body

- object
  - `description` string
  - `esql` object, required
    - `query` string, required
  - `evidence` string[]
  - `expires_at` string, date-time
  - `severity_score` number
  - `title` string, required — A non-empty string.

## Response `200`

The query was added or updated successfully.

---

[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/versions/531c9e2a7d23/schema)
