[role="xpack"]
[[delete-inference-api]]
=== Delete {infer} API

experimental[]

Deletes an {infer} endpoint.

IMPORTANT: The {infer} APIs enable you to use certain services, such as built-in {ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face.
For built-in models and models uploaded through Eland, the {infer} APIs offer an alternative way to use and manage trained models.
However, if you do not plan to use the {infer} APIs to use these models or if you want to use non-NLP models, use the <<ml-df-trained-models-apis>>.


[discrete]
[[delete-inference-api-request]]
==== {api-request-title}

`DELETE /_inference/<inference_id>`

`DELETE /_inference/<task_type>/<inference_id>`

[discrete]
[[delete-inference-api-prereqs]]
==== {api-prereq-title}

* Requires the `manage_inference` <<privileges-list-cluster,cluster privilege>>
(the built-in `inference_admin` role grants this privilege)


[discrete]
[[delete-inference-api-path-params]]
==== {api-path-parms-title}

<inference_id>::
(Required, string)
The unique identifier of the {infer} endpoint to delete.

<task_type>::
(Optional, string)
The type of {infer} task that the model performs.


[discrete]
[[delete-inference-query-parms]]
== {api-query-parms-title}

`dry_run`::
(Optional, Boolean)
When `true`, checks the `semantic_text` fields and  {infer} processors that reference the endpoint and returns them in a list, but does not delete the endpoint.
Defaults to `false`.

`force`::
(Optional, Boolean)
Deletes the endpoint regardless if it's used in a `semantic_text` field or in an {infer} pipeline.


[discrete]
[[delete-inference-api-example]]
==== {api-examples-title}

The following API call deletes the `my-elser-model` {infer} model that can
perform `sparse_embedding` tasks.


[source,console]
------------------------------------------------------------
DELETE /_inference/sparse_embedding/my-elser-model
------------------------------------------------------------
// TEST[skip:TBD]


The API returns the following response:

[source,console-result]
------------------------------------------------------------
{
  "acknowledged": true
}
------------------------------------------------------------
// NOTCONSOLE
