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

# Reset an anomaly detection job

## 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 use 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}"
  ```
  
  For more information about where to find API keys for the Elasticsearch endpoint (${ES_URL}) for a project, go to [Get started with Elasticsearch Serverless](https://www.elastic.co/docs/solutions/search/serverless-elasticsearch-get-started).

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

