---
type: api
title: Delete an unreferenced trained model
description: The request deletes a trained inference model that is not referenced by an ingest pipeline.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-ml-delete-trained-model
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-ml-delete-trained-model
products:
  - Elasticsearch
---

# Delete an unreferenced trained model

Availability: 7.10+

## Paths

- `DELETE` `/_ml/trained_models/{model_id}`

- [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

- `model_id` (string Id)
  The unique identifier of the trained model.

## Description

The request deletes a trained inference model that is not referenced by an ingest pipeline.

## Required authorization

* Cluster privileges: `manage_ml`

## Query String Parameters

- `force` (boolean)
  Forcefully deletes a trained model that is referenced by ingest pipelines or has a started deployment.
- `timeout` (string Duration · default: 30s)
  Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

## 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
DELETE _ml/trained_models/regression-job-one-1574775307356
```

#### JavaScript

```javascript
const response = await client.ml.deleteTrainedModel({
  model_id: "regression-job-one-1574775307356",
});
```

#### Python

```python
resp = client.ml.delete_trained_model(
    model_id="regression-job-one-1574775307356",
)
```

#### curl

```curl
curl -X DELETE "$ELASTICSEARCH_URL/_ml/trained_models/regression-job-one-1574775307356" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.ml().deleteTrainedModel(d -> d
    .modelId("regression-job-one-1574775307356")
);
```

#### C#

```c#
var response = await client.MachineLearning.DeleteTrainedModelAsync(modelId: "regression-job-one-1574775307356");
```

#### PHP

```php
$resp = $client->ml()->deleteTrainedModel([
    "model_id" => "regression-job-one-1574775307356",
]);
```

#### Ruby

```ruby
response = client.ml.delete_trained_model(
  model_id: "regression-job-one-1574775307356"
)
```

## Response Examples

#### Ml delete trained model response example1

A successful response when deleting an existing trained inference model.

```json
{
  "acknowledged": true
}
```

