---
type: api
title: Deactivate a watch
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-watcher-deactivate-watch
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-watcher-deactivate-watch
products:
  - Elasticsearch
---

# Deactivate a watch


## Paths

- `POST` (also `PUT`) `/_watcher/watch/{watch_id}/_deactivate`

#### Path parameters

- `watch_id` (string) — required
  The watch identifier.

## Description

A watch can be either active or inactive.

[Read the reference documentation](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/how-watcher-works.html)

## Required authorization

- Cluster privileges: `manage_watcher`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/guide/en/elasticsearch/reference/current/token-authentication-services.html)

## Response

`application/json`

- `status` (object)
  - `actions` (object)
  - `state` (object)
    - `active` (boolean)
    - `timestamp` (union)
  - `version` (number)
## Code examples

#### Console

```console
POST _watcher/watch/my_watch/_deactivate
```

#### JavaScript

```javascript
const response = await client.watcher.deactivateWatch({
  watch_id: "my_watch",
});
```

#### Python

```python
resp = client.watcher.deactivate_watch(
    watch_id="my_watch",
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/_watcher/watch/my_watch/_deactivate" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.watcher().deactivateWatch(d -> d
    .watchId("my_watch")
);
```

#### PHP

```php
$resp = $client->watcher()->deactivateWatch([
    "watch_id" => "my_watch",
]);
```

#### Ruby

```ruby
response = client.watcher.deactivate_watch(
  watch_id: "my_watch"
)
```

