---
type: api
title: Delete an inference endpoint
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-inference-delete
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-inference-delete
products:
  - Elasticsearch
---

# Delete an inference endpoint


Availability: 8.11+

## Paths

- `DELETE` `/_inference/{task_type}/{inference_id}`
- `DELETE` `/_inference/{inference_id}`

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

#### Path Parameters

- `task_type` (enum TaskType) — optional, leave it out to use `/_inference/{inference_id}`
  The task type
  Values: `sparse_embedding`, `text_embedding`, `rerank`, `completion`, `chat_completion`, `embedding`
- `inference_id` (string Id)
  The inference identifier.

## Description

This API requires the manage_inference cluster privilege (the built-in `inference_admin` role grants this privilege).

## Query String Parameters

- `dry_run` (boolean · default: false)
  When true, checks the semantic_text fields and inference processors that reference the endpoint and returns them in a list, but does not delete the endpoint.
- `force` (boolean · default: false)
  When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields.

## Response

`application/json`

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

#### Console

```console
DELETE /_inference/sparse_embedding/my-elser-model
```

#### JavaScript

```javascript
const response = await client.inference.delete({
  task_type: "sparse_embedding",
  inference_id: "my-elser-model",
});
```

#### Python

```python
resp = client.inference.delete(
    task_type="sparse_embedding",
    inference_id="my-elser-model",
)
```

#### curl

```curl
curl -X DELETE "$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.inference().delete(d -> d
    .inferenceId("my-elser-model")
    .taskType(TaskType.SparseEmbedding)
);
```

#### C#

```c#
var response = await client.Inference
    .DeleteAsync(new DeleteInferenceRequest()
    {
        InferenceId = "my-elser-model",
        TaskType = TaskType.SparseEmbedding
    });
```

#### PHP

```php
$resp = $client->inference()->delete([
    "task_type" => "sparse_embedding",
    "inference_id" => "my-elser-model",
]);
```

#### Ruby

```ruby
response = client.inference.delete(
  task_type: "sparse_embedding",
  inference_id: "my-elser-model"
)
```

