@metronome/sdk 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/bin/cli +5 -12
  3. package/internal/to-file.d.mts +1 -1
  4. package/internal/to-file.d.ts +1 -1
  5. package/internal/to-file.js +1 -1
  6. package/internal/to-file.mjs +1 -1
  7. package/package.json +1 -1
  8. package/resources/shared.d.mts +129 -5
  9. package/resources/shared.d.mts.map +1 -1
  10. package/resources/shared.d.ts +129 -5
  11. package/resources/shared.d.ts.map +1 -1
  12. package/resources/v1/alerts.d.mts +68 -64
  13. package/resources/v1/alerts.d.mts.map +1 -1
  14. package/resources/v1/alerts.d.ts +68 -64
  15. package/resources/v1/alerts.d.ts.map +1 -1
  16. package/resources/v1/alerts.js +40 -39
  17. package/resources/v1/alerts.js.map +1 -1
  18. package/resources/v1/alerts.mjs +40 -39
  19. package/resources/v1/alerts.mjs.map +1 -1
  20. package/resources/v1/contracts/contracts.d.mts +28 -6
  21. package/resources/v1/contracts/contracts.d.mts.map +1 -1
  22. package/resources/v1/contracts/contracts.d.ts +28 -6
  23. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  24. package/resources/v1/contracts/contracts.js +4 -3
  25. package/resources/v1/contracts/contracts.js.map +1 -1
  26. package/resources/v1/contracts/contracts.mjs +4 -3
  27. package/resources/v1/contracts/contracts.mjs.map +1 -1
  28. package/resources/v1/customers/alerts.d.mts +98 -77
  29. package/resources/v1/customers/alerts.d.mts.map +1 -1
  30. package/resources/v1/customers/alerts.d.ts +98 -77
  31. package/resources/v1/customers/alerts.d.ts.map +1 -1
  32. package/resources/v1/customers/alerts.js +65 -46
  33. package/resources/v1/customers/alerts.js.map +1 -1
  34. package/resources/v1/customers/alerts.mjs +65 -46
  35. package/resources/v1/customers/alerts.mjs.map +1 -1
  36. package/resources/v1/customers/customers.d.mts +17 -16
  37. package/resources/v1/customers/customers.d.mts.map +1 -1
  38. package/resources/v1/customers/customers.d.ts +17 -16
  39. package/resources/v1/customers/customers.d.ts.map +1 -1
  40. package/resources/v1/customers/customers.js +7 -4
  41. package/resources/v1/customers/customers.js.map +1 -1
  42. package/resources/v1/customers/customers.mjs +7 -4
  43. package/resources/v1/customers/customers.mjs.map +1 -1
  44. package/resources/v1/customers/index.d.mts +1 -1
  45. package/resources/v1/customers/index.d.mts.map +1 -1
  46. package/resources/v1/customers/index.d.ts +1 -1
  47. package/resources/v1/customers/index.d.ts.map +1 -1
  48. package/resources/v1/customers/index.js.map +1 -1
  49. package/resources/v1/customers/index.mjs.map +1 -1
  50. package/resources/v1/customers/invoices.d.mts +117 -2
  51. package/resources/v1/customers/invoices.d.mts.map +1 -1
  52. package/resources/v1/customers/invoices.d.ts +117 -2
  53. package/resources/v1/customers/invoices.d.ts.map +1 -1
  54. package/resources/v1/customers/invoices.js +49 -0
  55. package/resources/v1/customers/invoices.js.map +1 -1
  56. package/resources/v1/customers/invoices.mjs +49 -0
  57. package/resources/v1/customers/invoices.mjs.map +1 -1
  58. package/resources/v1/index.d.mts +1 -0
  59. package/resources/v1/index.d.mts.map +1 -1
  60. package/resources/v1/index.d.ts +1 -0
  61. package/resources/v1/index.d.ts.map +1 -1
  62. package/resources/v1/index.js +3 -1
  63. package/resources/v1/index.js.map +1 -1
  64. package/resources/v1/index.mjs +1 -0
  65. package/resources/v1/index.mjs.map +1 -1
  66. package/resources/v1/payments.d.mts +116 -0
  67. package/resources/v1/payments.d.mts.map +1 -0
  68. package/resources/v1/payments.d.ts +116 -0
  69. package/resources/v1/payments.d.ts.map +1 -0
  70. package/resources/v1/payments.js +71 -0
  71. package/resources/v1/payments.js.map +1 -0
  72. package/resources/v1/payments.mjs +67 -0
  73. package/resources/v1/payments.mjs.map +1 -0
  74. package/resources/v1/usage.d.mts +4 -2
  75. package/resources/v1/usage.d.mts.map +1 -1
  76. package/resources/v1/usage.d.ts +4 -2
  77. package/resources/v1/usage.d.ts.map +1 -1
  78. package/resources/v1/usage.js +4 -2
  79. package/resources/v1/usage.js.map +1 -1
  80. package/resources/v1/usage.mjs +4 -2
  81. package/resources/v1/usage.mjs.map +1 -1
  82. package/resources/v1/v1.d.mts +4 -0
  83. package/resources/v1/v1.d.mts.map +1 -1
  84. package/resources/v1/v1.d.ts +4 -0
  85. package/resources/v1/v1.d.ts.map +1 -1
  86. package/resources/v1/v1.js +4 -0
  87. package/resources/v1/v1.js.map +1 -1
  88. package/resources/v1/v1.mjs +4 -0
  89. package/resources/v1/v1.mjs.map +1 -1
  90. package/resources/v2/contracts.d.mts +109 -3
  91. package/resources/v2/contracts.d.mts.map +1 -1
  92. package/resources/v2/contracts.d.ts +109 -3
  93. package/resources/v2/contracts.d.ts.map +1 -1
  94. package/src/internal/to-file.ts +1 -1
  95. package/src/resources/shared.ts +160 -5
  96. package/src/resources/v1/alerts.ts +68 -64
  97. package/src/resources/v1/contracts/contracts.ts +32 -6
  98. package/src/resources/v1/customers/alerts.ts +98 -77
  99. package/src/resources/v1/customers/customers.ts +18 -15
  100. package/src/resources/v1/customers/index.ts +1 -0
  101. package/src/resources/v1/customers/invoices.ts +142 -1
  102. package/src/resources/v1/index.ts +11 -0
  103. package/src/resources/v1/payments.ts +170 -0
  104. package/src/resources/v1/usage.ts +4 -2
  105. package/src/resources/v1/v1.ts +26 -0
  106. package/src/resources/v2/contracts.ts +144 -3
  107. package/src/version.ts +1 -1
  108. package/version.d.mts +1 -1
  109. package/version.d.ts +1 -1
  110. package/version.js +1 -1
  111. package/version.mjs +1 -1
@@ -7,16 +7,15 @@ import { RequestOptions } from '../../internal/request-options';
7
7
 
8
8
  export class Alerts extends APIResource {
9
9
  /**
10
- * Create a new alert to monitor customer spending, balances, and billing metrics
11
- * in real-time. Metronome's alert system provides industry-leading speed with
12
- * immediate evaluation capabilities, enabling you to proactively manage customer
13
- * accounts and prevent revenue leakage.
10
+ * Create a new threshold notification to monitor customer spending, balances, and
11
+ * billing metrics in real-time. Metronome's notification system provides
12
+ * industry-leading speed with immediate evaluation capabilities, enabling you to
13
+ * proactively manage customer accounts and prevent revenue leakage.
14
14
  *
15
- * This endpoint creates configurable alerts that continuously monitor various
16
- * billing thresholds including spend limits, credit balances, commitment
17
- * utilization, and invoice totals. Alerts can be configured globally for all
18
- * customers or targeted to specific customer accounts. Custom fields can be used
19
- * on certain alert types to further target alerts to groups of customers.
15
+ * This endpoint creates configurable threshold notifications that continuously
16
+ * monitor various billing thresholds including spend limits, credit balances,
17
+ * commitment utilization, and invoice totals. Threshold notifications can be
18
+ * configured globally for all customers or targeted to specific customer accounts.
20
19
  *
21
20
  * ### Use this endpoint to:
22
21
  *
@@ -32,26 +31,27 @@ export class Alerts extends APIResource {
32
31
  *
33
32
  * A successful response returns a CustomerAlert object containing:
34
33
  *
35
- * - The alert configuration with its unique ID and current status
34
+ * - The threshold notification configuration with its unique ID and current status
36
35
  * - The customer's evaluation status (ok, in_alarm, or evaluating)
37
- * - Alert metadata including type, threshold values, and update timestamps
36
+ * - Threshold notification metadata including type, threshold values, and update
37
+ * timestamps
38
38
  *
39
39
  * ### Usage guidelines:
40
40
  *
41
41
  * - Immediate evaluation: Set `evaluate_on_create` : `true` (default) for instant
42
42
  * evaluation against existing customers
43
- * - Uniqueness constraints: Each alert must have a unique `uniqueness_key` within
44
- * your organization. Use `release_uniqueness_key` : `true` when archiving to
45
- * reuse keys
46
- * - Alert type requirements: Different alert types require specific fields (e.g.,
47
- * `billable_metric_id` for usage alerts, `credit_type_id` for credit-based
48
- * alerts)
49
- * - Webhook delivery: Alerts trigger webhook notifications for real-time
50
- * integration with your systems. Configure webhook endpoints before creating
51
- * alerts
52
- * - Performance at scale: Metronome's event-driven architecture processes alert
53
- * evaluations in real-time as usage events stream in, unlike competitors who
54
- * rely on periodic polling or batch evaluation cycles
43
+ * - Uniqueness constraints: Each threshold notification must have a unique
44
+ * `uniqueness_key` within your organization. Use `release_uniqueness_key` :
45
+ * `true` when archiving to reuse keys
46
+ * - Notification type requirements: Different threshold notification types require
47
+ * specific fields (e.g., `billable_metric_id` for usage notifications,
48
+ * `credit_type_id` for credit-based threshold notifications)
49
+ * - Webhook delivery: Threshold notifications trigger webhook notifications for
50
+ * real-time integration with your systems. Configure webhook endpoints before
51
+ * creating threshold notifications
52
+ * - Performance at scale: Metronome's event-driven architecture processes
53
+ * threshold notification evaluations in real-time as usage events stream in,
54
+ * unlike competitors who rely on periodic polling or batch evaluation cycles
55
55
  *
56
56
  * @example
57
57
  * ```ts
@@ -70,33 +70,34 @@ export class Alerts extends APIResource {
70
70
  }
71
71
 
72
72
  /**
73
- * Permanently disable an alert and remove it from active monitoring across all
74
- * customers. Archived alerts stop evaluating immediately and can optionally
75
- * release their uniqueness key for reuse in future alert configurations.
73
+ * Permanently disable a threshold notification and remove it from active
74
+ * monitoring across all customers. Archived threshold notifications stop
75
+ * evaluating immediately and can optionally release their uniqueness key for reuse
76
+ * in future threshold notification configurations.
76
77
  *
77
78
  * ### Use this endpoint to:
78
79
  *
79
- * - Decommission alerts that are no longer needed
80
- * - Clean up test or deprecated alert configurations
81
- * - Free up uniqueness keys for reuse with new alerts
82
- * - Stop alert evaluations without losing historical configuration data
80
+ * - Decommission threshold notifications that are no longer needed
81
+ * - Clean up test or deprecated threshold notification configurations
82
+ * - Free up uniqueness keys for reuse with new threshold notifications
83
+ * - Stop threshold notification evaluations without losing historical
84
+ * configuration data
83
85
  * - Disable outdated monitoring rules during pricing model transitions
84
86
  *
85
87
  * ### Key response fields:
86
88
  *
87
- * - data: Object containing the archived alert's ID
88
- * - Alert evaluation stops immediately for all affected customers
89
- * - Historical alert data and configurations remain accessible for audit purposes
89
+ * - data: Object containing the archived threshold notification's ID
90
90
  *
91
91
  * ### Usage guidelines:
92
92
  *
93
- * - Irreversible for evaluation: Archived alerts cannot be re-enabled; create a
94
- * new alert to resume monitoring
93
+ * - Irreversible for evaluation: Archived threshold notifications cannot be
94
+ * re-enabled; create a new threshold notification to resume monitoring
95
95
  * - Uniqueness key handling: Set `release_uniqueness_key` : `true` to reuse the
96
- * key in future alerts
97
- * - Immediate effect: Alert evaluation stops instantly across all customers
98
- * - Historical preservation: Archive operation maintains alert history and
99
- * configuration for compliance and auditing
96
+ * key in future threshold notifications
97
+ * - Immediate effect: Threshold notification evaluation stops instantly across all
98
+ * customers
99
+ * - Historical preservation: Archive operation maintains threshold notification
100
+ * history and configuration for compliance and auditing
100
101
  *
101
102
  * @example
102
103
  * ```ts
@@ -120,7 +121,7 @@ export interface AlertArchiveResponse {
120
121
 
121
122
  export interface AlertCreateParams {
122
123
  /**
123
- * Type of the alert
124
+ * Type of the threshold notification
124
125
  */
125
126
  alert_type:
126
127
  | 'low_credit_balance_reached'
@@ -139,70 +140,72 @@ export interface AlertCreateParams {
139
140
  | 'invoice_total_reached';
140
141
 
141
142
  /**
142
- * Name of the alert
143
+ * Name of the threshold notification
143
144
  */
144
145
  name: string;
145
146
 
146
147
  /**
147
- * Threshold value of the alert policy. Depending upon the alert type, this number
148
- * may represent a financial amount, the days remaining, or a percentage reached.
148
+ * Threshold value of the notification policy. Depending upon the notification
149
+ * type, this number may represent a financial amount, the days remaining, or a
150
+ * percentage reached.
149
151
  */
150
152
  threshold: number;
151
153
 
152
154
  /**
153
- * For alerts of type `usage_threshold_reached`, specifies which billable metric to
154
- * track the usage for.
155
+ * For threshold notifications of type `usage_threshold_reached`, specifies which
156
+ * billable metric to track the usage for.
155
157
  */
156
158
  billable_metric_id?: string;
157
159
 
158
160
  /**
159
- * An array of strings, representing a way to filter the credit grant this alert
160
- * applies to, by looking at the credit_grant_type field on the credit grant. This
161
- * field is only defined for CreditPercentage and CreditBalance alerts
161
+ * An array of strings, representing a way to filter the credit grant this
162
+ * threshold notification applies to, by looking at the credit_grant_type field on
163
+ * the credit grant. This field is only defined for CreditPercentage and
164
+ * CreditBalance notifications
162
165
  */
163
166
  credit_grant_type_filters?: Array<string>;
164
167
 
165
168
  /**
166
- * ID of the credit's currency, defaults to USD. If the specific alert type
169
+ * ID of the credit's currency, defaults to USD. If the specific notification type
167
170
  * requires a pricing unit/currency, find the ID in the
168
171
  * [Metronome app](https://app.metronome.com/offering/pricing-units).
169
172
  */
170
173
  credit_type_id?: string;
171
174
 
172
175
  /**
173
- * A list of custom field filters for alert types that support advanced filtering.
174
- * Only present for contract invoices.
176
+ * A list of custom field filters for threshold notification types that support
177
+ * advanced filtering. Only present for contract invoices.
175
178
  */
176
179
  custom_field_filters?: Array<AlertCreateParams.CustomFieldFilter>;
177
180
 
178
181
  /**
179
- * If provided, will create this alert for this specific customer. To create an
180
- * alert for all customers, do not specify a `customer_id`.
182
+ * If provided, will create this threshold notification for this specific customer.
183
+ * To create a notification for all customers, do not specify a `customer_id`.
181
184
  */
182
185
  customer_id?: string;
183
186
 
184
187
  /**
185
- * If true, the alert will evaluate immediately on customers that already meet the
186
- * alert threshold. If false, it will only evaluate on future customers that
187
- * trigger the alert threshold. Defaults to true.
188
+ * If true, the threshold notification will evaluate immediately on customers that
189
+ * already meet the notification threshold. If false, it will only evaluate on
190
+ * future customers that trigger the threshold. Defaults to true.
188
191
  */
189
192
  evaluate_on_create?: boolean;
190
193
 
191
194
  /**
192
- * Only present for `spend_threshold_reached` alerts. Scope alert to a specific
193
- * group key on individual line items.
195
+ * Only present for `spend_threshold_reached` notifications. Scope notification to
196
+ * a specific group key on individual line items.
194
197
  */
195
198
  group_values?: Array<AlertCreateParams.GroupValue>;
196
199
 
197
200
  /**
198
- * Only supported for invoice_total_reached alerts. A list of invoice types to
199
- * evaluate.
201
+ * Only supported for invoice_total_reached threshold notifications. A list of
202
+ * invoice types to evaluate.
200
203
  */
201
204
  invoice_types_filter?: Array<string>;
202
205
 
203
206
  /**
204
- * If provided, will create this alert for this specific plan. To create an alert
205
- * for all customers, do not specify a `plan_id`.
207
+ * If provided, will create this threshold notification for this specific plan. To
208
+ * create a notification for all customers, do not specify a `plan_id`.
206
209
  */
207
210
  plan_id?: string;
208
211
 
@@ -232,12 +235,13 @@ export namespace AlertCreateParams {
232
235
 
233
236
  export interface AlertArchiveParams {
234
237
  /**
235
- * The Metronome ID of the alert
238
+ * The Metronome ID of the threshold notification
236
239
  */
237
240
  id: string;
238
241
 
239
242
  /**
240
- * If true, resets the uniqueness key on this alert so it can be re-used
243
+ * If true, resets the uniqueness key on this threshold notification so it can be
244
+ * re-used
241
245
  */
242
246
  release_uniqueness_key?: boolean;
243
247
  }
@@ -574,11 +574,12 @@ export class Contracts extends APIResource {
574
574
  }
575
575
 
576
576
  /**
577
- * Update or and an end date to a contract. Ending a contract early will impact
577
+ * Update or add an end date to a contract. Ending a contract early will impact
578
578
  * draft usage statements, truncate any terms, and remove upcoming scheduled
579
579
  * invoices. Moving the date into the future will only extend the contract length.
580
- * Terms and scheduled invoices are not extended. Use this if a contract's end date
581
- * has changed or if a perpetual contract ends.
580
+ * Terms and scheduled invoices are not extended. In-advance subscriptions will not
581
+ * be extended. Use this if a contract's end date has changed or if a perpetual
582
+ * contract ends.
582
583
  *
583
584
  * @example
584
585
  * ```ts
@@ -1117,7 +1118,7 @@ export namespace ContractCreateParams {
1117
1118
  * not wish Metronome to calculate tax on your behalf. Leaving this field blank
1118
1119
  * will default to NONE.
1119
1120
  */
1120
- tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
1121
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'AVALARA' | 'PRECALCULATED';
1121
1122
  }
1122
1123
 
1123
1124
  export namespace PaymentGateConfig {
@@ -1387,7 +1388,22 @@ export namespace ContractCreateParams {
1387
1388
  }
1388
1389
 
1389
1390
  export interface HierarchyConfiguration {
1390
- parent: HierarchyConfiguration.Parent;
1391
+ parent?: HierarchyConfiguration.Parent;
1392
+
1393
+ parent_behavior?: HierarchyConfiguration.ParentBehavior;
1394
+
1395
+ /**
1396
+ * Indicates whether the parent should pay for the child's invoice charges
1397
+ */
1398
+ payer?: 'SELF' | 'PARENT';
1399
+
1400
+ /**
1401
+ * Indicates the behavior of the child's invoice statements on the parent's
1402
+ * invoices **CONSOLIDATE**: Child's invoice statements will be added to parent's
1403
+ * consolidated invoices **SEPARATE**: Child's invoice statements will appear not
1404
+ * appear on parent's consolidated invoices
1405
+ */
1406
+ usage_statement_behavior?: 'CONSOLIDATE' | 'SEPARATE';
1391
1407
  }
1392
1408
 
1393
1409
  export namespace HierarchyConfiguration {
@@ -1396,6 +1412,16 @@ export namespace ContractCreateParams {
1396
1412
 
1397
1413
  customer_id: string;
1398
1414
  }
1415
+
1416
+ export interface ParentBehavior {
1417
+ /**
1418
+ * Indicates the desired behavior of consolidated invoices generated by the parent
1419
+ * in a customer hierarchy **CONCATENATE**: Statements on the invoices of child
1420
+ * customers will be appended to the consolidated invoice **NONE**: Do not generate
1421
+ * consolidated invoices
1422
+ */
1423
+ invoice_consolidation_type?: 'CONCATENATE' | 'NONE';
1424
+ }
1399
1425
  }
1400
1426
 
1401
1427
  export interface Override {
@@ -2648,7 +2674,7 @@ export namespace ContractAmendParams {
2648
2674
  * not wish Metronome to calculate tax on your behalf. Leaving this field blank
2649
2675
  * will default to NONE.
2650
2676
  */
2651
- tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
2677
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'AVALARA' | 'PRECALCULATED';
2652
2678
  }
2653
2679
 
2654
2680
  export namespace PaymentGateConfig {
@@ -13,17 +13,26 @@ import { RequestOptions } from '../../../internal/request-options';
13
13
 
14
14
  export class Alerts extends APIResource {
15
15
  /**
16
- * Retrieve the real-time evaluation status for a specific alert-customer pair.
17
- * This endpoint provides instant visibility into whether a customer has triggered
18
- * an alert condition, enabling you to monitor account health and take proactive
19
- * action based on current alert states.
16
+ * Retrieve the real-time evaluation status for a specific threshold
17
+ * notification-customer pair. This endpoint provides instant visibility into
18
+ * whether a customer has triggered a threshold notification condition, enabling
19
+ * you to monitor account health and take proactive action based on current
20
+ * threshold notification states.
20
21
  *
21
22
  * ### Use this endpoint to:
22
23
  *
23
- * - Check if a specific customer is currently violating an alert threshold
24
+ * - Check if a specific customer is currently violating an threshold notification
24
25
  * (`in_alarm` status)
25
- * - Verify alert configuration details and threshold values for a customer
26
- * - Integrate alert status checks into customer support tools or admin interfaces
26
+ * - Verify threshold notification configuration details and threshold values for a
27
+ * customer
28
+ * - Monitor the evaluation state of newly created or recently modified threshold
29
+ * notification
30
+ * - Build dashboards or automated workflows that respond to specific threshold
31
+ * notification conditions
32
+ * - Validate threshold notification behavior before deploying to production
33
+ * customers
34
+ * - Integrate threshold notification status checks into customer support tools or
35
+ * admin interfaces
27
36
  *
28
37
  * ### Key response fields:
29
38
  *
@@ -32,29 +41,32 @@ export class Alerts extends APIResource {
32
41
  * - `customer_status`: The current evaluation state
33
42
  *
34
43
  * - `ok` - Customer is within acceptable thresholds
35
- * - `in_alarm`- Customer has breached the alert threshold
36
- * - `evaluating` - Alert has yet to be evaluated (typically due to a customer or
37
- * alert having just been created)
38
- * - `null` - Alert has been archived
39
- * - `triggered_by`: Additional context about what caused the alert to trigger
40
- * (when applicable)
41
- * - alert: Complete alert configuration including:
42
- * - Alert ID, name, and type
44
+ * - `in_alarm` - Customer has breached the threshold for the notification
45
+ * - `evaluating` - Notification is currently being evaluated (typically during
46
+ * initial setup)
47
+ * - `null` - Notification has been archived
48
+ * - `triggered_by`: Additional context about what caused the notification to
49
+ * trigger (when applicable)
50
+ * - alert: Complete threshold notification configuration including:
51
+ * - Notification ID, name, and type
43
52
  * - Current threshold values and credit type information
44
- * - Alert status (enabled, disabled, or archived)
53
+ * - Notification status (enabled, disabled, or archived)
45
54
  * - Last update timestamp
46
55
  * - Any applied filters (credit grant types, custom fields, group values)
47
56
  *
48
57
  * ### Usage guidelines:
49
58
  *
50
59
  * - Customer status: Returns the current evaluation state, not historical data.
51
- * For alert history, use webhook notifications or event logs
52
- * - Archived alerts: Returns null for customer_status if the alert has been
53
- * archived, but still includes the alert configuration details
54
- * - Integration patterns: This endpoint can be used to check a customer's alert
55
- * status, but shouldn't be scraped. You should instead rely on the webhook
56
- * notification to understand when customers are moved to IN_ALARM.
57
- * - Error handling: Returns 404 if either the customer or alert ID doesn't exist
60
+ * For threshold notification history, use webhook notifications or event logs
61
+ * - Required parameters: Both customer_id and alert_id must be valid UUIDs that
62
+ * exist in your organization
63
+ * - Archived notifications: Returns null for customer_status if the notification
64
+ * has been archived, but still includes the notification configuration details
65
+ * - Performance considerations: This endpoint queries live evaluation state,
66
+ * making it ideal for real-time monitoring but not for bulk status checks
67
+ * - Integration patterns: Best used for on-demand status checks in response to
68
+ * user actions or as part of targeted monitoring workflows
69
+ * - Error handling: Returns 404 if either the customer or alert_id doesn't exist
58
70
  * or isn't accessible to your organization
59
71
  *
60
72
  * @example
@@ -70,31 +82,37 @@ export class Alerts extends APIResource {
70
82
  }
71
83
 
72
84
  /**
73
- * Retrieve all alert configurations and their current statuses for a specific
74
- * customer in a single API call. This endpoint provides a comprehensive view of
75
- * all alerts monitoring a customer account.
85
+ * Retrieve all threshold notification configurations and their current statuses
86
+ * for a specific customer in a single API call. This endpoint provides a
87
+ * comprehensive view of all threshold notification monitoring a customer account.
76
88
  *
77
89
  * ### Use this endpoint to:
78
90
  *
79
- * - Display all active alerts for a customer in dashboards or admin panels
80
- * - Quickly identify which alerts a customer is currently triggering
81
- * - Audit alert coverage for specific accounts
82
- * - Filter alerts by status (enabled, disabled, or archived)
91
+ * - Display all active threshold notifications for a customer in dashboards or
92
+ * admin panels
93
+ * - Quickly identify which threshold notifications a customer is currently
94
+ * triggering
95
+ * - Audit threshold notification coverage for specific accounts
96
+ * - Filter threshold notifications by status (enabled, disabled, or archived)
83
97
  *
84
98
  * ### Key response fields:
85
99
  *
86
100
  * - data: Array of CustomerAlert objects, each containing:
87
101
  * - Current evaluation status (`ok`, `in_alarm`, `evaluating`, or `null`)
88
- * - Complete alert configuration and threshold details
89
- * - Alert metadata including type, name, and last update time
90
- * - `next_page`: Pagination cursor for retrieving additional results
102
+ * - Complete threshold notification configuration and threshold details
103
+ * - Threshold notification metadata including type, name, and last update time
104
+ * - next_page: Pagination cursor for retrieving additional results
91
105
  *
92
106
  * ### Usage guidelines:
93
107
  *
94
- * - Default behavior: Returns only enabled alerts unless alert_statuses filter is
95
- * specified
108
+ * - Default behavior: Returns only enabled threshold notifications unless
109
+ * `alert_statuses` filter is specified
96
110
  * - Pagination: Use the `next_page` cursor to retrieve all results for customers
97
- * with many alerts
111
+ * with many notifications
112
+ * - Performance: Efficiently retrieves multiple threshold notification statuses in
113
+ * a single request instead of making individual calls
114
+ * - Filtering: Pass the `alert_statuses` array to include disabled or archived
115
+ * threshold notifications in results
98
116
  *
99
117
  * @example
100
118
  * ```ts
@@ -120,23 +138,24 @@ export class Alerts extends APIResource {
120
138
  }
121
139
 
122
140
  /**
123
- * Force an immediate re-evaluation of a specific alert for a customer, clearing
124
- * any previous state and triggering a fresh assessment against current thresholds.
125
- * This endpoint ensures alert accuracy after configuration changes or data
126
- * corrections.
141
+ * Force an immediate re-evaluation of a specific threshold notification for a
142
+ * customer, clearing any previous state and triggering a fresh assessment against
143
+ * current thresholds. This endpoint ensures threshold notification accuracy after
144
+ * configuration changes or data corrections.
127
145
  *
128
146
  * ### Use this endpoint to:
129
147
  *
130
- * - Clear false positive alerts after fixing data issues
131
- * - Re-evaluate alerts after adjusting customer balances or credits
132
- * - Test alert behavior during development and debugging
133
- * - Resolve stuck alerts that may be in an incorrect state
148
+ * - Clear false positive threshold notifications after fixing data issues
149
+ * - Re-evaluate threshold notifications after adjusting customer balances or
150
+ * credits
151
+ * - Test threshold notification behavior during development and debugging
152
+ * - Resolve stuck threshold notification that may be in an incorrect state
134
153
  * - Trigger immediate evaluation after threshold modifications
135
154
  *
136
155
  * ### Key response fields:
137
156
  *
138
- * - 200 Success: Confirmation that the alert has been reset and re-evaluation
139
- * initiated
157
+ * - 200 Success: Confirmation that the threshold notification has been reset and
158
+ * re-evaluation initiated
140
159
  * - No response body is returned - the operation completes asynchronously
141
160
  *
142
161
  * ### Usage guidelines:
@@ -172,13 +191,13 @@ export interface CustomerAlert {
172
191
  alert: CustomerAlert.Alert;
173
192
 
174
193
  /**
175
- * The status of the customer alert. If the alert is archived, null will be
176
- * returned.
194
+ * The status of the threshold notification. If the notification is archived, null
195
+ * will be returned.
177
196
  */
178
197
  customer_status: 'ok' | 'in_alarm' | 'evaluating' | null;
179
198
 
180
199
  /**
181
- * If present, indicates the reason the alert was triggered.
200
+ * If present, indicates the reason the threshold notification was triggered.
182
201
  */
183
202
  triggered_by?: string | null;
184
203
  }
@@ -186,27 +205,27 @@ export interface CustomerAlert {
186
205
  export namespace CustomerAlert {
187
206
  export interface Alert {
188
207
  /**
189
- * the Metronome ID of the alert
208
+ * the Metronome ID of the threshold notification
190
209
  */
191
210
  id: string;
192
211
 
193
212
  /**
194
- * Name of the alert
213
+ * Name of the threshold notification
195
214
  */
196
215
  name: string;
197
216
 
198
217
  /**
199
- * Status of the alert
218
+ * Status of the threshold notification
200
219
  */
201
220
  status: 'enabled' | 'archived' | 'disabled';
202
221
 
203
222
  /**
204
- * Threshold value of the alert policy
223
+ * Threshold value of the notification policy
205
224
  */
206
225
  threshold: number;
207
226
 
208
227
  /**
209
- * Type of the alert
228
+ * Type of the threshold notification
210
229
  */
211
230
  type:
212
231
  | 'low_credit_balance_reached'
@@ -225,39 +244,41 @@ export namespace CustomerAlert {
225
244
  | 'invoice_total_reached';
226
245
 
227
246
  /**
228
- * Timestamp for when the alert was last updated
247
+ * Timestamp for when the threshold notification was last updated
229
248
  */
230
249
  updated_at: string;
231
250
 
232
251
  /**
233
- * An array of strings, representing a way to filter the credit grant this alert
234
- * applies to, by looking at the credit_grant_type field on the credit grant. This
235
- * field is only defined for CreditPercentage and CreditBalance alerts
252
+ * An array of strings, representing a way to filter the credit grant this
253
+ * threshold notification applies to, by looking at the credit_grant_type field on
254
+ * the credit grant. This field is only defined for CreditPercentage and
255
+ * CreditBalance notifications
236
256
  */
237
257
  credit_grant_type_filters?: Array<string>;
238
258
 
239
259
  credit_type?: Shared.CreditTypeData | null;
240
260
 
241
261
  /**
242
- * A list of custom field filters for alert types that support advanced filtering
262
+ * A list of custom field filters for notification types that support advanced
263
+ * filtering
243
264
  */
244
265
  custom_field_filters?: Array<Alert.CustomFieldFilter>;
245
266
 
246
267
  /**
247
- * Scopes alert evaluation to a specific presentation group key on individual line
248
- * items. Only present for spend alerts.
268
+ * Scopes threshold notification evaluation to a specific presentation group key on
269
+ * individual line items. Only present for spend notifications.
249
270
  */
250
271
  group_key_filter?: Alert.GroupKeyFilter;
251
272
 
252
273
  /**
253
- * Only present for `spend_threshold_reached` alerts. Scope alert to a specific
254
- * group key on individual line items.
274
+ * Only present for `spend_threshold_reached` notifications. Scope notification to
275
+ * a specific group key on individual line items.
255
276
  */
256
277
  group_values?: Array<Alert.GroupValue>;
257
278
 
258
279
  /**
259
- * Only supported for invoice_total_reached alerts. A list of invoice types to
260
- * evaluate.
280
+ * Only supported for invoice_total_reached threshold notifications. A list of
281
+ * invoice types to evaluate.
261
282
  */
262
283
  invoice_types_filter?: Array<string>;
263
284
 
@@ -279,8 +300,8 @@ export namespace CustomerAlert {
279
300
  }
280
301
 
281
302
  /**
282
- * Scopes alert evaluation to a specific presentation group key on individual line
283
- * items. Only present for spend alerts.
303
+ * Scopes threshold notification evaluation to a specific presentation group key on
304
+ * individual line items. Only present for spend notifications.
284
305
  */
285
306
  export interface GroupKeyFilter {
286
307
  key: string;
@@ -302,7 +323,7 @@ export interface AlertRetrieveResponse {
302
323
 
303
324
  export interface AlertRetrieveParams {
304
325
  /**
305
- * The Metronome ID of the alert
326
+ * The Metronome ID of the threshold notification
306
327
  */
307
328
  alert_id: string;
308
329
 
@@ -312,22 +333,22 @@ export interface AlertRetrieveParams {
312
333
  customer_id: string;
313
334
 
314
335
  /**
315
- * Only present for `spend_threshold_reached` alerts. Retrieve the alert for a
316
- * specific group key-value pair.
336
+ * Only present for `spend_threshold_reached` notifications. Retrieve the
337
+ * notification for a specific group key-value pair.
317
338
  */
318
339
  group_values?: Array<AlertRetrieveParams.GroupValue>;
319
340
 
320
341
  /**
321
- * When parallel alerts are enabled during migration, this flag denotes whether to
322
- * fetch alerts for plans or contracts.
342
+ * When parallel threshold notifications are enabled during migration, this flag
343
+ * denotes whether to fetch notifications for plans or contracts.
323
344
  */
324
345
  plans_or_contracts?: 'PLANS' | 'CONTRACTS';
325
346
  }
326
347
 
327
348
  export namespace AlertRetrieveParams {
328
349
  /**
329
- * Scopes alert evaluation to a specific presentation group key on individual line
330
- * items. Only present for spend alerts.
350
+ * Scopes threshold notification evaluation to a specific presentation group key on
351
+ * individual line items. Only present for spend notifications.
331
352
  */
332
353
  export interface GroupValue {
333
354
  key: string;
@@ -343,15 +364,15 @@ export interface AlertListParams extends CursorPageWithoutLimitParams {
343
364
  customer_id: string;
344
365
 
345
366
  /**
346
- * Body param: Optionally filter by alert status. If absent, only enabled alerts
347
- * will be returned.
367
+ * Body param: Optionally filter by threshold notification status. If absent, only
368
+ * enabled notifications will be returned.
348
369
  */
349
370
  alert_statuses?: Array<'ENABLED' | 'DISABLED' | 'ARCHIVED'>;
350
371
  }
351
372
 
352
373
  export interface AlertResetParams {
353
374
  /**
354
- * The Metronome ID of the alert
375
+ * The Metronome ID of the threshold notification
355
376
  */
356
377
  alert_id: string;
357
378