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

# Update an ML Model

> Create or update an ML model with a full request body

# Update an ML Model

Create an ML model or update it if it already exists, using `PUT /v1/mlmodels` with the full request body. Send the complete definition, not just the fields you want to change. To change only some fields, use `PATCH` with a JSON Patch array and the `application/json-patch+json` content type, as shown in the PATCH examples below.

## Body Parameters

**name** `string` *required*

Name of the ML model. Must be unique within the parent ML model service.

**service** `string` *required*

Fully qualified name of the parent MlModelService (for example, `mlflow_svc`).

**algorithm** `string`

Algorithm used by the ML model (for example, `KMeans`, `RandomForest`, `XGBoost`, `Neural Network`).

**displayName** `string`

Human-readable display name for the ML model.

**description** `string`

Description of the ML model in Markdown format.

**mlFeatures** `array`

Array of ML features used by the model.

**properties**

**name** `string`

Name of the feature.

**dataType** `string`

Data type of the feature, for example `numerical`, `categorical`.

**featureSources** `array`

Sources of the feature data.

**properties**

**name** `string`

Name of the feature source.

**dataType** `string`

Data type of the source.

**dataSource** `object`

Reference to the source entity (for example, a table or column).

**mlHyperParameters** `array`

Array of hyperparameters used by the model.

**properties**

**name** `string`

Name of the hyperparameter.

**value** `string`

Value of the hyperparameter.

**target** `string`

Target variable or objective of the ML model.

**server** `string`

Endpoint URL for the model serving server.

**dashboard** `string`

Fully qualified name of the associated dashboard (for example, `sample_superset.10`).

**owners** `array`

Array of owner references (users or teams) to assign to the ML model.

**properties**

**id** `string`

UUID of the owner entity.

**type** `string`

Type of owner entity, for example `user`, `team`.

**name** `string`

Name of the owner entity.

**domains** `array`

Array of fully qualified names of the domains to assign for governance purposes.

**tags** `array`

Array of classification tags to apply to the ML model.

**properties**

**tagFQN** `string` *required*

Fully qualified name of the tag.

**labelType** `string`

Type of label, for example `Manual`, `Derived`, `Propagated`.

**state** `string`

State of the tag, for example `Suggested`, `Confirmed`.

**extension** `object`

Custom property values defined by your organization's metadata schema.

```bash PUT /v1/mlmodels theme={null}
curl -X PUT "{base_url}/api/v1/mlmodels" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "customer_segmentation",
    "displayName": "Customer Segmentation Model",
    "service": "mlflow_svc",
    "algorithm": "KMeans",
    "description": "Segments customers into groups based on purchasing behavior",
    "mlFeatures": [
      {
        "name": "total_spend",
        "dataType": "numerical"
      },
      {
        "name": "purchase_frequency",
        "dataType": "numerical"
      }
    ],
    "mlHyperParameters": [
      {"name": "n_clusters", "value": "5"},
      {"name": "max_iter", "value": "300"}
    ],
    "target": "customer_segment"
  }'
```

```python PATCH /v1/mlmodels/{id} theme={null}
from metadata.sdk import configure
from metadata.sdk.entities import MLModels

configure(
    host="https://your-company.getcollate.io/api",
    jwt_token="your-jwt-token"
)

# Retrieve, modify, and update
model = MLModels.retrieve("6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2")
model.description = "Updated: Customer segmentation using KMeans with 5 clusters"
model.mlHyperParameters = [
    {"name": "n_clusters", "value": "7"},
    {"name": "max_iter", "value": "500"}
]
updated = MLModels.update(model)

print(f"Updated to version {updated.version.root}")
```

```java PATCH /v1/mlmodels/{id} theme={null}
import org.openmetadata.schema.entity.data.MlModel;

// client is an initialized OpenMetadataClient.

// Retrieve, modify, and update
MlModel model = client.mlModels().get("6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2");
model.setDescription("Updated: Customer segmentation using KMeans with 5 clusters");
MlModel updated = client.mlModels().update(model.getId(), model);
```

```bash PATCH /v1/mlmodels/{id} theme={null}
# Update by ID
curl -X PATCH "{base_url}/api/v1/mlmodels/6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json-patch+json" \
  -d '[
    {"op": "replace", "path": "/description", "value": "Updated: Customer segmentation using KMeans with 5 clusters"}
  ]'

# Update by name
curl -X PATCH "{base_url}/api/v1/mlmodels/name/mlflow_svc.customer_segmentation" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json-patch+json" \
  -d '[
    {"op": "replace", "path": "/description", "value": "Updated: Customer segmentation using KMeans with 5 clusters"}
  ]'
```

```json Response theme={null}
{
  "id": "6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2",
  "name": "customer_segmentation",
  "fullyQualifiedName": "mlflow_svc.customer_segmentation",
  "displayName": "Customer Segmentation Model",
  "description": "Updated: Customer segmentation using KMeans with 5 clusters",
  "algorithm": "KMeans",
  "version": 0.2,
  "updatedAt": 1769982669247,
  "updatedBy": "admin",
  "service": {
    "id": "ca22d46e-81b9-4e48-85b5-0adc44980da9",
    "type": "mlmodelService",
    "name": "mlflow_svc",
    "fullyQualifiedName": "mlflow_svc",
    "deleted": false
  },
  "serviceType": "Mlflow",
  "href": "http://localhost:8585/api/v1/mlmodels/6b04e1d8-b66d-4f78-ab21-beb5be2cf4f2",
  "deleted": false,
  "owners": [],
  "tags": [],
  "followers": [],
  "votes": {
    "upVotes": 0,
    "downVotes": 0
  },
  "domains": []
}
```

***

## Returns

Returns the updated ML model object with the new version number.

## Response

**id** `string`

Unique identifier for the ML model (UUID format).

**name** `string`

ML model name.

**fullyQualifiedName** `string`

Fully qualified name in format `service.modelName`.

**description** `string`

Updated description.

**version** `number`

Incremented version number.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `400` | `BAD_REQUEST` | Invalid or malformed request body |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to update this ML model |
| `409` | `CONFLICT` | Concurrent modification detected |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.