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

# Updating Monitor

> Update an existing monitor.

> [!WARNING]
>
> You are reading the docs of Galtea 5.16. [Read this page in the latest version](https://docs.galtea.ai/sdk/api/monitor/update.md).

## Returns

Returns the updated [Monitor](https://docs.galtea.ai/v5.16/concepts/product/monitor.md) object.

## Example

```python theme={"system"}
# Raise the sampling rate. Only the fields you pass change.
galtea.monitors.update(monitor.id, sampling_percentage=25)
```

To change the bound Specifications:

```python theme={"system"}
# Replace the bound Specifications. Pass an empty list to unbind them all.
# The monitor must keep at least one metric family or Specification.
galtea.monitors.update(specification_monitor.id, specification_ids=[specification.id])
```

To turn the message filter off, so a session is scored whatever its number of messages:

```python theme={"system"}
# Turn the message filter off, so every session is eligible whatever its number of messages.
galtea.monitors.update(monitor.id, message_conditions=[])
```

To pause or resume a monitor, use [`monitors.pause()`](https://docs.galtea.ai/v5.16/sdk/api/monitor/pause) and [`monitors.resume()`](https://docs.galtea.ai/v5.16/sdk/api/monitor/resume). Setting `status` here still works. Users may set only `ACTIVE` (resume) or `PAUSED` (pause); `CAPPED`, `NO_CREDITS`, and `FAILING` are system-set and are rejected.

## Parameters

**monitor\_id** `string` *required*

The ID of the monitor to update.

**name** `string`

New name for the monitor.

**version\_id** `string`

New version to watch. Pass `None` to watch every version of the product.

**metric\_group\_ids** `list[string]`

New metric family IDs (`metric.metric_group_id`) to score with. Adding a self-hosted metric family
raises an error, for the same reason as on create. So does a newly bound
[Classifier](https://docs.galtea.ai/v5.16/concepts/metric/classifier.md) family when classifier metrics are off on the
deployment. A family the monitor already binds can still be resent: only a newly bound family is checked.

**sampling\_percentage** `number`

New sampling percentage, from just above `0` up to `100`.

**monthly\_credit\_cap** `int`

New monthly credit cap. Must be positive when set. Pass `None` for no cap.

**status** `string | MonitorStatus`

New status. Prefer [`pause()`](https://docs.galtea.ai/v5.16/sdk/api/monitor/pause) and [`resume()`](https://docs.galtea.ai/v5.16/sdk/api/monitor/resume). Valid user-settable values: `ACTIVE` (resume), `PAUSED` (pause). Other string values are sent to the API unchanged, so values added in newer API versions can be used; the API rejects invalid ones.

**specification\_ids** `list[string]`

New Specification IDs to bind. The list replaces the bound Specifications, and an empty list unbinds them all.
Only Policy and Capability Specifications of the monitor's product are accepted. The update is refused when
the monitor would be left with nothing to score. Removing a Specification deletes the alert rules on that
Specification and on the families that only it brought.

**message\_conditions** `list[MonitorMessageCondition]`

New conditions on a session's number of messages, joined by AND. The list replaces the stored conditions. Pass `[]` to turn the filter off.
`None` is refused. At most `10` conditions. Each `MonitorMessageCondition` has a `count` (`messages` or `user_messages`), an `operator` (`lt`, `lte`, `eq`, `gte` or `gt`) and a `value` (an integer from `0` to `200`; `lt` with `0` is refused). A list that no session can meet is refused too, such as `messages` `gt` `5` with `messages` `lte` `3`, or more user messages than the messages allow.
The change applies to sessions that close after the update.

> [!NOTE]
>
> Only the fields you pass are updated. Any field you omit is left unchanged. Pass `None` to clear `version_id` or `monthly_credit_cap`. The other fields refuse `None`: leave them out to keep their value, or pass an empty list to clear `metric_group_ids`, `specification_ids` or `message_conditions`.


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