---
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/4371/api/doc/elasticsearch/operation/operation-ml-reset-job
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-ml-reset-job
products:
  - Elasticsearch
---

# Reset an anomaly detection job

Availability: 7.14+

## Paths

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

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#bearerauth)

#### Path Parameters

- `job_id` (string Id)
  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)
  Should this request wait until the operation has completed before
returning.
- `delete_user_annotations` (boolean · default: false)
  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"
)
```

