Create Widget Metric
create_widget_metricCreate a Lock Screen Widget metric: a named value, such as monthly revenue or deploy success rate, that the user can show in an ActivitySmith widget on their iPhone or iPad Lock Screen. Create each metric once, then send values with set_widget_metric_value using the same key. To change the label or format later, use update_widget_metric. The new metric has no value yet, and nothing changes on the Lock Screen until the user adds a widget for it. Fails if the key already exists in the account. Returns the created metric, including its public_id.
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 | No | 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). | number |
| 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 |