[role="xpack"]
[[stop-trained-model-deployment]]
= Stop trained model deployment API
[subs="attributes"]
++++
<titleabbrev>Stop trained model deployment</titleabbrev>
++++

Stops a trained model deployment.

[[stop-trained-model-deployment-request]]
== {api-request-title}

`POST _ml/trained_models/<deployment_id>/deployment/_stop`

[[stop-trained-model-deployment-prereq]]
== {api-prereq-title}

Requires the `manage_ml` cluster privilege. This privilege is included in the
`machine_learning_admin` built-in role.

[[stop-trained-model-deployment-desc]]
== {api-description-title}

Deployment is required only for trained models that have a PyTorch `model_type`.

[[stop-trained-model-deployment-path-params]]
== {api-path-parms-title}

`<deployment_id>`::
(Required, string)
include::{es-ref-dir}/ml/ml-shared.asciidoc[tag=deployment-id]


[[stop-trained-model-deployment-query-params]]
== {api-query-parms-title}

`allow_no_match`::
(Optional, Boolean)
include::{es-ref-dir}/ml/ml-shared.asciidoc[tag=allow-no-match-deployments]

`force`::
(Optional, Boolean) If true, the deployment is stopped even if it or one of its
model aliases is referenced by ingest pipelines. You can't use these pipelines
until you restart the model deployment.

`finish_pending_work`::
(Optional, Boolean) If true, the deployment is stopped after any queued work is completed. Defaults to `false`.

////
[role="child_attributes"]
[[stop-trained-model-deployment-results]]
== {api-response-body-title}
////

////
[[stop-trained-models-response-codes]]
== {api-response-codes-title}
////

[[stop-trained-model-deployment-example]]
== {api-examples-title}

The following example stops the `my_model_for_search` deployment:

[source,console]
--------------------------------------------------
POST _ml/trained_models/my_model_for_search/deployment/_stop
--------------------------------------------------
