Update Widget Metric
update_widget_metricChange an existing Lock Screen Widget metric's definition: key, label, format, currency, or unit. All definition fields are replaced, so send the current values (from list_widget_metrics) for anything you want to keep. To record a new value, use set_widget_metric_value instead. Side effects: a new key breaks scripts, SDK calls, and agents that still send values with the old key, and switching between the string format and a numeric format clears the latest value. Widgets show the change on their next refresh, about every 15 minutes. Fails if another metric already uses the key. Returns the updated metric.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Stable identifier that set_widget_metric_value, the REST API, and the SDKs use to send values. 1-64 lowercase letters, numbers, dots, underscores, or dashes, starting with a letter or number (uppercase is lowercased). Examples: mrr, deploy.success_rate. | |
| unit | No | Unit suffix for the unit format, up to 16 characters, such as ms, users, or GB. Ignored for other formats. | |
| label | Yes | Name shown on the widget, up to 80 characters. Examples: MRR, Deploy success. | |
| format | Yes | How the widget displays the value: number (1,234), currency (requires currency_code, shows $1,234), percent (send 99.9 to show 99.9%), unit (a number with a unit suffix, such as 120 ms), or string (text up to 64 characters). | |
| public_id | Yes | The metric's public_id, from list_widget_metrics or create_widget_metric. | |
| unit_spacing | No | For the unit format only: none shows 120ms, space shows 120 ms. Ignored for other formats. | none |
| currency_code | No | 3-letter ISO 4217 currency code, such as USD or EUR. Required when format is currency, ignored otherwise. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | Yes |