---
type: api
title: Reset an anomaly detection job
description: All model state and results are deleted. The job is ready to start over as if
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/operation/operation-ml-reset-job
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/operation/operation-ml-reset-job
products:
  - Elasticsearch
---

# Reset an anomaly detection job

Authentication: required

Availability: Generally available since 7.14

## Paths

- `POST` `/_ml/anomaly_detectors/{job_id}/_reset`

#### Path parameters

- `job_id` (string) — required
  The ID of the job to reset.

## Description

All model state and results are deleted. The job is ready to start over as if
it had just been created.
It is not currently possible to reset multiple jobs using wildcards or a
comma separated list.

## Required authorization

- Cluster privileges: `manage_ml`

## Query string parameters

- `wait_for_completion` (boolean · default: true) — optional
  Should this request wait until the operation has completed before
returning.
- `delete_user_annotations` (boolean · default: false) — optional
  Specifies whether annotations that have been added by the
user should be deleted along with any auto-generated annotations when the job is
reset.

## Response

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code examples

#### Console

```console
POST _ml/anomaly_detectors/total-requests/_reset
```

#### JavaScript

```javascript
const response = await client.ml.resetJob({
  job_id: "total-requests",
});
```

#### Python

```python
resp = client.ml.reset_job(
    job_id="total-requests",
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_reset" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.ml().resetJob(r -> r
    .jobId("total-requests")
);
```

#### C#

```c#
var response = await client.MachineLearning.ResetJobAsync(jobId: "total-requests");
```

#### PHP

```php
$resp = $client->ml()->resetJob([
    "job_id" => "total-requests",
]);
```

#### Ruby

```ruby
response = client.ml.reset_job(
  job_id: "total-requests"
)
```

## 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
{
  "acknowledged": false
}
```

