> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete an ML Model

> Delete an ML model by ID or name, with soft/hard delete options

# Delete an ML Model

Delete an ML model by ID or fully qualified name. Supports soft delete (default), hard delete, and restore operations.

## Delete by ID

<ParamField path="id" type="string" required>
  UUID of the ML model to delete.
</ParamField>

<ParamField query="recursive" type="boolean" default="false">
  Recursively delete child entities.
</ParamField>

<ParamField query="hardDelete" type="boolean" default="false">
  Permanently delete the ML model. If `false`, the ML model is soft-deleted and can be restored.
</ParamField>

## Delete by Name

Use `DELETE /v1/mlmodels/name/{fqn}` to delete by fully qualified name.

<ParamField path="fqn" type="string" required>
  Fully qualified name of the ML model (e.g., `mlflow_svc.customer_segmentation`).
</ParamField>

<ParamField query="recursive" type="boolean" default="false">
  Recursively delete child entities.
</ParamField>

<ParamField query="hardDelete" type="boolean" default="false">
  Permanently delete the ML model.
</ParamField>

## Restore a Soft-Deleted ML Model

Use `PUT /v1/mlmodels/restore` to restore a soft-deleted ML model.

<ParamField body="id" type="string" required>
  UUID of the soft-deleted ML model to restore.
</ParamField>

<RequestExample dropdown>
  ```python DELETE /v1/mlmodels/{id} theme={null}
  from metadata.sdk import configure
  from metadata.sdk.entities import MLModels

  configure(
      host="https://your-company.open-metadata.org/api",
      jwt_token="your-jwt-token"
  )

  # Soft delete by ID
  MLModels.delete("6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2")

  # Hard delete
  MLModels.delete(
      "6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2",
      hard_delete=True
  )

  # Delete by name
  MLModels.delete_by_name("mlflow_svc.customer_segmentation")

  # Delete by name with options
  MLModels.delete_by_name(
      "mlflow_svc.customer_segmentation",
      hard_delete=True
  )

  # Restore a soft-deleted ML model
  MLModels.restore("6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2")
  ```

  ```java DELETE /v1/mlmodels/{id} theme={null}
  import static org.openmetadata.sdk.fluent.MlModels.*;

  // Soft delete
  MlModels.delete("6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2").execute();

  // Hard delete
  MlModels.delete("6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2")
      .hardDelete()
      .execute();

  // Delete by name
  MlModels.deleteByName("mlflow_svc.customer_segmentation").execute();

  // Restore
  MlModels.restore("6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2");
  ```

  ```bash DELETE /v1/mlmodels/{id} theme={null}
  # Soft delete by ID
  curl -X DELETE "{base_url}/api/v1/mlmodels/6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2" \
    -H "Authorization: Bearer {access_token}"

  # Hard delete
  curl -X DELETE "{base_url}/api/v1/mlmodels/6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2?hardDelete=true" \
    -H "Authorization: Bearer {access_token}"

  # Delete by name
  curl -X DELETE "{base_url}/api/v1/mlmodels/name/mlflow_svc.customer_segmentation" \
    -H "Authorization: Bearer {access_token}"

  # Restore soft-deleted ML model
  curl -X PUT "{base_url}/api/v1/mlmodels/restore" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: application/json" \
    -d '{"id": "6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2"}'
  ```
</RequestExample>

<ResponseExample>
  ```json Response (Soft Delete) theme={null}
  {
    "id": "6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2",
    "name": "customer_segmentation",
    "fullyQualifiedName": "mlflow_svc.customer_segmentation",
    "displayName": "Customer Segmentation Model",
    "algorithm": "KMeans",
    "version": 0.2,
    "updatedAt": 1769982669247,
    "updatedBy": "admin",
    "service": {
      "id": "ca22d46e-81b9-4e48-85b5-0adc44980da9",
      "type": "mlmodelService",
      "name": "mlflow_svc",
      "fullyQualifiedName": "mlflow_svc"
    },
    "serviceType": "Mlflow",
    "deleted": true,
    "owners": [],
    "tags": [],
    "domains": []
  }
  ```
</ResponseExample>

***

## Returns

Soft delete returns the ML model object with `deleted: true`. Hard delete returns no content (204). Restore returns the restored ML model object.

***

## Error Handling

| Code  | Error Type     | Description                                   |
| ----- | -------------- | --------------------------------------------- |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token       |
| `403` | `FORBIDDEN`    | User lacks permission to delete this ML model |
| `404` | `NOT_FOUND`    | ML model with given ID or FQN does not exist  |
