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

# Reset an anomaly detection job

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`

## 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/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

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

