@openmeter/client 1.0.0-beta.235 → 1.0.0-beta.237

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.
@@ -258,6 +258,11 @@ export interface ChargeFlatFeeDiscounts {
258
258
  /** Percentage discount applied to the price (0–100). */
259
259
  percentage?: number;
260
260
  }
261
+ /** External identifiers for an invoice line item assigned by third-party systems. */
262
+ export interface InvoiceLineExternalReferences {
263
+ /** The ID assigned by the external invoicing app. */
264
+ invoicingId?: string;
265
+ }
261
266
  /** Remove a rate card from a phase. */
262
267
  export interface SubscriptionEditRemoveItem {
263
268
  /** Discriminator for the remove-item operation. */
@@ -283,6 +288,14 @@ export interface SubscriptionEditUnscheduleEdit {
283
288
  * "mesh", "kic", or "\_".
284
289
  */
285
290
  export type UpdateLabels = Record<string, string>;
291
+ /**
292
+ * Request to reconcile the app's webhook events with the latest supported event
293
+ * set.
294
+ */
295
+ export interface AppReconcileWebhookEventsActionRequest {
296
+ /** The action to execute. */
297
+ actionType: 'reconcile_webhook_events';
298
+ }
286
299
  /** Model for installing an app from the catalog with an API key. */
287
300
  export interface InstallAppStripeWithApiKey {
288
301
  /** Type of the app. */
@@ -309,15 +322,15 @@ export interface InstallAppSandbox {
309
322
  */
310
323
  createBillingProfile: boolean;
311
324
  }
312
- /** Base model for installing an app from the catalog. */
325
+ /** Model for installing an External Invoicing app from the catalog. */
313
326
  export interface InstallAppExternalInvoicing {
314
327
  /** Type of the app. */
315
328
  type: 'external_invoicing';
316
329
  /** Name of the app. */
317
330
  name: string;
318
331
  /**
319
- * If true, a billing profile will be created for the app. The Stripe app will be
320
- * also set as the default billing profile if the current default is a Sandbox app.
332
+ * If true, creates the Auto Collection preset with an OpenMeter supplier in the US
333
+ * (postal code 94114), without replacing the default profile.
321
334
  */
322
335
  createBillingProfile: boolean;
323
336
  }
@@ -329,11 +342,6 @@ export interface WorkflowCollectionAlignmentSubscription {
329
342
  /** The type of alignment. */
330
343
  type: 'subscription';
331
344
  }
332
- /** External identifiers for an invoice line item assigned by third-party systems. */
333
- export interface InvoiceLineExternalReferences {
334
- /** The ID assigned by the external invoicing app. */
335
- invoicingId?: string;
336
- }
337
345
  /**
338
346
  * Invoice-level invoicing settings.
339
347
  *
@@ -416,6 +424,272 @@ export interface EntitlementAccessQueryRequestFeatures {
416
424
  /** List of feature keys to evaluate access for. */
417
425
  keys: string[];
418
426
  }
427
+ /**
428
+ * The response the recipient returned for a delivery attempt. For webhook channels
429
+ * this is the HTTP response.
430
+ */
431
+ export interface NotificationEventDeliveryAttemptResponse {
432
+ /**
433
+ * The HTTP status code returned by the recipient. Absent when no response was
434
+ * received.
435
+ */
436
+ statusCode?: number;
437
+ /** The response body returned by the recipient. Empty when no body was received. */
438
+ body: string;
439
+ /** How long the delivery attempt took, in milliseconds. */
440
+ durationMs: bigint;
441
+ /** The URL the event was delivered to. Only set for webhook channels. */
442
+ url?: string;
443
+ }
444
+ /**
445
+ * Set of key-value pairs. Metadata can be used to store additional information
446
+ * about a resource.
447
+ */
448
+ export type NotificationEventV1Metadata = Record<string, string>;
449
+ /** Set of key-value pairs managed by the system. Cannot be modified by user. */
450
+ export type NotificationEventV1Annotations = Record<string, unknown>;
451
+ /** A period with a start and end time. */
452
+ export interface NotificationEventV1Period {
453
+ /** Period start time. */
454
+ from: Date;
455
+ /** Period end time. */
456
+ to: Date;
457
+ }
458
+ /** A filter for a string field. */
459
+ export interface NotificationEventV1FilterString {
460
+ /** The field must be equal to the provided value. */
461
+ $eq?: string | null;
462
+ /** The field must not be equal to the provided value. */
463
+ $ne?: string | null;
464
+ /** The field must be in the provided list of values. */
465
+ $in?: string[] | null;
466
+ /** The field must not be in the provided list of values. */
467
+ $nin?: string[] | null;
468
+ /** The field must match the provided value. */
469
+ $like?: string | null;
470
+ /** The field must not match the provided value. */
471
+ $nlike?: string | null;
472
+ /** The field must match the provided value, ignoring case. */
473
+ $ilike?: string | null;
474
+ /** The field must not match the provided value, ignoring case. */
475
+ $nilike?: string | null;
476
+ /** The field must be greater than the provided value. */
477
+ $gt?: string | null;
478
+ /** The field must be greater than or equal to the provided value. */
479
+ $gte?: string | null;
480
+ /** The field must be less than the provided value. */
481
+ $lt?: string | null;
482
+ /** The field must be less than or equal to the provided value. */
483
+ $lte?: string | null;
484
+ /** Provide a list of filters to be combined with a logical AND. */
485
+ $and?: NotificationEventV1FilterString[] | null;
486
+ /** Provide a list of filters to be combined with a logical OR. */
487
+ $or?: NotificationEventV1FilterString[] | null;
488
+ }
489
+ /**
490
+ * A subject is a unique identifier for a usage attribution by its key. Subjects
491
+ * only exist in the concept of metering. Subjects are optional to create and work
492
+ * as an enrichment for the subject key like displayName, metadata, etc. Subjects
493
+ * are useful when you are reporting usage events with your own database ID but
494
+ * want to enrich the subject with a human-readable name or metadata. For most use
495
+ * cases, a subject is equivalent to a customer.
496
+ *
497
+ * ⚠️ **Deprecated**: Subjects as managable entities are being depracated, use
498
+ * customers with subject key usage attribution instead.
499
+ */
500
+ export interface NotificationEventV1Subject {
501
+ /** Timestamp of when the resource was created. */
502
+ createdAt: Date;
503
+ /** Timestamp of when the resource was last updated. */
504
+ updatedAt: Date;
505
+ /** Timestamp of when the resource was permanently deleted. */
506
+ deletedAt?: Date;
507
+ /** A unique identifier for the subject. */
508
+ id: string;
509
+ /**
510
+ * A unique, human-readable identifier for the subject. This is typically a
511
+ * database ID or a customer key.
512
+ */
513
+ key: string;
514
+ /** A human-readable display name for the subject. */
515
+ displayName?: string | null;
516
+ /** Metadata for the subject. */
517
+ metadata?: Record<string, unknown> | null;
518
+ /** The start of the current period for the subject. */
519
+ currentPeriodStart?: Date;
520
+ /** The end of the current period for the subject. */
521
+ currentPeriodEnd?: Date;
522
+ /** The Stripe customer ID for the subject. */
523
+ stripeCustomerId?: string | null;
524
+ }
525
+ /**
526
+ * Entitlements are the core of OpenMeter access management. They define access to
527
+ * features for subjects. Entitlements can be metered, boolean, or static.
528
+ */
529
+ export interface NotificationEventV1EntitlementValue {
530
+ /**
531
+ * Whether the subject has access to the feature. Shared accross all entitlement
532
+ * types.
533
+ */
534
+ hasAccess: boolean;
535
+ /**
536
+ * Only available for metered entitlements. Metered entitlements are built around a
537
+ * balance calculation where feature usage is deducted from the issued grants.
538
+ * Balance represents the remaining balance of the entitlement, it's value never
539
+ * turns negative.
540
+ */
541
+ balance?: number;
542
+ /**
543
+ * Only available for metered entitlements. Returns the total feature usage in the
544
+ * current period.
545
+ */
546
+ usage?: number;
547
+ /**
548
+ * Only available for metered entitlements. Overage represents the usage that
549
+ * wasn't covered by grants, e.g. if the subject had a total feature usage of 100
550
+ * in the period but they were only granted 80, there would be 20 overage.
551
+ */
552
+ overage?: number;
553
+ /**
554
+ * Only available for metered entitlements. The summed amount of all grant active
555
+ * at query time PLUS the used amount of since inactive grants.
556
+ */
557
+ totalAvailableGrantAmount?: number;
558
+ /**
559
+ * Only available for static entitlements. The JSON parsable config of the
560
+ * entitlement.
561
+ */
562
+ config?: string;
563
+ }
564
+ /**
565
+ * Mapping to attribute metered usage to the customer. One customer can have zero
566
+ * or more subjects, but one subject can only belong to one customer.
567
+ */
568
+ export interface NotificationEventV1CustomerUsageAttribution {
569
+ /**
570
+ * The subjects that are attributed to the customer. Can be empty when no subjects
571
+ * are associated with the customer.
572
+ */
573
+ subjectKeys: string[] | null;
574
+ }
575
+ /** Alignment configuration for a plan or subscription. */
576
+ export interface NotificationEventV1Alignment {
577
+ /**
578
+ * Whether all Billable items and RateCards must align. Alignment means the Price's
579
+ * BillingCadence must align for both duration and anchor time.
580
+ */
581
+ billablesMustAlign?: boolean;
582
+ }
583
+ /** References an exact plan. */
584
+ export interface NotificationEventV1PlanReference {
585
+ /** The plan ID. */
586
+ id: string;
587
+ /** The plan key. */
588
+ key: string;
589
+ /** The plan version. */
590
+ version: number;
591
+ }
592
+ /**
593
+ * InvoiceAvailableActionInvoiceDetails represents the details of the invoice
594
+ * action for non-gathering invoices.
595
+ */
596
+ export interface NotificationEventV1InvoiceAvailableActionDetails {
597
+ /**
598
+ * The state the invoice will reach if the action is activated and all intermediate
599
+ * steps are successful.
600
+ *
601
+ * For example advancing a draft_created invoice will result in a
602
+ * draft_manual_approval_needed invoice.
603
+ */
604
+ resultingState: string;
605
+ }
606
+ /**
607
+ * InvoiceAvailableActionInvoiceDetails represents the details of the invoice
608
+ * action for gathering invoices.
609
+ */
610
+ export type NotificationEventV1InvoiceAvailableActionInvoiceDetails = Record<string, never>;
611
+ /**
612
+ * BillingWorkflowCollectionAlignmentSubscription specifies the alignment for
613
+ * collecting the pending line items into an invoice.
614
+ */
615
+ export interface NotificationEventV1BillingWorkflowCollectionAlignmentSubscription {
616
+ /** The type of alignment. */
617
+ type: 'subscription';
618
+ }
619
+ /** The tax config for Stripe. */
620
+ export interface NotificationEventV1StripeTaxConfig {
621
+ /**
622
+ * Product tax code.
623
+ *
624
+ * See: https://docs.stripe.com/tax/tax-codes
625
+ */
626
+ code: string;
627
+ }
628
+ /** Custom invoicing tax config. */
629
+ export interface NotificationEventV1CustomInvoicingTaxConfig {
630
+ /**
631
+ * Tax code.
632
+ *
633
+ * The tax code should be interpreted by the custom invoicing provider.
634
+ */
635
+ code: string;
636
+ }
637
+ /** BillingWorkflowTaxSettings represents the tax settings for a billing workflow */
638
+ export interface NotificationEventV1BillingWorkflowTaxSettings {
639
+ /**
640
+ * Enable automatic tax calculation when tax is supported by the app. For example,
641
+ * with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.
642
+ */
643
+ enabled?: boolean;
644
+ /**
645
+ * Enforce tax calculation when tax is supported by the app. When enabled,
646
+ * OpenMeter will not allow to create an invoice without tax calculation.
647
+ * Enforcement is different per apps, for example, Stripe app requires customer to
648
+ * have a tax location when starting a paid subscription.
649
+ */
650
+ enforced?: boolean;
651
+ }
652
+ /** The reason for the discount is a maximum spend. */
653
+ export interface NotificationEventV1DiscountReasonMaximumSpend {
654
+ /** type. */
655
+ type: 'maximum_spend';
656
+ }
657
+ /**
658
+ * InvoiceLineAppExternalIds contains the external IDs of the invoice in other apps
659
+ * such as Stripe.
660
+ */
661
+ export interface NotificationEventV1InvoiceLineAppExternalIds {
662
+ /** The external ID of the invoice in the invoicing app if available. */
663
+ invoicing?: string;
664
+ /** The external ID of the invoice in the tax app if available. */
665
+ tax?: string;
666
+ }
667
+ /** IDResource is a resouce with an ID. */
668
+ export interface NotificationEventV1IdResource {
669
+ /** A unique identifier for the resource. */
670
+ id: string;
671
+ }
672
+ /** PaymentTermInstant defines the terms for payment on receipt of invoice. */
673
+ export interface NotificationEventV1PaymentTermInstant {
674
+ /** Type of terms to be applied. */
675
+ type: 'instant';
676
+ /** Text detail of the chosen payment terms. */
677
+ detail?: string;
678
+ /** Description of the conditions for payment. */
679
+ notes?: string;
680
+ }
681
+ /**
682
+ * InvoiceAppExternalIds contains the external IDs of the invoice in other apps
683
+ * such as Stripe.
684
+ */
685
+ export interface NotificationEventV1InvoiceAppExternalIds {
686
+ /** The external ID of the invoice in the invoicing app if available. */
687
+ invoicing?: string;
688
+ /** The external ID of the invoice in the tax app if available. */
689
+ tax?: string;
690
+ /** The external ID of the invoice in the payment app if available. */
691
+ payment?: string;
692
+ }
419
693
  /**
420
694
  * A query filter for an integer attribute. Operators are mutually exclusive, only
421
695
  * one operator is allowed at a time.
@@ -481,6 +755,16 @@ export interface PagePaginationQuery {
481
755
  * list of objects.
482
756
  */
483
757
  export type PublicLabels = Record<string, string>;
758
+ /**
759
+ * Rule configuration of `v1.billing.invoice.created`. Invoice Rules have no
760
+ * type-specific settings.
761
+ */
762
+ export type InvoiceCreatedV1RuleConfig = Record<string, never>;
763
+ /**
764
+ * Rule configuration of `v1.billing.invoice.updated`. Invoice Rules have no
765
+ * type-specific settings.
766
+ */
767
+ export type InvoiceUpdatedV1RuleConfig = Record<string, never>;
484
768
  /**
485
769
  * The system account access token is meant for automations and integrations that
486
770
  * are not directly associated with a human identity.
@@ -958,6 +1242,10 @@ export interface CreateChargeCostBasisPinned {
958
1242
  export interface CreateResourceReference {
959
1243
  id: string;
960
1244
  }
1245
+ /** CurrencyCustom reference. */
1246
+ export interface CurrencyCustomReference {
1247
+ id: string;
1248
+ }
961
1249
  /** Cost basis pinned to a specific cost basis resource of the custom currency. */
962
1250
  export interface ChargeCostBasisPinned {
963
1251
  /** Discriminator selecting the cost basis mode. */
@@ -980,10 +1268,6 @@ export interface CreditGrantInvoiceReference {
980
1268
  id: string;
981
1269
  };
982
1270
  }
983
- /** CurrencyCustom reference. */
984
- export interface CurrencyCustomReference {
985
- id: string;
986
- }
987
1271
  /** A cost basis pinned to a custom-currency pair for the subscription. */
988
1272
  export interface SubscriptionCostBasisPin {
989
1273
  /** The managed custom currency ID. */
@@ -1024,19 +1308,23 @@ export interface AppReference {
1024
1308
  export interface ChargeRealizationInvoiceReference {
1025
1309
  id: string;
1026
1310
  }
1027
- /** Addon reference. */
1028
- export interface AddonReference {
1029
- id: string;
1030
- }
1031
1311
  /** Reference to a charge associated with an invoice line. */
1032
1312
  export interface ChargeReference {
1033
1313
  /** Unique identifier for the charge. */
1034
1314
  id: string;
1035
1315
  }
1316
+ /** Addon reference. */
1317
+ export interface AddonReference {
1318
+ id: string;
1319
+ }
1036
1320
  /** TaxCode reference. */
1037
1321
  export interface UpdateResourceReference {
1038
1322
  id: string;
1039
1323
  }
1324
+ /** NotificationChannel reference. */
1325
+ export interface NotificationChannelReference {
1326
+ id: string;
1327
+ }
1040
1328
  /** Customer reference. */
1041
1329
  export interface BillingCustomerReference {
1042
1330
  /** The ID of the customer. */
@@ -1229,6 +1517,16 @@ export interface ChargeResolvedCostBasis {
1229
1517
  /** When the rate was resolved. */
1230
1518
  resolvedAt: Date;
1231
1519
  }
1520
+ /** Options for manually collecting a customer's pending lines into invoices. */
1521
+ export interface InvoiceCustomerChargesInput {
1522
+ /** Collection cutoff. Defaults to the current time and cannot be in the future. */
1523
+ asOf?: Date;
1524
+ /**
1525
+ * Override the customer's progressive billing setting for this collection. When
1526
+ * enabled, eligible usage-based lines can be collected for a partial period.
1527
+ */
1528
+ progressiveBillingOverride?: boolean;
1529
+ }
1232
1530
  /** A subscription add-on event. */
1233
1531
  export interface SubscriptionAddonTimelineSegment {
1234
1532
  /** An ISO-8601 timestamp representation of the cadence start of the resource. */
@@ -1979,15 +2277,6 @@ export interface CreditGrantPlanFilter {
1979
2277
  /** Omission matches all versions, including future versions. */
1980
2278
  version?: VersionFilter;
1981
2279
  }
1982
- /** Filter options for listing credit grants. */
1983
- export interface ListCreditGrantsParamsFilter {
1984
- /** Filter credit grants by status. */
1985
- status?: 'pending' | 'active' | 'expired' | 'voided';
1986
- /** Filter credit grants by currency. */
1987
- currency?: string;
1988
- /** Filter credit grants by key. */
1989
- key?: StringFieldFilter;
1990
- }
1991
2280
  /** A validation issue found while processing a billing resource. */
1992
2281
  export interface ValidationIssue {
1993
2282
  /** Machine-readable error code. */
@@ -2123,6 +2412,43 @@ export interface ChargeRealizationPayment {
2123
2412
  /** The settlement status of the payment. */
2124
2413
  status: 'authorized' | 'settled';
2125
2414
  }
2415
+ /** A monetary amount discount applied to an invoice line item. */
2416
+ export interface InvoiceLineAmountDiscount {
2417
+ /** Unique identifier for the discount. */
2418
+ id: string;
2419
+ /** The reason this discount was applied. */
2420
+ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
2421
+ /** Optional human-readable description of the discount. */
2422
+ description?: string;
2423
+ /** External identifiers for this discount. */
2424
+ externalReferences?: InvoiceLineExternalReferences;
2425
+ /** The monetary amount deducted. */
2426
+ amount: string;
2427
+ }
2428
+ /** A usage quantity discount applied to an invoice line item. */
2429
+ export interface InvoiceLineUsageDiscount {
2430
+ /** Unique identifier for the discount. */
2431
+ id: string;
2432
+ /** The reason this discount was applied. */
2433
+ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
2434
+ /** Optional human-readable description of the discount. */
2435
+ description?: string;
2436
+ /** External identifiers for this discount. */
2437
+ externalReferences?: InvoiceLineExternalReferences;
2438
+ /** The usage quantity deducted (in billing units). */
2439
+ quantity: string;
2440
+ }
2441
+ /** Base fields shared by all invoice line item discounts. */
2442
+ export interface InvoiceLineBaseDiscount {
2443
+ /** Unique identifier for the discount. */
2444
+ id: string;
2445
+ /** The reason this discount was applied. */
2446
+ reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
2447
+ /** Optional human-readable description of the discount. */
2448
+ description?: string;
2449
+ /** External identifiers for this discount. */
2450
+ externalReferences?: InvoiceLineExternalReferences;
2451
+ }
2126
2452
  /** Remove a phase from the subscription. */
2127
2453
  export interface SubscriptionEditRemovePhase {
2128
2454
  /** Discriminator for the remove-phase operation. */
@@ -2150,6 +2476,13 @@ export interface AppCapability {
2150
2476
  /** Description of the capability. */
2151
2477
  description: string;
2152
2478
  }
2479
+ /** An action the operator should take on an installed app. */
2480
+ export interface AppAction {
2481
+ /** The action type. */
2482
+ type: 'reconcile_webhook_events';
2483
+ /** Human readable explanation of why the action is needed. */
2484
+ description: string;
2485
+ }
2153
2486
  /** AppStripe update request. */
2154
2487
  export interface UpdateAppStripeRequest {
2155
2488
  /**
@@ -2240,43 +2573,11 @@ export interface WorkflowInvoicingSettings {
2240
2573
  progressiveBilling: boolean;
2241
2574
  /** Controls how subscription-ending shortened service periods are billed. */
2242
2575
  subscriptionEndProrationMode: 'bill_full_period' | 'bill_actual_period';
2243
- }
2244
- /** A monetary amount discount applied to an invoice line item. */
2245
- export interface InvoiceLineAmountDiscount {
2246
- /** Unique identifier for the discount. */
2247
- id: string;
2248
- /** The reason this discount was applied. */
2249
- reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
2250
- /** Optional human-readable description of the discount. */
2251
- description?: string;
2252
- /** External identifiers for this discount. */
2253
- externalReferences?: InvoiceLineExternalReferences;
2254
- /** The monetary amount deducted. */
2255
- amount: string;
2256
- }
2257
- /** A usage quantity discount applied to an invoice line item. */
2258
- export interface InvoiceLineUsageDiscount {
2259
- /** Unique identifier for the discount. */
2260
- id: string;
2261
- /** The reason this discount was applied. */
2262
- reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
2263
- /** Optional human-readable description of the discount. */
2264
- description?: string;
2265
- /** External identifiers for this discount. */
2266
- externalReferences?: InvoiceLineExternalReferences;
2267
- /** The usage quantity deducted (in billing units). */
2268
- quantity: string;
2269
- }
2270
- /** Base fields shared by all invoice line item discounts. */
2271
- export interface InvoiceLineBaseDiscount {
2272
- /** Unique identifier for the discount. */
2273
- id: string;
2274
- /** The reason this discount was applied. */
2275
- reason: 'maximum_spend' | 'ratecard_percentage' | 'ratecard_usage';
2276
- /** Optional human-readable description of the discount. */
2277
- description?: string;
2278
- /** External identifiers for this discount. */
2279
- externalReferences?: InvoiceLineExternalReferences;
2576
+ /**
2577
+ * Controls whether empty invoices are created in the invoicing app. An invoice is
2578
+ * empty when it has no line items or its total is zero.
2579
+ */
2580
+ emptyInvoiceMode: 'create' | 'omit';
2280
2581
  }
2281
2582
  /** Filter options for listing currencies. */
2282
2583
  export interface ListCurrenciesParamsFilter {
@@ -2429,32 +2730,470 @@ export interface UpdateBillingNotificationChannelRequest {
2429
2730
  */
2430
2731
  signingSecret?: string;
2431
2732
  }
2432
- /** App customer data. */
2433
- export interface AppCustomerData {
2434
- /**
2435
- * Used if the customer has a linked Stripe app.
2436
- *
2437
- * Set to `null` to remove the Stripe data of the customer; omit to leave it
2438
- * unchanged.
2439
- */
2440
- stripe?: AppCustomerDataStripe | null;
2441
- /**
2442
- * Used if the customer has a linked external invoicing app.
2443
- *
2444
- * Set to `null` to remove the external invoicing data of the customer; omit to
2445
- * leave it unchanged.
2446
- */
2447
- externalInvoicing?: AppCustomerDataExternalInvoicing | null;
2733
+ /**
2734
+ * A balance threshold of a notification rule. Crossing it generates an
2735
+ * `entitlements.balance.threshold` event.
2736
+ */
2737
+ export interface NotificationBalanceThreshold {
2738
+ /** What the threshold value is measured against. */
2739
+ type: 'balance_value' | 'usage_percentage' | 'usage_value';
2740
+ /** The threshold value. */
2741
+ value: number;
2448
2742
  }
2449
- /** AppCustomerData upsert request. */
2450
- export interface UpsertAppCustomerDataRequest {
2451
- /**
2452
- * Used if the customer has a linked Stripe app.
2453
- *
2454
- * Set to `null` to remove the Stripe data of the customer; omit to leave it
2455
- * unchanged.
2456
- */
2457
- stripe?: AppCustomerDataStripe | null;
2743
+ /** A reference to the notification rule that generated an event. */
2744
+ export interface NotificationRuleReference {
2745
+ /** The unique identifier of the rule. */
2746
+ id: string;
2747
+ /** The type of event the rule generates. */
2748
+ type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated';
2749
+ /** The user-provided name of the rule. */
2750
+ name: string;
2751
+ }
2752
+ /** A single delivery attempt to a channel. */
2753
+ export interface NotificationEventDeliveryAttempt {
2754
+ /** The delivery state reached by this attempt. */
2755
+ state: 'success' | 'failed' | 'sending' | 'pending' | 'resending';
2756
+ /** The response returned by the recipient. */
2757
+ response: NotificationEventDeliveryAttemptResponse;
2758
+ /** When the attempt was made. */
2759
+ timestamp: Date;
2760
+ }
2761
+ /** A fixed per-unit cost amount. */
2762
+ export interface NotificationEventV1FeatureManualUnitCost {
2763
+ /** type. */
2764
+ type: 'manual';
2765
+ /** Fixed per-unit cost amount in USD. */
2766
+ amount: string;
2767
+ }
2768
+ /** Resolved per-token pricing from the LLM cost database. */
2769
+ export interface NotificationEventV1FeatureLlmUnitCostPricing {
2770
+ /** Cost per input token in USD. */
2771
+ inputPerToken: string;
2772
+ /** Cost per output token in USD. */
2773
+ outputPerToken: string;
2774
+ /** Cost per cache read token in USD. */
2775
+ cacheReadPerToken?: string;
2776
+ /** Cost per reasoning token in USD. */
2777
+ reasoningPerToken?: string;
2778
+ /** Cost per cache write token in USD. */
2779
+ cacheWritePerToken?: string;
2780
+ }
2781
+ /** Totals contains the summaries of all calculations for the invoice. */
2782
+ export interface NotificationEventV1InvoiceTotals {
2783
+ /** The total value of the line before taxes, discounts and commitments. */
2784
+ amount: string;
2785
+ /** The amount of value of the line that are due to additional charges. */
2786
+ chargesTotal: string;
2787
+ /** The amount of value of the line that are due to discounts. */
2788
+ discountsTotal: string;
2789
+ /** The amount of value of the line that are due to credits. */
2790
+ creditsTotal: string;
2791
+ /** The total amount of taxes that are included in the line. */
2792
+ taxesInclusiveTotal: string;
2793
+ /** The total amount of taxes that are added on top of amount from the line. */
2794
+ taxesExclusiveTotal: string;
2795
+ /** The total amount of taxes for this line. */
2796
+ taxesTotal: string;
2797
+ /** The total amount value of the line after taxes, discounts and commitments. */
2798
+ total: string;
2799
+ }
2800
+ /** The reason for the discount is a ratecard usage. */
2801
+ export interface NotificationEventV1DiscountReasonRatecardUsage {
2802
+ /** type. */
2803
+ type: 'ratecard_usage';
2804
+ /**
2805
+ * The quantity of the usage discount.
2806
+ *
2807
+ * Must be positive.
2808
+ */
2809
+ quantity: string;
2810
+ /**
2811
+ * Correlation ID for the discount.
2812
+ *
2813
+ * This is used to link discounts across different invoices (progressive billing
2814
+ * use case).
2815
+ *
2816
+ * If not provided, the invoicing engine will auto-generate one. When editing an
2817
+ * invoice line, please make sure to keep the same correlation ID of the discount
2818
+ * or in progressive billing setups the discount amounts might be incorrect.
2819
+ */
2820
+ correlationId?: string;
2821
+ }
2822
+ /**
2823
+ * InvoiceLineCreditAllocation represents a credit amount allocated to the line
2824
+ * before taxes are applied.
2825
+ */
2826
+ export interface NotificationEventV1InvoiceLineCreditAllocation {
2827
+ /** Amount allocated from credits. */
2828
+ amount: string;
2829
+ /** Text description as to why the credit was allocated. */
2830
+ description?: string;
2831
+ }
2832
+ /** Unit price with spend commitments. */
2833
+ export interface NotificationEventV1UnitPriceWithCommitments {
2834
+ /** The type of the price. */
2835
+ type: 'unit';
2836
+ /** The amount of the unit price. */
2837
+ amount: string;
2838
+ /** The customer is committed to spend at least the amount. */
2839
+ minimumAmount?: string;
2840
+ /** The customer is limited to spend at most the amount. */
2841
+ maximumAmount?: string;
2842
+ }
2843
+ /** Flat price. */
2844
+ export interface NotificationEventV1FlatPrice {
2845
+ /** The type of the price. */
2846
+ type: 'flat';
2847
+ /** The amount of the flat price. */
2848
+ amount: string;
2849
+ }
2850
+ /** Unit price. */
2851
+ export interface NotificationEventV1UnitPrice {
2852
+ /** The type of the price. */
2853
+ type: 'unit';
2854
+ /** The amount of the unit price. */
2855
+ amount: string;
2856
+ }
2857
+ /** Dynamic price with spend commitments. */
2858
+ export interface NotificationEventV1DynamicPriceWithCommitments {
2859
+ /** The type of the price. */
2860
+ type: 'dynamic';
2861
+ /**
2862
+ * The multiplier to apply to the base price to get the dynamic price.
2863
+ *
2864
+ * Examples:
2865
+ *
2866
+ * - 0.0: the price is zero
2867
+ * - 0.5: the price is 50% of the base price
2868
+ * - 1.0: the price is the same as the base price
2869
+ * - 1.5: the price is 150% of the base price
2870
+ */
2871
+ multiplier?: string;
2872
+ /** The customer is committed to spend at least the amount. */
2873
+ minimumAmount?: string;
2874
+ /** The customer is limited to spend at most the amount. */
2875
+ maximumAmount?: string;
2876
+ }
2877
+ /** Package price with spend commitments. */
2878
+ export interface NotificationEventV1PackagePriceWithCommitments {
2879
+ /** The type of the price. */
2880
+ type: 'package';
2881
+ /** The price of one package. */
2882
+ amount: string;
2883
+ /** The quantity per package. */
2884
+ quantityPerPackage: string;
2885
+ /** The customer is committed to spend at least the amount. */
2886
+ minimumAmount?: string;
2887
+ /** The customer is limited to spend at most the amount. */
2888
+ maximumAmount?: string;
2889
+ }
2890
+ /** A usage discount. */
2891
+ export interface NotificationEventV1BillingDiscountUsage {
2892
+ /**
2893
+ * The quantity of the usage discount.
2894
+ *
2895
+ * Must be positive.
2896
+ */
2897
+ quantity: string;
2898
+ /**
2899
+ * Correlation ID for the discount.
2900
+ *
2901
+ * This is used to link discounts across different invoices (progressive billing
2902
+ * use case).
2903
+ *
2904
+ * If not provided, the invoicing engine will auto-generate one. When editing an
2905
+ * invoice line, please make sure to keep the same correlation ID of the discount
2906
+ * or in progressive billing setups the discount amounts might be incorrect.
2907
+ */
2908
+ correlationId?: string;
2909
+ }
2910
+ /** A cost basis pinned to a custom-currency pair for the subscription. */
2911
+ export interface NotificationEventV1SubscriptionCostBasisPin {
2912
+ /** The managed custom currency ID. */
2913
+ customCurrencyId: string;
2914
+ /** The fiat currency in which the subscription is invoiced. */
2915
+ invoiceCurrency: string;
2916
+ /** The pinned cost basis resource ID. */
2917
+ costBasisId: string;
2918
+ }
2919
+ /** Address */
2920
+ export interface NotificationEventV1Address {
2921
+ /**
2922
+ * Country code in [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html)
2923
+ * alpha-2 format.
2924
+ */
2925
+ country?: string;
2926
+ /** Postal code. */
2927
+ postalCode?: string;
2928
+ /** State or province. */
2929
+ state?: string;
2930
+ /** City. */
2931
+ city?: string;
2932
+ /** First line of the address. */
2933
+ line1?: string;
2934
+ /** Second line of the address. */
2935
+ line2?: string;
2936
+ /** Phone number. */
2937
+ phoneNumber?: string;
2938
+ }
2939
+ /** Configuration for pro-rating behavior. */
2940
+ export interface NotificationEventV1ProRatingConfig {
2941
+ /** Whether pro-rating is enabled for this plan. */
2942
+ enabled: boolean;
2943
+ /** How to handle pro-rating for billing period changes. */
2944
+ mode: 'prorate_prices';
2945
+ }
2946
+ /** Threshold value with multiple supported types. */
2947
+ export interface NotificationEventV1RuleBalanceThresholdValue {
2948
+ /** Value of the threshold. */
2949
+ value: number;
2950
+ /** Type of the threshold. */
2951
+ type: 'PERCENT' | 'NUMBER' | 'balance_value' | 'usage_percentage' | 'usage_value';
2952
+ }
2953
+ /**
2954
+ * Identity stores the details required to identify an entity for tax purposes in a
2955
+ * specific country.
2956
+ */
2957
+ export interface NotificationEventV1BillingPartyTaxIdentity {
2958
+ /** Normalized tax code shown on the original identity document. */
2959
+ code?: string;
2960
+ }
2961
+ /** Reference to an invoice. */
2962
+ export interface NotificationEventV1InvoiceReference {
2963
+ /** The ID of the invoice. */
2964
+ id: string;
2965
+ /** The number of the invoice. */
2966
+ number?: string;
2967
+ }
2968
+ /**
2969
+ * InvoiceDocumentRef is used to describe a reference to an existing document
2970
+ * (invoice).
2971
+ *
2972
+ * The v1 schema describes credit note references with issued_at, number and url,
2973
+ * but the v1 API only ever sends the generic fields below.
2974
+ */
2975
+ export interface NotificationEventV1InvoiceDocumentRef {
2976
+ /** Type of the document referenced. */
2977
+ type: 'credit_note_original_invoice';
2978
+ /** Human readable description on why this reference is here or needs to be used. */
2979
+ reason?: string;
2980
+ /** Additional details about the document. */
2981
+ description?: string;
2982
+ }
2983
+ /**
2984
+ * Omitted fields: period: Tax period in which the referred document had an effect
2985
+ * required by some tax regimes and formats. stamps: Seals of approval from other
2986
+ * organisations that may need to be listed. ext: Extensions for additional codes
2987
+ * that may be required.
2988
+ */
2989
+ export interface NotificationEventV1InvoiceGenericDocumentRef {
2990
+ /** Type of the document referenced. */
2991
+ type: 'credit_note_original_invoice';
2992
+ /** Human readable description on why this reference is here or needs to be used. */
2993
+ reason?: string;
2994
+ /** Additional details about the document. */
2995
+ description?: string;
2996
+ }
2997
+ /**
2998
+ * InvoiceAvailableActions represents the actions that can be performed on the
2999
+ * invoice.
3000
+ */
3001
+ export interface NotificationEventV1InvoiceAvailableActions {
3002
+ /** Advance the invoice to the next status. */
3003
+ advance?: NotificationEventV1InvoiceAvailableActionDetails;
3004
+ /** Approve an invoice that requires manual approval. */
3005
+ approve?: NotificationEventV1InvoiceAvailableActionDetails;
3006
+ /** Delete the invoice (only non-issued invoices can be deleted). */
3007
+ delete?: NotificationEventV1InvoiceAvailableActionDetails;
3008
+ /** Retry an invoice issuing step that failed. */
3009
+ retry?: NotificationEventV1InvoiceAvailableActionDetails;
3010
+ /** Snapshot quantities for usage based line items. */
3011
+ snapshotQuantities?: NotificationEventV1InvoiceAvailableActionDetails;
3012
+ /** Void an already issued invoice. */
3013
+ void?: NotificationEventV1InvoiceAvailableActionDetails;
3014
+ /** Invoice a gathering invoice */
3015
+ invoice?: NotificationEventV1InvoiceAvailableActionInvoiceDetails;
3016
+ }
3017
+ /**
3018
+ * App capability.
3019
+ *
3020
+ * Capabilities only exist in config so they don't extend the Resource model.
3021
+ */
3022
+ export interface NotificationEventV1AppCapability {
3023
+ /** The capability type. */
3024
+ type: 'reportUsage' | 'reportEvents' | 'calculateTax' | 'invoiceCustomers' | 'collectPayments';
3025
+ /** Key */
3026
+ key: string;
3027
+ /** The capability name. */
3028
+ name: string;
3029
+ /** The capability description. */
3030
+ description: string;
3031
+ }
3032
+ /** Set of provider specific tax configs. */
3033
+ export interface NotificationEventV1TaxConfig {
3034
+ /**
3035
+ * Tax behavior.
3036
+ *
3037
+ * If not specified the billing profile is used to determine the tax behavior. If
3038
+ * not specified in the billing profile, the provider's default behavior is used.
3039
+ */
3040
+ behavior?: 'inclusive' | 'exclusive';
3041
+ /** Stripe tax config. */
3042
+ stripe?: NotificationEventV1StripeTaxConfig;
3043
+ /** Custom invoicing tax config. */
3044
+ customInvoicing?: NotificationEventV1CustomInvoicingTaxConfig;
3045
+ /**
3046
+ * Tax code reference.
3047
+ *
3048
+ * When both `taxCodeId` and `stripe.code` are provided, `taxCodeId` takes
3049
+ * precedence: the referenced tax code entity is used and `stripe.code` is ignored.
3050
+ */
3051
+ taxCodeId?: string;
3052
+ }
3053
+ /**
3054
+ * BillingWorkflowPaymentSettings represents the payment settings for a billing
3055
+ * workflow
3056
+ */
3057
+ export interface NotificationEventV1BillingWorkflowPaymentSettings {
3058
+ /** The payment method for the invoice. */
3059
+ collectionMethod?: 'charge_automatically' | 'send_invoice';
3060
+ }
3061
+ /** The reason for the discount is a ratecard percentage. */
3062
+ export interface NotificationEventV1DiscountReasonRatecardPercentage {
3063
+ /** type. */
3064
+ type: 'ratecard_percentage';
3065
+ /** The percentage of the discount. */
3066
+ percentage: number;
3067
+ /**
3068
+ * Correlation ID for the discount.
3069
+ *
3070
+ * This is used to link discounts across different invoices (progressive billing
3071
+ * use case).
3072
+ *
3073
+ * If not provided, the invoicing engine will auto-generate one. When editing an
3074
+ * invoice line, please make sure to keep the same correlation ID of the discount
3075
+ * or in progressive billing setups the discount amounts might be incorrect.
3076
+ */
3077
+ correlationId?: string;
3078
+ }
3079
+ /** A percentage discount. */
3080
+ export interface NotificationEventV1BillingDiscountPercentage {
3081
+ /** The percentage of the discount. */
3082
+ percentage: number;
3083
+ /**
3084
+ * Correlation ID for the discount.
3085
+ *
3086
+ * This is used to link discounts across different invoices (progressive billing
3087
+ * use case).
3088
+ *
3089
+ * If not provided, the invoicing engine will auto-generate one. When editing an
3090
+ * invoice line, please make sure to keep the same correlation ID of the discount
3091
+ * or in progressive billing setups the discount amounts might be incorrect.
3092
+ */
3093
+ correlationId?: string;
3094
+ }
3095
+ /** PaymentDueDate contains an amount that should be paid by the given date. */
3096
+ export interface NotificationEventV1PaymentDueDate {
3097
+ /** When the payment is due. */
3098
+ dueAt: Date;
3099
+ /** Other details to take into account for the due date. */
3100
+ notes?: string;
3101
+ /** How much needs to be paid by the date. */
3102
+ amount: string;
3103
+ /** Percentage of the total that should be paid by the date. */
3104
+ percent?: number;
3105
+ /** If different from the parent document's base currency. */
3106
+ currency?: string;
3107
+ }
3108
+ /**
3109
+ * InvoiceLineSubscriptionReference contains the references to the subscription
3110
+ * that this line is related to.
3111
+ */
3112
+ export interface NotificationEventV1InvoiceLineSubscriptionReference {
3113
+ /** The subscription. */
3114
+ subscription: NotificationEventV1IdResource;
3115
+ /** The phase of the subscription. */
3116
+ phase: NotificationEventV1IdResource;
3117
+ /** The item this line is related to. */
3118
+ item: NotificationEventV1IdResource;
3119
+ /**
3120
+ * The billing period of the subscription. In case the subscription item's billing
3121
+ * period is different from the subscription's billing period, this field will
3122
+ * contain the billing period of the subscription itself.
3123
+ *
3124
+ * For example, in case of:
3125
+ *
3126
+ * - A monthly billed subscription anchored to 2025-01-01
3127
+ * - A subscription item billed daily
3128
+ *
3129
+ * An example line would have the period of 2025-01-02 to 2025-01-03 as the item is
3130
+ * billed daily, but the subscription's billing period will be 2025-01-01 to
3131
+ * 2025-01-31.
3132
+ */
3133
+ billingPeriod: NotificationEventV1Period;
3134
+ }
3135
+ /** Flat price with payment term. */
3136
+ export interface NotificationEventV1FlatPriceWithPaymentTerm {
3137
+ /** The type of the price. */
3138
+ type: 'flat';
3139
+ /** The amount of the flat price. */
3140
+ amount: string;
3141
+ /** The payment term of the flat price. Defaults to in advance. */
3142
+ paymentTerm?: 'in_advance' | 'in_arrears';
3143
+ }
3144
+ /**
3145
+ * ValidationIssue captures any validation issues related to the invoice.
3146
+ *
3147
+ * Issues with severity "critical" will prevent the invoice from being issued.
3148
+ */
3149
+ export interface NotificationEventV1ValidationIssue {
3150
+ /** Timestamp of when the resource was created. */
3151
+ createdAt: Date;
3152
+ /** Timestamp of when the resource was last updated. */
3153
+ updatedAt: Date;
3154
+ /** Timestamp of when the resource was permanently deleted. */
3155
+ deletedAt?: Date;
3156
+ /** ID of the charge or discount. */
3157
+ id: string;
3158
+ /** The severity of the issue. */
3159
+ severity: 'critical' | 'warning';
3160
+ /** The field that the issue is related to, if available in JSON path format. */
3161
+ field?: string;
3162
+ /** Machine indentifiable code for the issue, if available. */
3163
+ code?: string;
3164
+ /** Component reporting the issue. */
3165
+ component: string;
3166
+ /** A human-readable description of the issue. */
3167
+ message: string;
3168
+ /** Additional context for the issue. */
3169
+ metadata?: NotificationEventV1Metadata;
3170
+ }
3171
+ /** App customer data. */
3172
+ export interface AppCustomerData {
3173
+ /**
3174
+ * Used if the customer has a linked Stripe app.
3175
+ *
3176
+ * Set to `null` to remove the Stripe data of the customer; omit to leave it
3177
+ * unchanged.
3178
+ */
3179
+ stripe?: AppCustomerDataStripe | null;
3180
+ /**
3181
+ * Used if the customer has a linked external invoicing app.
3182
+ *
3183
+ * Set to `null` to remove the external invoicing data of the customer; omit to
3184
+ * leave it unchanged.
3185
+ */
3186
+ externalInvoicing?: AppCustomerDataExternalInvoicing | null;
3187
+ }
3188
+ /** AppCustomerData upsert request. */
3189
+ export interface UpsertAppCustomerDataRequest {
3190
+ /**
3191
+ * Used if the customer has a linked Stripe app.
3192
+ *
3193
+ * Set to `null` to remove the Stripe data of the customer; omit to leave it
3194
+ * unchanged.
3195
+ */
3196
+ stripe?: AppCustomerDataStripe | null;
2458
3197
  /**
2459
3198
  * Used if the customer has a linked external invoicing app.
2460
3199
  *
@@ -2486,6 +3225,22 @@ export interface CreditAdjustment {
2486
3225
  description?: string;
2487
3226
  labels?: Labels;
2488
3227
  }
3228
+ /** Filter options for listing credit grants. */
3229
+ export interface ListCreditGrantsParamsFilter {
3230
+ /** Filter credit grants by status. */
3231
+ status?: 'pending' | 'active' | 'expired' | 'voided';
3232
+ /** Filter credit grants by fiat or custom currency code. */
3233
+ currency?: BillingCurrencyCode;
3234
+ /** Filter credit grants by key. */
3235
+ key?: StringFieldFilter;
3236
+ /**
3237
+ * Select grants spendable on any requested feature, including grants without
3238
+ * feature restrictions. Keys are case-sensitive. Supports `eq` (or shorthand) and
3239
+ * `oeq` with comma-separated keys. Omit to include all features; use
3240
+ * `exists=false` for grants without feature restrictions.
3241
+ */
3242
+ featureKey?: StringFieldFilter;
3243
+ }
2489
3244
  /** CreditAdjustment create request. */
2490
3245
  export interface CreateCreditAdjustmentRequest {
2491
3246
  /**
@@ -2509,7 +3264,7 @@ export interface CreateCreditAdjustmentRequest {
2509
3264
  /** Filter options for listing credit transactions. */
2510
3265
  export interface ListCreditTransactionsParamsFilter {
2511
3266
  /** Filter credit transactions by type. */
2512
- type?: 'funded' | 'consumed' | 'expired' | 'voided';
3267
+ type?: 'funded' | 'consumed' | 'correction' | 'expired' | 'voided';
2513
3268
  /**
2514
3269
  * Filter credit transactions by currency code. Custom-currency rows retain their
2515
3270
  * managed currency identifier.
@@ -2807,6 +3562,47 @@ export interface ListPlanAddonsParamsFilter {
2807
3562
  addonName?: StringFieldFilter;
2808
3563
  planCurrency?: StringFieldFilter;
2809
3564
  }
3565
+ /** CustomerBillingProfile upsert request. */
3566
+ export interface UpsertCustomerBillingProfileRequest {
3567
+ /**
3568
+ * The billing profile explicitly selected for the customer.
3569
+ *
3570
+ * Unpinned customers use the current namespace default. Selecting the current
3571
+ * default explicitly pins the customer to that profile.
3572
+ */
3573
+ billingProfile?: ProfileReference | null;
3574
+ }
3575
+ /** Customer billing profile selection. */
3576
+ export interface CustomerProfile {
3577
+ /**
3578
+ * The billing profile explicitly selected for the customer.
3579
+ *
3580
+ * Unpinned customers use the current namespace default. Selecting the current
3581
+ * default explicitly pins the customer to that profile.
3582
+ */
3583
+ billingProfile?: ProfileReference | null;
3584
+ /**
3585
+ * The effective billing profile for the customer. Uses the explicitly selected
3586
+ * billing profile when pinned, otherwise the current default billing profile.
3587
+ */
3588
+ effectiveBillingProfile: ProfileReference;
3589
+ }
3590
+ /** The feature filter shared by the entitlement Rule configurations. */
3591
+ export interface EntitlementFeaturesRuleConfig {
3592
+ /**
3593
+ * The features the rule applies to. When omitted, the rule applies to every
3594
+ * feature.
3595
+ */
3596
+ features?: FeatureReference[];
3597
+ }
3598
+ /** Rule configuration of `v1.entitlement.usage_period.reset`. */
3599
+ export interface EntitlementUsagePeriodResetV1RuleConfig {
3600
+ /**
3601
+ * The features the rule applies to. When omitted, the rule applies to every
3602
+ * feature.
3603
+ */
3604
+ features?: FeatureReference[];
3605
+ }
2810
3606
  /**
2811
3607
  * Tax configuration for a billable resource.
2812
3608
  *
@@ -2827,6 +3623,84 @@ export interface CreateTaxCodeConfig {
2827
3623
  /** Tax code applied to the invoice line item. */
2828
3624
  code?: CreateResourceReference;
2829
3625
  }
3626
+ /** The credit balance by currency. */
3627
+ export interface CreditBalance {
3628
+ currency: BillingCurrencyCode;
3629
+ /** Managed currency reference. Present only for custom currencies. */
3630
+ customCurrency?: CurrencyCustomReference;
3631
+ /**
3632
+ * Spendable balance after applying currently live, unbooked charge impacts. Can be
3633
+ * negative when usage exceeds available credit.
3634
+ *
3635
+ * Always zero for historical balance queries using the `timestamp` parameter
3636
+ * because live charge impacts cannot be reconstructed historically.
3637
+ */
3638
+ live: string;
3639
+ /**
3640
+ * Credits that have been booked on the ledger as of the balance timestamp,
3641
+ * including credit-only advance debt. Can be negative.
3642
+ */
3643
+ booked: string;
3644
+ /** Deprecated alias for `booked`. Always returns the same value. */
3645
+ settled: string;
3646
+ /**
3647
+ * Spendable credit at the balance timestamp, including any credit-only advance
3648
+ * debt. Preserves credit already committed to later usage. Future grants cannot be
3649
+ * spent early; scheduled expiry reduces availability when it takes effect. Can be
3650
+ * negative when advance debt exceeds spendable credit.
3651
+ */
3652
+ spendable: string;
3653
+ /**
3654
+ * Credits that have been granted but are not yet written to the ledger, or are
3655
+ * written to the ledger with a future booked time.
3656
+ */
3657
+ pending: string;
3658
+ }
3659
+ /**
3660
+ * A credit transaction represents a single credit movement on the customer's
3661
+ * balance.
3662
+ *
3663
+ * Credit transactions are immutable.
3664
+ */
3665
+ export interface CreditTransaction {
3666
+ id: string;
3667
+ /**
3668
+ * Display name of the resource.
3669
+ *
3670
+ * Between 1 and 256 characters.
3671
+ */
3672
+ name: string;
3673
+ /**
3674
+ * Optional description of the resource.
3675
+ *
3676
+ * Maximum 1024 characters.
3677
+ */
3678
+ description?: string;
3679
+ labels?: Labels;
3680
+ /** An ISO-8601 timestamp representation of entity creation date. */
3681
+ createdAt: Date;
3682
+ /** The date and time the transaction was booked. */
3683
+ bookedAt: Date;
3684
+ /** The type of credit transaction. */
3685
+ type: 'funded' | 'consumed' | 'correction' | 'expired' | 'voided';
3686
+ /** Currency of the balance affected by the transaction. */
3687
+ currency: BillingCurrencyCode;
3688
+ /** Managed currency reference. Present only for custom currencies. */
3689
+ customCurrency?: CurrencyCustomReference;
3690
+ /**
3691
+ * Signed amount of the credit movement. Positive values add balance, negative
3692
+ * values reduce balance.
3693
+ */
3694
+ amount: string;
3695
+ /**
3696
+ * The booked credit balance before and after the transaction, including
3697
+ * credit-only advance debt.
3698
+ */
3699
+ availableBalance: {
3700
+ before: string;
3701
+ after: string;
3702
+ };
3703
+ }
2830
3704
  /**
2831
3705
  * Tax configuration for a billable resource.
2832
3706
  *
@@ -2894,68 +3768,6 @@ export interface UpdateOrganizationDefaultTaxCodesRequest {
2894
3768
  /** Default tax code for credit grants. */
2895
3769
  creditGrantTaxCode?: TaxCodeReference;
2896
3770
  }
2897
- /** The credit balance by currency. */
2898
- export interface CreditBalance {
2899
- currency: BillingCurrencyCode;
2900
- /** Managed currency reference. Present only for custom currencies. */
2901
- customCurrency?: CurrencyCustomReference;
2902
- /**
2903
- * Credits available after applying currently live charge impacts.
2904
- *
2905
- * Always zero for historical balance queries using the `timestamp` parameter
2906
- * because live charge impacts cannot be reconstructed historically.
2907
- */
2908
- live: string;
2909
- /** Credits that have been booked on the ledger as of the balance timestamp. */
2910
- settled: string;
2911
- /**
2912
- * Credits that have been granted but are not yet written to the ledger, or are
2913
- * written to the ledger with a future booked time.
2914
- */
2915
- pending: string;
2916
- }
2917
- /**
2918
- * A credit transaction represents a single credit movement on the customer's
2919
- * balance.
2920
- *
2921
- * Credit transactions are immutable.
2922
- */
2923
- export interface CreditTransaction {
2924
- id: string;
2925
- /**
2926
- * Display name of the resource.
2927
- *
2928
- * Between 1 and 256 characters.
2929
- */
2930
- name: string;
2931
- /**
2932
- * Optional description of the resource.
2933
- *
2934
- * Maximum 1024 characters.
2935
- */
2936
- description?: string;
2937
- labels?: Labels;
2938
- /** An ISO-8601 timestamp representation of entity creation date. */
2939
- createdAt: Date;
2940
- /** The date and time the transaction was booked. */
2941
- bookedAt: Date;
2942
- /** The type of credit transaction. */
2943
- type: 'funded' | 'consumed' | 'expired' | 'voided';
2944
- /** Currency of the balance affected by the transaction. */
2945
- currency: BillingCurrencyCode;
2946
- /** Managed currency reference. Present only for custom currencies. */
2947
- customCurrency?: CurrencyCustomReference;
2948
- /**
2949
- * Signed amount of the credit movement. Positive values add balance, negative
2950
- * values reduce balance.
2951
- */
2952
- amount: string;
2953
- /** The available balance before and after the transaction. */
2954
- availableBalance: {
2955
- before: string;
2956
- after: string;
2957
- };
2958
- }
2959
3771
  /**
2960
3772
  * BillingInvoiceWorkflowAppsReferences represents the references (id) to the apps
2961
3773
  * used by a billing profile
@@ -3035,31 +3847,191 @@ export interface CreatePlanAddonRequest {
3035
3847
  /** The key of the plan phase from which the add-on becomes available for purchase. */
3036
3848
  fromPlanPhase: string;
3037
3849
  /**
3038
- * The maximum number of times the add-on can be purchased for the plan. For
3039
- * single-instance add-ons this field must be omitted. For multi-instance add-ons
3040
- * when omitted, unlimited quantity can be purchased.
3850
+ * The maximum number of times the add-on can be purchased for the plan. For
3851
+ * single-instance add-ons this field must be omitted. For multi-instance add-ons
3852
+ * when omitted, unlimited quantity can be purchased.
3853
+ */
3854
+ maxQuantity?: number;
3855
+ }
3856
+ /**
3857
+ * Tax configuration for a billable resource.
3858
+ *
3859
+ * Applies a tax code and tax behavior to the resulting invoice line items. When
3860
+ * not set, the applicable default is used: the billing profile default tax
3861
+ * configuration, then the organization default tax code.
3862
+ */
3863
+ export interface UpdateTaxCodeConfig {
3864
+ /**
3865
+ * Tax behavior.
3866
+ *
3867
+ * This enum is used to specify whether tax is included in the price or excluded
3868
+ * from the price. If not specified, the billing profile is used to determine the
3869
+ * tax behavior. If not specified in the billing profile, the provider's default
3870
+ * behavior is used.
3871
+ */
3872
+ behavior?: 'inclusive' | 'exclusive';
3873
+ /** Tax code applied to the invoice line item. */
3874
+ code?: UpdateResourceReference;
3875
+ }
3876
+ /** A rule that generates an event when an entitlement usage period is reset. */
3877
+ export interface NotificationRuleEntitlementReset {
3878
+ id: string;
3879
+ /**
3880
+ * Display name of the resource.
3881
+ *
3882
+ * Between 1 and 256 characters.
3883
+ */
3884
+ name: string;
3885
+ labels?: Labels;
3886
+ /** An ISO-8601 timestamp representation of entity creation date. */
3887
+ createdAt: Date;
3888
+ /** An ISO-8601 timestamp representation of entity last update date. */
3889
+ updatedAt: Date;
3890
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3891
+ deletedAt?: Date;
3892
+ /** The type of event the rule generates. Immutable after creation. */
3893
+ type: 'entitlements.reset';
3894
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3895
+ disabled: boolean;
3896
+ /**
3897
+ * The channels the rule delivers its events to. At least one and at most five
3898
+ * channels are required. Responses omit channels that have since been disabled or
3899
+ * deleted.
3900
+ */
3901
+ channels: NotificationChannelReference[];
3902
+ /**
3903
+ * The features the rule applies to. When omitted, the rule applies to every
3904
+ * feature.
3905
+ */
3906
+ features?: FeatureReference[];
3907
+ }
3908
+ /** A rule that generates an event when an invoice is created. */
3909
+ export interface NotificationRuleInvoiceCreated {
3910
+ id: string;
3911
+ /**
3912
+ * Display name of the resource.
3913
+ *
3914
+ * Between 1 and 256 characters.
3915
+ */
3916
+ name: string;
3917
+ labels?: Labels;
3918
+ /** An ISO-8601 timestamp representation of entity creation date. */
3919
+ createdAt: Date;
3920
+ /** An ISO-8601 timestamp representation of entity last update date. */
3921
+ updatedAt: Date;
3922
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3923
+ deletedAt?: Date;
3924
+ /** The type of event the rule generates. Immutable after creation. */
3925
+ type: 'invoice.created';
3926
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3927
+ disabled: boolean;
3928
+ /**
3929
+ * The channels the rule delivers its events to. At least one and at most five
3930
+ * channels are required. Responses omit channels that have since been disabled or
3931
+ * deleted.
3932
+ */
3933
+ channels: NotificationChannelReference[];
3934
+ }
3935
+ /** A rule that generates an event when an invoice is updated. */
3936
+ export interface NotificationRuleInvoiceUpdated {
3937
+ id: string;
3938
+ /**
3939
+ * Display name of the resource.
3940
+ *
3941
+ * Between 1 and 256 characters.
3942
+ */
3943
+ name: string;
3944
+ labels?: Labels;
3945
+ /** An ISO-8601 timestamp representation of entity creation date. */
3946
+ createdAt: Date;
3947
+ /** An ISO-8601 timestamp representation of entity last update date. */
3948
+ updatedAt: Date;
3949
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3950
+ deletedAt?: Date;
3951
+ /** The type of event the rule generates. Immutable after creation. */
3952
+ type: 'invoice.updated';
3953
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3954
+ disabled: boolean;
3955
+ /**
3956
+ * The channels the rule delivers its events to. At least one and at most five
3957
+ * channels are required. Responses omit channels that have since been disabled or
3958
+ * deleted.
3959
+ */
3960
+ channels: NotificationChannelReference[];
3961
+ }
3962
+ /** Request body for an entitlement reset rule. */
3963
+ export interface NotificationRuleEntitlementResetRequest {
3964
+ /**
3965
+ * Display name of the resource.
3966
+ *
3967
+ * Between 1 and 256 characters.
3968
+ */
3969
+ name: string;
3970
+ labels?: Labels;
3971
+ /** The type of event the rule generates. Immutable after creation. */
3972
+ type: 'entitlements.reset';
3973
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3974
+ disabled: boolean;
3975
+ /**
3976
+ * The channels the rule delivers its events to. At least one and at most five
3977
+ * channels are required. Responses omit channels that have since been disabled or
3978
+ * deleted.
3979
+ */
3980
+ channels: NotificationChannelReference[];
3981
+ /**
3982
+ * The features the rule applies to. When omitted, the rule applies to every
3983
+ * feature.
3984
+ */
3985
+ features?: FeatureReference[];
3986
+ }
3987
+ /** Request body for an invoice created rule. */
3988
+ export interface NotificationRuleInvoiceCreatedRequest {
3989
+ /**
3990
+ * Display name of the resource.
3991
+ *
3992
+ * Between 1 and 256 characters.
3993
+ */
3994
+ name: string;
3995
+ labels?: Labels;
3996
+ /** The type of event the rule generates. Immutable after creation. */
3997
+ type: 'invoice.created';
3998
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3999
+ disabled: boolean;
4000
+ /**
4001
+ * The channels the rule delivers its events to. At least one and at most five
4002
+ * channels are required. Responses omit channels that have since been disabled or
4003
+ * deleted.
4004
+ */
4005
+ channels: NotificationChannelReference[];
4006
+ }
4007
+ /** Request body for an invoice updated rule. */
4008
+ export interface NotificationRuleInvoiceUpdatedRequest {
4009
+ /**
4010
+ * Display name of the resource.
4011
+ *
4012
+ * Between 1 and 256 characters.
4013
+ */
4014
+ name: string;
4015
+ labels?: Labels;
4016
+ /** The type of event the rule generates. Immutable after creation. */
4017
+ type: 'invoice.updated';
4018
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
4019
+ disabled: boolean;
4020
+ /**
4021
+ * The channels the rule delivers its events to. At least one and at most five
4022
+ * channels are required. Responses omit channels that have since been disabled or
4023
+ * deleted.
3041
4024
  */
3042
- maxQuantity?: number;
4025
+ channels: NotificationChannelReference[];
3043
4026
  }
3044
- /**
3045
- * Tax configuration for a billable resource.
3046
- *
3047
- * Applies a tax code and tax behavior to the resulting invoice line items. When
3048
- * not set, the applicable default is used: the billing profile default tax
3049
- * configuration, then the organization default tax code.
3050
- */
3051
- export interface UpdateTaxCodeConfig {
4027
+ /** Request body for resending a notification event. */
4028
+ export interface ResendBillingNotificationEventRequest {
3052
4029
  /**
3053
- * Tax behavior.
3054
- *
3055
- * This enum is used to specify whether tax is included in the price or excluded
3056
- * from the price. If not specified, the billing profile is used to determine the
3057
- * tax behavior. If not specified in the billing profile, the provider's default
3058
- * behavior is used.
4030
+ * The channels to resend the event to. When omitted or empty, the event is resent
4031
+ * to every enabled channel of the rule. Channels not targeted by the rule or
4032
+ * disabled are rejected.
3059
4033
  */
3060
- behavior?: 'inclusive' | 'exclusive';
3061
- /** Tax code applied to the invoice line item. */
3062
- code?: UpdateResourceReference;
4034
+ channels?: NotificationChannelReference[];
3063
4035
  }
3064
4036
  /** Filter options for listing ingested events. */
3065
4037
  export interface ListEventsParamsFilter {
@@ -3152,6 +4124,57 @@ export interface ListNotificationChannelsParamsFilter {
3152
4124
  createdAt?: DateTimeFieldFilter;
3153
4125
  updatedAt?: DateTimeFieldFilter;
3154
4126
  }
4127
+ /** Filter options for listing notification rules. */
4128
+ export interface ListNotificationRulesParamsFilter {
4129
+ id?: UlidFieldFilter;
4130
+ name?: StringFieldFilter;
4131
+ type?: StringFieldFilterExact;
4132
+ disabled?: BooleanFieldFilter;
4133
+ createdAt?: DateTimeFieldFilter;
4134
+ updatedAt?: DateTimeFieldFilter;
4135
+ /**
4136
+ * Filter by an assigned channel. Matches rules that deliver to at least one of the
4137
+ * given channels. Only `eq` and `oeq` are supported.
4138
+ */
4139
+ channelId?: UlidFieldFilter;
4140
+ }
4141
+ /** Filter options for listing notification events. */
4142
+ export interface ListNotificationEventsParamsFilter {
4143
+ id?: UlidFieldFilter;
4144
+ type?: StringFieldFilterExact;
4145
+ createdAt?: DateTimeFieldFilter;
4146
+ ruleId?: UlidFieldFilter;
4147
+ /**
4148
+ * Filter by a channel of the generating rule. Matches events whose rule targets at
4149
+ * least one of the given channels. Only `eq` and `oeq` are supported.
4150
+ */
4151
+ channelId?: UlidFieldFilter;
4152
+ /**
4153
+ * Filter by delivery state. Matches events where delivery to at least one channel
4154
+ * is in one of the given states. Only `eq` and `oeq` are supported.
4155
+ */
4156
+ deliveryStatus?: StringFieldFilterExact;
4157
+ /**
4158
+ * Filter by the key of the subject the event refers to. Events without a subject
4159
+ * never match, not even with `neq`.
4160
+ */
4161
+ subjectKey?: StringFieldFilterExact;
4162
+ /**
4163
+ * Filter by the id of the subject the event refers to. Events without a subject
4164
+ * never match, not even with `neq`.
4165
+ */
4166
+ subjectId?: UlidFieldFilter;
4167
+ /**
4168
+ * Filter by the key of the feature the event refers to. Events without a feature
4169
+ * never match, not even with `neq`.
4170
+ */
4171
+ featureKey?: StringFieldFilterExact;
4172
+ /**
4173
+ * Filter by the id of the feature the event refers to. Events without a feature
4174
+ * never match, not even with `neq`.
4175
+ */
4176
+ featureId?: UlidFieldFilter;
4177
+ }
3155
4178
  /** Resource filters. */
3156
4179
  export interface ResourceFilters {
3157
4180
  name?: StringFieldFilter;
@@ -3915,6 +4938,13 @@ export interface InvoiceWorkflow {
3915
4938
  /** Payment settings for this invoice. */
3916
4939
  payment?: WorkflowPaymentSettings;
3917
4940
  }
4941
+ /** Discounts applied to an invoice line item. */
4942
+ export interface InvoiceLineDiscounts {
4943
+ /** Monetary amount discounts (e.g. from maximum spend commitments). */
4944
+ amount?: InvoiceLineAmountDiscount[];
4945
+ /** Usage quantity discounts (e.g. free tier usage allowances). */
4946
+ usage?: InvoiceLineUsageDiscount[];
4947
+ }
3918
4948
  /** Request for canceling a subscription. */
3919
4949
  export interface SubscriptionCancel {
3920
4950
  /** If not provided the subscription is canceled immediately. */
@@ -4054,13 +5084,6 @@ export interface AppCatalogItem {
4054
5084
  /** Available install methods of the app. */
4055
5085
  installMethods: ('with_oauth2' | 'with_api_key' | 'no_credentials_required')[];
4056
5086
  }
4057
- /** Discounts applied to an invoice line item. */
4058
- export interface InvoiceLineDiscounts {
4059
- /** Monetary amount discounts (e.g. from maximum spend commitments). */
4060
- amount?: InvoiceLineAmountDiscount[];
4061
- /** Usage quantity discounts (e.g. free tier usage allowances). */
4062
- usage?: InvoiceLineUsageDiscount[];
4063
- }
4064
5087
  /**
4065
5088
  * Invoice-level snapshot of the workflow configuration.
4066
5089
  *
@@ -4096,25 +5119,407 @@ export interface NotificationChannelPagePaginatedResponse {
4096
5119
  data: NotificationChannel[];
4097
5120
  meta: PaginatedMeta;
4098
5121
  }
5122
+ /**
5123
+ * A rule that generates an event when an entitlement balance crosses one of its
5124
+ * thresholds.
5125
+ */
5126
+ export interface NotificationRuleBalanceThreshold {
5127
+ id: string;
5128
+ /**
5129
+ * Display name of the resource.
5130
+ *
5131
+ * Between 1 and 256 characters.
5132
+ */
5133
+ name: string;
5134
+ labels?: Labels;
5135
+ /** An ISO-8601 timestamp representation of entity creation date. */
5136
+ createdAt: Date;
5137
+ /** An ISO-8601 timestamp representation of entity last update date. */
5138
+ updatedAt: Date;
5139
+ /** An ISO-8601 timestamp representation of entity deletion date. */
5140
+ deletedAt?: Date;
5141
+ /** The type of event the rule generates. Immutable after creation. */
5142
+ type: 'entitlements.balance.threshold';
5143
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
5144
+ disabled: boolean;
5145
+ /**
5146
+ * The channels the rule delivers its events to. At least one and at most five
5147
+ * channels are required. Responses omit channels that have since been disabled or
5148
+ * deleted.
5149
+ */
5150
+ channels: NotificationChannelReference[];
5151
+ /** The thresholds that generate an event when crossed. */
5152
+ thresholds: NotificationBalanceThreshold[];
5153
+ /**
5154
+ * The features the rule applies to. When omitted, the rule applies to every
5155
+ * feature.
5156
+ */
5157
+ features?: FeatureReference[];
5158
+ }
5159
+ /** Request body for a balance threshold rule. */
5160
+ export interface NotificationRuleBalanceThresholdRequest {
5161
+ /**
5162
+ * Display name of the resource.
5163
+ *
5164
+ * Between 1 and 256 characters.
5165
+ */
5166
+ name: string;
5167
+ labels?: Labels;
5168
+ /** The type of event the rule generates. Immutable after creation. */
5169
+ type: 'entitlements.balance.threshold';
5170
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
5171
+ disabled: boolean;
5172
+ /**
5173
+ * The channels the rule delivers its events to. At least one and at most five
5174
+ * channels are required. Responses omit channels that have since been disabled or
5175
+ * deleted.
5176
+ */
5177
+ channels: NotificationChannelReference[];
5178
+ /** The thresholds that generate an event when crossed. */
5179
+ thresholds: NotificationBalanceThreshold[];
5180
+ /**
5181
+ * The features the rule applies to. When omitted, the rule applies to every
5182
+ * feature.
5183
+ */
5184
+ features?: FeatureReference[];
5185
+ }
5186
+ /** Rule configuration of `v1.entitlement.balance_threshold.triggered`. */
5187
+ export interface EntitlementBalanceThresholdTriggeredV1RuleConfig {
5188
+ /** The thresholds that generate an event when crossed. */
5189
+ thresholds: NotificationBalanceThreshold[];
5190
+ /**
5191
+ * The features the rule applies to. When omitted, the rule applies to every
5192
+ * feature.
5193
+ */
5194
+ features?: FeatureReference[];
5195
+ }
5196
+ /**
5197
+ * The delivery status of a notification event for one channel of the generating
5198
+ * rule.
5199
+ */
5200
+ export interface NotificationEventDeliveryStatus {
5201
+ /** The identifier of the channel this delivery status belongs to. */
5202
+ channelId: string;
5203
+ /** The current delivery state. */
5204
+ state: 'success' | 'failed' | 'sending' | 'pending' | 'resending';
5205
+ /** The reason for the last state change. Empty for successful deliveries. */
5206
+ reason: string;
5207
+ /** When the delivery state was last updated. */
5208
+ updatedAt: Date;
5209
+ /**
5210
+ * When the next delivery attempt is scheduled. Absent when no further attempts
5211
+ * will be made.
5212
+ */
5213
+ nextAttempt?: Date;
5214
+ /** The delivery attempts made so far, most recent first. */
5215
+ attempts: NotificationEventDeliveryAttempt[];
5216
+ }
5217
+ /** Recurring period with an interval and an anchor. */
5218
+ export interface NotificationEventV1RecurringPeriod {
5219
+ /**
5220
+ * The unit of time for the interval. Heuristically maps ISO duraitons to enum
5221
+ * values or returns the ISO duration.
5222
+ */
5223
+ interval: NotificationEventV1RecurringPeriodInterval;
5224
+ /** A date-time anchor to base the recurring period on. */
5225
+ anchor: Date;
5226
+ /** The unit of time for the interval in ISO8601 format. */
5227
+ intervalIso: string;
5228
+ }
5229
+ /** Recurring period with an interval and an anchor. */
5230
+ export interface NotificationEventV1RecurringPeriodV2 {
5231
+ /**
5232
+ * The unit of time for the interval. Heuristically maps ISO duraitons to enum
5233
+ * values or returns the ISO duration.
5234
+ */
5235
+ interval: NotificationEventV1RecurringPeriodInterval;
5236
+ /** A date-time anchor to base the recurring period on. */
5237
+ anchor: Date;
5238
+ }
5239
+ /**
5240
+ * LLM cost lookup configuration. Maps meter group-by dimensions to LLM cost
5241
+ * database fields.
5242
+ */
5243
+ export interface NotificationEventV1FeatureLlmUnitCost {
5244
+ /** type. */
5245
+ type: 'llm';
5246
+ /**
5247
+ * Meter group-by property that holds the LLM provider. Use this when the meter has
5248
+ * a group-by dimension for provider. Mutually exclusive with `provider`.
5249
+ */
5250
+ providerProperty?: string;
5251
+ /**
5252
+ * Static LLM provider value (e.g., "openai", "anthropic"). Use this when the
5253
+ * feature tracks a single provider. Mutually exclusive with `providerProperty`.
5254
+ */
5255
+ provider?: string;
5256
+ /**
5257
+ * Meter group-by property that holds the model ID. Use this when the meter has a
5258
+ * group-by dimension for model. Mutually exclusive with `model`.
5259
+ */
5260
+ modelProperty?: string;
5261
+ /**
5262
+ * Static model ID value (e.g., "gpt-4", "claude-3-5-sonnet"). Use this when the
5263
+ * feature tracks a single model. Mutually exclusive with `modelProperty`.
5264
+ */
5265
+ model?: string;
5266
+ /**
5267
+ * Meter group-by property that holds the token type. Use this when the meter has a
5268
+ * group-by dimension for token type. Mutually exclusive with `tokenType`.
5269
+ */
5270
+ tokenTypeProperty?: string;
5271
+ /**
5272
+ * Static token type value. Use this when the feature tracks a single token type
5273
+ * (e.g., only input tokens). Expected values: input, output, cache_read,
5274
+ * reasoning, cache_write, request, response. `request` is an alias for `input`,
5275
+ * `response` is an alias for `output`. Mutually exclusive with
5276
+ * `tokenTypeProperty`.
5277
+ */
5278
+ tokenType?: string;
5279
+ /**
5280
+ * Resolved per-token pricing from the LLM cost database. Only populated in
5281
+ * responses when the feature's meter group-by filters specify exact provider and
5282
+ * model values.
5283
+ */
5284
+ pricing?: NotificationEventV1FeatureLlmUnitCostPricing;
5285
+ }
5286
+ /** A price tier. At least one price component is required in each tier. */
5287
+ export interface NotificationEventV1PriceTier {
5288
+ /**
5289
+ * Up to and including to this quantity will be contained in the tier. If null, the
5290
+ * tier is open-ended.
5291
+ */
5292
+ upToAmount?: string;
5293
+ /** The flat price component of the tier. */
5294
+ flatPrice: NotificationEventV1FlatPrice | null;
5295
+ /** The unit price component of the tier. */
5296
+ unitPrice: NotificationEventV1UnitPrice | null;
5297
+ }
5298
+ /** Subscription is an exact subscription instance. */
5299
+ export interface NotificationEventV1Subscription {
5300
+ /** A unique identifier for the resource. */
5301
+ id: string;
5302
+ /** Human-readable name for the resource. Between 1 and 256 characters. */
5303
+ name: string;
5304
+ /** Optional description of the resource. Maximum 1024 characters. */
5305
+ description?: string;
5306
+ /** Additional metadata for the resource. */
5307
+ metadata?: NotificationEventV1Metadata | null;
5308
+ /** Timestamp of when the resource was created. */
5309
+ createdAt: Date;
5310
+ /** Timestamp of when the resource was last updated. */
5311
+ updatedAt: Date;
5312
+ /** Timestamp of when the resource was permanently deleted. */
5313
+ deletedAt?: Date;
5314
+ /** The cadence start of the resource. */
5315
+ activeFrom: Date;
5316
+ /** The cadence end of the resource. */
5317
+ activeTo?: Date;
5318
+ /** Set of key-value pairs managed by the system. Cannot be modified by user. */
5319
+ annotations?: NotificationEventV1Annotations;
5320
+ /** Alignment configuration for the plan. */
5321
+ alignment?: NotificationEventV1Alignment;
5322
+ /** The status of the subscription. */
5323
+ status: 'active' | 'inactive' | 'canceled' | 'scheduled';
5324
+ /** The customer ID of the subscription. */
5325
+ customerId: string;
5326
+ /** The plan of the subscription. */
5327
+ plan?: NotificationEventV1PlanReference;
5328
+ /** The fiat currency in which the subscription is invoiced. */
5329
+ currency: string;
5330
+ /**
5331
+ * Controls whether custom-currency cost bases are resolved dynamically or pinned
5332
+ * when their currency pair is introduced to the subscription.
5333
+ */
5334
+ costBasisMode: 'dynamic' | 'pinned';
5335
+ /** Cost bases pinned to custom-currency pairs for this subscription. */
5336
+ costBasisPins: NotificationEventV1SubscriptionCostBasisPin[];
5337
+ /**
5338
+ * The billing cadence for the subscriptions. Defines how often customers are
5339
+ * billed using ISO8601 duration format. Examples: "P1M" (monthly), "P3M"
5340
+ * (quarterly), "P1Y" (annually).
5341
+ */
5342
+ billingCadence: string;
5343
+ /** The pro-rating configuration for the subscriptions. */
5344
+ proRatingConfig?: NotificationEventV1ProRatingConfig;
5345
+ /** The normalizedbilling anchor of the subscription. */
5346
+ billingAnchor: Date;
5347
+ /**
5348
+ * The settlement mode of the subscription.
5349
+ *
5350
+ * - credit_then_invoice: credits from the previous billing period are applied
5351
+ * first, then the remaining balance is invoiced.
5352
+ * - credit_only: only credits from the previous billing period are generated and
5353
+ * applied. No invoices are generated for the subscription. This is the default
5354
+ * and most common settlement mode.
5355
+ */
5356
+ settlementMode: 'credit_then_invoice' | 'credit_only';
5357
+ }
5358
+ /** Party represents a person or business entity. */
5359
+ export interface NotificationEventV1BillingParty {
5360
+ /** Unique identifier for the party (if available) */
5361
+ id?: string;
5362
+ /** An optional unique key of the party (if available) */
5363
+ key?: string;
5364
+ /** Legal name or representation of the organization. */
5365
+ name?: string;
5366
+ /**
5367
+ * The entity's legal ID code used for tax purposes. They may have other numbers,
5368
+ * but we're only interested in those valid for tax purposes.
5369
+ */
5370
+ taxId?: NotificationEventV1BillingPartyTaxIdentity;
5371
+ /** Regular post addresses for where information should be sent if needed. */
5372
+ addresses?: NotificationEventV1Address[];
5373
+ }
5374
+ /**
5375
+ * BillingInvoiceCustomerExtendedDetails is a collection of fields that are used to
5376
+ * extend the billing party details for invoices.
5377
+ *
5378
+ * These fields contain the OpenMeter specific details for the customer, that are
5379
+ * not strictly required for the invoice itself.
5380
+ */
5381
+ export interface NotificationEventV1BillingInvoiceCustomerExtendedDetails {
5382
+ /** Unique identifier for the party (if available) */
5383
+ id?: string;
5384
+ /** An optional unique key of the party (if available) */
5385
+ key?: string;
5386
+ /** Legal name or representation of the organization. */
5387
+ name?: string;
5388
+ /**
5389
+ * The entity's legal ID code used for tax purposes. They may have other numbers,
5390
+ * but we're only interested in those valid for tax purposes.
5391
+ */
5392
+ taxId?: NotificationEventV1BillingPartyTaxIdentity;
5393
+ /** Regular post addresses for where information should be sent if needed. */
5394
+ addresses?: NotificationEventV1Address[];
5395
+ /** Mapping to attribute metered usage to the customer */
5396
+ usageAttribution: NotificationEventV1CustomerUsageAttribution;
5397
+ }
5398
+ /**
5399
+ * InvoiceStatusDetails represents the details of the invoice status.
5400
+ *
5401
+ * API users are encouraged to rely on the immutable/failed/avaliableActions fields
5402
+ * to determine the next steps of the invoice instead of the extendedStatus field.
5403
+ */
5404
+ export interface NotificationEventV1InvoiceStatusDetails {
5405
+ /** Is the invoice editable? */
5406
+ immutable: boolean;
5407
+ /** Is the invoice in a failed state? */
5408
+ failed: boolean;
5409
+ /** Extended status information for the invoice. */
5410
+ extendedStatus: string;
5411
+ /** The actions that can be performed on the invoice. */
5412
+ availableActions: NotificationEventV1InvoiceAvailableActions;
5413
+ }
5414
+ /**
5415
+ * A marketplace listing. Represent an available app in the app marketplace that
5416
+ * can be installed to the organization.
5417
+ *
5418
+ * Marketplace apps only exist in config so they don't extend the Resource model.
5419
+ */
5420
+ export interface NotificationEventV1MarketplaceListing {
5421
+ /** The app's type */
5422
+ type: 'stripe' | 'sandbox' | 'custom_invoicing';
5423
+ /** The app's name. */
5424
+ name: string;
5425
+ /** The app's description. */
5426
+ description: string;
5427
+ /** The app's capabilities. */
5428
+ capabilities: NotificationEventV1AppCapability[];
5429
+ /**
5430
+ * Install methods.
5431
+ *
5432
+ * List of methods to install the app.
5433
+ */
5434
+ installMethods: ('with_oauth2' | 'with_api_key' | 'no_credentials_required')[];
5435
+ }
5436
+ /**
5437
+ * BillingWorkflowInvoicingSettings represents the invoice settings for a billing
5438
+ * workflow
5439
+ */
5440
+ export interface NotificationEventV1BillingWorkflowInvoicingSettings {
5441
+ /** Whether to automatically issue the invoice after the draftPeriod has passed. */
5442
+ autoAdvance?: boolean;
5443
+ /** The period for the invoice to be kept in draft status for manual reviews. */
5444
+ draftPeriod?: string;
5445
+ /**
5446
+ * The period after which the invoice is due. With some payment solutions it's only
5447
+ * applicable for manual collection method.
5448
+ */
5449
+ dueAfter?: string;
5450
+ /** Should progressive billing be allowed for this workflow? */
5451
+ progressiveBilling?: boolean;
5452
+ /** Controls how subscription-ending shortened service periods are billed. */
5453
+ subscriptionEndProrationMode?: 'bill_full_period' | 'bill_actual_period';
5454
+ /**
5455
+ * Default tax configuration to apply to the invoices.
5456
+ *
5457
+ * Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax
5458
+ * config is deprecated and can no longer be added or changed: the organization
5459
+ * default tax code is used instead. Existing tax-code values may still be removed,
5460
+ * and `behavior` remains fully supported.
5461
+ */
5462
+ defaultTaxConfig?: NotificationEventV1TaxConfig;
5463
+ }
5464
+ /** TaxConfig stores the configuration for a tax line relative to an invoice line. */
5465
+ export interface NotificationEventV1InvoiceLineTaxItem {
5466
+ /** Tax provider configuration. */
5467
+ config?: NotificationEventV1TaxConfig;
5468
+ /**
5469
+ * Percent defines the percentage set manually or determined from the rate key
5470
+ * (calculated if rate present). A nil percent implies that this tax combo is
5471
+ * **exempt** from tax.")
5472
+ */
5473
+ percent?: number;
5474
+ /** Some countries require an additional surcharge (calculated if rate present). */
5475
+ surcharge?: string;
5476
+ /** Is the tax item inclusive or exclusive of the base amount. */
5477
+ behavior?: 'inclusive' | 'exclusive';
5478
+ }
5479
+ /** A discount by type. */
5480
+ export interface NotificationEventV1BillingDiscounts {
5481
+ /** The percentage discount. */
5482
+ percentage?: NotificationEventV1BillingDiscountPercentage;
5483
+ /** The usage discount. */
5484
+ usage?: NotificationEventV1BillingDiscountUsage;
5485
+ }
5486
+ /** PaymentTermDueDate defines the terms for payment on a specific date. */
5487
+ export interface NotificationEventV1PaymentTermDueDate {
5488
+ /** Type of terms to be applied. */
5489
+ type: 'due_date';
5490
+ /** Text detail of the chosen payment terms. */
5491
+ detail?: string;
5492
+ /** Description of the conditions for payment. */
5493
+ notes?: string;
5494
+ /** When the payment is due. */
5495
+ dueAt: NotificationEventV1PaymentDueDate[];
5496
+ }
4099
5497
  /** Billing customer data. */
4100
5498
  export interface CustomerData {
4101
5499
  /**
4102
- * The billing profile for the customer.
5500
+ * The billing profile explicitly selected for the customer.
4103
5501
  *
4104
- * If not provided, the default billing profile will be used.
5502
+ * Unpinned customers use the current namespace default. Selecting the current
5503
+ * default explicitly pins the customer to that profile.
5504
+ */
5505
+ billingProfile?: ProfileReference | null;
5506
+ /**
5507
+ * The effective billing profile for the customer. Uses the explicitly selected
5508
+ * billing profile when pinned, otherwise the current default billing profile.
4105
5509
  */
4106
- billingProfile?: ProfileReference;
5510
+ effectiveBillingProfile: ProfileReference;
4107
5511
  /** App customer data. */
4108
5512
  appData?: AppCustomerData;
4109
5513
  }
4110
5514
  /** CustomerBillingData upsert request. */
4111
5515
  export interface UpsertCustomerBillingDataRequest {
4112
5516
  /**
4113
- * The billing profile for the customer.
5517
+ * The billing profile explicitly selected for the customer.
4114
5518
  *
4115
- * If not provided, the default billing profile will be used.
5519
+ * Unpinned customers use the current namespace default. Selecting the current
5520
+ * default explicitly pins the customer to that profile.
4116
5521
  */
4117
- billingProfile?: ProfileReference;
5522
+ billingProfile?: ProfileReference | null;
4118
5523
  /** App customer data. */
4119
5524
  appData?: AppCustomerData;
4120
5525
  }
@@ -4268,6 +5673,18 @@ export interface CreateCreditGrantPurchase {
4268
5673
  */
4269
5674
  availabilityPolicy: 'on_creation';
4270
5675
  }
5676
+ /** The balances of the credits of a customer. */
5677
+ export interface CreditBalances {
5678
+ /** The timestamp of the balance retrieval. */
5679
+ retrievedAt: Date;
5680
+ /** The balances by currencies. */
5681
+ balances: CreditBalance[];
5682
+ }
5683
+ /** Cursor paginated response. */
5684
+ export interface CreditTransactionPaginatedResponse {
5685
+ data: CreditTransaction[];
5686
+ meta: CursorMeta;
5687
+ }
4271
5688
  /** Purchase and payment terms of the grant. */
4272
5689
  export interface CreditGrantPurchase {
4273
5690
  /**
@@ -4383,18 +5800,6 @@ export interface WorkflowTaxSettings {
4383
5800
  */
4384
5801
  defaultTaxConfig?: TaxConfig;
4385
5802
  }
4386
- /** The balances of the credits of a customer. */
4387
- export interface CreditBalances {
4388
- /** The timestamp of the balance retrieval. */
4389
- retrievedAt: Date;
4390
- /** The balances by currencies. */
4391
- balances: CreditBalance[];
4392
- }
4393
- /** Cursor paginated response. */
4394
- export interface CreditTransactionPaginatedResponse {
4395
- data: CreditTransaction[];
4396
- meta: CursorMeta;
4397
- }
4398
5803
  /** Page paginated response. */
4399
5804
  export interface PlanAddonPagePaginatedResponse {
4400
5805
  data: PlanAddon[];
@@ -4651,6 +6056,50 @@ export interface InvoiceWorkflowSettings {
4651
6056
  */
4652
6057
  workflow: InvoiceWorkflow;
4653
6058
  }
6059
+ /**
6060
+ * A detailed (child) sub-line belonging to a parent invoice line.
6061
+ *
6062
+ * Detailed lines represent the individual flat-fee components that make up a
6063
+ * usage-based parent line after quantity snapshotting.
6064
+ */
6065
+ export interface InvoiceDetailedLine {
6066
+ id: string;
6067
+ /**
6068
+ * Display name of the resource.
6069
+ *
6070
+ * Between 1 and 256 characters.
6071
+ */
6072
+ name: string;
6073
+ /**
6074
+ * Optional description of the resource.
6075
+ *
6076
+ * Maximum 1024 characters.
6077
+ */
6078
+ description?: string;
6079
+ labels?: Labels;
6080
+ /** An ISO-8601 timestamp representation of entity creation date. */
6081
+ createdAt: Date;
6082
+ /** An ISO-8601 timestamp representation of entity last update date. */
6083
+ updatedAt: Date;
6084
+ /** An ISO-8601 timestamp representation of entity deletion date. */
6085
+ deletedAt?: Date;
6086
+ /** The service period covered by this detailed line. */
6087
+ servicePeriod: ClosedPeriod;
6088
+ /** Aggregated financial totals for the detailed line. */
6089
+ totals: Totals;
6090
+ /** The cost category of this detailed line. */
6091
+ category: 'regular' | 'commitment';
6092
+ /** Discounts applied to this detailed line. */
6093
+ discounts?: InvoiceLineDiscounts;
6094
+ /** Credit applied to this detailed line. */
6095
+ creditsApplied?: InvoiceLineCreditsApplied[];
6096
+ /** External identifiers for this detailed line. */
6097
+ externalReferences?: InvoiceLineExternalReferences;
6098
+ /** The quantity of the detailed line. */
6099
+ quantity: string;
6100
+ /** The unit price of the detailed line. */
6101
+ unitPrice: string;
6102
+ }
4654
6103
  /** Page paginated response. */
4655
6104
  export interface TaxCodePagePaginatedResponse {
4656
6105
  data: TaxCode[];
@@ -4684,6 +6133,11 @@ export interface AppStripe {
4684
6133
  definition: AppCatalogItem;
4685
6134
  /** Status of the app connection. */
4686
6135
  status: 'ready' | 'unauthorized';
6136
+ /**
6137
+ * Actions the operator should take to bring the app up to date. Omitted when no
6138
+ * action is required.
6139
+ */
6140
+ actions?: AppAction[];
4687
6141
  /** The Stripe account ID associated with the connected Stripe account. */
4688
6142
  accountId: string;
4689
6143
  /** Indicates whether the app is connected to a live Stripe account. */
@@ -4719,6 +6173,11 @@ export interface AppSandbox {
4719
6173
  definition: AppCatalogItem;
4720
6174
  /** Status of the app connection. */
4721
6175
  status: 'ready' | 'unauthorized';
6176
+ /**
6177
+ * Actions the operator should take to bring the app up to date. Omitted when no
6178
+ * action is required.
6179
+ */
6180
+ actions?: AppAction[];
4722
6181
  }
4723
6182
  /**
4724
6183
  * External Invoicing app enables integration with third-party invoicing or payment
@@ -4766,6 +6225,11 @@ export interface AppExternalInvoicing {
4766
6225
  definition: AppCatalogItem;
4767
6226
  /** Status of the app connection. */
4768
6227
  status: 'ready' | 'unauthorized';
6228
+ /**
6229
+ * Actions the operator should take to bring the app up to date. Omitted when no
6230
+ * action is required.
6231
+ */
6232
+ actions?: AppAction[];
4769
6233
  /**
4770
6234
  * Enable draft synchronization hook.
4771
6235
  *
@@ -4824,6 +6288,11 @@ export interface InstalledAppStripe {
4824
6288
  definition: AppCatalogItem;
4825
6289
  /** Status of the app connection. */
4826
6290
  status: 'ready' | 'unauthorized';
6291
+ /**
6292
+ * Actions the operator should take to bring the app up to date. Omitted when no
6293
+ * action is required.
6294
+ */
6295
+ actions?: AppAction[];
4827
6296
  /** The Stripe account ID associated with the connected Stripe account. */
4828
6297
  accountId: string;
4829
6298
  /** Indicates whether the app is connected to a live Stripe account. */
@@ -4861,145 +6330,430 @@ export interface InstalledAppSandbox {
4861
6330
  definition: AppCatalogItem;
4862
6331
  /** Status of the app connection. */
4863
6332
  status: 'ready' | 'unauthorized';
6333
+ /**
6334
+ * Actions the operator should take to bring the app up to date. Omitted when no
6335
+ * action is required.
6336
+ */
6337
+ actions?: AppAction[];
4864
6338
  /** Default capabilities of the installed app. */
4865
6339
  defaultForCapabilityTypes: ('report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments')[];
4866
6340
  }
4867
6341
  /** Response of an installed app. */
4868
6342
  export interface InstalledAppExternalInvoicing {
4869
6343
  id: string;
4870
- /**
4871
- * Display name of the resource.
4872
- *
4873
- * Between 1 and 256 characters.
4874
- */
6344
+ /**
6345
+ * Display name of the resource.
6346
+ *
6347
+ * Between 1 and 256 characters.
6348
+ */
6349
+ name: string;
6350
+ /**
6351
+ * Optional description of the resource.
6352
+ *
6353
+ * Maximum 1024 characters.
6354
+ */
6355
+ description?: string;
6356
+ labels?: Labels;
6357
+ /** An ISO-8601 timestamp representation of entity creation date. */
6358
+ createdAt: Date;
6359
+ /** An ISO-8601 timestamp representation of entity last update date. */
6360
+ updatedAt: Date;
6361
+ /** An ISO-8601 timestamp representation of entity deletion date. */
6362
+ deletedAt?: Date;
6363
+ /** The app type. */
6364
+ type: 'external_invoicing';
6365
+ /** The app catalog definition that this installed app is based on. */
6366
+ definition: AppCatalogItem;
6367
+ /** Status of the app connection. */
6368
+ status: 'ready' | 'unauthorized';
6369
+ /**
6370
+ * Actions the operator should take to bring the app up to date. Omitted when no
6371
+ * action is required.
6372
+ */
6373
+ actions?: AppAction[];
6374
+ /**
6375
+ * Enable draft synchronization hook.
6376
+ *
6377
+ * When enabled, invoices will pause at the draft state and wait for the
6378
+ * integration to call the draft synchronized endpoint before progressing to the
6379
+ * issuing state. This allows the external system to validate and prepare the
6380
+ * invoice data.
6381
+ *
6382
+ * When disabled, invoices automatically progress through the draft state based on
6383
+ * the configured workflow timing.
6384
+ */
6385
+ enableDraftSyncHook: boolean;
6386
+ /**
6387
+ * Enable issuing synchronization hook.
6388
+ *
6389
+ * When enabled, invoices will pause at the issuing state and wait for the
6390
+ * integration to call the issuing synchronized endpoint before progressing to the
6391
+ * issued state. This ensures the external invoicing system has successfully
6392
+ * created and finalized the invoice before it is marked as issued.
6393
+ *
6394
+ * When disabled, invoices automatically progress through the issuing state and are
6395
+ * immediately marked as issued.
6396
+ */
6397
+ enableIssuingSyncHook: boolean;
6398
+ /** Default capabilities of the installed app. */
6399
+ defaultForCapabilityTypes: ('report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments')[];
6400
+ }
6401
+ /** Snapshot of the billing workflow configuration captured at invoice creation. */
6402
+ export interface UpdateInvoiceWorkflowSettings {
6403
+ /**
6404
+ * The workflow configuration that was active when the invoice was created.
6405
+ *
6406
+ * Only the fields that are meaningful at the per-invoice level are included:
6407
+ * invoicing behaviour (auto-advance, draft period) and payment settings
6408
+ * (collection method, due date). Profile-wide settings such as collection
6409
+ * alignment, progressive billing, and tax policy are omitted.
6410
+ */
6411
+ workflow: UpdateBillingInvoiceWorkflow;
6412
+ }
6413
+ /** Access evaluation result for a single resolved customer. */
6414
+ export interface EntitlementAccessQueryResult {
6415
+ /**
6416
+ * The list of identifiers from the request that resolved to this customer. Each
6417
+ * entry is either the customer `key` or one of its usage-attribution subject
6418
+ * `key`s.
6419
+ *
6420
+ * Duplicate or aliased identifiers that resolve to the same customer collapse to a
6421
+ * single result entry, with every requested identifier listed here.
6422
+ */
6423
+ matched: string[];
6424
+ /** The customer the matched identifiers resolved to. */
6425
+ customer: Customer;
6426
+ /**
6427
+ * Map of features with their access status.
6428
+ *
6429
+ * Map keys are the feature keys requested in `feature.keys`, or every feature
6430
+ * `key` available in the organization when the feature filter was omitted.
6431
+ */
6432
+ features: Record<string, EntitlementFeatureAccess>;
6433
+ /**
6434
+ * Timestamp of the most recent change to the customer's access state reflected in
6435
+ * this result.
6436
+ */
6437
+ updatedAt: Date;
6438
+ }
6439
+ /**
6440
+ * Metered entitlements are useful for many different use cases, from setting up
6441
+ * usage based access to implementing complex credit systems. Access is determined
6442
+ * based on feature usage using a balance calculation (the "usage allowance"
6443
+ * provided by the issued grants is "burnt down" by the usage).
6444
+ */
6445
+ export interface NotificationEventV1EntitlementMetered {
6446
+ /** type. */
6447
+ type: 'metered';
6448
+ /**
6449
+ * If softLimit=true the subject can use the feature even if the entitlement is
6450
+ * exhausted, hasAccess will always be true.
6451
+ */
6452
+ isSoftLimit?: boolean;
6453
+ /**
6454
+ * Deprecated, ignored by the backend. Please use isSoftLimit instead; this field
6455
+ * will be removed in the future.
6456
+ */
6457
+ isUnlimited?: boolean;
6458
+ /**
6459
+ * You can grant usage automatically alongside the entitlement, the example
6460
+ * scenario would be creating a starting balance. If an amount is specified here, a
6461
+ * grant will be created alongside the entitlement with the specified amount. That
6462
+ * grant will have it's rollover settings configured in a way that after each reset
6463
+ * operation, the balance will return the original amount specified here. Manually
6464
+ * creating such a grant would mean having the "amount", "minRolloverAmount", and
6465
+ * "maxRolloverAmount" fields all be the same.
6466
+ */
6467
+ issueAfterReset?: number;
6468
+ /** Defines the grant priority for the default grant. */
6469
+ issueAfterResetPriority?: number;
6470
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
6471
+ preserveOverageAtReset?: boolean;
6472
+ /** Timestamp of when the resource was created. */
6473
+ createdAt: Date;
6474
+ /** Timestamp of when the resource was last updated. */
6475
+ updatedAt: Date;
6476
+ /** Timestamp of when the resource was permanently deleted. */
6477
+ deletedAt?: Date;
6478
+ /** Additional metadata for the feature. */
6479
+ metadata?: NotificationEventV1Metadata;
6480
+ /** The cadence start of the resource. */
6481
+ activeFrom: Date;
6482
+ /** The cadence end of the resource. */
6483
+ activeTo?: Date;
6484
+ /** The annotations of the entitlement. */
6485
+ annotations?: NotificationEventV1Annotations;
6486
+ /** Readonly unique ULID identifier. */
6487
+ id: string;
6488
+ /**
6489
+ * The identifier key unique to the subject. NOTE: Subjects are being deprecated,
6490
+ * please use the new customer APIs.
6491
+ */
6492
+ subjectKey: string;
6493
+ /** The feature the subject is entitled to use. */
6494
+ featureKey: string;
6495
+ /** The feature the subject is entitled to use. */
6496
+ featureId: string;
6497
+ /** The time the last reset happened. */
6498
+ lastReset: Date;
6499
+ /** The current usage period. */
6500
+ currentUsagePeriod: NotificationEventV1Period;
6501
+ /**
6502
+ * The time from which usage is measured. If not specified on creation, defaults to
6503
+ * entitlement creation time.
6504
+ */
6505
+ measureUsageFrom: Date;
6506
+ /** THe usage period of the entitlement. */
6507
+ usagePeriod: NotificationEventV1RecurringPeriod;
6508
+ }
6509
+ /**
6510
+ * BillingWorkflowCollectionAlignmentAnchored specifies the alignment for
6511
+ * collecting the pending line items into an invoice.
6512
+ */
6513
+ export interface NotificationEventV1BillingWorkflowCollectionAlignmentAnchored {
6514
+ /** The type of alignment. */
6515
+ type: 'anchored';
6516
+ /** The recurring period for the alignment. */
6517
+ recurringPeriod: NotificationEventV1RecurringPeriodV2;
6518
+ }
6519
+ /** Tiered price with spend commitments. */
6520
+ export interface NotificationEventV1TieredPriceWithCommitments {
6521
+ /**
6522
+ * The type of the price.
6523
+ *
6524
+ * One of: flat, unit, or tiered.
6525
+ */
6526
+ type: 'tiered';
6527
+ /**
6528
+ * Defines if the tiering mode is volume-based or graduated:
6529
+ *
6530
+ * - In `volume`-based tiering, the maximum quantity within a period determines the
6531
+ * per unit price.
6532
+ * - In `graduated` tiering, pricing can change as the quantity grows.
6533
+ */
6534
+ mode: 'volume' | 'graduated';
6535
+ /**
6536
+ * The tiers of the tiered price. At least one price component is required in each
6537
+ * tier.
6538
+ */
6539
+ tiers: NotificationEventV1PriceTier[];
6540
+ /** The customer is committed to spend at least the amount. */
6541
+ minimumAmount?: string;
6542
+ /** The customer is limited to spend at most the amount. */
6543
+ maximumAmount?: string;
6544
+ }
6545
+ /** A customer object. */
6546
+ export interface NotificationEventV1Customer {
6547
+ /** A unique identifier for the resource. */
6548
+ id: string;
6549
+ /** Human-readable name for the resource. Between 1 and 256 characters. */
6550
+ name: string;
6551
+ /** Optional description of the resource. Maximum 1024 characters. */
6552
+ description?: string;
6553
+ /** Additional metadata for the resource. */
6554
+ metadata?: NotificationEventV1Metadata | null;
6555
+ /** Timestamp of when the resource was created. */
6556
+ createdAt: Date;
6557
+ /** Timestamp of when the resource was last updated. */
6558
+ updatedAt: Date;
6559
+ /** Timestamp of when the resource was permanently deleted. */
6560
+ deletedAt?: Date;
6561
+ /**
6562
+ * An optional unique key of the customer. Either key or
6563
+ * usageAttribution.subjectKeys must be provided. Useful to reference the customer
6564
+ * in external systems. For example, your database ID.
6565
+ */
6566
+ key?: string;
6567
+ /**
6568
+ * Mapping to attribute metered usage to the customer Either key or
6569
+ * usageAttribution.subjectKeys must be provided.
6570
+ */
6571
+ usageAttribution?: NotificationEventV1CustomerUsageAttribution;
6572
+ /** The primary email address of the customer. */
6573
+ primaryEmail?: string;
6574
+ /** Currency of the customer. Used for billing, tax and invoicing. */
6575
+ currency?: string;
6576
+ /** The billing address of the customer. Used for tax and invoicing. */
6577
+ billingAddress?: NotificationEventV1Address;
6578
+ /** The ID of the Subscription if the customer has one. */
6579
+ currentSubscriptionId?: string;
6580
+ /** The subscriptions of the customer. Only with the `subscriptions` expand option. */
6581
+ subscriptions?: NotificationEventV1Subscription[];
6582
+ /** Set of key-value pairs managed by the system. Cannot be modified by user. */
6583
+ annotations?: NotificationEventV1Annotations;
6584
+ }
6585
+ /** A installed Stripe app object. */
6586
+ export interface NotificationEventV1StripeApp {
6587
+ /** A unique identifier for the resource. */
6588
+ id: string;
6589
+ /** Human-readable name for the resource. Between 1 and 256 characters. */
6590
+ name: string;
6591
+ /** Optional description of the resource. Maximum 1024 characters. */
6592
+ description?: string;
6593
+ /** Additional metadata for the resource. */
6594
+ metadata?: NotificationEventV1Metadata | null;
6595
+ /** Timestamp of when the resource was created. */
6596
+ createdAt: Date;
6597
+ /** Timestamp of when the resource was last updated. */
6598
+ updatedAt: Date;
6599
+ /** Timestamp of when the resource was permanently deleted. */
6600
+ deletedAt?: Date;
6601
+ /** The marketplace listing that this installed app is based on. */
6602
+ listing: NotificationEventV1MarketplaceListing;
6603
+ /** Status of the app connection. */
6604
+ status: 'ready' | 'unauthorized';
6605
+ /** The app's type is Stripe. */
6606
+ type: 'stripe';
6607
+ /** The Stripe account ID. */
6608
+ stripeAccountId: string;
6609
+ /** Livemode, true if the app is in production mode. */
6610
+ livemode: boolean;
6611
+ /** The masked API key. Only shows the first 8 and last 3 characters. */
6612
+ maskedApiKey: string;
6613
+ }
6614
+ /**
6615
+ * Sandbox app can be used for testing OpenMeter features.
6616
+ *
6617
+ * The app is not creating anything in external systems, thus it is safe to use for
6618
+ * verifying OpenMeter features.
6619
+ */
6620
+ export interface NotificationEventV1SandboxApp {
6621
+ /** A unique identifier for the resource. */
6622
+ id: string;
6623
+ /** Human-readable name for the resource. Between 1 and 256 characters. */
6624
+ name: string;
6625
+ /** Optional description of the resource. Maximum 1024 characters. */
6626
+ description?: string;
6627
+ /** Additional metadata for the resource. */
6628
+ metadata?: NotificationEventV1Metadata | null;
6629
+ /** Timestamp of when the resource was created. */
6630
+ createdAt: Date;
6631
+ /** Timestamp of when the resource was last updated. */
6632
+ updatedAt: Date;
6633
+ /** Timestamp of when the resource was permanently deleted. */
6634
+ deletedAt?: Date;
6635
+ /** The marketplace listing that this installed app is based on. */
6636
+ listing: NotificationEventV1MarketplaceListing;
6637
+ /** Status of the app connection. */
6638
+ status: 'ready' | 'unauthorized';
6639
+ /** The app's type is Sandbox. */
6640
+ type: 'sandbox';
6641
+ }
6642
+ /**
6643
+ * Custom Invoicing app can be used for interface with any invoicing or payment
6644
+ * system.
6645
+ *
6646
+ * This app provides ways to manipulate invoices and payments, however the
6647
+ * integration must rely on Notifications API to get notified about invoice
6648
+ * changes.
6649
+ */
6650
+ export interface NotificationEventV1CustomInvoicingApp {
6651
+ /** A unique identifier for the resource. */
6652
+ id: string;
6653
+ /** Human-readable name for the resource. Between 1 and 256 characters. */
4875
6654
  name: string;
4876
- /**
4877
- * Optional description of the resource.
4878
- *
4879
- * Maximum 1024 characters.
4880
- */
6655
+ /** Optional description of the resource. Maximum 1024 characters. */
4881
6656
  description?: string;
4882
- labels?: Labels;
4883
- /** An ISO-8601 timestamp representation of entity creation date. */
6657
+ /** Additional metadata for the resource. */
6658
+ metadata?: NotificationEventV1Metadata | null;
6659
+ /** Timestamp of when the resource was created. */
4884
6660
  createdAt: Date;
4885
- /** An ISO-8601 timestamp representation of entity last update date. */
6661
+ /** Timestamp of when the resource was last updated. */
4886
6662
  updatedAt: Date;
4887
- /** An ISO-8601 timestamp representation of entity deletion date. */
6663
+ /** Timestamp of when the resource was permanently deleted. */
4888
6664
  deletedAt?: Date;
4889
- /** The app type. */
4890
- type: 'external_invoicing';
4891
- /** The app catalog definition that this installed app is based on. */
4892
- definition: AppCatalogItem;
6665
+ /** The marketplace listing that this installed app is based on. */
6666
+ listing: NotificationEventV1MarketplaceListing;
4893
6667
  /** Status of the app connection. */
4894
6668
  status: 'ready' | 'unauthorized';
6669
+ /** The app's type is CustomInvoicing. */
6670
+ type: 'custom_invoicing';
4895
6671
  /**
4896
- * Enable draft synchronization hook.
4897
- *
4898
- * When enabled, invoices will pause at the draft state and wait for the
4899
- * integration to call the draft synchronized endpoint before progressing to the
4900
- * issuing state. This allows the external system to validate and prepare the
4901
- * invoice data.
6672
+ * Enable draft.sync hook.
4902
6673
  *
4903
- * When disabled, invoices automatically progress through the draft state based on
4904
- * the configured workflow timing.
6674
+ * If the hook is not enabled, the invoice will be progressed to the next state
6675
+ * automatically.
4905
6676
  */
4906
6677
  enableDraftSyncHook: boolean;
4907
6678
  /**
4908
- * Enable issuing synchronization hook.
4909
- *
4910
- * When enabled, invoices will pause at the issuing state and wait for the
4911
- * integration to call the issuing synchronized endpoint before progressing to the
4912
- * issued state. This ensures the external invoicing system has successfully
4913
- * created and finalized the invoice before it is marked as issued.
6679
+ * Enable issuing.sync hook.
4914
6680
  *
4915
- * When disabled, invoices automatically progress through the issuing state and are
4916
- * immediately marked as issued.
6681
+ * If the hook is not enabled, the invoice will be progressed to the next state
6682
+ * automatically.
4917
6683
  */
4918
6684
  enableIssuingSyncHook: boolean;
4919
- /** Default capabilities of the installed app. */
4920
- defaultForCapabilityTypes: ('report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments')[];
4921
6685
  }
4922
6686
  /**
4923
- * A detailed (child) sub-line belonging to a parent invoice line.
4924
- *
4925
- * Detailed lines represent the individual flat-fee components that make up a
4926
- * usage-based parent line after quantity snapshotting.
6687
+ * InvoiceLineAmountDiscount represents an amount deducted from the line, and will
6688
+ * be applied before taxes.
4927
6689
  */
4928
- export interface InvoiceDetailedLine {
6690
+ export interface NotificationEventV1InvoiceLineAmountDiscount {
6691
+ /** Timestamp of when the resource was created. */
6692
+ createdAt: Date;
6693
+ /** Timestamp of when the resource was last updated. */
6694
+ updatedAt: Date;
6695
+ /** Timestamp of when the resource was permanently deleted. */
6696
+ deletedAt?: Date;
6697
+ /** ID of the charge or discount. */
4929
6698
  id: string;
4930
- /**
4931
- * Display name of the resource.
4932
- *
4933
- * Between 1 and 256 characters.
4934
- */
4935
- name: string;
4936
- /**
4937
- * Optional description of the resource.
4938
- *
4939
- * Maximum 1024 characters.
4940
- */
6699
+ /** Reason code. */
6700
+ reason: NotificationEventV1BillingDiscountReason;
6701
+ /** Text description as to why the discount was applied. */
4941
6702
  description?: string;
4942
- labels?: Labels;
4943
- /** An ISO-8601 timestamp representation of entity creation date. */
6703
+ /** External IDs of the invoice in other apps such as Stripe. */
6704
+ externalIds?: NotificationEventV1InvoiceLineAppExternalIds;
6705
+ /** Fixed discount amount to apply (calculated if percent present). */
6706
+ amount: string;
6707
+ }
6708
+ /**
6709
+ * InvoiceLineUsageDiscount represents an usage-based discount applied to the line.
6710
+ *
6711
+ * The deduction is done before the pricing algorithm is applied.
6712
+ */
6713
+ export interface NotificationEventV1InvoiceLineUsageDiscount {
6714
+ /** Timestamp of when the resource was created. */
4944
6715
  createdAt: Date;
4945
- /** An ISO-8601 timestamp representation of entity last update date. */
6716
+ /** Timestamp of when the resource was last updated. */
4946
6717
  updatedAt: Date;
4947
- /** An ISO-8601 timestamp representation of entity deletion date. */
6718
+ /** Timestamp of when the resource was permanently deleted. */
4948
6719
  deletedAt?: Date;
4949
- /** The service period covered by this detailed line. */
4950
- servicePeriod: ClosedPeriod;
4951
- /** Aggregated financial totals for the detailed line. */
4952
- totals: Totals;
4953
- /** The cost category of this detailed line. */
4954
- category: 'regular' | 'commitment';
4955
- /** Discounts applied to this detailed line. */
4956
- discounts?: InvoiceLineDiscounts;
4957
- /** Credit applied to this detailed line. */
4958
- creditsApplied?: InvoiceLineCreditsApplied[];
4959
- /** External identifiers for this detailed line. */
4960
- externalReferences?: InvoiceLineExternalReferences;
4961
- /** The quantity of the detailed line. */
6720
+ /** ID of the charge or discount. */
6721
+ id: string;
6722
+ /** Reason code. */
6723
+ reason: NotificationEventV1BillingDiscountReason;
6724
+ /** Text description as to why the discount was applied. */
6725
+ description?: string;
6726
+ /** External IDs of the invoice in other apps such as Stripe. */
6727
+ externalIds?: NotificationEventV1InvoiceLineAppExternalIds;
6728
+ /** The usage to apply. */
4962
6729
  quantity: string;
4963
- /** The unit price of the detailed line. */
4964
- unitPrice: string;
4965
- }
4966
- /** Snapshot of the billing workflow configuration captured at invoice creation. */
4967
- export interface UpdateInvoiceWorkflowSettings {
4968
6730
  /**
4969
- * The workflow configuration that was active when the invoice was created.
6731
+ * The usage discount already applied to the previous split lines.
4970
6732
  *
4971
- * Only the fields that are meaningful at the per-invoice level are included:
4972
- * invoicing behaviour (auto-advance, draft period) and payment settings
4973
- * (collection method, due date). Profile-wide settings such as collection
4974
- * alignment, progressive billing, and tax policy are omitted.
6733
+ * Only set if progressive billing is enabled and the line is a split line.
4975
6734
  */
4976
- workflow: UpdateBillingInvoiceWorkflow;
6735
+ preLinePeriodQuantity?: string;
4977
6736
  }
4978
- /** Access evaluation result for a single resolved customer. */
4979
- export interface EntitlementAccessQueryResult {
6737
+ /**
6738
+ * InvoiceDetailedLineRateCard represents the rate card (intent) for a flat fee
6739
+ * line.
6740
+ */
6741
+ export interface NotificationEventV1InvoiceDetailedLineRateCard {
4980
6742
  /**
4981
- * The list of identifiers from the request that resolved to this customer. Each
4982
- * entry is either the customer `key` or one of its usage-attribution subject
4983
- * `key`s.
4984
- *
4985
- * Duplicate or aliased identifiers that resolve to the same customer collapse to a
4986
- * single result entry, with every requested identifier listed here.
6743
+ * The tax config of the rate card. When undefined, the tax config of the feature
6744
+ * or the default tax config of the plan is used.
4987
6745
  */
4988
- matched: string[];
4989
- /** The customer the matched identifiers resolved to. */
4990
- customer: Customer;
6746
+ taxConfig?: NotificationEventV1TaxConfig;
6747
+ /** The price of the rate card. When null, the feature or service is free. */
6748
+ price: NotificationEventV1FlatPriceWithPaymentTerm | null;
4991
6749
  /**
4992
- * Map of features with their access status.
6750
+ * Quantity of the item being sold.
4993
6751
  *
4994
- * Map keys are the feature keys requested in `feature.keys`, or every feature
4995
- * `key` available in the organization when the feature filter was omitted.
4996
- */
4997
- features: Record<string, EntitlementFeatureAccess>;
4998
- /**
4999
- * Timestamp of the most recent change to the customer's access state reflected in
5000
- * this result.
6752
+ * Default: 1
5001
6753
  */
5002
- updatedAt: Date;
6754
+ quantity?: string;
6755
+ /** The discounts that are applied to the line. */
6756
+ discounts?: NotificationEventV1BillingDiscounts;
5003
6757
  }
5004
6758
  /** A capability or billable dimension offered by a provider. */
5005
6759
  export interface Feature {
@@ -5174,6 +6928,8 @@ export interface CreditGrant {
5174
6928
  * fiat currency.
5175
6929
  */
5176
6930
  currency: BillingCurrencyCode;
6931
+ /** Managed currency reference. Present only for custom currencies. */
6932
+ customCurrency?: CurrencyCustomReference;
5177
6933
  /** Granted credit amount. */
5178
6934
  amount: string;
5179
6935
  /** Present when a funding workflow applies (funding_method is not `none`). */
@@ -5411,6 +7167,78 @@ export interface EntitlementAccessQueryResponse {
5411
7167
  */
5412
7168
  meta: CursorMeta;
5413
7169
  }
7170
+ /** Page paginated response. */
7171
+ export interface NotificationRulePagePaginatedResponse {
7172
+ data: NotificationRule[];
7173
+ meta: PaginatedMeta;
7174
+ }
7175
+ /**
7176
+ * Represents a feature that can be enabled or disabled for a plan. Used both for
7177
+ * product catalog and entitlements.
7178
+ */
7179
+ export interface NotificationEventV1Feature {
7180
+ /** Timestamp of when the resource was created. */
7181
+ createdAt: Date;
7182
+ /** Timestamp of when the resource was last updated. */
7183
+ updatedAt: Date;
7184
+ /** Timestamp of when the resource was permanently deleted. */
7185
+ deletedAt?: Date;
7186
+ /** Timestamp of when the resource was archived. */
7187
+ archivedAt?: Date;
7188
+ /** A key is a unique string that is used to identify a resource. */
7189
+ key: string;
7190
+ /** The human-readable name of the feature. */
7191
+ name: string;
7192
+ /** Optional metadata. */
7193
+ metadata?: NotificationEventV1Metadata;
7194
+ /** A key is a unique string that is used to identify a resource. */
7195
+ meterSlug?: string;
7196
+ /**
7197
+ * Optional meter group by filters. Useful if the meter scope is broader than what
7198
+ * feature tracks. Example scenario would be a meter tracking all token use with
7199
+ * groupBy fields for the model, then the feature could filter for model=gpt-4.
7200
+ *
7201
+ * ⚠️ **Deprecated**: Use advancedMeterGroupByFilters instead
7202
+ */
7203
+ meterGroupByFilters?: Record<string, string>;
7204
+ /**
7205
+ * Optional advanced meter group by filters. You can use this to filter for values
7206
+ * of the meter groupBy fields.
7207
+ */
7208
+ advancedMeterGroupByFilters?: Record<string, NotificationEventV1FilterString>;
7209
+ /**
7210
+ * Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or
7211
+ * "llm" to look up cost from the LLM cost database based on meter group-by
7212
+ * properties.
7213
+ */
7214
+ unitCost?: NotificationEventV1FeatureUnitCost;
7215
+ /** Readonly unique ULID identifier. */
7216
+ id: string;
7217
+ }
7218
+ /**
7219
+ * InvoiceLineDiscounts represents the discounts applied to the invoice line by
7220
+ * type.
7221
+ */
7222
+ export interface NotificationEventV1InvoiceLineDiscounts {
7223
+ /**
7224
+ * Amount based discounts applied to the line.
7225
+ *
7226
+ * Amount based discounts are deduced from the total price of the line.
7227
+ */
7228
+ amount?: NotificationEventV1InvoiceLineAmountDiscount[];
7229
+ /**
7230
+ * Usage based discounts applied to the line.
7231
+ *
7232
+ * Usage based discounts are deduced from the usage of the line before price
7233
+ * calculations are applied.
7234
+ */
7235
+ usage?: NotificationEventV1InvoiceLineUsageDiscount[];
7236
+ }
7237
+ /** Payment contains details as to how the invoice should be paid. */
7238
+ export interface NotificationEventV1InvoicePaymentTerms {
7239
+ /** The terms of payment for the invoice. */
7240
+ terms?: NotificationEventV1PaymentTerms;
7241
+ }
5414
7242
  /** A rate card defines the pricing and entitlement of a feature or service. */
5415
7243
  export interface RateCard {
5416
7244
  /**
@@ -5653,6 +7481,195 @@ export interface ProfileApps {
5653
7481
  /** The payment app used for this workflow. */
5654
7482
  payment: App;
5655
7483
  }
7484
+ /**
7485
+ * Workflow collection specifies how to collect the pending line items for an
7486
+ * invoice
7487
+ */
7488
+ export interface NotificationEventV1BillingWorkflowCollectionSettings {
7489
+ /** The alignment for collecting the pending line items into an invoice. */
7490
+ alignment?: NotificationEventV1BillingWorkflowCollectionAlignment;
7491
+ /**
7492
+ * This grace period can be used to delay the collection of the pending line items
7493
+ * specified in alignment.
7494
+ *
7495
+ * This is useful, in case of multiple subscriptions having slightly different
7496
+ * billing periods.
7497
+ */
7498
+ interval?: string;
7499
+ }
7500
+ /**
7501
+ * Payload of `v1.entitlement.balance_threshold.triggered`, the legacy
7502
+ * `entitlements.balance.threshold` Event type.
7503
+ */
7504
+ export interface EntitlementBalanceThresholdTriggeredV1Payload {
7505
+ /** Entitlement. */
7506
+ entitlement: NotificationEventV1EntitlementMetered;
7507
+ /** Feature. */
7508
+ feature: NotificationEventV1Feature;
7509
+ /** Subject. */
7510
+ subject: NotificationEventV1Subject;
7511
+ /** Entitlement Value. */
7512
+ value: NotificationEventV1EntitlementValue;
7513
+ /** Customer. */
7514
+ customer?: NotificationEventV1Customer;
7515
+ /** Threshold. */
7516
+ threshold: NotificationEventV1RuleBalanceThresholdValue;
7517
+ }
7518
+ /**
7519
+ * Payload of `v1.entitlement.usage_period.reset`, the legacy `entitlements.reset`
7520
+ * Event type.
7521
+ */
7522
+ export interface EntitlementUsagePeriodResetV1Payload {
7523
+ /** Entitlement. */
7524
+ entitlement: NotificationEventV1EntitlementMetered;
7525
+ /** Feature. */
7526
+ feature: NotificationEventV1Feature;
7527
+ /** Subject. */
7528
+ subject: NotificationEventV1Subject;
7529
+ /** Entitlement Value. */
7530
+ value: NotificationEventV1EntitlementValue;
7531
+ /** Customer. */
7532
+ customer?: NotificationEventV1Customer;
7533
+ }
7534
+ /**
7535
+ * Data of the payload for notification event with `entitlements.balance.threshold`
7536
+ * type.
7537
+ */
7538
+ export interface NotificationEventV1BalanceThresholdPayloadData {
7539
+ /** Entitlement. */
7540
+ entitlement: NotificationEventV1EntitlementMetered;
7541
+ /** Feature. */
7542
+ feature: NotificationEventV1Feature;
7543
+ /** Subject. */
7544
+ subject: NotificationEventV1Subject;
7545
+ /** Entitlement Value. */
7546
+ value: NotificationEventV1EntitlementValue;
7547
+ /** Customer. */
7548
+ customer?: NotificationEventV1Customer;
7549
+ /** Threshold. */
7550
+ threshold: NotificationEventV1RuleBalanceThresholdValue;
7551
+ }
7552
+ /** Base data for any payload with entitlement entitlement value. */
7553
+ export interface NotificationEventV1EntitlementValuePayloadBase {
7554
+ /** Entitlement. */
7555
+ entitlement: NotificationEventV1EntitlementMetered;
7556
+ /** Feature. */
7557
+ feature: NotificationEventV1Feature;
7558
+ /** Subject. */
7559
+ subject: NotificationEventV1Subject;
7560
+ /** Entitlement Value. */
7561
+ value: NotificationEventV1EntitlementValue;
7562
+ /** Customer. */
7563
+ customer?: NotificationEventV1Customer;
7564
+ }
7565
+ /**
7566
+ * InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based
7567
+ * line.
7568
+ */
7569
+ export interface NotificationEventV1InvoiceUsageBasedRateCard {
7570
+ /** The feature the customer is entitled to use. */
7571
+ featureKey?: string;
7572
+ /**
7573
+ * The tax config of the rate card. When undefined, the tax config of the feature
7574
+ * or the default tax config of the plan is used.
7575
+ */
7576
+ taxConfig?: NotificationEventV1TaxConfig;
7577
+ /** The price of the rate card. When null, the feature or service is free. */
7578
+ price: NotificationEventV1RateCardUsageBasedPrice | null;
7579
+ /** The discounts that are applied to the line. */
7580
+ discounts?: NotificationEventV1BillingDiscounts;
7581
+ }
7582
+ /** BillingProfileApps represents the applications used by a billing profile */
7583
+ export interface NotificationEventV1BillingProfileApps {
7584
+ /** The tax app used for this workflow */
7585
+ tax: NotificationEventV1App | null;
7586
+ /** The invoicing app used for this workflow */
7587
+ invoicing: NotificationEventV1App | null;
7588
+ /** The payment app used for this workflow */
7589
+ payment: NotificationEventV1App | null;
7590
+ }
7591
+ /**
7592
+ * InvoiceDetailedLine represents a line item that is sold to the customer as a
7593
+ * manually added fee.
7594
+ */
7595
+ export interface NotificationEventV1InvoiceDetailedLine {
7596
+ /** Human-readable name for the resource. Between 1 and 256 characters. */
7597
+ name: string;
7598
+ /** Optional description of the resource. Maximum 1024 characters. */
7599
+ description?: string;
7600
+ /** Additional metadata for the resource. */
7601
+ metadata?: NotificationEventV1Metadata | null;
7602
+ /** Timestamp of when the resource was created. */
7603
+ createdAt: Date;
7604
+ /** Timestamp of when the resource was last updated. */
7605
+ updatedAt: Date;
7606
+ /** Timestamp of when the resource was permanently deleted. */
7607
+ deletedAt?: Date;
7608
+ /** ID of the line. */
7609
+ id: string;
7610
+ /**
7611
+ * managedBy specifies if the line is manually added via the api or managed by
7612
+ * OpenMeter.
7613
+ */
7614
+ managedBy: 'subscription' | 'system' | 'manual';
7615
+ /**
7616
+ * Status of the line.
7617
+ *
7618
+ * External calls always create valid lines, other line types are managed by the
7619
+ * billing engine of OpenMeter.
7620
+ */
7621
+ status: 'valid' | 'detailed' | 'split';
7622
+ /**
7623
+ * Discounts detailes applied to this line.
7624
+ *
7625
+ * New discounts can be added via the invoice's discounts API, to facilitate
7626
+ * discounts that are affecting multiple lines.
7627
+ */
7628
+ discounts?: NotificationEventV1InvoiceLineDiscounts;
7629
+ /**
7630
+ * Credit allocations applied to this line.
7631
+ *
7632
+ * Credits are deducted from the line total before taxes are applied.
7633
+ */
7634
+ creditAllocations?: NotificationEventV1InvoiceLineCreditAllocation[];
7635
+ /** The invoice this item belongs to. */
7636
+ invoice?: NotificationEventV1InvoiceReference;
7637
+ /** The currency of this line. */
7638
+ currency: string;
7639
+ /** Taxes applied to the invoice totals. */
7640
+ taxes?: NotificationEventV1InvoiceLineTaxItem[];
7641
+ /** Tax config specify the tax configuration for this line. */
7642
+ taxConfig?: NotificationEventV1TaxConfig;
7643
+ /** Totals for this line. */
7644
+ totals: NotificationEventV1InvoiceTotals;
7645
+ /**
7646
+ * Period of the line item applies to for revenue recognition pruposes.
7647
+ *
7648
+ * Billing always treats periods as start being inclusive and end being exclusive.
7649
+ */
7650
+ period: NotificationEventV1Period;
7651
+ /** External IDs of the invoice in other apps such as Stripe. */
7652
+ externalIds?: NotificationEventV1InvoiceLineAppExternalIds;
7653
+ /**
7654
+ * Subscription are the references to the subscritpions that this line is related
7655
+ * to.
7656
+ */
7657
+ subscription?: NotificationEventV1InvoiceLineSubscriptionReference;
7658
+ /** The time this line item should be invoiced. */
7659
+ invoiceAt: Date;
7660
+ /** Type of the line. */
7661
+ type: 'flat_fee';
7662
+ /** Price of the item being sold. */
7663
+ perUnitAmount?: string;
7664
+ /** Payment term of the line. */
7665
+ paymentTerm?: 'in_advance' | 'in_arrears';
7666
+ /** Quantity of the item being sold. */
7667
+ quantity?: string;
7668
+ /** The rate card that is used for this line. */
7669
+ rateCard?: NotificationEventV1InvoiceDetailedLineRateCard;
7670
+ /** Category of the flat fee. */
7671
+ category?: 'regular' | 'commitment';
7672
+ }
5656
7673
  /** A subscription item pins a rate card to a cadence within a subscription phase. */
5657
7674
  export interface SubscriptionItem {
5658
7675
  /** The unique identifier of the subscription item instance. */
@@ -6043,52 +8060,198 @@ export interface UpsertBillingProfileRequest {
6043
8060
  */
6044
8061
  export interface ChargeRealization {
6045
8062
  /**
6046
- * The ID of the realization run. Not present on `outstanding` entries, which are
6047
- * projections rather than persisted runs.
8063
+ * The ID of the realization run. Not present on `outstanding` entries, which are
8064
+ * projections rather than persisted runs.
8065
+ */
8066
+ id?: string;
8067
+ /**
8068
+ * The ID of the invoice line this realization was booked to, when the realization
8069
+ * has been invoiced.
8070
+ */
8071
+ lineId?: string;
8072
+ /** The reference of the invoice related to the realization. */
8073
+ invoice?: ChargeRealizationInvoiceOrReference;
8074
+ /** The type of the realization run. */
8075
+ type: 'final_realization' | 'partial_invoice' | 'outstanding' | 'voided';
8076
+ /** The service period covered by this realization run. */
8077
+ servicePeriod: ClosedPeriod;
8078
+ /**
8079
+ * The metered usage quantity this realization run accounts for. Only present on
8080
+ * usage-based charges; flat fees are not metered, so their realizations carry no
8081
+ * usage.
8082
+ *
8083
+ * Booked entries report a signed delta: a negative value states a downward usage
8084
+ * correction (or a voided run that snapshotted behind its live neighbors) instead
8085
+ * of masking it as zero.
8086
+ *
8087
+ * On an `outstanding` entry, usage is omitted unless `real_time_usage` supplies a
8088
+ * live reading. When present, it is the unbooked remainder of that reading,
8089
+ * floored at zero.
8090
+ */
8091
+ usage?: string;
8092
+ /**
8093
+ * The payment state of the realization, when the charge requires a fiat
8094
+ * transaction to settle.
8095
+ */
8096
+ payment?: ChargeRealizationPayment;
8097
+ /**
8098
+ * Financial totals for the realization run, including credit allocations.
8099
+ *
8100
+ * Requires the `realization.totals` expand.
8101
+ */
8102
+ totals?: Totals;
8103
+ /**
8104
+ * The detailed (rated) lines produced by the realization run.
8105
+ *
8106
+ * Requires the `realization.detailed_lines` expand.
8107
+ */
8108
+ detailedLines?: ChargeRealizationDetailedLine[];
8109
+ }
8110
+ /** BillingWorkflow represents the settings for a billing workflow. */
8111
+ export interface NotificationEventV1BillingWorkflow {
8112
+ /** The collection settings for this workflow */
8113
+ collection?: NotificationEventV1BillingWorkflowCollectionSettings;
8114
+ /** The invoicing settings for this workflow */
8115
+ invoicing?: NotificationEventV1BillingWorkflowInvoicingSettings;
8116
+ /** The payment settings for this workflow */
8117
+ payment?: NotificationEventV1BillingWorkflowPaymentSettings;
8118
+ /** The tax settings for this workflow */
8119
+ tax?: NotificationEventV1BillingWorkflowTaxSettings;
8120
+ }
8121
+ /** A balance threshold notification event payload. */
8122
+ export interface NotificationEventBalanceThresholdPayload {
8123
+ /** The identifier of the event the payload belongs to. */
8124
+ id: string;
8125
+ /** The type of the event. */
8126
+ type: 'entitlements.balance.threshold';
8127
+ /** When the event was generated. */
8128
+ timestamp: Date;
8129
+ /** The entities and threshold the event refers to. */
8130
+ data: EntitlementBalanceThresholdTriggeredV1Payload;
8131
+ }
8132
+ /** An entitlement reset notification event payload. */
8133
+ export interface NotificationEventResetPayload {
8134
+ /** The identifier of the event the payload belongs to. */
8135
+ id: string;
8136
+ /** The type of the event. */
8137
+ type: 'entitlements.reset';
8138
+ /** When the event was generated. */
8139
+ timestamp: Date;
8140
+ /** The entities the event refers to. */
8141
+ data: EntitlementUsagePeriodResetV1Payload;
8142
+ }
8143
+ /**
8144
+ * InvoiceUsageBasedLine represents a line item that is sold to the customer based
8145
+ * on usage.
8146
+ */
8147
+ export interface NotificationEventV1InvoiceLine {
8148
+ /** Human-readable name for the resource. Between 1 and 256 characters. */
8149
+ name: string;
8150
+ /** Optional description of the resource. Maximum 1024 characters. */
8151
+ description?: string;
8152
+ /** Additional metadata for the resource. */
8153
+ metadata?: NotificationEventV1Metadata | null;
8154
+ /** Timestamp of when the resource was created. */
8155
+ createdAt: Date;
8156
+ /** Timestamp of when the resource was last updated. */
8157
+ updatedAt: Date;
8158
+ /** Timestamp of when the resource was permanently deleted. */
8159
+ deletedAt?: Date;
8160
+ /** ID of the line. */
8161
+ id: string;
8162
+ /**
8163
+ * managedBy specifies if the line is manually added via the api or managed by
8164
+ * OpenMeter.
6048
8165
  */
6049
- id?: string;
8166
+ managedBy: 'subscription' | 'system' | 'manual';
6050
8167
  /**
6051
- * The ID of the invoice line this realization was booked to, when the realization
6052
- * has been invoiced.
8168
+ * Status of the line.
8169
+ *
8170
+ * External calls always create valid lines, other line types are managed by the
8171
+ * billing engine of OpenMeter.
6053
8172
  */
6054
- lineId?: string;
6055
- /** The reference of the invoice related to the realization. */
6056
- invoice?: ChargeRealizationInvoiceOrReference;
6057
- /** The type of the realization run. */
6058
- type: 'final_realization' | 'partial_invoice' | 'outstanding' | 'voided';
6059
- /** The service period covered by this realization run. */
6060
- servicePeriod: ClosedPeriod;
8173
+ status: 'valid' | 'detailed' | 'split';
6061
8174
  /**
6062
- * The metered usage quantity this realization run accounts for. Only present on
6063
- * usage-based charges; flat fees are not metered, so their realizations carry no
6064
- * usage.
8175
+ * Discounts detailes applied to this line.
6065
8176
  *
6066
- * Booked entries report a signed delta: a negative value states a downward usage
6067
- * correction (or a voided run that snapshotted behind its live neighbors) instead
6068
- * of masking it as zero.
8177
+ * New discounts can be added via the invoice's discounts API, to facilitate
8178
+ * discounts that are affecting multiple lines.
8179
+ */
8180
+ discounts?: NotificationEventV1InvoiceLineDiscounts;
8181
+ /**
8182
+ * Credit allocations applied to this line.
6069
8183
  *
6070
- * On an `outstanding` entry this is `0` unless the `real_time_usage` expand is
6071
- * applied, in which case it is the not-yet-booked remainder of the live metering
6072
- * read (never negative).
8184
+ * Credits are deducted from the line total before taxes are applied.
6073
8185
  */
6074
- usage?: string;
8186
+ creditAllocations?: NotificationEventV1InvoiceLineCreditAllocation[];
8187
+ /** The invoice this item belongs to. */
8188
+ invoice?: NotificationEventV1InvoiceReference;
8189
+ /** The currency of this line. */
8190
+ currency: string;
8191
+ /** Taxes applied to the invoice totals. */
8192
+ taxes?: NotificationEventV1InvoiceLineTaxItem[];
8193
+ /** Tax config specify the tax configuration for this line. */
8194
+ taxConfig?: NotificationEventV1TaxConfig;
8195
+ /** Totals for this line. */
8196
+ totals: NotificationEventV1InvoiceTotals;
6075
8197
  /**
6076
- * The payment state of the realization, when the charge requires a fiat
6077
- * transaction to settle.
8198
+ * Period of the line item applies to for revenue recognition pruposes.
8199
+ *
8200
+ * Billing always treats periods as start being inclusive and end being exclusive.
6078
8201
  */
6079
- payment?: ChargeRealizationPayment;
8202
+ period: NotificationEventV1Period;
8203
+ /** The time this line item should be invoiced. */
8204
+ invoiceAt: Date;
8205
+ /** External IDs of the invoice in other apps such as Stripe. */
8206
+ externalIds?: NotificationEventV1InvoiceLineAppExternalIds;
6080
8207
  /**
6081
- * Financial totals for the realization run, including credit allocations.
8208
+ * Subscription are the references to the subscritpions that this line is related
8209
+ * to.
8210
+ */
8211
+ subscription?: NotificationEventV1InvoiceLineSubscriptionReference;
8212
+ /** Type of the line. */
8213
+ type: 'usage_based';
8214
+ /** Price of the usage-based item being sold. */
8215
+ price?: NotificationEventV1RateCardUsageBasedPrice;
8216
+ /** The feature that the usage is based on. */
8217
+ featureKey?: string;
8218
+ /** The lines detailing the item or service sold. */
8219
+ children?: NotificationEventV1InvoiceDetailedLine[];
8220
+ /**
8221
+ * The rate card that is used for this line.
6082
8222
  *
6083
- * Requires the `realization.totals` expand.
8223
+ * The rate card captures the intent of the price and discounts for the usage-based
8224
+ * item.
6084
8225
  */
6085
- totals?: Totals;
8226
+ rateCard?: NotificationEventV1InvoiceUsageBasedRateCard;
6086
8227
  /**
6087
- * The detailed (rated) lines produced by the realization run.
8228
+ * The quantity of the item being sold.
6088
8229
  *
6089
- * Requires the `realization.detailed_lines` expand.
8230
+ * Any usage discounts applied previously are deducted from this quantity.
6090
8231
  */
6091
- detailedLines?: ChargeRealizationDetailedLine[];
8232
+ quantity?: string;
8233
+ /**
8234
+ * The quantity of the item that has been metered for the period before any
8235
+ * discounts were applied.
8236
+ */
8237
+ meteredQuantity?: string;
8238
+ /**
8239
+ * The quantity of the item used before this line's period.
8240
+ *
8241
+ * It is non-zero in case of progressive billing, when this shows how much of the
8242
+ * usage was already billed.
8243
+ *
8244
+ * Any usage discounts applied previously are deducted from this quantity.
8245
+ */
8246
+ preLinePeriodQuantity?: string;
8247
+ /**
8248
+ * The metered quantity of the item used in before this line's period without any
8249
+ * discounts applied.
8250
+ *
8251
+ * It is non-zero in case of progressive billing, when this shows how much of the
8252
+ * usage was already billed.
8253
+ */
8254
+ meteredPreLinePeriodQuantity?: string;
6092
8255
  }
6093
8256
  /**
6094
8257
  * A subscription phase groups the rate cards in effect for a segment of the
@@ -6365,6 +8528,31 @@ export interface ProfilePagePaginatedResponse {
6365
8528
  data: Profile[];
6366
8529
  meta: PaginatedMeta;
6367
8530
  }
8531
+ /**
8532
+ * InvoiceWorkflowSettings represents the workflow settings used by the invoice.
8533
+ *
8534
+ * This is a clone of the billing profile's workflow settings at the time of
8535
+ * invoice creation with customer overrides considered.
8536
+ */
8537
+ export interface NotificationEventV1InvoiceWorkflowSettings {
8538
+ /**
8539
+ * The apps that will be used to orchestrate the invoice's workflow.
8540
+ *
8541
+ * The v1 schema allows app references here too, but the v1 Event payloads always
8542
+ * carry the full apps.
8543
+ */
8544
+ apps?: NotificationEventV1BillingProfileApps;
8545
+ /**
8546
+ * sourceBillingProfileID is the billing profile on which the workflow was based
8547
+ * on.
8548
+ *
8549
+ * The profile is snapshotted on invoice creation, after which it can be altered
8550
+ * independently of the profile itself.
8551
+ */
8552
+ sourceBillingProfileId: string;
8553
+ /** The workflow details used by this invoice. */
8554
+ workflow: NotificationEventV1BillingWorkflow;
8555
+ }
6368
8556
  /** Subscription. */
6369
8557
  export interface Subscription {
6370
8558
  id: string;
@@ -6626,99 +8814,459 @@ export interface InvoiceStandard {
6626
8814
  deletedAt?: Date;
6627
8815
  /** Human-readable invoice number generated by the invoicing app. */
6628
8816
  number: string;
6629
- /** Three-letter ISO 4217 currency code for the invoice. */
8817
+ /** Three-letter ISO 4217 currency code for the invoice. */
8818
+ currency: string;
8819
+ /**
8820
+ * Snapshot of the supplier's contact information at the time the invoice was
8821
+ * issued.
8822
+ */
8823
+ supplier: Supplier;
8824
+ /** Snapshot of the customer's information at the time the invoice was issued. */
8825
+ customer: InvoiceCustomer;
8826
+ /** Aggregated financial totals for the invoice. */
8827
+ totals: Totals;
8828
+ /**
8829
+ * The service period covered by this invoice.
8830
+ *
8831
+ * For flat fee the service period can be empty which means `from` will be equals
8832
+ * to `to`. In other cases those fields will be filled with the actual service
8833
+ * period.
8834
+ */
8835
+ servicePeriod: ClosedPeriod;
8836
+ /**
8837
+ * Validation issues found during invoice processing.
8838
+ *
8839
+ * Present only when there are one or more validation findings. An empty list is
8840
+ * omitted.
8841
+ */
8842
+ validationIssues?: ValidationIssue[];
8843
+ /** External identifiers assigned to this invoice by third-party systems. */
8844
+ externalReferences?: InvoiceExternalReferences;
8845
+ /** Discriminator field identifying this as a standard invoice. */
8846
+ type: 'standard';
8847
+ /** Current lifecycle status of the invoice. */
8848
+ status: 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
8849
+ /** Detailed status information including available actions and workflow state. */
8850
+ statusDetails: InvoiceStatusDetails;
8851
+ /** Timestamp when the invoice was issued to the customer. */
8852
+ issuedAt?: Date;
8853
+ /**
8854
+ * Timestamp until which the invoice remains in draft state.
8855
+ *
8856
+ * The invoice advances automatically once this time is reached.
8857
+ */
8858
+ draftUntil?: Date;
8859
+ /** Timestamp when usage quantities were last snapshotted for this invoice. */
8860
+ quantitySnapshottedAt?: Date;
8861
+ /** Timestamp when collection was initiated for this invoice. */
8862
+ collectionAt?: Date;
8863
+ /** Timestamp when payment is due. */
8864
+ dueAt?: Date;
8865
+ /** Timestamp when the invoice was sent to the customer. */
8866
+ sentToCustomerAt?: Date;
8867
+ /** Workflow configuration snapshot captured at invoice creation time. */
8868
+ workflow: InvoiceWorkflowSettings;
8869
+ /**
8870
+ * Line items on this invoice.
8871
+ *
8872
+ * Always returned on single-resource GET; omitted on list endpoints unless
8873
+ * explicitly expanded. Editable via update: existing lines are matched by `id`,
8874
+ * lines without an `id` are created, and lines present on the invoice but omitted
8875
+ * from the update request are deleted. Detailed (child) lines are always computed
8876
+ * and cannot be edited directly.
8877
+ */
8878
+ lines?: InvoiceLine[];
8879
+ }
8880
+ /** InvoiceStandard update request. */
8881
+ export interface UpdateInvoiceStandardRequest {
8882
+ /**
8883
+ * Optional description of the resource.
8884
+ *
8885
+ * Maximum 1024 characters.
8886
+ */
8887
+ description?: string;
8888
+ labels?: UpdateLabels;
8889
+ /**
8890
+ * Snapshot of the supplier's contact information at the time the invoice was
8891
+ * issued.
8892
+ */
8893
+ supplier: UpdateSupplier;
8894
+ /** Snapshot of the customer's information at the time the invoice was issued. */
8895
+ customer: UpdateInvoiceCustomer;
8896
+ /** Discriminator field identifying this as a standard invoice. */
8897
+ type: 'standard';
8898
+ /** Workflow configuration snapshot captured at invoice creation time. */
8899
+ workflow: UpdateInvoiceWorkflowSettings;
8900
+ /**
8901
+ * Line items on this invoice.
8902
+ *
8903
+ * Always returned on single-resource GET; omitted on list endpoints unless
8904
+ * explicitly expanded. Editable via update: existing lines are matched by `id`,
8905
+ * lines without an `id` are created, and lines present on the invoice but omitted
8906
+ * from the update request are deleted. Detailed (child) lines are always computed
8907
+ * and cannot be edited directly.
8908
+ */
8909
+ lines?: UpdateInvoiceLine[];
8910
+ }
8911
+ /**
8912
+ * Payload of `v1.billing.invoice.created`, the legacy `invoice.created` Event
8913
+ * type: the invoice as it was created.
8914
+ */
8915
+ export interface InvoiceCreatedV1Payload {
8916
+ /** A unique identifier for the resource. */
8917
+ id: string;
8918
+ /** Optional description of the resource. Maximum 1024 characters. */
8919
+ description?: string;
8920
+ /** Additional metadata for the resource. */
8921
+ metadata?: NotificationEventV1Metadata | null;
8922
+ /** Timestamp of when the resource was created. */
8923
+ createdAt: Date;
8924
+ /** Timestamp of when the resource was last updated. */
8925
+ updatedAt: Date;
8926
+ /** Timestamp of when the resource was permanently deleted. */
8927
+ deletedAt?: Date;
8928
+ /**
8929
+ * Type of the invoice.
8930
+ *
8931
+ * The type of invoice determines the purpose of the invoice and how it should be
8932
+ * handled.
8933
+ *
8934
+ * Supported types:
8935
+ *
8936
+ * - standard: A regular commercial invoice document between a supplier and
8937
+ * customer.
8938
+ * - credit_note: Reflects a refund either partial or complete of the preceding
8939
+ * document. A credit note effectively _extends_ the previous document.
8940
+ */
8941
+ type: 'standard' | 'credit_note';
8942
+ /** The taxable entity supplying the goods or services. */
8943
+ supplier: NotificationEventV1BillingParty;
8944
+ /** Legal entity receiving the goods or services. */
8945
+ customer: NotificationEventV1BillingInvoiceCustomerExtendedDetails;
8946
+ /**
8947
+ * Number specifies the human readable key used to reference this Invoice.
8948
+ *
8949
+ * The invoice number can change in the draft phases, as we are allocating
8950
+ * temporary draft invoice numbers, but it's final as soon as the invoice gets
8951
+ * finalized (issued state).
8952
+ *
8953
+ * Please note that the number is (depending on the upstream settings) either
8954
+ * unique for the whole organization or unique for the customer, or in multi
8955
+ * (stripe) account setups unique for the account.
8956
+ */
8957
+ number: string;
8958
+ /**
8959
+ * Currency for all invoice line items.
8960
+ *
8961
+ * Multi currency invoices are not supported yet.
8962
+ */
8963
+ currency: string;
8964
+ /**
8965
+ * Key information regarding previous invoices and potentially details as to why
8966
+ * they were corrected.
8967
+ */
8968
+ preceding?: NotificationEventV1InvoiceDocumentRef[];
8969
+ /** Summary of all the invoice totals, including taxes (calculated). */
8970
+ totals: NotificationEventV1InvoiceTotals;
8971
+ /**
8972
+ * The status of the invoice.
8973
+ *
8974
+ * This field only conatins a simplified status, for more detailed information use
8975
+ * the statusDetails field.
8976
+ */
8977
+ status: 'gathering' | 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
8978
+ /** The details of the current invoice status. */
8979
+ statusDetails: NotificationEventV1InvoiceStatusDetails;
8980
+ /**
8981
+ * The time the invoice was issued.
8982
+ *
8983
+ * Depending on the status of the invoice this can mean multiple things:
8984
+ *
8985
+ * - draft, gathering: The time the invoice will be issued based on the workflow
8986
+ * settings.
8987
+ * - issued: The time the invoice was issued.
8988
+ */
8989
+ issuedAt?: Date;
8990
+ /**
8991
+ * The time until the invoice is in draft status.
8992
+ *
8993
+ * On draft invoice creation it is calculated from the workflow settings.
8994
+ *
8995
+ * If manual approval is required, the draftUntil time is set.
8996
+ */
8997
+ draftUntil?: Date;
8998
+ /** The time when the quantity snapshots on the invoice lines were taken. */
8999
+ quantitySnapshotedAt?: Date;
9000
+ /** The time when the invoice will be/has been collected. */
9001
+ collectionAt?: Date;
9002
+ /** Due time of the fulfillment of the invoice (if available). */
9003
+ dueAt?: Date;
9004
+ /** The period the invoice covers. If the invoice has no line items, it's not set. */
9005
+ period?: NotificationEventV1Period;
9006
+ /**
9007
+ * The time the invoice was voided.
9008
+ *
9009
+ * If the invoice was voided, this field will be set to the time the invoice was
9010
+ * voided.
9011
+ */
9012
+ voidedAt?: Date;
9013
+ /** The time the invoice was sent to customer. */
9014
+ sentToCustomerAt?: Date;
9015
+ /**
9016
+ * The workflow associated with the invoice.
9017
+ *
9018
+ * It is always a snapshot of the workflow settings at the time of invoice
9019
+ * creation. The field is optional as it should be explicitly requested with expand
9020
+ * options.
9021
+ */
9022
+ workflow: NotificationEventV1InvoiceWorkflowSettings;
9023
+ /** List of invoice lines representing each of the items sold to the customer. */
9024
+ lines?: NotificationEventV1InvoiceLine[];
9025
+ /** Information on when, how, and to whom the invoice should be paid. */
9026
+ payment?: NotificationEventV1InvoicePaymentTerms;
9027
+ /** Validation issues reported by the invoice workflow. */
9028
+ validationIssues?: NotificationEventV1ValidationIssue[];
9029
+ /** External IDs of the invoice in other apps such as Stripe. */
9030
+ externalIds?: NotificationEventV1InvoiceAppExternalIds;
9031
+ }
9032
+ /**
9033
+ * Payload of `v1.billing.invoice.updated`, the legacy `invoice.updated` Event
9034
+ * type: the invoice after the update.
9035
+ */
9036
+ export interface InvoiceUpdatedV1Payload {
9037
+ /** A unique identifier for the resource. */
9038
+ id: string;
9039
+ /** Optional description of the resource. Maximum 1024 characters. */
9040
+ description?: string;
9041
+ /** Additional metadata for the resource. */
9042
+ metadata?: NotificationEventV1Metadata | null;
9043
+ /** Timestamp of when the resource was created. */
9044
+ createdAt: Date;
9045
+ /** Timestamp of when the resource was last updated. */
9046
+ updatedAt: Date;
9047
+ /** Timestamp of when the resource was permanently deleted. */
9048
+ deletedAt?: Date;
9049
+ /**
9050
+ * Type of the invoice.
9051
+ *
9052
+ * The type of invoice determines the purpose of the invoice and how it should be
9053
+ * handled.
9054
+ *
9055
+ * Supported types:
9056
+ *
9057
+ * - standard: A regular commercial invoice document between a supplier and
9058
+ * customer.
9059
+ * - credit_note: Reflects a refund either partial or complete of the preceding
9060
+ * document. A credit note effectively _extends_ the previous document.
9061
+ */
9062
+ type: 'standard' | 'credit_note';
9063
+ /** The taxable entity supplying the goods or services. */
9064
+ supplier: NotificationEventV1BillingParty;
9065
+ /** Legal entity receiving the goods or services. */
9066
+ customer: NotificationEventV1BillingInvoiceCustomerExtendedDetails;
9067
+ /**
9068
+ * Number specifies the human readable key used to reference this Invoice.
9069
+ *
9070
+ * The invoice number can change in the draft phases, as we are allocating
9071
+ * temporary draft invoice numbers, but it's final as soon as the invoice gets
9072
+ * finalized (issued state).
9073
+ *
9074
+ * Please note that the number is (depending on the upstream settings) either
9075
+ * unique for the whole organization or unique for the customer, or in multi
9076
+ * (stripe) account setups unique for the account.
9077
+ */
9078
+ number: string;
9079
+ /**
9080
+ * Currency for all invoice line items.
9081
+ *
9082
+ * Multi currency invoices are not supported yet.
9083
+ */
9084
+ currency: string;
9085
+ /**
9086
+ * Key information regarding previous invoices and potentially details as to why
9087
+ * they were corrected.
9088
+ */
9089
+ preceding?: NotificationEventV1InvoiceDocumentRef[];
9090
+ /** Summary of all the invoice totals, including taxes (calculated). */
9091
+ totals: NotificationEventV1InvoiceTotals;
9092
+ /**
9093
+ * The status of the invoice.
9094
+ *
9095
+ * This field only conatins a simplified status, for more detailed information use
9096
+ * the statusDetails field.
9097
+ */
9098
+ status: 'gathering' | 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
9099
+ /** The details of the current invoice status. */
9100
+ statusDetails: NotificationEventV1InvoiceStatusDetails;
9101
+ /**
9102
+ * The time the invoice was issued.
9103
+ *
9104
+ * Depending on the status of the invoice this can mean multiple things:
9105
+ *
9106
+ * - draft, gathering: The time the invoice will be issued based on the workflow
9107
+ * settings.
9108
+ * - issued: The time the invoice was issued.
9109
+ */
9110
+ issuedAt?: Date;
9111
+ /**
9112
+ * The time until the invoice is in draft status.
9113
+ *
9114
+ * On draft invoice creation it is calculated from the workflow settings.
9115
+ *
9116
+ * If manual approval is required, the draftUntil time is set.
9117
+ */
9118
+ draftUntil?: Date;
9119
+ /** The time when the quantity snapshots on the invoice lines were taken. */
9120
+ quantitySnapshotedAt?: Date;
9121
+ /** The time when the invoice will be/has been collected. */
9122
+ collectionAt?: Date;
9123
+ /** Due time of the fulfillment of the invoice (if available). */
9124
+ dueAt?: Date;
9125
+ /** The period the invoice covers. If the invoice has no line items, it's not set. */
9126
+ period?: NotificationEventV1Period;
9127
+ /**
9128
+ * The time the invoice was voided.
9129
+ *
9130
+ * If the invoice was voided, this field will be set to the time the invoice was
9131
+ * voided.
9132
+ */
9133
+ voidedAt?: Date;
9134
+ /** The time the invoice was sent to customer. */
9135
+ sentToCustomerAt?: Date;
9136
+ /**
9137
+ * The workflow associated with the invoice.
9138
+ *
9139
+ * It is always a snapshot of the workflow settings at the time of invoice
9140
+ * creation. The field is optional as it should be explicitly requested with expand
9141
+ * options.
9142
+ */
9143
+ workflow: NotificationEventV1InvoiceWorkflowSettings;
9144
+ /** List of invoice lines representing each of the items sold to the customer. */
9145
+ lines?: NotificationEventV1InvoiceLine[];
9146
+ /** Information on when, how, and to whom the invoice should be paid. */
9147
+ payment?: NotificationEventV1InvoicePaymentTerms;
9148
+ /** Validation issues reported by the invoice workflow. */
9149
+ validationIssues?: NotificationEventV1ValidationIssue[];
9150
+ /** External IDs of the invoice in other apps such as Stripe. */
9151
+ externalIds?: NotificationEventV1InvoiceAppExternalIds;
9152
+ }
9153
+ /** Invoice represents an invoice in the system. */
9154
+ export interface NotificationEventV1Invoice {
9155
+ /** A unique identifier for the resource. */
9156
+ id: string;
9157
+ /** Optional description of the resource. Maximum 1024 characters. */
9158
+ description?: string;
9159
+ /** Additional metadata for the resource. */
9160
+ metadata?: NotificationEventV1Metadata | null;
9161
+ /** Timestamp of when the resource was created. */
9162
+ createdAt: Date;
9163
+ /** Timestamp of when the resource was last updated. */
9164
+ updatedAt: Date;
9165
+ /** Timestamp of when the resource was permanently deleted. */
9166
+ deletedAt?: Date;
9167
+ /**
9168
+ * Type of the invoice.
9169
+ *
9170
+ * The type of invoice determines the purpose of the invoice and how it should be
9171
+ * handled.
9172
+ *
9173
+ * Supported types:
9174
+ *
9175
+ * - standard: A regular commercial invoice document between a supplier and
9176
+ * customer.
9177
+ * - credit_note: Reflects a refund either partial or complete of the preceding
9178
+ * document. A credit note effectively _extends_ the previous document.
9179
+ */
9180
+ type: 'standard' | 'credit_note';
9181
+ /** The taxable entity supplying the goods or services. */
9182
+ supplier: NotificationEventV1BillingParty;
9183
+ /** Legal entity receiving the goods or services. */
9184
+ customer: NotificationEventV1BillingInvoiceCustomerExtendedDetails;
9185
+ /**
9186
+ * Number specifies the human readable key used to reference this Invoice.
9187
+ *
9188
+ * The invoice number can change in the draft phases, as we are allocating
9189
+ * temporary draft invoice numbers, but it's final as soon as the invoice gets
9190
+ * finalized (issued state).
9191
+ *
9192
+ * Please note that the number is (depending on the upstream settings) either
9193
+ * unique for the whole organization or unique for the customer, or in multi
9194
+ * (stripe) account setups unique for the account.
9195
+ */
9196
+ number: string;
9197
+ /**
9198
+ * Currency for all invoice line items.
9199
+ *
9200
+ * Multi currency invoices are not supported yet.
9201
+ */
6630
9202
  currency: string;
6631
9203
  /**
6632
- * Snapshot of the supplier's contact information at the time the invoice was
6633
- * issued.
9204
+ * Key information regarding previous invoices and potentially details as to why
9205
+ * they were corrected.
6634
9206
  */
6635
- supplier: Supplier;
6636
- /** Snapshot of the customer's information at the time the invoice was issued. */
6637
- customer: InvoiceCustomer;
6638
- /** Aggregated financial totals for the invoice. */
6639
- totals: Totals;
9207
+ preceding?: NotificationEventV1InvoiceDocumentRef[];
9208
+ /** Summary of all the invoice totals, including taxes (calculated). */
9209
+ totals: NotificationEventV1InvoiceTotals;
6640
9210
  /**
6641
- * The service period covered by this invoice.
9211
+ * The status of the invoice.
6642
9212
  *
6643
- * For flat fee the service period can be empty which means `from` will be equals
6644
- * to `to`. In other cases those fields will be filled with the actual service
6645
- * period.
9213
+ * This field only conatins a simplified status, for more detailed information use
9214
+ * the statusDetails field.
6646
9215
  */
6647
- servicePeriod: ClosedPeriod;
9216
+ status: 'gathering' | 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
9217
+ /** The details of the current invoice status. */
9218
+ statusDetails: NotificationEventV1InvoiceStatusDetails;
6648
9219
  /**
6649
- * Validation issues found during invoice processing.
9220
+ * The time the invoice was issued.
6650
9221
  *
6651
- * Present only when there are one or more validation findings. An empty list is
6652
- * omitted.
9222
+ * Depending on the status of the invoice this can mean multiple things:
9223
+ *
9224
+ * - draft, gathering: The time the invoice will be issued based on the workflow
9225
+ * settings.
9226
+ * - issued: The time the invoice was issued.
6653
9227
  */
6654
- validationIssues?: ValidationIssue[];
6655
- /** External identifiers assigned to this invoice by third-party systems. */
6656
- externalReferences?: InvoiceExternalReferences;
6657
- /** Discriminator field identifying this as a standard invoice. */
6658
- type: 'standard';
6659
- /** Current lifecycle status of the invoice. */
6660
- status: 'draft' | 'issuing' | 'issued' | 'payment_processing' | 'overdue' | 'paid' | 'uncollectible' | 'voided';
6661
- /** Detailed status information including available actions and workflow state. */
6662
- statusDetails: InvoiceStatusDetails;
6663
- /** Timestamp when the invoice was issued to the customer. */
6664
9228
  issuedAt?: Date;
6665
9229
  /**
6666
- * Timestamp until which the invoice remains in draft state.
9230
+ * The time until the invoice is in draft status.
6667
9231
  *
6668
- * The invoice advances automatically once this time is reached.
9232
+ * On draft invoice creation it is calculated from the workflow settings.
9233
+ *
9234
+ * If manual approval is required, the draftUntil time is set.
6669
9235
  */
6670
9236
  draftUntil?: Date;
6671
- /** Timestamp when usage quantities were last snapshotted for this invoice. */
6672
- quantitySnapshottedAt?: Date;
6673
- /** Timestamp when collection was initiated for this invoice. */
9237
+ /** The time when the quantity snapshots on the invoice lines were taken. */
9238
+ quantitySnapshotedAt?: Date;
9239
+ /** The time when the invoice will be/has been collected. */
6674
9240
  collectionAt?: Date;
6675
- /** Timestamp when payment is due. */
9241
+ /** Due time of the fulfillment of the invoice (if available). */
6676
9242
  dueAt?: Date;
6677
- /** Timestamp when the invoice was sent to the customer. */
6678
- sentToCustomerAt?: Date;
6679
- /** Workflow configuration snapshot captured at invoice creation time. */
6680
- workflow: InvoiceWorkflowSettings;
6681
- /**
6682
- * Line items on this invoice.
6683
- *
6684
- * Always returned on single-resource GET; omitted on list endpoints unless
6685
- * explicitly expanded. Editable via update: existing lines are matched by `id`,
6686
- * lines without an `id` are created, and lines present on the invoice but omitted
6687
- * from the update request are deleted. Detailed (child) lines are always computed
6688
- * and cannot be edited directly.
6689
- */
6690
- lines?: InvoiceLine[];
6691
- }
6692
- /** InvoiceStandard update request. */
6693
- export interface UpdateInvoiceStandardRequest {
9243
+ /** The period the invoice covers. If the invoice has no line items, it's not set. */
9244
+ period?: NotificationEventV1Period;
6694
9245
  /**
6695
- * Optional description of the resource.
9246
+ * The time the invoice was voided.
6696
9247
  *
6697
- * Maximum 1024 characters.
6698
- */
6699
- description?: string;
6700
- labels?: UpdateLabels;
6701
- /**
6702
- * Snapshot of the supplier's contact information at the time the invoice was
6703
- * issued.
9248
+ * If the invoice was voided, this field will be set to the time the invoice was
9249
+ * voided.
6704
9250
  */
6705
- supplier: UpdateSupplier;
6706
- /** Snapshot of the customer's information at the time the invoice was issued. */
6707
- customer: UpdateInvoiceCustomer;
6708
- /** Discriminator field identifying this as a standard invoice. */
6709
- type: 'standard';
6710
- /** Workflow configuration snapshot captured at invoice creation time. */
6711
- workflow: UpdateInvoiceWorkflowSettings;
9251
+ voidedAt?: Date;
9252
+ /** The time the invoice was sent to customer. */
9253
+ sentToCustomerAt?: Date;
6712
9254
  /**
6713
- * Line items on this invoice.
9255
+ * The workflow associated with the invoice.
6714
9256
  *
6715
- * Always returned on single-resource GET; omitted on list endpoints unless
6716
- * explicitly expanded. Editable via update: existing lines are matched by `id`,
6717
- * lines without an `id` are created, and lines present on the invoice but omitted
6718
- * from the update request are deleted. Detailed (child) lines are always computed
6719
- * and cannot be edited directly.
9257
+ * It is always a snapshot of the workflow settings at the time of invoice
9258
+ * creation. The field is optional as it should be explicitly requested with expand
9259
+ * options.
6720
9260
  */
6721
- lines?: UpdateInvoiceLine[];
9261
+ workflow: NotificationEventV1InvoiceWorkflowSettings;
9262
+ /** List of invoice lines representing each of the items sold to the customer. */
9263
+ lines?: NotificationEventV1InvoiceLine[];
9264
+ /** Information on when, how, and to whom the invoice should be paid. */
9265
+ payment?: NotificationEventV1InvoicePaymentTerms;
9266
+ /** Validation issues reported by the invoice workflow. */
9267
+ validationIssues?: NotificationEventV1ValidationIssue[];
9268
+ /** External IDs of the invoice in other apps such as Stripe. */
9269
+ externalIds?: NotificationEventV1InvoiceAppExternalIds;
6722
9270
  }
6723
9271
  /** Page paginated response. */
6724
9272
  export interface SubscriptionPagePaginatedResponse {
@@ -6743,6 +9291,28 @@ export interface SubscriptionMigrateResponse {
6743
9291
  /** The resulting subscription, including its phases and items. */
6744
9292
  next: Subscription;
6745
9293
  }
9294
+ /** An invoice created notification event payload. */
9295
+ export interface NotificationEventInvoiceCreatedPayload {
9296
+ /** The identifier of the event the payload belongs to. */
9297
+ id: string;
9298
+ /** The type of the event. */
9299
+ type: 'invoice.created';
9300
+ /** When the event was generated. */
9301
+ timestamp: Date;
9302
+ /** The invoice the event refers to. */
9303
+ data: InvoiceCreatedV1Payload;
9304
+ }
9305
+ /** An invoice updated notification event payload. */
9306
+ export interface NotificationEventInvoiceUpdatedPayload {
9307
+ /** The identifier of the event the payload belongs to. */
9308
+ id: string;
9309
+ /** The type of the event. */
9310
+ type: 'invoice.updated';
9311
+ /** When the event was generated. */
9312
+ timestamp: Date;
9313
+ /** The invoice the event refers to. */
9314
+ data: InvoiceUpdatedV1Payload;
9315
+ }
6746
9316
  /** A flat fee charge for a customer. */
6747
9317
  export interface ChargeFlatFee {
6748
9318
  id: string;
@@ -6966,16 +9536,45 @@ export interface ChargeUsageBased {
6966
9536
  */
6967
9537
  systemIntent?: ChargeUsageBasedSystemIntent;
6968
9538
  }
9539
+ /** Result of manually collecting a customer's pending lines into invoices. */
9540
+ export interface InvoiceCustomerChargesResult {
9541
+ /** Created standard invoices, one per collected currency. */
9542
+ invoices: Invoice[];
9543
+ }
6969
9544
  /** Page paginated response. */
6970
9545
  export interface InvoicePagePaginatedResponse {
6971
9546
  data: Invoice[];
6972
9547
  meta: PaginatedMeta;
6973
9548
  }
9549
+ /**
9550
+ * A notification event records that a notification rule fired and tracks the
9551
+ * delivery of its payload to each channel of the rule. Events are created by the
9552
+ * system and cannot be modified.
9553
+ */
9554
+ export interface NotificationEvent {
9555
+ /** The unique identifier of the event. */
9556
+ id: string;
9557
+ /** The type of the event. */
9558
+ type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated';
9559
+ /** When the event was generated. */
9560
+ createdAt: Date;
9561
+ /** The rule that generated the event. */
9562
+ rule: NotificationRuleReference;
9563
+ /** The delivery status of the event, one entry per channel of the rule. */
9564
+ deliveryStatus: NotificationEventDeliveryStatus[];
9565
+ /** The payload delivered to the channels. */
9566
+ payload: NotificationEventPayload;
9567
+ }
6974
9568
  /** Page paginated response. */
6975
9569
  export interface ChargePagePaginatedResponse {
6976
9570
  data: Charge[];
6977
9571
  meta: PaginatedMeta;
6978
9572
  }
9573
+ /** Page paginated response. */
9574
+ export interface NotificationEventPagePaginatedResponse {
9575
+ data: NotificationEvent[];
9576
+ meta: PaginatedMeta;
9577
+ }
6979
9578
  /**
6980
9579
  * Filters on the given string field value by either exact or fuzzy match. All
6981
9580
  * properties are optional; provide exactly one to specify the comparison.
@@ -7058,10 +9657,14 @@ export type SubscriptionCreateTiming = 'immediate' | Date;
7058
9657
  * returned.
7059
9658
  */
7060
9659
  export type SubscriptionEditTiming = 'immediate' | 'next_billing_cycle' | Date;
9660
+ /** Request to execute an operator action on an installed app. */
9661
+ export type AppActionRequest = AppReconcileWebhookEventsActionRequest;
7061
9662
  /** Request to install an app from the catalog. */
7062
9663
  export type InstallAppRequest = InstallAppStripeWithApiKey | InstallAppSandbox | InstallAppExternalInvoicing;
7063
9664
  /** Payment settings for a billing workflow. */
7064
9665
  export type UpdateBillingWorkflowPaymentSettings = UpdateBillingWorkflowPaymentChargeAutomaticallySettings | UpdateBillingWorkflowPaymentSendInvoiceSettings;
9666
+ /** Period duration for the recurrence */
9667
+ export type NotificationEventV1RecurringPeriodInterval = string | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
7065
9668
  /**
7066
9669
  * Cost basis selection for a custom-currency charge. The variant chosen fixes when
7067
9670
  * and how the conversion rate is determined.
@@ -7081,6 +9684,8 @@ export type InvalidParameter = InvalidParameterStandard | InvalidParameterMinimu
7081
9684
  export type RateCardEntitlement = RateCardMeteredEntitlement | RateCardStaticEntitlement | RateCardBooleanEntitlement;
7082
9685
  /** Request to update an installed app. */
7083
9686
  export type UpdateAppRequest = UpdateAppStripeRequest | UpdateAppSandboxRequest | UpdateAppExternalInvoicingRequest;
9687
+ /** The reason for the discount. */
9688
+ export type NotificationEventV1BillingDiscountReason = NotificationEventV1DiscountReasonMaximumSpend | NotificationEventV1DiscountReasonRatecardPercentage | NotificationEventV1DiscountReasonRatecardUsage;
7084
9689
  /**
7085
9690
  * Per-unit cost configuration for a feature. Either a fixed manual amount or a
7086
9691
  * dynamic LLM cost lookup.
@@ -7110,6 +9715,24 @@ export type Entitlement = EntitlementMetered | EntitlementStatic | EntitlementBo
7110
9715
  * arrears items).
7111
9716
  */
7112
9717
  export type WorkflowCollectionAlignment = WorkflowCollectionAlignmentSubscription | WorkflowCollectionAlignmentAnchored;
9718
+ /**
9719
+ * A notification rule selects the type of event to generate, the conditions
9720
+ * specific to that type, and the channels to deliver the events to.
9721
+ */
9722
+ export type NotificationRule = NotificationRuleBalanceThreshold | NotificationRuleEntitlementReset | NotificationRuleInvoiceCreated | NotificationRuleInvoiceUpdated;
9723
+ /**
9724
+ * Request body for creating or updating a notification rule. Updates replace the
9725
+ * rule's mutable state: omitting `disabled`, `labels`, or `features` resets them
9726
+ * to their defaults. The `type` must match the existing rule on update.
9727
+ */
9728
+ export type NotificationRuleRequest = NotificationRuleBalanceThresholdRequest | NotificationRuleEntitlementResetRequest | NotificationRuleInvoiceCreatedRequest | NotificationRuleInvoiceUpdatedRequest;
9729
+ /**
9730
+ * Per-unit cost configuration for a feature. Either a fixed manual amount or a
9731
+ * dynamic LLM cost lookup.
9732
+ */
9733
+ export type NotificationEventV1FeatureUnitCost = NotificationEventV1FeatureManualUnitCost | NotificationEventV1FeatureLlmUnitCost;
9734
+ /** PaymentTerms defines the terms for payment. */
9735
+ export type NotificationEventV1PaymentTerms = NotificationEventV1PaymentTermInstant | NotificationEventV1PaymentTermDueDate;
7113
9736
  /** Price. */
7114
9737
  export type Price = PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
7115
9738
  /**
@@ -7127,6 +9750,18 @@ export type CreateEntitlementRequest = CreateEntitlementMeteredRequest | CreateE
7127
9750
  export type App = AppStripe | AppSandbox | AppExternalInvoicing;
7128
9751
  /** Response of the app install. */
7129
9752
  export type BillingInstallAppResponse = InstalledAppStripe | InstalledAppSandbox | InstalledAppExternalInvoicing;
9753
+ /**
9754
+ * The alignment for collecting the pending line items into an invoice.
9755
+ *
9756
+ * Defaults to subscription, which means that we are to create a new invoice every
9757
+ * time the a subscription period starts (for in advance items) or ends (for in
9758
+ * arrears items).
9759
+ */
9760
+ export type NotificationEventV1BillingWorkflowCollectionAlignment = NotificationEventV1BillingWorkflowCollectionAlignmentSubscription | NotificationEventV1BillingWorkflowCollectionAlignmentAnchored;
9761
+ /** The price of the usage based rate card. */
9762
+ export type NotificationEventV1RateCardUsageBasedPrice = NotificationEventV1FlatPriceWithPaymentTerm | NotificationEventV1UnitPriceWithCommitments | NotificationEventV1TieredPriceWithCommitments | NotificationEventV1DynamicPriceWithCommitments | NotificationEventV1PackagePriceWithCommitments;
9763
+ /** App. One of: stripe */
9764
+ export type NotificationEventV1App = NotificationEventV1StripeApp | NotificationEventV1SandboxApp | NotificationEventV1CustomInvoicingApp;
7130
9765
  /** Feature or reference. */
7131
9766
  export type FeatureOrReference = Feature | FeatureReference;
7132
9767
  /** ChargeRealizationInvoice or reference. */
@@ -7166,6 +9801,8 @@ export type SubscriptionOrReference = Subscription | SubscriptionReference;
7166
9801
  export type Invoice = InvoiceStandard;
7167
9802
  /** UpdateInvoiceRequest update request. */
7168
9803
  export type UpdateInvoiceRequest = UpdateInvoiceStandardRequest;
9804
+ /** The payload delivered to the channels, discriminated by the event type. */
9805
+ export type NotificationEventPayload = NotificationEventBalanceThresholdPayload | NotificationEventResetPayload | NotificationEventInvoiceCreatedPayload | NotificationEventInvoiceUpdatedPayload;
7169
9806
  /** Customer charge. */
7170
9807
  export type Charge = ChargeFlatFee | ChargeUsageBased;
7171
9808
  /**
@@ -7485,6 +10122,11 @@ export interface WorkflowInvoicingSettingsInput {
7485
10122
  progressiveBilling?: boolean;
7486
10123
  /** Controls how subscription-ending shortened service periods are billed. */
7487
10124
  subscriptionEndProrationMode?: 'bill_full_period' | 'bill_actual_period';
10125
+ /**
10126
+ * Controls whether empty invoices are created in the invoicing app. An invoice is
10127
+ * empty when it has no line items or its total is zero.
10128
+ */
10129
+ emptyInvoiceMode?: 'create' | 'omit';
7488
10130
  }
7489
10131
  /** Query to evaluate feature access for a list of customers. */
7490
10132
  export interface EntitlementAccessQueryRequestInput {
@@ -7612,6 +10254,157 @@ export interface UpdateBillingNotificationChannelRequestInput {
7612
10254
  */
7613
10255
  signingSecret?: string;
7614
10256
  }
10257
+ /** A rule that generates an event when an entitlement usage period is reset. */
10258
+ export interface NotificationRuleEntitlementResetInput {
10259
+ id: string;
10260
+ /**
10261
+ * Display name of the resource.
10262
+ *
10263
+ * Between 1 and 256 characters.
10264
+ */
10265
+ name: string;
10266
+ labels?: Labels;
10267
+ /** An ISO-8601 timestamp representation of entity creation date. */
10268
+ createdAt: Date;
10269
+ /** An ISO-8601 timestamp representation of entity last update date. */
10270
+ updatedAt: Date;
10271
+ /** An ISO-8601 timestamp representation of entity deletion date. */
10272
+ deletedAt?: Date;
10273
+ /** The type of event the rule generates. Immutable after creation. */
10274
+ type: 'entitlements.reset';
10275
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
10276
+ disabled?: boolean;
10277
+ /**
10278
+ * The channels the rule delivers its events to. At least one and at most five
10279
+ * channels are required. Responses omit channels that have since been disabled or
10280
+ * deleted.
10281
+ */
10282
+ channels: NotificationChannelReference[];
10283
+ /**
10284
+ * The features the rule applies to. When omitted, the rule applies to every
10285
+ * feature.
10286
+ */
10287
+ features?: FeatureReference[];
10288
+ }
10289
+ /** A rule that generates an event when an invoice is created. */
10290
+ export interface NotificationRuleInvoiceCreatedInput {
10291
+ id: string;
10292
+ /**
10293
+ * Display name of the resource.
10294
+ *
10295
+ * Between 1 and 256 characters.
10296
+ */
10297
+ name: string;
10298
+ labels?: Labels;
10299
+ /** An ISO-8601 timestamp representation of entity creation date. */
10300
+ createdAt: Date;
10301
+ /** An ISO-8601 timestamp representation of entity last update date. */
10302
+ updatedAt: Date;
10303
+ /** An ISO-8601 timestamp representation of entity deletion date. */
10304
+ deletedAt?: Date;
10305
+ /** The type of event the rule generates. Immutable after creation. */
10306
+ type: 'invoice.created';
10307
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
10308
+ disabled?: boolean;
10309
+ /**
10310
+ * The channels the rule delivers its events to. At least one and at most five
10311
+ * channels are required. Responses omit channels that have since been disabled or
10312
+ * deleted.
10313
+ */
10314
+ channels: NotificationChannelReference[];
10315
+ }
10316
+ /** A rule that generates an event when an invoice is updated. */
10317
+ export interface NotificationRuleInvoiceUpdatedInput {
10318
+ id: string;
10319
+ /**
10320
+ * Display name of the resource.
10321
+ *
10322
+ * Between 1 and 256 characters.
10323
+ */
10324
+ name: string;
10325
+ labels?: Labels;
10326
+ /** An ISO-8601 timestamp representation of entity creation date. */
10327
+ createdAt: Date;
10328
+ /** An ISO-8601 timestamp representation of entity last update date. */
10329
+ updatedAt: Date;
10330
+ /** An ISO-8601 timestamp representation of entity deletion date. */
10331
+ deletedAt?: Date;
10332
+ /** The type of event the rule generates. Immutable after creation. */
10333
+ type: 'invoice.updated';
10334
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
10335
+ disabled?: boolean;
10336
+ /**
10337
+ * The channels the rule delivers its events to. At least one and at most five
10338
+ * channels are required. Responses omit channels that have since been disabled or
10339
+ * deleted.
10340
+ */
10341
+ channels: NotificationChannelReference[];
10342
+ }
10343
+ /** Request body for an entitlement reset rule. */
10344
+ export interface NotificationRuleEntitlementResetRequestInput {
10345
+ /**
10346
+ * Display name of the resource.
10347
+ *
10348
+ * Between 1 and 256 characters.
10349
+ */
10350
+ name: string;
10351
+ labels?: Labels;
10352
+ /** The type of event the rule generates. Immutable after creation. */
10353
+ type: 'entitlements.reset';
10354
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
10355
+ disabled?: boolean;
10356
+ /**
10357
+ * The channels the rule delivers its events to. At least one and at most five
10358
+ * channels are required. Responses omit channels that have since been disabled or
10359
+ * deleted.
10360
+ */
10361
+ channels: NotificationChannelReference[];
10362
+ /**
10363
+ * The features the rule applies to. When omitted, the rule applies to every
10364
+ * feature.
10365
+ */
10366
+ features?: FeatureReference[];
10367
+ }
10368
+ /** Request body for an invoice created rule. */
10369
+ export interface NotificationRuleInvoiceCreatedRequestInput {
10370
+ /**
10371
+ * Display name of the resource.
10372
+ *
10373
+ * Between 1 and 256 characters.
10374
+ */
10375
+ name: string;
10376
+ labels?: Labels;
10377
+ /** The type of event the rule generates. Immutable after creation. */
10378
+ type: 'invoice.created';
10379
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
10380
+ disabled?: boolean;
10381
+ /**
10382
+ * The channels the rule delivers its events to. At least one and at most five
10383
+ * channels are required. Responses omit channels that have since been disabled or
10384
+ * deleted.
10385
+ */
10386
+ channels: NotificationChannelReference[];
10387
+ }
10388
+ /** Request body for an invoice updated rule. */
10389
+ export interface NotificationRuleInvoiceUpdatedRequestInput {
10390
+ /**
10391
+ * Display name of the resource.
10392
+ *
10393
+ * Between 1 and 256 characters.
10394
+ */
10395
+ name: string;
10396
+ labels?: Labels;
10397
+ /** The type of event the rule generates. Immutable after creation. */
10398
+ type: 'invoice.updated';
10399
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
10400
+ disabled?: boolean;
10401
+ /**
10402
+ * The channels the rule delivers its events to. At least one and at most five
10403
+ * channels are required. Responses omit channels that have since been disabled or
10404
+ * deleted.
10405
+ */
10406
+ channels: NotificationChannelReference[];
10407
+ }
7615
10408
  /** An ingested metering event with ingestion metadata. */
7616
10409
  export interface IngestedEventInput {
7617
10410
  /** The original event ingested. */
@@ -7813,6 +10606,70 @@ export interface NotificationChannelPagePaginatedResponseInput {
7813
10606
  data: NotificationChannelInput[];
7814
10607
  meta: PaginatedMeta;
7815
10608
  }
10609
+ /**
10610
+ * A rule that generates an event when an entitlement balance crosses one of its
10611
+ * thresholds.
10612
+ */
10613
+ export interface NotificationRuleBalanceThresholdInput {
10614
+ id: string;
10615
+ /**
10616
+ * Display name of the resource.
10617
+ *
10618
+ * Between 1 and 256 characters.
10619
+ */
10620
+ name: string;
10621
+ labels?: Labels;
10622
+ /** An ISO-8601 timestamp representation of entity creation date. */
10623
+ createdAt: Date;
10624
+ /** An ISO-8601 timestamp representation of entity last update date. */
10625
+ updatedAt: Date;
10626
+ /** An ISO-8601 timestamp representation of entity deletion date. */
10627
+ deletedAt?: Date;
10628
+ /** The type of event the rule generates. Immutable after creation. */
10629
+ type: 'entitlements.balance.threshold';
10630
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
10631
+ disabled?: boolean;
10632
+ /**
10633
+ * The channels the rule delivers its events to. At least one and at most five
10634
+ * channels are required. Responses omit channels that have since been disabled or
10635
+ * deleted.
10636
+ */
10637
+ channels: NotificationChannelReference[];
10638
+ /** The thresholds that generate an event when crossed. */
10639
+ thresholds: NotificationBalanceThreshold[];
10640
+ /**
10641
+ * The features the rule applies to. When omitted, the rule applies to every
10642
+ * feature.
10643
+ */
10644
+ features?: FeatureReference[];
10645
+ }
10646
+ /** Request body for a balance threshold rule. */
10647
+ export interface NotificationRuleBalanceThresholdRequestInput {
10648
+ /**
10649
+ * Display name of the resource.
10650
+ *
10651
+ * Between 1 and 256 characters.
10652
+ */
10653
+ name: string;
10654
+ labels?: Labels;
10655
+ /** The type of event the rule generates. Immutable after creation. */
10656
+ type: 'entitlements.balance.threshold';
10657
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
10658
+ disabled?: boolean;
10659
+ /**
10660
+ * The channels the rule delivers its events to. At least one and at most five
10661
+ * channels are required. Responses omit channels that have since been disabled or
10662
+ * deleted.
10663
+ */
10664
+ channels: NotificationChannelReference[];
10665
+ /** The thresholds that generate an event when crossed. */
10666
+ thresholds: NotificationBalanceThreshold[];
10667
+ /**
10668
+ * The features the rule applies to. When omitted, the rule applies to every
10669
+ * feature.
10670
+ */
10671
+ features?: FeatureReference[];
10672
+ }
7816
10673
  /** Purchase and payment terms of the grant. */
7817
10674
  export interface CreateCreditGrantPurchaseInput {
7818
10675
  /**
@@ -8239,6 +11096,8 @@ export interface CreditGrantInput {
8239
11096
  * fiat currency.
8240
11097
  */
8241
11098
  currency: BillingCurrencyCode;
11099
+ /** Managed currency reference. Present only for custom currencies. */
11100
+ customCurrency?: CurrencyCustomReference;
8242
11101
  /** Granted credit amount. */
8243
11102
  amount: string;
8244
11103
  /** Present when a funding workflow applies (funding_method is not `none`). */
@@ -8408,6 +11267,11 @@ export interface ChargeRealizationInvoiceInput {
8408
11267
  /** Workflow configuration snapshot captured at invoice creation time. */
8409
11268
  workflow: InvoiceWorkflowSettingsInput;
8410
11269
  }
11270
+ /** Page paginated response. */
11271
+ export interface NotificationRulePagePaginatedResponseInput {
11272
+ data: NotificationRuleInput[];
11273
+ meta: PaginatedMeta;
11274
+ }
8411
11275
  /** A rate card defines the pricing and entitlement of a feature or service. */
8412
11276
  export interface RateCardInput {
8413
11277
  /**
@@ -8992,9 +11856,9 @@ export interface ChargeRealizationInput {
8992
11856
  * correction (or a voided run that snapshotted behind its live neighbors) instead
8993
11857
  * of masking it as zero.
8994
11858
  *
8995
- * On an `outstanding` entry this is `0` unless the `real_time_usage` expand is
8996
- * applied, in which case it is the not-yet-booked remainder of the live metering
8997
- * read (never negative).
11859
+ * On an `outstanding` entry, usage is omitted unless `real_time_usage` supplies a
11860
+ * live reading. When present, it is the unbooked remainder of that reading,
11861
+ * floored at zero.
8998
11862
  */
8999
11863
  usage?: string;
9000
11864
  /**
@@ -9891,6 +12755,11 @@ export interface ChargeUsageBasedInput {
9891
12755
  */
9892
12756
  systemIntent?: ChargeUsageBasedSystemIntentInput;
9893
12757
  }
12758
+ /** Result of manually collecting a customer's pending lines into invoices. */
12759
+ export interface InvoiceCustomerChargesResultInput {
12760
+ /** Created standard invoices, one per collected currency. */
12761
+ invoices: InvoiceInput[];
12762
+ }
9894
12763
  /** Page paginated response. */
9895
12764
  export interface InvoicePagePaginatedResponseInput {
9896
12765
  data: InvoiceInput[];
@@ -9912,6 +12781,17 @@ export type UpdateBillingWorkflowPaymentSettingsInput = UpdateBillingWorkflowPay
9912
12781
  export type RateCardEntitlementInput = RateCardMeteredEntitlementInput | RateCardStaticEntitlement | RateCardBooleanEntitlement;
9913
12782
  /** An entitlement grants a customer access to a feature. */
9914
12783
  export type EntitlementInput = EntitlementMeteredInput | EntitlementStatic | EntitlementBoolean;
12784
+ /**
12785
+ * A notification rule selects the type of event to generate, the conditions
12786
+ * specific to that type, and the channels to deliver the events to.
12787
+ */
12788
+ export type NotificationRuleInput = NotificationRuleBalanceThresholdInput | NotificationRuleEntitlementResetInput | NotificationRuleInvoiceCreatedInput | NotificationRuleInvoiceUpdatedInput;
12789
+ /**
12790
+ * Request body for creating or updating a notification rule. Updates replace the
12791
+ * rule's mutable state: omitting `disabled`, `labels`, or `features` resets them
12792
+ * to their defaults. The `type` must match the existing rule on update.
12793
+ */
12794
+ export type NotificationRuleRequestInput = NotificationRuleBalanceThresholdRequestInput | NotificationRuleEntitlementResetRequestInput | NotificationRuleInvoiceCreatedRequestInput | NotificationRuleInvoiceUpdatedRequestInput;
9915
12795
  /** Entitlement create request. */
9916
12796
  export type CreateEntitlementRequestInput = CreateEntitlementMeteredRequestInput | CreateEntitlementStaticRequest | CreateEntitlementBooleanRequest;
9917
12797
  /** ChargeRealizationInvoice or reference. */