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

# Delete an inference endpoint


Availability: Generally available since 8.11

## Paths

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

#### Path parameters

- `task_type` (enum) — 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) — required
  The inference identifier.

## Description

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

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

- `dry_run` (boolean · default: false) — optional
  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) — optional
  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"
)
```

