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

# Deactivate a watch

Authentication: required

## 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`

## Response

`application/json`

- `status` (object)
  - `actions` (object)
  - `state` (object)
    - `active` (boolean)
    - `timestamp` (union oneOf)
      One of: `string` or `number`
  - `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"
)
```

## 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
{
  "status": {
    "actions": {
      "key": {
        "ack": {
          "state": "awaits_successful_execution"
        },
        "last_execution": {
          "successful": false,
          "reason": "string"
        },
        "last_successful_execution": {
          "successful": false,
          "reason": "string"
        },
        "last_throttle": {
          "reason": "string"
        }
      }
    },
    "state": {
      "active": false,
      "timestamp": "string"
    },
    "version": 0
  }
}
```

