priceos 1.0.21 → 1.0.23

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.
@@ -17,7 +17,10 @@ export interface paths {
17
17
  */
18
18
  get: {
19
19
  parameters: {
20
- query?: never;
20
+ query?: {
21
+ /** @description Optional fields to include in the response. */
22
+ expand?: "subscriptions"[];
23
+ };
21
24
  header: {
22
25
  /** @description API key from your PriceOS dashboard. */
23
26
  "x-api-key": string;
@@ -40,6 +43,7 @@ export interface paths {
40
43
  * @example {
41
44
  * "customerId": "customer_123",
42
45
  * "stripeCustomerId": "cus_abc123",
46
+ * "hasPaymentMethod": true,
43
47
  * "name": "Ada Lovelace",
44
48
  * "email": "ada@example.com",
45
49
  * "created": 1735689600000,
@@ -118,14 +122,14 @@ export interface paths {
118
122
  customerId?: string;
119
123
  /** @description Stripe customer ID. */
120
124
  stripeCustomerId?: string;
125
+ /** @description Whether the Stripe customer has at least one saved payment method. */
126
+ hasPaymentMethod: boolean;
121
127
  /** @description Customer name. */
122
128
  name?: string;
123
129
  /** @description Customer email address. */
124
130
  email?: string;
125
131
  /** @description Unix timestamp (ms) when the customer was created. */
126
132
  created?: number;
127
- /** @description Unix timestamp (ms) when usage tracking started. This will determine when usage gets reset for your limit features if a customer is assinged a custom product. */
128
- usageStartedAt?: number;
129
133
  /**
130
134
  * @description Customer environment.
131
135
  * @enum {string}
@@ -252,6 +256,12 @@ export interface paths {
252
256
  /** @description Unix timestamp (ms) when the bonus was updated. */
253
257
  updatedAt: number;
254
258
  }[];
259
+ /** @description Resolved Unix timestamp (ms) usage reset anchor. For Stripe customers, this is derived from active Stripe product period start (or product startedAt) when available. Otherwise it uses stored usageStartedAt; if unset, it falls back to the customer created timestamp. */
260
+ usageStartedAt?: number;
261
+ /** @description Expanded Stripe subscriptions. Each item is raw Stripe subscription object. Included only when requested via expand=subscriptions. */
262
+ subscriptions?: {
263
+ [key: string]: unknown;
264
+ }[];
255
265
  } | null;
256
266
  };
257
267
  };
@@ -317,10 +327,10 @@ export interface paths {
317
327
  name?: string;
318
328
  /** @description Customer email address. */
319
329
  email?: string;
320
- /** @description Unix timestamp (ms) when usage tracking started. This will determine when usage gets reset for your limit features if a customer is assinged a custom product. */
321
- usageStartedAt?: number;
322
330
  /** @description Assigned custom product keys. */
323
331
  customProductKeys?: string[];
332
+ /** @description Optional usage reset anchor (unix timestamp in ms) for the account. Defines the start time from which usage is measured and limits are calculated. */
333
+ usageStartedAt?: number;
324
334
  };
325
335
  };
326
336
  };
@@ -335,6 +345,7 @@ export interface paths {
335
345
  * @example {
336
346
  * "customerId": "customer_123",
337
347
  * "stripeCustomerId": "cus_abc123",
348
+ * "hasPaymentMethod": true,
338
349
  * "name": "Ada Lovelace",
339
350
  * "email": "ada@example.com",
340
351
  * "created": 1735689600000,
@@ -413,14 +424,14 @@ export interface paths {
413
424
  customerId?: string;
414
425
  /** @description Stripe customer ID. */
415
426
  stripeCustomerId?: string;
427
+ /** @description Whether the Stripe customer has at least one saved payment method. */
428
+ hasPaymentMethod: boolean;
416
429
  /** @description Customer name. */
417
430
  name?: string;
418
431
  /** @description Customer email address. */
419
432
  email?: string;
420
433
  /** @description Unix timestamp (ms) when the customer was created. */
421
434
  created?: number;
422
- /** @description Unix timestamp (ms) when usage tracking started. This will determine when usage gets reset for your limit features if a customer is assinged a custom product. */
423
- usageStartedAt?: number;
424
435
  /**
425
436
  * @description Customer environment.
426
437
  * @enum {string}
@@ -547,6 +558,8 @@ export interface paths {
547
558
  /** @description Unix timestamp (ms) when the bonus was updated. */
548
559
  updatedAt: number;
549
560
  }[];
561
+ /** @description Resolved Unix timestamp (ms) usage reset anchor. For Stripe customers, this is derived from active Stripe product period start (or product startedAt) when available. Otherwise it uses stored usageStartedAt; if unset, it falls back to the customer created timestamp. */
562
+ usageStartedAt?: number;
550
563
  };
551
564
  };
552
565
  };
@@ -719,10 +732,10 @@ export interface paths {
719
732
  name?: string;
720
733
  /** @description Customer email address. */
721
734
  email?: string;
722
- /** @description Unix timestamp (ms) when usage tracking started. This will determine when usage gets reset for your limit features if a customer is assinged a custom product. */
723
- usageStartedAt?: number;
724
735
  /** @description Assigned custom product keys. */
725
736
  customProductKeys?: string[];
737
+ /** @description Optional usage reset anchor (unix timestamp in ms) for the account. Defines the start time from which usage is measured and limits are calculated. */
738
+ usageStartedAt?: number;
726
739
  };
727
740
  };
728
741
  };
@@ -737,6 +750,7 @@ export interface paths {
737
750
  * @example {
738
751
  * "customerId": "customer_123",
739
752
  * "stripeCustomerId": "cus_abc123",
753
+ * "hasPaymentMethod": true,
740
754
  * "name": "Ada Lovelace",
741
755
  * "email": "ada@example.com",
742
756
  * "created": 1735689600000,
@@ -815,14 +829,14 @@ export interface paths {
815
829
  customerId?: string;
816
830
  /** @description Stripe customer ID. */
817
831
  stripeCustomerId?: string;
832
+ /** @description Whether the Stripe customer has at least one saved payment method. */
833
+ hasPaymentMethod: boolean;
818
834
  /** @description Customer name. */
819
835
  name?: string;
820
836
  /** @description Customer email address. */
821
837
  email?: string;
822
838
  /** @description Unix timestamp (ms) when the customer was created. */
823
839
  created?: number;
824
- /** @description Unix timestamp (ms) when usage tracking started. This will determine when usage gets reset for your limit features if a customer is assinged a custom product. */
825
- usageStartedAt?: number;
826
840
  /**
827
841
  * @description Customer environment.
828
842
  * @enum {string}
@@ -949,6 +963,8 @@ export interface paths {
949
963
  /** @description Unix timestamp (ms) when the bonus was updated. */
950
964
  updatedAt: number;
951
965
  }[];
966
+ /** @description Resolved Unix timestamp (ms) usage reset anchor. For Stripe customers, this is derived from active Stripe product period start (or product startedAt) when available. Otherwise it uses stored usageStartedAt; if unset, it falls back to the customer created timestamp. */
967
+ usageStartedAt?: number;
952
968
  };
953
969
  };
954
970
  };
@@ -1052,6 +1068,7 @@ export interface paths {
1052
1068
  * @example {
1053
1069
  * "customerId": "customer_123",
1054
1070
  * "stripeCustomerId": "cus_abc123",
1071
+ * "hasPaymentMethod": true,
1055
1072
  * "name": "Ada Lovelace",
1056
1073
  * "email": "ada@example.com",
1057
1074
  * "created": 1735689600000,
@@ -1130,14 +1147,14 @@ export interface paths {
1130
1147
  customerId?: string;
1131
1148
  /** @description Stripe customer ID. */
1132
1149
  stripeCustomerId?: string;
1150
+ /** @description Whether the Stripe customer has at least one saved payment method. */
1151
+ hasPaymentMethod: boolean;
1133
1152
  /** @description Customer name. */
1134
1153
  name?: string;
1135
1154
  /** @description Customer email address. */
1136
1155
  email?: string;
1137
1156
  /** @description Unix timestamp (ms) when the customer was created. */
1138
1157
  created?: number;
1139
- /** @description Unix timestamp (ms) when usage tracking started. This will determine when usage gets reset for your limit features if a customer is assinged a custom product. */
1140
- usageStartedAt?: number;
1141
1158
  /**
1142
1159
  * @description Customer environment.
1143
1160
  * @enum {string}
@@ -1264,6 +1281,8 @@ export interface paths {
1264
1281
  /** @description Unix timestamp (ms) when the bonus was updated. */
1265
1282
  updatedAt: number;
1266
1283
  }[];
1284
+ /** @description Resolved Unix timestamp (ms) usage reset anchor. For Stripe customers, this is derived from active Stripe product period start (or product startedAt) when available. Otherwise it uses stored usageStartedAt; if unset, it falls back to the customer created timestamp. */
1285
+ usageStartedAt?: number;
1267
1286
  };
1268
1287
  };
1269
1288
  };
@@ -1345,7 +1364,7 @@ export interface paths {
1345
1364
  get?: never;
1346
1365
  put?: never;
1347
1366
  /**
1348
- * Create customer portal session
1367
+ * Open customer portal
1349
1368
  * @description Create a Stripe customer portal session URL for a customer.
1350
1369
  */
1351
1370
  post: {
@@ -1451,7 +1470,7 @@ export interface paths {
1451
1470
  patch?: never;
1452
1471
  trace?: never;
1453
1472
  };
1454
- "/v1/usage/set": {
1473
+ "/v1/customers/{customerId}/checkout": {
1455
1474
  parameters: {
1456
1475
  query?: never;
1457
1476
  header?: never;
@@ -1461,8 +1480,8 @@ export interface paths {
1461
1480
  get?: never;
1462
1481
  put?: never;
1463
1482
  /**
1464
- * Set usage
1465
- * @description Set absolute usage for the current period by recording an adjustment event.
1483
+ * Checkout
1484
+ * @description Create a Stripe checkout session URL for a customer and Stripe product key. Creates the customer in PriceOS if missing.
1466
1485
  */
1467
1486
  post: {
1468
1487
  parameters: {
@@ -1471,45 +1490,54 @@ export interface paths {
1471
1490
  /** @description API key from your PriceOS dashboard. */
1472
1491
  "x-api-key": string;
1473
1492
  };
1474
- path?: never;
1493
+ path: {
1494
+ /** @description Customer ID (internal or Stripe). */
1495
+ customerId: string;
1496
+ };
1475
1497
  cookie?: never;
1476
1498
  };
1477
1499
  requestBody: {
1478
1500
  content: {
1479
1501
  "application/json": {
1480
- /** @description Customer ID (internal or Stripe). */
1481
- customerId: string;
1482
- /** @description Feature key to set usage for. */
1483
- featureKey: string;
1484
- /** @description Absolute usage value to set for the current usage period. */
1485
- used: number;
1486
- /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
1487
- idempotencyKey?: string;
1488
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
1489
- eventKey?: string;
1490
- /** @description Optional metadata for the adjustment event (string key/value pairs). */
1491
- metadata?: {
1492
- [key: string]: string;
1502
+ /** @description Stripe product key configured in PriceOS. Must reference a Stripe product (not a custom product). */
1503
+ stripeProductKey: string;
1504
+ /**
1505
+ * Format: uri
1506
+ * @description Optional checkout success redirect URL.
1507
+ */
1508
+ successUrl?: string;
1509
+ /** @description Optional customer info used when creating/updating the customer. */
1510
+ customerInfo?: {
1511
+ /** @description Optional customer name. */
1512
+ name?: string | null;
1513
+ /** @description Optional customer email address. */
1514
+ email?: string | null;
1515
+ };
1516
+ /** @description Optional Stripe Checkout Session params to merge into the request. */
1517
+ checkoutParams?: {
1518
+ [key: string]: unknown;
1493
1519
  };
1494
1520
  };
1495
1521
  };
1496
1522
  };
1497
1523
  responses: {
1498
- /** @description Usage set */
1524
+ /** @description Customer checkout session */
1499
1525
  200: {
1500
1526
  headers: {
1501
1527
  [name: string]: unknown;
1502
1528
  };
1503
1529
  content: {
1530
+ /**
1531
+ * @example {
1532
+ * "url": "https://checkout.stripe.com/c/pay/cs_test_123"
1533
+ * }
1534
+ */
1504
1535
  "application/json": {
1505
- /** @description Whether the usage event was applied. */
1506
- applied: boolean;
1507
- /** @description Updated usage total, if applicable. */
1508
- used: number | null;
1509
- /** @description Reason the usage event was not applied. */
1510
- reason?: string | null;
1511
- /** @description Adjustment amount applied to reach the requested usage value. */
1512
- adjustment: number;
1536
+ /**
1537
+ * Format: uri
1538
+ * @description Stripe checkout URL.
1539
+ */
1540
+ url: string;
1513
1541
  };
1514
1542
  };
1515
1543
  };
@@ -1549,6 +1577,18 @@ export interface paths {
1549
1577
  };
1550
1578
  };
1551
1579
  };
1580
+ /** @description Conflict */
1581
+ 409: {
1582
+ headers: {
1583
+ [name: string]: unknown;
1584
+ };
1585
+ content: {
1586
+ "application/json": {
1587
+ /** @description Error message. */
1588
+ error: string;
1589
+ };
1590
+ };
1591
+ };
1552
1592
  /** @description Server error */
1553
1593
  500: {
1554
1594
  headers: {
@@ -1569,33 +1609,42 @@ export interface paths {
1569
1609
  patch?: never;
1570
1610
  trace?: never;
1571
1611
  };
1572
- "/v1/feature-access": {
1612
+ "/v1/customers/{customerId}/custom-product/add": {
1573
1613
  parameters: {
1574
1614
  query?: never;
1575
1615
  header?: never;
1576
1616
  path?: never;
1577
1617
  cookie?: never;
1578
1618
  };
1619
+ get?: never;
1620
+ put?: never;
1579
1621
  /**
1580
- * Get feature access
1581
- * @description Return feature access for a customer.
1622
+ * Add custom product
1623
+ * @description Add one custom product to a customer without removing existing custom products.
1582
1624
  */
1583
- get: {
1625
+ post: {
1584
1626
  parameters: {
1585
- query: {
1586
- /** @description Customer ID (internal or Stripe). */
1587
- customerId: string;
1588
- };
1627
+ query?: never;
1589
1628
  header: {
1590
1629
  /** @description API key from your PriceOS dashboard. */
1591
1630
  "x-api-key": string;
1592
1631
  };
1593
- path?: never;
1632
+ path: {
1633
+ /** @description Customer ID (internal or Stripe). */
1634
+ customerId: string;
1635
+ };
1594
1636
  cookie?: never;
1595
1637
  };
1596
- requestBody?: never;
1638
+ requestBody: {
1639
+ content: {
1640
+ "application/json": {
1641
+ /** @description Custom product key to add or remove. */
1642
+ customProductKey: string;
1643
+ };
1644
+ };
1645
+ };
1597
1646
  responses: {
1598
- /** @description Feature access lookup */
1647
+ /** @description Customer custom product updated */
1599
1648
  200: {
1600
1649
  headers: {
1601
1650
  [name: string]: unknown;
@@ -1603,83 +1652,228 @@ export interface paths {
1603
1652
  content: {
1604
1653
  /**
1605
1654
  * @example {
1606
- * "api_calls": {
1607
- * "hasAccess": true,
1608
- * "type": "limit",
1609
- * "limit": 1000,
1610
- * "isUnlimited": false,
1611
- * "usage": {
1612
- * "used": 120,
1613
- * "remaining": 880,
1614
- * "bonusRemaining": 25,
1615
- * "hasReachedLimit": false,
1616
- * "bonusUsed": 5,
1617
- * "nextReset": 1738368000000,
1618
- * "lastReset": 1735689600000
1655
+ * "customerId": "customer_123",
1656
+ * "stripeCustomerId": "cus_abc123",
1657
+ * "hasPaymentMethod": true,
1658
+ * "name": "Ada Lovelace",
1659
+ * "email": "ada@example.com",
1660
+ * "created": 1735689600000,
1661
+ * "usageStartedAt": 1735689600000,
1662
+ * "enviroment": "test",
1663
+ * "products": [
1664
+ * {
1665
+ * "id": "prod_123",
1666
+ * "key": "starter",
1667
+ * "name": "Starter",
1668
+ * "type": "stripe",
1669
+ * "isDefault": false,
1670
+ * "status": "active",
1671
+ * "version": 1,
1672
+ * "metadata": {
1673
+ * "tier": "starter"
1674
+ * },
1675
+ * "canceledAt": null,
1676
+ * "startedAt": 1735689600000,
1677
+ * "currentPeriodStart": 1735689600000,
1678
+ * "currentPeriodEnd": 1738368000000,
1679
+ * "prices": [
1680
+ * {
1681
+ * "stripePriceId": "price_123",
1682
+ * "quantity": 1,
1683
+ * "currency": "usd",
1684
+ * "unitAmount": 2000,
1685
+ * "recurringInterval": "month",
1686
+ * "isActive": true,
1687
+ * "isDefault": true,
1688
+ * "recurringIntervalCount": 1
1689
+ * }
1690
+ * ]
1691
+ * }
1692
+ * ],
1693
+ * "featureAccess": {
1694
+ * "api_calls": {
1695
+ * "hasAccess": true,
1696
+ * "type": "limit",
1697
+ * "limit": 1000,
1698
+ * "isUnlimited": false,
1699
+ * "usage": {
1700
+ * "used": 120,
1701
+ * "remaining": 880,
1702
+ * "bonusRemaining": 25,
1703
+ * "hasReachedLimit": false,
1704
+ * "bonusUsed": 5,
1705
+ * "nextReset": 1738368000000,
1706
+ * "lastReset": 1735689600000
1707
+ * }
1708
+ * },
1709
+ * "team_seats": {
1710
+ * "hasAccess": true,
1711
+ * "type": "boolean"
1619
1712
  * }
1620
1713
  * },
1621
- * "team_seats": {
1622
- * "hasAccess": true,
1623
- * "type": "boolean"
1624
- * }
1714
+ * "bonuses": [
1715
+ * {
1716
+ * "bonusId": "9e9be7e5-55d2-4b44-93af-c3687f4b8af5",
1717
+ * "featureKey": "api_calls",
1718
+ * "amount": 50,
1719
+ * "remainingAmount": 50,
1720
+ * "expiresAt": 1738368000000,
1721
+ * "reason": "Support credit",
1722
+ * "metadata": {
1723
+ * "source": "support"
1724
+ * },
1725
+ * "createdAt": 1735689600000,
1726
+ * "updatedAt": 1735689600000
1727
+ * }
1728
+ * ]
1625
1729
  * }
1626
1730
  */
1627
1731
  "application/json": {
1628
- [key: string]: {
1732
+ /** @description Customer ID (internal or Stripe). */
1733
+ customerId?: string;
1734
+ /** @description Stripe customer ID. */
1735
+ stripeCustomerId?: string;
1736
+ /** @description Whether the Stripe customer has at least one saved payment method. */
1737
+ hasPaymentMethod: boolean;
1738
+ /** @description Customer name. */
1739
+ name?: string;
1740
+ /** @description Customer email address. */
1741
+ email?: string;
1742
+ /** @description Unix timestamp (ms) when the customer was created. */
1743
+ created?: number;
1744
+ /**
1745
+ * @description Customer environment.
1746
+ * @enum {string}
1747
+ */
1748
+ enviroment: "test" | "live";
1749
+ /** @description Subscribed or assigned products. */
1750
+ products: {
1751
+ /** @description Product ID. */
1752
+ id: string;
1753
+ /** @description Product key. */
1754
+ key: string;
1755
+ /** @description Product name. */
1756
+ name: string;
1629
1757
  /**
1630
- * @description Feature access type.
1758
+ * @description Product type.
1631
1759
  * @enum {string}
1632
1760
  */
1633
- type: "boolean";
1634
- /** @description Whether the customer has access. */
1635
- hasAccess: boolean;
1636
- } | {
1761
+ type: "stripe" | "custom";
1762
+ /** @description Whether this product is the default custom product. */
1763
+ isDefault: boolean;
1637
1764
  /**
1638
- * @description Feature access type.
1765
+ * @description Stripe subscription status (Stripe customers only).
1639
1766
  * @enum {string}
1640
1767
  */
1641
- type: "limit";
1642
- /** @description Whether the customer has access. */
1643
- hasAccess: boolean;
1644
- /** @description Whether the feature is unlimited. */
1645
- isUnlimited: boolean;
1646
- /** @description Limit for the feature, when applicable. */
1647
- limit: number | null;
1648
- /** @description Usage details for tracked features. */
1649
- usage?: {
1650
- /** @description Usage consumed for the feature. */
1651
- used: number;
1652
- /** @description Remaining base limit (limit - used). */
1653
- remaining: number | null;
1654
- /** @description Remaining bonus amount. */
1655
- bonusRemaining: number;
1656
- /** @description Whether base limit is met or exceeded and no bonus amount remains. */
1657
- hasReachedLimit: boolean;
1658
- /** @description Bonus amount consumed. */
1659
- bonusUsed: number;
1660
- /** @description Unix timestamp (ms) for the next reset, when applicable. */
1661
- nextReset: number | null;
1662
- /** @description Unix timestamp (ms) for the last reset, when applicable. */
1663
- lastReset: number | null;
1768
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
1769
+ /** @description Product version number. */
1770
+ version: number;
1771
+ /** @description Custom product metadata (custom products only). */
1772
+ metadata?: {
1773
+ [key: string]: string;
1664
1774
  };
1665
- };
1666
- };
1667
- };
1668
- };
1669
- /** @description Bad request */
1670
- 400: {
1671
- headers: {
1672
- [name: string]: unknown;
1673
- };
1674
- content: {
1675
- "application/json": {
1676
- /** @description Error message. */
1677
- error: string;
1775
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
1776
+ canceledAt?: number | null;
1777
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
1778
+ startedAt?: number;
1779
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
1780
+ currentPeriodStart?: number;
1781
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
1782
+ currentPeriodEnd?: number;
1783
+ /** @description Prices tied to this product (Stripe customers only). */
1784
+ prices?: {
1785
+ /** @description Stripe price ID. */
1786
+ stripePriceId: string;
1787
+ /** @description Price quantity. */
1788
+ quantity: number;
1789
+ /** @description ISO currency code. */
1790
+ currency: string;
1791
+ /** @description Unit amount in the smallest currency unit. */
1792
+ unitAmount: number;
1793
+ /** @description Recurring interval, if any. */
1794
+ recurringInterval: string | null;
1795
+ /** @description Whether the price is active. */
1796
+ isActive: boolean;
1797
+ /** @description Whether this is the default price. */
1798
+ isDefault: boolean;
1799
+ /** @description Number of intervals between charges. */
1800
+ recurringIntervalCount: number;
1801
+ }[];
1802
+ }[];
1803
+ /** @description Feature access map. */
1804
+ featureAccess: {
1805
+ [key: string]: {
1806
+ /**
1807
+ * @description Feature access type.
1808
+ * @enum {string}
1809
+ */
1810
+ type: "boolean";
1811
+ /** @description Whether the customer has access. */
1812
+ hasAccess: boolean;
1813
+ } | {
1814
+ /**
1815
+ * @description Feature access type.
1816
+ * @enum {string}
1817
+ */
1818
+ type: "limit";
1819
+ /** @description Whether the customer has access. */
1820
+ hasAccess: boolean;
1821
+ /** @description Whether the feature is unlimited. */
1822
+ isUnlimited: boolean;
1823
+ /** @description Limit for the feature, when applicable. */
1824
+ limit: number | null;
1825
+ /** @description Usage details for tracked features. */
1826
+ usage?: {
1827
+ /** @description Usage consumed for the feature. */
1828
+ used: number;
1829
+ /** @description Remaining base limit (limit - used). */
1830
+ remaining: number | null;
1831
+ /** @description Remaining bonus amount. */
1832
+ bonusRemaining: number;
1833
+ /** @description Whether base limit is met or exceeded and no bonus amount remains. */
1834
+ hasReachedLimit: boolean;
1835
+ /** @description Bonus amount consumed. */
1836
+ bonusUsed: number;
1837
+ /** @description Unix timestamp (ms) for the next reset, when applicable. */
1838
+ nextReset: number | null;
1839
+ /** @description Unix timestamp (ms) for the last reset, when applicable. */
1840
+ lastReset: number | null;
1841
+ };
1842
+ };
1843
+ };
1844
+ /** @description Customer bonuses. */
1845
+ bonuses: {
1846
+ /**
1847
+ * Format: uuid
1848
+ * @description Bonus ID.
1849
+ */
1850
+ bonusId: string;
1851
+ /** @description Feature key. */
1852
+ featureKey: string;
1853
+ /** @description Bonus amount. */
1854
+ amount: number;
1855
+ /** @description Remaining bonus amount. */
1856
+ remainingAmount: number;
1857
+ /** @description Unix timestamp (ms) when the bonus expires. */
1858
+ expiresAt?: number | null;
1859
+ /** @description Bonus reason. */
1860
+ reason?: string | null;
1861
+ /** @description Bonus metadata. */
1862
+ metadata?: {
1863
+ [key: string]: string;
1864
+ };
1865
+ /** @description Unix timestamp (ms) when the bonus was created. */
1866
+ createdAt: number;
1867
+ /** @description Unix timestamp (ms) when the bonus was updated. */
1868
+ updatedAt: number;
1869
+ }[];
1870
+ /** @description Resolved Unix timestamp (ms) usage reset anchor. For Stripe customers, this is derived from active Stripe product period start (or product startedAt) when available. Otherwise it uses stored usageStartedAt; if unset, it falls back to the customer created timestamp. */
1871
+ usageStartedAt?: number;
1678
1872
  };
1679
1873
  };
1680
1874
  };
1681
- /** @description Unauthorized */
1682
- 401: {
1875
+ /** @description Bad request */
1876
+ 400: {
1683
1877
  headers: {
1684
1878
  [name: string]: unknown;
1685
1879
  };
@@ -1690,8 +1884,8 @@ export interface paths {
1690
1884
  };
1691
1885
  };
1692
1886
  };
1693
- /** @description Server error */
1694
- 500: {
1887
+ /** @description Unauthorized */
1888
+ 401: {
1695
1889
  headers: {
1696
1890
  [name: string]: unknown;
1697
1891
  };
@@ -1702,76 +1896,8 @@ export interface paths {
1702
1896
  };
1703
1897
  };
1704
1898
  };
1705
- };
1706
- };
1707
- put?: never;
1708
- post?: never;
1709
- delete?: never;
1710
- options?: never;
1711
- head?: never;
1712
- patch?: never;
1713
- trace?: never;
1714
- };
1715
- "/v1/features": {
1716
- parameters: {
1717
- query?: never;
1718
- header?: never;
1719
- path?: never;
1720
- cookie?: never;
1721
- };
1722
- /**
1723
- * Get features
1724
- * @description List features for the workspace.
1725
- */
1726
- get: {
1727
- parameters: {
1728
- query?: never;
1729
- header: {
1730
- /** @description API key from your PriceOS dashboard. */
1731
- "x-api-key": string;
1732
- };
1733
- path?: never;
1734
- cookie?: never;
1735
- };
1736
- requestBody?: never;
1737
- responses: {
1738
- /** @description Feature list */
1739
- 200: {
1740
- headers: {
1741
- [name: string]: unknown;
1742
- };
1743
- content: {
1744
- "application/json": {
1745
- /** @description Feature ID. */
1746
- id: string;
1747
- /** @description Feature key. */
1748
- featureKey: string;
1749
- /** @description Feature name. */
1750
- name: string;
1751
- /** @description Feature description. */
1752
- description: string | null;
1753
- /**
1754
- * @description Feature access type.
1755
- * @enum {string}
1756
- */
1757
- type: "boolean" | "limit";
1758
- /** @description Whether the feature tracks usage. */
1759
- tracksUsage: boolean;
1760
- /**
1761
- * @description Usage reset interval.
1762
- * @enum {string}
1763
- */
1764
- usageResetInterval: "never" | "day" | "week" | "month" | "year";
1765
- /**
1766
- * @description Usage reset anchor.
1767
- * @enum {string}
1768
- */
1769
- usageResetAnchor: "billing_period" | "calendar";
1770
- }[];
1771
- };
1772
- };
1773
- /** @description Unauthorized */
1774
- 401: {
1899
+ /** @description Not found */
1900
+ 404: {
1775
1901
  headers: {
1776
1902
  [name: string]: unknown;
1777
1903
  };
@@ -1796,43 +1922,48 @@ export interface paths {
1796
1922
  };
1797
1923
  };
1798
1924
  };
1799
- put?: never;
1800
- post?: never;
1801
1925
  delete?: never;
1802
1926
  options?: never;
1803
1927
  head?: never;
1804
1928
  patch?: never;
1805
1929
  trace?: never;
1806
1930
  };
1807
- "/v1/pricing-table": {
1931
+ "/v1/customers/{customerId}/custom-product/remove": {
1808
1932
  parameters: {
1809
1933
  query?: never;
1810
1934
  header?: never;
1811
1935
  path?: never;
1812
1936
  cookie?: never;
1813
1937
  };
1938
+ get?: never;
1939
+ put?: never;
1814
1940
  /**
1815
- * Get pricing table
1816
- * @description List plans with PriceOS feature/limit definitions. Optionally include customer plan state and load a specific pricing table by key.
1941
+ * Remove custom product
1942
+ * @description Remove one custom product from a customer.
1817
1943
  */
1818
- get: {
1944
+ post: {
1819
1945
  parameters: {
1820
- query?: {
1821
- /** @description Optional customer ID (internal or Stripe). */
1822
- customerId?: string | null;
1823
- /** @description Optional pricing table key. */
1824
- pricingTableKey?: string | null;
1825
- };
1946
+ query?: never;
1826
1947
  header: {
1827
1948
  /** @description API key from your PriceOS dashboard. */
1828
1949
  "x-api-key": string;
1829
1950
  };
1830
- path?: never;
1951
+ path: {
1952
+ /** @description Customer ID (internal or Stripe). */
1953
+ customerId: string;
1954
+ };
1831
1955
  cookie?: never;
1832
1956
  };
1833
- requestBody?: never;
1957
+ requestBody: {
1958
+ content: {
1959
+ "application/json": {
1960
+ /** @description Custom product key to add or remove. */
1961
+ customProductKey: string;
1962
+ };
1963
+ };
1964
+ };
1834
1965
  responses: {
1835
- /** @description Pricing table */
1966
+ /** @description Customer custom product updated */
1836
1967
  200: {
1837
1968
  headers: {
1838
1969
  [name: string]: unknown;
@@ -1840,209 +1971,492 @@ export interface paths {
1840
1971
  content: {
1841
1972
  /**
1842
1973
  * @example {
1843
- * "table": {
1844
- * "id": "11111111-1111-1111-1111-111111111111",
1845
- * "name": "Default pricing table",
1846
- * "tableKey": "default_table",
1847
- * "settings": {
1848
- * "defaultView": "monthly",
1849
- * "language": "en",
1850
- * "backgroundColor": "#ffffff",
1851
- * "buttonColor": "#0074d4",
1852
- * "fontFamily": "system",
1853
- * "buttonShape": "rounded",
1854
- * "highlightProduct": false,
1855
- * "pricingDisplay": "monthly_terms"
1856
- * }
1857
- * },
1858
- * "plans": [
1974
+ * "customerId": "customer_123",
1975
+ * "stripeCustomerId": "cus_abc123",
1976
+ * "hasPaymentMethod": true,
1977
+ * "name": "Ada Lovelace",
1978
+ * "email": "ada@example.com",
1979
+ * "created": 1735689600000,
1980
+ * "usageStartedAt": 1735689600000,
1981
+ * "enviroment": "test",
1982
+ * "products": [
1859
1983
  * {
1860
- * "productId": "prod_123",
1861
- * "productKey": "starter",
1984
+ * "id": "prod_123",
1985
+ * "key": "starter",
1862
1986
  * "name": "Starter",
1863
- * "monthlyPrice": {
1864
- * "stripePriceId": "price_monthly_starter",
1865
- * "label": "$29/month",
1866
- * "currency": "usd",
1867
- * "unitAmount": 2900,
1868
- * "recurringInterval": "month",
1869
- * "recurringIntervalCount": 1
1987
+ * "type": "stripe",
1988
+ * "isDefault": false,
1989
+ * "status": "active",
1990
+ * "version": 1,
1991
+ * "metadata": {
1992
+ * "tier": "starter"
1870
1993
  * },
1871
- * "yearlyPrice": {
1872
- * "stripePriceId": "price_yearly_starter",
1873
- * "label": "$290/year",
1874
- * "currency": "usd",
1875
- * "unitAmount": 29000,
1876
- * "recurringInterval": "year",
1877
- * "recurringIntervalCount": 1
1878
- * },
1879
- * "features": [
1880
- * {
1881
- * "featureKey": "api_calls",
1882
- * "name": "API Calls",
1883
- * "type": "limit",
1884
- * "label": "10000 API Calls",
1885
- * "limit": 10000,
1886
- * "isUnlimited": false
1887
- * },
1994
+ * "canceledAt": null,
1995
+ * "startedAt": 1735689600000,
1996
+ * "currentPeriodStart": 1735689600000,
1997
+ * "currentPeriodEnd": 1738368000000,
1998
+ * "prices": [
1888
1999
  * {
1889
- * "featureKey": "priority_support",
1890
- * "name": "Priority Support",
1891
- * "type": "boolean",
1892
- * "label": "Priority Support"
2000
+ * "stripePriceId": "price_123",
2001
+ * "quantity": 1,
2002
+ * "currency": "usd",
2003
+ * "unitAmount": 2000,
2004
+ * "recurringInterval": "month",
2005
+ * "isActive": true,
2006
+ * "isDefault": true,
2007
+ * "recurringIntervalCount": 1
1893
2008
  * }
1894
- * ],
1895
- * "isCurrent": true
2009
+ * ]
1896
2010
  * }
1897
2011
  * ],
1898
- * "customer": {
1899
- * "customerId": "customer_123",
1900
- * "stripeCustomerId": "cus_abc123",
1901
- * "currentProductIds": [
1902
- * "prod_123"
1903
- * ],
1904
- * "currentPriceIds": [
1905
- * "price_monthly_starter"
1906
- * ]
1907
- * }
2012
+ * "featureAccess": {
2013
+ * "api_calls": {
2014
+ * "hasAccess": true,
2015
+ * "type": "limit",
2016
+ * "limit": 1000,
2017
+ * "isUnlimited": false,
2018
+ * "usage": {
2019
+ * "used": 120,
2020
+ * "remaining": 880,
2021
+ * "bonusRemaining": 25,
2022
+ * "hasReachedLimit": false,
2023
+ * "bonusUsed": 5,
2024
+ * "nextReset": 1738368000000,
2025
+ * "lastReset": 1735689600000
2026
+ * }
2027
+ * },
2028
+ * "team_seats": {
2029
+ * "hasAccess": true,
2030
+ * "type": "boolean"
2031
+ * }
2032
+ * },
2033
+ * "bonuses": [
2034
+ * {
2035
+ * "bonusId": "9e9be7e5-55d2-4b44-93af-c3687f4b8af5",
2036
+ * "featureKey": "api_calls",
2037
+ * "amount": 50,
2038
+ * "remainingAmount": 50,
2039
+ * "expiresAt": 1738368000000,
2040
+ * "reason": "Support credit",
2041
+ * "metadata": {
2042
+ * "source": "support"
2043
+ * },
2044
+ * "createdAt": 1735689600000,
2045
+ * "updatedAt": 1735689600000
2046
+ * }
2047
+ * ]
1908
2048
  * }
1909
2049
  */
1910
2050
  "application/json": {
1911
- /** @description Pricing plans. */
1912
- plans: {
2051
+ /** @description Customer ID (internal or Stripe). */
2052
+ customerId?: string;
2053
+ /** @description Stripe customer ID. */
2054
+ stripeCustomerId?: string;
2055
+ /** @description Whether the Stripe customer has at least one saved payment method. */
2056
+ hasPaymentMethod: boolean;
2057
+ /** @description Customer name. */
2058
+ name?: string;
2059
+ /** @description Customer email address. */
2060
+ email?: string;
2061
+ /** @description Unix timestamp (ms) when the customer was created. */
2062
+ created?: number;
2063
+ /**
2064
+ * @description Customer environment.
2065
+ * @enum {string}
2066
+ */
2067
+ enviroment: "test" | "live";
2068
+ /** @description Subscribed or assigned products. */
2069
+ products: {
1913
2070
  /** @description Product ID. */
1914
- productId: string;
2071
+ id: string;
1915
2072
  /** @description Product key. */
1916
- productKey: string;
1917
- /** @description Product display name. */
2073
+ key: string;
2074
+ /** @description Product name. */
1918
2075
  name: string;
1919
- /** @description Optional product description text shown in the pricing card. */
1920
- description?: string;
1921
- /** @description Optional subheader text shown above this plan's feature list. */
1922
- featuresSubheader?: string;
1923
- /** @description Monthly recurring price, when available. */
1924
- monthlyPrice: {
1925
- /** @description Stripe price ID. */
1926
- stripePriceId: string;
1927
- /** @description Formatted display label. */
1928
- label: string;
1929
- /** @description ISO currency code. */
1930
- currency: string;
1931
- /** @description Unit amount in the smallest currency unit. */
1932
- unitAmount: number | null;
1933
- /** @description Recurring interval, if any. */
1934
- recurringInterval: string | null;
1935
- /** @description Recurring interval count, if any. */
1936
- recurringIntervalCount: number | null;
1937
- } | null;
1938
- /** @description Yearly recurring price, when available. */
1939
- yearlyPrice: {
2076
+ /**
2077
+ * @description Product type.
2078
+ * @enum {string}
2079
+ */
2080
+ type: "stripe" | "custom";
2081
+ /** @description Whether this product is the default custom product. */
2082
+ isDefault: boolean;
2083
+ /**
2084
+ * @description Stripe subscription status (Stripe customers only).
2085
+ * @enum {string}
2086
+ */
2087
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
2088
+ /** @description Product version number. */
2089
+ version: number;
2090
+ /** @description Custom product metadata (custom products only). */
2091
+ metadata?: {
2092
+ [key: string]: string;
2093
+ };
2094
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
2095
+ canceledAt?: number | null;
2096
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
2097
+ startedAt?: number;
2098
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
2099
+ currentPeriodStart?: number;
2100
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
2101
+ currentPeriodEnd?: number;
2102
+ /** @description Prices tied to this product (Stripe customers only). */
2103
+ prices?: {
1940
2104
  /** @description Stripe price ID. */
1941
2105
  stripePriceId: string;
1942
- /** @description Formatted display label. */
1943
- label: string;
2106
+ /** @description Price quantity. */
2107
+ quantity: number;
1944
2108
  /** @description ISO currency code. */
1945
2109
  currency: string;
1946
2110
  /** @description Unit amount in the smallest currency unit. */
1947
- unitAmount: number | null;
2111
+ unitAmount: number;
1948
2112
  /** @description Recurring interval, if any. */
1949
2113
  recurringInterval: string | null;
1950
- /** @description Recurring interval count, if any. */
1951
- recurringIntervalCount: number | null;
1952
- } | null;
1953
- /** @description Feature and limit entries for the product. */
1954
- features: {
1955
- /** @description Feature key. */
1956
- featureKey: string;
1957
- /** @description Feature name. */
1958
- name: string;
2114
+ /** @description Whether the price is active. */
2115
+ isActive: boolean;
2116
+ /** @description Whether this is the default price. */
2117
+ isDefault: boolean;
2118
+ /** @description Number of intervals between charges. */
2119
+ recurringIntervalCount: number;
2120
+ }[];
2121
+ }[];
2122
+ /** @description Feature access map. */
2123
+ featureAccess: {
2124
+ [key: string]: {
1959
2125
  /**
1960
2126
  * @description Feature access type.
1961
2127
  * @enum {string}
1962
2128
  */
1963
- type: "boolean" | "limit";
1964
- /** @description Human-readable feature label. */
1965
- label: string;
1966
- /** @description Configured numeric limit for limit features. */
1967
- limit?: number | null;
1968
- /** @description Whether the feature is unlimited. */
1969
- isUnlimited?: boolean;
1970
- }[];
1971
- /** @description Custom CTA configuration for non-checkout plans. */
1972
- customCta?: {
2129
+ type: "boolean";
2130
+ /** @description Whether the customer has access. */
2131
+ hasAccess: boolean;
2132
+ } | {
1973
2133
  /**
1974
- * @description Action triggered by the pricing table button.
2134
+ * @description Feature access type.
1975
2135
  * @enum {string}
1976
2136
  */
1977
- buttonAction?: "stripe_checkout" | "custom_url";
1978
- /** @description Custom call-to-action button label. */
1979
- buttonText?: string;
1980
- /**
1981
- * Format: uri
1982
- * @description URL opened when the custom call-to-action button is clicked.
1983
- */
1984
- linkUrl?: string;
2137
+ type: "limit";
2138
+ /** @description Whether the customer has access. */
2139
+ hasAccess: boolean;
2140
+ /** @description Whether the feature is unlimited. */
2141
+ isUnlimited: boolean;
2142
+ /** @description Limit for the feature, when applicable. */
2143
+ limit: number | null;
2144
+ /** @description Usage details for tracked features. */
2145
+ usage?: {
2146
+ /** @description Usage consumed for the feature. */
2147
+ used: number;
2148
+ /** @description Remaining base limit (limit - used). */
2149
+ remaining: number | null;
2150
+ /** @description Remaining bonus amount. */
2151
+ bonusRemaining: number;
2152
+ /** @description Whether base limit is met or exceeded and no bonus amount remains. */
2153
+ hasReachedLimit: boolean;
2154
+ /** @description Bonus amount consumed. */
2155
+ bonusUsed: number;
2156
+ /** @description Unix timestamp (ms) for the next reset, when applicable. */
2157
+ nextReset: number | null;
2158
+ /** @description Unix timestamp (ms) for the last reset, when applicable. */
2159
+ lastReset: number | null;
2160
+ };
1985
2161
  };
1986
- /** @description Whether this plan is currently assigned to the customer. */
1987
- isCurrent?: boolean;
1988
- }[];
1989
- /** @description Current customer state when available. */
1990
- customer: {
1991
- /** @description Resolved customer ID. */
1992
- customerId: string;
1993
- /** @description Resolved Stripe customer ID. */
1994
- stripeCustomerId?: string | null;
1995
- /** @description Current Stripe product IDs assigned to the customer. */
1996
- currentProductIds: string[];
1997
- /** @description Current Stripe price IDs assigned to the customer. */
1998
- currentPriceIds: string[];
1999
- } | null;
2000
- /** @description Selected pricing table when requested by key. */
2001
- table: {
2162
+ };
2163
+ /** @description Customer bonuses. */
2164
+ bonuses: {
2002
2165
  /**
2003
2166
  * Format: uuid
2004
- * @description Pricing table ID.
2167
+ * @description Bonus ID.
2005
2168
  */
2006
- id: string;
2007
- /** @description Pricing table name. */
2008
- name: string;
2009
- /** @description Pricing table key. */
2010
- tableKey: string;
2011
- /** @description Display settings. */
2012
- settings: {
2013
- /**
2014
- * @description Default billing interval shown in the table.
2015
- * @enum {string}
2016
- */
2017
- defaultView: "monthly" | "yearly";
2018
- /** @description Display language. */
2019
- language: string;
2020
- /** @description Table background color hex code. */
2021
- backgroundColor: string;
2022
- /** @description Primary button color hex code. */
2023
- buttonColor: string;
2024
- /** @description Font family identifier. */
2025
- fontFamily: string;
2026
- /** @description Button shape. */
2027
- buttonShape: string;
2028
- /** @description Whether a highlighted product style is enabled. */
2029
- highlightProduct: boolean;
2030
- /** @description Product ID to highlight when highlight mode is enabled. */
2031
- highlightProductId?: string;
2032
- /** @description Label displayed on the highlighted product. */
2033
- highlightLabel?: string;
2034
- /**
2035
- * @description How yearly prices are displayed in the pricing table.
2036
- * @enum {string}
2037
- */
2038
- pricingDisplay: "monthly_terms" | "monthly_terms_only" | "annual_terms";
2039
- /**
2040
- * @description Whether custom CTA products are shown before or after priced products.
2041
- * @enum {string}
2042
- */
2043
- customProductPosition?: "first" | "last";
2169
+ bonusId: string;
2170
+ /** @description Feature key. */
2171
+ featureKey: string;
2172
+ /** @description Bonus amount. */
2173
+ amount: number;
2174
+ /** @description Remaining bonus amount. */
2175
+ remainingAmount: number;
2176
+ /** @description Unix timestamp (ms) when the bonus expires. */
2177
+ expiresAt?: number | null;
2178
+ /** @description Bonus reason. */
2179
+ reason?: string | null;
2180
+ /** @description Bonus metadata. */
2181
+ metadata?: {
2182
+ [key: string]: string;
2183
+ };
2184
+ /** @description Unix timestamp (ms) when the bonus was created. */
2185
+ createdAt: number;
2186
+ /** @description Unix timestamp (ms) when the bonus was updated. */
2187
+ updatedAt: number;
2188
+ }[];
2189
+ /** @description Resolved Unix timestamp (ms) usage reset anchor. For Stripe customers, this is derived from active Stripe product period start (or product startedAt) when available. Otherwise it uses stored usageStartedAt; if unset, it falls back to the customer created timestamp. */
2190
+ usageStartedAt?: number;
2191
+ };
2192
+ };
2193
+ };
2194
+ /** @description Bad request */
2195
+ 400: {
2196
+ headers: {
2197
+ [name: string]: unknown;
2198
+ };
2199
+ content: {
2200
+ "application/json": {
2201
+ /** @description Error message. */
2202
+ error: string;
2203
+ };
2204
+ };
2205
+ };
2206
+ /** @description Unauthorized */
2207
+ 401: {
2208
+ headers: {
2209
+ [name: string]: unknown;
2210
+ };
2211
+ content: {
2212
+ "application/json": {
2213
+ /** @description Error message. */
2214
+ error: string;
2215
+ };
2216
+ };
2217
+ };
2218
+ /** @description Not found */
2219
+ 404: {
2220
+ headers: {
2221
+ [name: string]: unknown;
2222
+ };
2223
+ content: {
2224
+ "application/json": {
2225
+ /** @description Error message. */
2226
+ error: string;
2227
+ };
2228
+ };
2229
+ };
2230
+ /** @description Server error */
2231
+ 500: {
2232
+ headers: {
2233
+ [name: string]: unknown;
2234
+ };
2235
+ content: {
2236
+ "application/json": {
2237
+ /** @description Error message. */
2238
+ error: string;
2239
+ };
2240
+ };
2241
+ };
2242
+ };
2243
+ };
2244
+ delete?: never;
2245
+ options?: never;
2246
+ head?: never;
2247
+ patch?: never;
2248
+ trace?: never;
2249
+ };
2250
+ "/v1/usage/set": {
2251
+ parameters: {
2252
+ query?: never;
2253
+ header?: never;
2254
+ path?: never;
2255
+ cookie?: never;
2256
+ };
2257
+ get?: never;
2258
+ put?: never;
2259
+ /**
2260
+ * Set usage
2261
+ * @description Set absolute usage for the current period by recording an adjustment event.
2262
+ */
2263
+ post: {
2264
+ parameters: {
2265
+ query?: never;
2266
+ header: {
2267
+ /** @description API key from your PriceOS dashboard. */
2268
+ "x-api-key": string;
2269
+ };
2270
+ path?: never;
2271
+ cookie?: never;
2272
+ };
2273
+ requestBody: {
2274
+ content: {
2275
+ "application/json": {
2276
+ /** @description Customer ID (internal or Stripe). */
2277
+ customerId: string;
2278
+ /** @description Feature key to set usage for. */
2279
+ featureKey: string;
2280
+ /** @description Absolute usage value to set for the current usage period. */
2281
+ used: number;
2282
+ /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
2283
+ idempotencyKey?: string;
2284
+ /** @description Optional metadata for the adjustment event (string key/value pairs). */
2285
+ metadata?: {
2286
+ [key: string]: string;
2287
+ };
2288
+ };
2289
+ };
2290
+ };
2291
+ responses: {
2292
+ /** @description Usage set */
2293
+ 200: {
2294
+ headers: {
2295
+ [name: string]: unknown;
2296
+ };
2297
+ content: {
2298
+ "application/json": {
2299
+ /** @description Whether the usage event was applied. */
2300
+ applied: boolean;
2301
+ /** @description Updated usage total, if applicable. */
2302
+ used: number | null;
2303
+ /** @description Reason the usage event was not applied. */
2304
+ reason?: string | null;
2305
+ /** @description Adjustment amount applied to reach the requested usage value. */
2306
+ adjustment: number;
2307
+ };
2308
+ };
2309
+ };
2310
+ /** @description Bad request */
2311
+ 400: {
2312
+ headers: {
2313
+ [name: string]: unknown;
2314
+ };
2315
+ content: {
2316
+ "application/json": {
2317
+ /** @description Error message. */
2318
+ error: string;
2319
+ };
2320
+ };
2321
+ };
2322
+ /** @description Unauthorized */
2323
+ 401: {
2324
+ headers: {
2325
+ [name: string]: unknown;
2326
+ };
2327
+ content: {
2328
+ "application/json": {
2329
+ /** @description Error message. */
2330
+ error: string;
2331
+ };
2332
+ };
2333
+ };
2334
+ /** @description Not found */
2335
+ 404: {
2336
+ headers: {
2337
+ [name: string]: unknown;
2338
+ };
2339
+ content: {
2340
+ "application/json": {
2341
+ /** @description Error message. */
2342
+ error: string;
2343
+ };
2344
+ };
2345
+ };
2346
+ /** @description Server error */
2347
+ 500: {
2348
+ headers: {
2349
+ [name: string]: unknown;
2350
+ };
2351
+ content: {
2352
+ "application/json": {
2353
+ /** @description Error message. */
2354
+ error: string;
2355
+ };
2356
+ };
2357
+ };
2358
+ };
2359
+ };
2360
+ delete?: never;
2361
+ options?: never;
2362
+ head?: never;
2363
+ patch?: never;
2364
+ trace?: never;
2365
+ };
2366
+ "/v1/feature-access": {
2367
+ parameters: {
2368
+ query?: never;
2369
+ header?: never;
2370
+ path?: never;
2371
+ cookie?: never;
2372
+ };
2373
+ /**
2374
+ * Get feature access
2375
+ * @description Return feature access for a customer.
2376
+ */
2377
+ get: {
2378
+ parameters: {
2379
+ query: {
2380
+ /** @description Customer ID (internal or Stripe). */
2381
+ customerId: string;
2382
+ };
2383
+ header: {
2384
+ /** @description API key from your PriceOS dashboard. */
2385
+ "x-api-key": string;
2386
+ };
2387
+ path?: never;
2388
+ cookie?: never;
2389
+ };
2390
+ requestBody?: never;
2391
+ responses: {
2392
+ /** @description Feature access lookup */
2393
+ 200: {
2394
+ headers: {
2395
+ [name: string]: unknown;
2396
+ };
2397
+ content: {
2398
+ /**
2399
+ * @example {
2400
+ * "api_calls": {
2401
+ * "hasAccess": true,
2402
+ * "type": "limit",
2403
+ * "limit": 1000,
2404
+ * "isUnlimited": false,
2405
+ * "usage": {
2406
+ * "used": 120,
2407
+ * "remaining": 880,
2408
+ * "bonusRemaining": 25,
2409
+ * "hasReachedLimit": false,
2410
+ * "bonusUsed": 5,
2411
+ * "nextReset": 1738368000000,
2412
+ * "lastReset": 1735689600000
2413
+ * }
2414
+ * },
2415
+ * "team_seats": {
2416
+ * "hasAccess": true,
2417
+ * "type": "boolean"
2418
+ * }
2419
+ * }
2420
+ */
2421
+ "application/json": {
2422
+ [key: string]: {
2423
+ /**
2424
+ * @description Feature access type.
2425
+ * @enum {string}
2426
+ */
2427
+ type: "boolean";
2428
+ /** @description Whether the customer has access. */
2429
+ hasAccess: boolean;
2430
+ } | {
2431
+ /**
2432
+ * @description Feature access type.
2433
+ * @enum {string}
2434
+ */
2435
+ type: "limit";
2436
+ /** @description Whether the customer has access. */
2437
+ hasAccess: boolean;
2438
+ /** @description Whether the feature is unlimited. */
2439
+ isUnlimited: boolean;
2440
+ /** @description Limit for the feature, when applicable. */
2441
+ limit: number | null;
2442
+ /** @description Usage details for tracked features. */
2443
+ usage?: {
2444
+ /** @description Usage consumed for the feature. */
2445
+ used: number;
2446
+ /** @description Remaining base limit (limit - used). */
2447
+ remaining: number | null;
2448
+ /** @description Remaining bonus amount. */
2449
+ bonusRemaining: number;
2450
+ /** @description Whether base limit is met or exceeded and no bonus amount remains. */
2451
+ hasReachedLimit: boolean;
2452
+ /** @description Bonus amount consumed. */
2453
+ bonusUsed: number;
2454
+ /** @description Unix timestamp (ms) for the next reset, when applicable. */
2455
+ nextReset: number | null;
2456
+ /** @description Unix timestamp (ms) for the last reset, when applicable. */
2457
+ lastReset: number | null;
2044
2458
  };
2045
- } | null;
2459
+ };
2046
2460
  };
2047
2461
  };
2048
2462
  };
@@ -2092,20 +2506,18 @@ export interface paths {
2092
2506
  patch?: never;
2093
2507
  trace?: never;
2094
2508
  };
2095
- "/v1/checkout": {
2509
+ "/v1/features": {
2096
2510
  parameters: {
2097
2511
  query?: never;
2098
2512
  header?: never;
2099
2513
  path?: never;
2100
2514
  cookie?: never;
2101
2515
  };
2102
- get?: never;
2103
- put?: never;
2104
2516
  /**
2105
- * Create checkout session
2106
- * @description Create a Stripe checkout session for a Stripe price linked to the workspace. Optionally links checkout to a PriceOS customer.
2517
+ * Get features
2518
+ * @description List features for the workspace.
2107
2519
  */
2108
- post: {
2520
+ get: {
2109
2521
  parameters: {
2110
2522
  query?: never;
2111
2523
  header: {
@@ -2115,61 +2527,41 @@ export interface paths {
2115
2527
  path?: never;
2116
2528
  cookie?: never;
2117
2529
  };
2118
- requestBody: {
2119
- content: {
2120
- "application/json": {
2121
- /** @description Stripe price ID. */
2122
- stripePriceId: string;
2123
- /**
2124
- * Format: uri
2125
- * @description Checkout success redirect URL.
2126
- */
2127
- successUrl: string;
2128
- /**
2129
- * Format: uri
2130
- * @description Checkout cancel redirect URL. Defaults to successUrl when omitted.
2131
- */
2132
- cancelUrl?: string;
2133
- /** @description Optional customer ID (internal or Stripe). */
2134
- customerId?: string | null;
2135
- /** @description Optional metadata to attach to the Stripe checkout session. */
2136
- metadata?: {
2137
- [key: string]: string;
2138
- };
2139
- };
2140
- };
2141
- };
2530
+ requestBody?: never;
2142
2531
  responses: {
2143
- /** @description Checkout session */
2532
+ /** @description Feature list */
2144
2533
  200: {
2145
2534
  headers: {
2146
2535
  [name: string]: unknown;
2147
2536
  };
2148
2537
  content: {
2149
- /**
2150
- * @example {
2151
- * "url": "https://checkout.stripe.com/c/pay/cs_test_123"
2152
- * }
2153
- */
2154
2538
  "application/json": {
2539
+ /** @description Feature ID. */
2540
+ id: string;
2541
+ /** @description Feature key. */
2542
+ featureKey: string;
2543
+ /** @description Feature name. */
2544
+ name: string;
2545
+ /** @description Feature description. */
2546
+ description: string | null;
2155
2547
  /**
2156
- * Format: uri
2157
- * @description Stripe checkout URL.
2548
+ * @description Feature access type.
2549
+ * @enum {string}
2158
2550
  */
2159
- url: string;
2160
- };
2161
- };
2162
- };
2163
- /** @description Bad request */
2164
- 400: {
2165
- headers: {
2166
- [name: string]: unknown;
2167
- };
2168
- content: {
2169
- "application/json": {
2170
- /** @description Error message. */
2171
- error: string;
2172
- };
2551
+ type: "boolean" | "limit";
2552
+ /** @description Whether the feature tracks usage. */
2553
+ tracksUsage: boolean;
2554
+ /**
2555
+ * @description Usage reset interval.
2556
+ * @enum {string}
2557
+ */
2558
+ usageResetInterval: "never" | "day" | "week" | "month" | "year";
2559
+ /**
2560
+ * @description Usage reset anchor.
2561
+ * @enum {string}
2562
+ */
2563
+ usageResetAnchor: "billing_period" | "calendar";
2564
+ }[];
2173
2565
  };
2174
2566
  };
2175
2567
  /** @description Unauthorized */
@@ -2184,30 +2576,6 @@ export interface paths {
2184
2576
  };
2185
2577
  };
2186
2578
  };
2187
- /** @description Not found */
2188
- 404: {
2189
- headers: {
2190
- [name: string]: unknown;
2191
- };
2192
- content: {
2193
- "application/json": {
2194
- /** @description Error message. */
2195
- error: string;
2196
- };
2197
- };
2198
- };
2199
- /** @description Conflict */
2200
- 409: {
2201
- headers: {
2202
- [name: string]: unknown;
2203
- };
2204
- content: {
2205
- "application/json": {
2206
- /** @description Error message. */
2207
- error: string;
2208
- };
2209
- };
2210
- };
2211
2579
  /** @description Server error */
2212
2580
  500: {
2213
2581
  headers: {
@@ -2222,28 +2590,33 @@ export interface paths {
2222
2590
  };
2223
2591
  };
2224
2592
  };
2593
+ put?: never;
2594
+ post?: never;
2225
2595
  delete?: never;
2226
2596
  options?: never;
2227
2597
  head?: never;
2228
2598
  patch?: never;
2229
2599
  trace?: never;
2230
2600
  };
2231
- "/v1/usage": {
2601
+ "/v1/pricing-table": {
2232
2602
  parameters: {
2233
2603
  query?: never;
2234
2604
  header?: never;
2235
2605
  path?: never;
2236
2606
  cookie?: never;
2237
2607
  };
2238
- get?: never;
2239
- put?: never;
2240
2608
  /**
2241
- * Track usage
2242
- * @description Record usage for a feature.
2609
+ * Get pricing table
2610
+ * @description List plans with PriceOS feature/limit definitions. Optionally include customer plan state and load a specific pricing table by key.
2243
2611
  */
2244
- post: {
2612
+ get: {
2245
2613
  parameters: {
2246
- query?: never;
2614
+ query?: {
2615
+ /** @description Optional customer ID (internal or Stripe). */
2616
+ customerId?: string | null;
2617
+ /** @description Optional pricing table key. */
2618
+ pricingTableKey?: string | null;
2619
+ };
2247
2620
  header: {
2248
2621
  /** @description API key from your PriceOS dashboard. */
2249
2622
  "x-api-key": string;
@@ -2251,45 +2624,219 @@ export interface paths {
2251
2624
  path?: never;
2252
2625
  cookie?: never;
2253
2626
  };
2254
- requestBody: {
2255
- content: {
2256
- "application/json": {
2257
- /** @description Customer ID (internal or Stripe). */
2258
- customerId: string;
2259
- /** @description Feature key to track usage for. */
2260
- featureKey: string;
2261
- /**
2262
- * @description Usage amount to record. Defaults to 1. Supports positive or negative values.
2263
- * @default 1
2264
- */
2265
- amount?: number;
2266
- /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
2267
- idempotencyKey?: string;
2268
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
2269
- eventKey?: string;
2270
- /** @description Unix timestamp (ms) when the event occurred. */
2271
- occurredAt?: number;
2272
- /** @description Optional metadata for the event (string key/value pairs). */
2273
- metadata?: {
2274
- [key: string]: string;
2275
- };
2276
- };
2277
- };
2278
- };
2627
+ requestBody?: never;
2279
2628
  responses: {
2280
- /** @description Usage recorded */
2629
+ /** @description Pricing table */
2281
2630
  200: {
2282
2631
  headers: {
2283
2632
  [name: string]: unknown;
2284
2633
  };
2285
2634
  content: {
2635
+ /**
2636
+ * @example {
2637
+ * "table": {
2638
+ * "id": "11111111-1111-1111-1111-111111111111",
2639
+ * "name": "Default pricing table",
2640
+ * "tableKey": "default_table",
2641
+ * "settings": {
2642
+ * "defaultView": "monthly",
2643
+ * "language": "en",
2644
+ * "backgroundColor": "#ffffff",
2645
+ * "buttonColor": "#0074d4",
2646
+ * "fontFamily": "system",
2647
+ * "buttonShape": "rounded",
2648
+ * "highlightProduct": false,
2649
+ * "pricingDisplay": "monthly_terms"
2650
+ * }
2651
+ * },
2652
+ * "plans": [
2653
+ * {
2654
+ * "productId": "prod_123",
2655
+ * "productKey": "starter",
2656
+ * "name": "Starter",
2657
+ * "monthlyPrice": {
2658
+ * "stripePriceId": "price_monthly_starter",
2659
+ * "label": "$29/month",
2660
+ * "currency": "usd",
2661
+ * "unitAmount": 2900,
2662
+ * "recurringInterval": "month",
2663
+ * "recurringIntervalCount": 1
2664
+ * },
2665
+ * "yearlyPrice": {
2666
+ * "stripePriceId": "price_yearly_starter",
2667
+ * "label": "$290/year",
2668
+ * "currency": "usd",
2669
+ * "unitAmount": 29000,
2670
+ * "recurringInterval": "year",
2671
+ * "recurringIntervalCount": 1
2672
+ * },
2673
+ * "features": [
2674
+ * {
2675
+ * "featureKey": "api_calls",
2676
+ * "name": "API Calls",
2677
+ * "type": "limit",
2678
+ * "label": "10000 API Calls",
2679
+ * "limit": 10000,
2680
+ * "isUnlimited": false
2681
+ * },
2682
+ * {
2683
+ * "featureKey": "priority_support",
2684
+ * "name": "Priority Support",
2685
+ * "type": "boolean",
2686
+ * "label": "Priority Support"
2687
+ * }
2688
+ * ],
2689
+ * "isCurrent": true
2690
+ * }
2691
+ * ],
2692
+ * "customer": {
2693
+ * "customerId": "customer_123",
2694
+ * "stripeCustomerId": "cus_abc123",
2695
+ * "currentProductIds": [
2696
+ * "prod_123"
2697
+ * ],
2698
+ * "currentPriceIds": [
2699
+ * "price_monthly_starter"
2700
+ * ]
2701
+ * }
2702
+ * }
2703
+ */
2286
2704
  "application/json": {
2287
- /** @description Whether the usage event was applied. */
2288
- applied: boolean;
2289
- /** @description Updated usage total, if applicable. */
2290
- used: number | null;
2291
- /** @description Reason the usage event was not applied. */
2292
- reason?: string | null;
2705
+ /** @description Pricing plans. */
2706
+ plans: {
2707
+ /** @description Product ID. */
2708
+ productId: string;
2709
+ /** @description Product key. */
2710
+ productKey: string;
2711
+ /** @description Product display name. */
2712
+ name: string;
2713
+ /** @description Optional product description text shown in the pricing card. */
2714
+ description?: string;
2715
+ /** @description Optional subheader text shown above this plan's feature list. */
2716
+ featuresSubheader?: string;
2717
+ /** @description Monthly recurring price, when available. */
2718
+ monthlyPrice: {
2719
+ /** @description Stripe price ID. */
2720
+ stripePriceId: string;
2721
+ /** @description Formatted display label. */
2722
+ label: string;
2723
+ /** @description ISO currency code. */
2724
+ currency: string;
2725
+ /** @description Unit amount in the smallest currency unit. */
2726
+ unitAmount: number | null;
2727
+ /** @description Recurring interval, if any. */
2728
+ recurringInterval: string | null;
2729
+ /** @description Recurring interval count, if any. */
2730
+ recurringIntervalCount: number | null;
2731
+ } | null;
2732
+ /** @description Yearly recurring price, when available. */
2733
+ yearlyPrice: {
2734
+ /** @description Stripe price ID. */
2735
+ stripePriceId: string;
2736
+ /** @description Formatted display label. */
2737
+ label: string;
2738
+ /** @description ISO currency code. */
2739
+ currency: string;
2740
+ /** @description Unit amount in the smallest currency unit. */
2741
+ unitAmount: number | null;
2742
+ /** @description Recurring interval, if any. */
2743
+ recurringInterval: string | null;
2744
+ /** @description Recurring interval count, if any. */
2745
+ recurringIntervalCount: number | null;
2746
+ } | null;
2747
+ /** @description Feature and limit entries for the product. */
2748
+ features: {
2749
+ /** @description Feature key. */
2750
+ featureKey: string;
2751
+ /** @description Feature name. */
2752
+ name: string;
2753
+ /**
2754
+ * @description Feature access type.
2755
+ * @enum {string}
2756
+ */
2757
+ type: "boolean" | "limit";
2758
+ /** @description Human-readable feature label. */
2759
+ label: string;
2760
+ /** @description Configured numeric limit for limit features. */
2761
+ limit?: number | null;
2762
+ /** @description Whether the feature is unlimited. */
2763
+ isUnlimited?: boolean;
2764
+ }[];
2765
+ /** @description Custom CTA configuration for non-checkout plans. */
2766
+ customCta?: {
2767
+ /**
2768
+ * @description Action triggered by the pricing table button.
2769
+ * @enum {string}
2770
+ */
2771
+ buttonAction?: "stripe_checkout" | "custom_url";
2772
+ /** @description Custom call-to-action button label. */
2773
+ buttonText?: string;
2774
+ /**
2775
+ * Format: uri
2776
+ * @description URL opened when the custom call-to-action button is clicked.
2777
+ */
2778
+ linkUrl?: string;
2779
+ };
2780
+ /** @description Whether this plan is currently assigned to the customer. */
2781
+ isCurrent?: boolean;
2782
+ }[];
2783
+ /** @description Current customer state when available. */
2784
+ customer: {
2785
+ /** @description Resolved customer ID. */
2786
+ customerId: string;
2787
+ /** @description Resolved Stripe customer ID. */
2788
+ stripeCustomerId?: string | null;
2789
+ /** @description Current Stripe product IDs assigned to the customer. */
2790
+ currentProductIds: string[];
2791
+ /** @description Current Stripe price IDs assigned to the customer. */
2792
+ currentPriceIds: string[];
2793
+ } | null;
2794
+ /** @description Selected pricing table when requested by key. */
2795
+ table: {
2796
+ /**
2797
+ * Format: uuid
2798
+ * @description Pricing table ID.
2799
+ */
2800
+ id: string;
2801
+ /** @description Pricing table name. */
2802
+ name: string;
2803
+ /** @description Pricing table key. */
2804
+ tableKey: string;
2805
+ /** @description Display settings. */
2806
+ settings: {
2807
+ /**
2808
+ * @description Default billing interval shown in the table.
2809
+ * @enum {string}
2810
+ */
2811
+ defaultView: "monthly" | "yearly";
2812
+ /** @description Display language. */
2813
+ language: string;
2814
+ /** @description Table background color hex code. */
2815
+ backgroundColor: string;
2816
+ /** @description Primary button color hex code. */
2817
+ buttonColor: string;
2818
+ /** @description Font family identifier. */
2819
+ fontFamily: string;
2820
+ /** @description Button shape. */
2821
+ buttonShape: string;
2822
+ /** @description Whether a highlighted product style is enabled. */
2823
+ highlightProduct: boolean;
2824
+ /** @description Product ID to highlight when highlight mode is enabled. */
2825
+ highlightProductId?: string;
2826
+ /** @description Label displayed on the highlighted product. */
2827
+ highlightLabel?: string;
2828
+ /**
2829
+ * @description How yearly prices are displayed in the pricing table.
2830
+ * @enum {string}
2831
+ */
2832
+ pricingDisplay: "monthly_terms" | "monthly_terms_only" | "annual_terms";
2833
+ /**
2834
+ * @description Whether custom CTA products are shown before or after priced products.
2835
+ * @enum {string}
2836
+ */
2837
+ customProductPosition?: "first" | "last";
2838
+ };
2839
+ } | null;
2293
2840
  };
2294
2841
  };
2295
2842
  };
@@ -2317,18 +2864,6 @@ export interface paths {
2317
2864
  };
2318
2865
  };
2319
2866
  };
2320
- /** @description Not found */
2321
- 404: {
2322
- headers: {
2323
- [name: string]: unknown;
2324
- };
2325
- content: {
2326
- "application/json": {
2327
- /** @description Error message. */
2328
- error: string;
2329
- };
2330
- };
2331
- };
2332
2867
  /** @description Server error */
2333
2868
  500: {
2334
2869
  headers: {
@@ -2343,130 +2878,26 @@ export interface paths {
2343
2878
  };
2344
2879
  };
2345
2880
  };
2881
+ put?: never;
2882
+ post?: never;
2346
2883
  delete?: never;
2347
2884
  options?: never;
2348
2885
  head?: never;
2349
2886
  patch?: never;
2350
2887
  trace?: never;
2351
2888
  };
2352
- "/v1/bonuses": {
2889
+ "/v1/checkout": {
2353
2890
  parameters: {
2354
2891
  query?: never;
2355
2892
  header?: never;
2356
2893
  path?: never;
2357
2894
  cookie?: never;
2358
2895
  };
2359
- /**
2360
- * List bonuses
2361
- * @description List bonuses for a customer, optionally filtered by feature key.
2362
- */
2363
- get: {
2364
- parameters: {
2365
- query: {
2366
- /** @description Customer ID (internal or Stripe). */
2367
- customerId: string;
2368
- /** @description Optional feature key to filter bonuses. */
2369
- featureKey?: string | null;
2370
- };
2371
- header: {
2372
- /** @description API key from your PriceOS dashboard. */
2373
- "x-api-key": string;
2374
- };
2375
- path?: never;
2376
- cookie?: never;
2377
- };
2378
- requestBody?: never;
2379
- responses: {
2380
- /** @description Bonus list */
2381
- 200: {
2382
- headers: {
2383
- [name: string]: unknown;
2384
- };
2385
- content: {
2386
- "application/json": {
2387
- /** @description Bonuses. */
2388
- bonuses: {
2389
- /**
2390
- * Format: uuid
2391
- * @description Bonus ID.
2392
- */
2393
- bonusId: string;
2394
- /** @description Feature key. */
2395
- featureKey: string;
2396
- /** @description Bonus amount. */
2397
- amount: number;
2398
- /** @description Remaining bonus amount. */
2399
- remainingAmount: number;
2400
- /** @description Unix timestamp (ms) when the bonus expires. */
2401
- expiresAt?: number | null;
2402
- /** @description Bonus reason. */
2403
- reason?: string | null;
2404
- /** @description Bonus metadata. */
2405
- metadata?: {
2406
- [key: string]: string;
2407
- };
2408
- /** @description Unix timestamp (ms) when the bonus was created. */
2409
- createdAt: number;
2410
- /** @description Unix timestamp (ms) when the bonus was last updated. */
2411
- updatedAt: number;
2412
- }[];
2413
- };
2414
- };
2415
- };
2416
- /** @description Bad request */
2417
- 400: {
2418
- headers: {
2419
- [name: string]: unknown;
2420
- };
2421
- content: {
2422
- "application/json": {
2423
- /** @description Error message. */
2424
- error: string;
2425
- };
2426
- };
2427
- };
2428
- /** @description Unauthorized */
2429
- 401: {
2430
- headers: {
2431
- [name: string]: unknown;
2432
- };
2433
- content: {
2434
- "application/json": {
2435
- /** @description Error message. */
2436
- error: string;
2437
- };
2438
- };
2439
- };
2440
- /** @description Not found */
2441
- 404: {
2442
- headers: {
2443
- [name: string]: unknown;
2444
- };
2445
- content: {
2446
- "application/json": {
2447
- /** @description Error message. */
2448
- error: string;
2449
- };
2450
- };
2451
- };
2452
- /** @description Server error */
2453
- 500: {
2454
- headers: {
2455
- [name: string]: unknown;
2456
- };
2457
- content: {
2458
- "application/json": {
2459
- /** @description Error message. */
2460
- error: string;
2461
- };
2462
- };
2463
- };
2464
- };
2465
- };
2896
+ get?: never;
2466
2897
  put?: never;
2467
2898
  /**
2468
- * Create bonus
2469
- * @description Create a one-time bonus amount for a customer feature.
2899
+ * Create checkout session
2900
+ * @description Create a Stripe checkout session for a Stripe price linked to the workspace. Optionally links checkout to a PriceOS customer.
2470
2901
  */
2471
2902
  post: {
2472
2903
  parameters: {
@@ -2479,19 +2910,23 @@ export interface paths {
2479
2910
  cookie?: never;
2480
2911
  };
2481
2912
  requestBody: {
2482
- content: {
2483
- "application/json": {
2484
- /** @description Customer ID (internal or Stripe). */
2485
- customerId: string;
2486
- /** @description Feature key to create bonus for. */
2487
- featureKey: string;
2488
- /** @description Bonus amount to create. */
2489
- amount: number;
2490
- /** @description Optional Unix timestamp (ms) when the bonus expires. */
2491
- expiresAt?: number;
2492
- /** @description Optional reason for the bonus. */
2493
- reason?: string | null;
2494
- /** @description Optional metadata for the bonus (string key/value pairs). */
2913
+ content: {
2914
+ "application/json": {
2915
+ /** @description Stripe price ID. */
2916
+ stripePriceId: string;
2917
+ /**
2918
+ * Format: uri
2919
+ * @description Checkout success redirect URL.
2920
+ */
2921
+ successUrl: string;
2922
+ /**
2923
+ * Format: uri
2924
+ * @description Checkout cancel redirect URL. Defaults to successUrl when omitted.
2925
+ */
2926
+ cancelUrl?: string;
2927
+ /** @description Optional customer ID (internal or Stripe). */
2928
+ customerId?: string | null;
2929
+ /** @description Optional metadata to attach to the Stripe checkout session. */
2495
2930
  metadata?: {
2496
2931
  [key: string]: string;
2497
2932
  };
@@ -2499,22 +2934,23 @@ export interface paths {
2499
2934
  };
2500
2935
  };
2501
2936
  responses: {
2502
- /** @description Bonus created */
2937
+ /** @description Checkout session */
2503
2938
  200: {
2504
2939
  headers: {
2505
2940
  [name: string]: unknown;
2506
2941
  };
2507
2942
  content: {
2943
+ /**
2944
+ * @example {
2945
+ * "url": "https://checkout.stripe.com/c/pay/cs_test_123"
2946
+ * }
2947
+ */
2508
2948
  "application/json": {
2509
2949
  /**
2510
- * Format: uuid
2511
- * @description Bonus ID.
2950
+ * Format: uri
2951
+ * @description Stripe checkout URL.
2512
2952
  */
2513
- bonusId: string;
2514
- /** @description Remaining amount for the newly created grant. */
2515
- remainingAmount: number;
2516
- /** @description Total remaining bonus amount for this customer + feature. */
2517
- counterRemaining: number;
2953
+ url: string;
2518
2954
  };
2519
2955
  };
2520
2956
  };
@@ -2554,6 +2990,18 @@ export interface paths {
2554
2990
  };
2555
2991
  };
2556
2992
  };
2993
+ /** @description Conflict */
2994
+ 409: {
2995
+ headers: {
2996
+ [name: string]: unknown;
2997
+ };
2998
+ content: {
2999
+ "application/json": {
3000
+ /** @description Error message. */
3001
+ error: string;
3002
+ };
3003
+ };
3004
+ };
2557
3005
  /** @description Server error */
2558
3006
  500: {
2559
3007
  headers: {
@@ -2574,7 +3022,7 @@ export interface paths {
2574
3022
  patch?: never;
2575
3023
  trace?: never;
2576
3024
  };
2577
- "/v1/bonuses/{bonusId}": {
3025
+ "/v1/usage": {
2578
3026
  parameters: {
2579
3027
  query?: never;
2580
3028
  header?: never;
@@ -2582,75 +3030,58 @@ export interface paths {
2582
3030
  cookie?: never;
2583
3031
  };
2584
3032
  get?: never;
3033
+ put?: never;
2585
3034
  /**
2586
- * Update bonus
2587
- * @description Update an existing bonus.
3035
+ * Track usage
3036
+ * @description Record usage for a feature.
2588
3037
  */
2589
- put: {
3038
+ post: {
2590
3039
  parameters: {
2591
3040
  query?: never;
2592
3041
  header: {
2593
3042
  /** @description API key from your PriceOS dashboard. */
2594
3043
  "x-api-key": string;
2595
3044
  };
2596
- path: {
2597
- /** @description Bonus ID. */
2598
- bonusId: string;
2599
- };
3045
+ path?: never;
2600
3046
  cookie?: never;
2601
3047
  };
2602
3048
  requestBody: {
2603
3049
  content: {
2604
3050
  "application/json": {
2605
- /** @description Optional updated bonus amount. */
3051
+ /** @description Customer ID (internal or Stripe). */
3052
+ customerId: string;
3053
+ /** @description Feature key to track usage for. */
3054
+ featureKey: string;
3055
+ /**
3056
+ * @description Usage amount to record. Defaults to 1. Supports positive or negative values.
3057
+ * @default 1
3058
+ */
2606
3059
  amount?: number;
2607
- /** @description Optional Unix timestamp (ms) when the bonus expires. Use null to clear. */
2608
- expiresAt?: number | null;
2609
- /** @description Optional reason for the bonus. Use null to clear. */
2610
- reason?: string | null;
2611
- /** @description Optional metadata for the bonus (string key/value pairs). Use null to clear. */
3060
+ /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
3061
+ idempotencyKey?: string;
3062
+ /** @description Unix timestamp (ms) when the event occurred. */
3063
+ occurredAt?: number;
3064
+ /** @description Optional metadata for the event (string key/value pairs). */
2612
3065
  metadata?: {
2613
3066
  [key: string]: string;
2614
- } | null;
3067
+ };
2615
3068
  };
2616
3069
  };
2617
3070
  };
2618
3071
  responses: {
2619
- /** @description Bonus updated */
3072
+ /** @description Usage recorded */
2620
3073
  200: {
2621
3074
  headers: {
2622
3075
  [name: string]: unknown;
2623
3076
  };
2624
3077
  content: {
2625
3078
  "application/json": {
2626
- /** @description Updated bonus. */
2627
- bonus: {
2628
- /**
2629
- * Format: uuid
2630
- * @description Bonus ID.
2631
- */
2632
- bonusId: string;
2633
- /** @description Feature key. */
2634
- featureKey: string;
2635
- /** @description Bonus amount. */
2636
- amount: number;
2637
- /** @description Remaining bonus amount. */
2638
- remainingAmount: number;
2639
- /** @description Unix timestamp (ms) when the bonus expires. */
2640
- expiresAt?: number | null;
2641
- /** @description Bonus reason. */
2642
- reason?: string | null;
2643
- /** @description Bonus metadata. */
2644
- metadata?: {
2645
- [key: string]: string;
2646
- };
2647
- /** @description Unix timestamp (ms) when the bonus was created. */
2648
- createdAt: number;
2649
- /** @description Unix timestamp (ms) when the bonus was last updated. */
2650
- updatedAt: number;
2651
- };
2652
- /** @description Total remaining bonus amount for this customer + feature. */
2653
- counterRemaining: number;
3079
+ /** @description Whether the usage event was applied. */
3080
+ applied: boolean;
3081
+ /** @description Updated usage total, if applicable. */
3082
+ used: number | null;
3083
+ /** @description Reason the usage event was not applied. */
3084
+ reason?: string | null;
2654
3085
  };
2655
3086
  };
2656
3087
  };
@@ -2704,45 +3135,73 @@ export interface paths {
2704
3135
  };
2705
3136
  };
2706
3137
  };
2707
- post?: never;
3138
+ delete?: never;
3139
+ options?: never;
3140
+ head?: never;
3141
+ patch?: never;
3142
+ trace?: never;
3143
+ };
3144
+ "/v1/bonuses": {
3145
+ parameters: {
3146
+ query?: never;
3147
+ header?: never;
3148
+ path?: never;
3149
+ cookie?: never;
3150
+ };
2708
3151
  /**
2709
- * Delete bonus
2710
- * @description Delete an existing bonus that has not been consumed.
3152
+ * List bonuses
3153
+ * @description List bonuses for a customer, optionally filtered by feature key.
2711
3154
  */
2712
- delete: {
3155
+ get: {
2713
3156
  parameters: {
2714
- query?: never;
3157
+ query: {
3158
+ /** @description Customer ID (internal or Stripe). */
3159
+ customerId: string;
3160
+ /** @description Optional feature key to filter bonuses. */
3161
+ featureKey?: string | null;
3162
+ };
2715
3163
  header: {
2716
3164
  /** @description API key from your PriceOS dashboard. */
2717
3165
  "x-api-key": string;
2718
3166
  };
2719
- path: {
2720
- /** @description Bonus ID. */
2721
- bonusId: string;
2722
- };
3167
+ path?: never;
2723
3168
  cookie?: never;
2724
3169
  };
2725
3170
  requestBody?: never;
2726
3171
  responses: {
2727
- /** @description Bonus deleted */
3172
+ /** @description Bonus list */
2728
3173
  200: {
2729
3174
  headers: {
2730
3175
  [name: string]: unknown;
2731
3176
  };
2732
3177
  content: {
2733
3178
  "application/json": {
2734
- /**
2735
- * @description Whether the bonus was deleted.
2736
- * @enum {boolean}
2737
- */
2738
- deleted: true;
2739
- /**
2740
- * Format: uuid
2741
- * @description Deleted bonus ID.
2742
- */
2743
- bonusId: string;
2744
- /** @description Total remaining bonus amount for this customer + feature. */
2745
- counterRemaining: number;
3179
+ /** @description Bonuses. */
3180
+ bonuses: {
3181
+ /**
3182
+ * Format: uuid
3183
+ * @description Bonus ID.
3184
+ */
3185
+ bonusId: string;
3186
+ /** @description Feature key. */
3187
+ featureKey: string;
3188
+ /** @description Bonus amount. */
3189
+ amount: number;
3190
+ /** @description Remaining bonus amount. */
3191
+ remainingAmount: number;
3192
+ /** @description Unix timestamp (ms) when the bonus expires. */
3193
+ expiresAt?: number | null;
3194
+ /** @description Bonus reason. */
3195
+ reason?: string | null;
3196
+ /** @description Bonus metadata. */
3197
+ metadata?: {
3198
+ [key: string]: string;
3199
+ };
3200
+ /** @description Unix timestamp (ms) when the bonus was created. */
3201
+ createdAt: number;
3202
+ /** @description Unix timestamp (ms) when the bonus was last updated. */
3203
+ updatedAt: number;
3204
+ }[];
2746
3205
  };
2747
3206
  };
2748
3207
  };
@@ -2796,72 +3255,58 @@ export interface paths {
2796
3255
  };
2797
3256
  };
2798
3257
  };
2799
- options?: never;
2800
- head?: never;
2801
- patch?: never;
2802
- trace?: never;
2803
- };
2804
- "/v1/usage/{id}": {
2805
- parameters: {
2806
- query?: never;
2807
- header?: never;
2808
- path?: never;
2809
- cookie?: never;
2810
- };
3258
+ put?: never;
2811
3259
  /**
2812
- * Get usage event
2813
- * @description Get a usage event by ID.
3260
+ * Create bonus
3261
+ * @description Create a one-time bonus amount for a customer feature.
2814
3262
  */
2815
- get: {
3263
+ post: {
2816
3264
  parameters: {
2817
3265
  query?: never;
2818
3266
  header: {
2819
3267
  /** @description API key from your PriceOS dashboard. */
2820
3268
  "x-api-key": string;
2821
3269
  };
2822
- path: {
2823
- /** @description Usage event ID. */
2824
- id: string;
2825
- };
3270
+ path?: never;
2826
3271
  cookie?: never;
2827
3272
  };
2828
- requestBody?: never;
2829
- responses: {
2830
- /** @description Usage event */
2831
- 200: {
2832
- headers: {
2833
- [name: string]: unknown;
3273
+ requestBody: {
3274
+ content: {
3275
+ "application/json": {
3276
+ /** @description Customer ID (internal or Stripe). */
3277
+ customerId: string;
3278
+ /** @description Feature key to create bonus for. */
3279
+ featureKey: string;
3280
+ /** @description Bonus amount to create. */
3281
+ amount: number;
3282
+ /** @description Optional Unix timestamp (ms) when the bonus expires. */
3283
+ expiresAt?: number;
3284
+ /** @description Optional reason for the bonus. */
3285
+ reason?: string | null;
3286
+ /** @description Optional metadata for the bonus (string key/value pairs). */
3287
+ metadata?: {
3288
+ [key: string]: string;
3289
+ };
2834
3290
  };
2835
- content: {
2836
- "application/json": {
2837
- /** @description Usage event. */
2838
- usageEvent: {
2839
- /** @description Usage event ID. */
2840
- id: string;
2841
- /** @description Usage amount recorded. */
2842
- amount: number;
2843
- /** @description Unix timestamp (ms) when the event occurred. */
2844
- occurredAt: number;
2845
- /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
2846
- idempotencyKey?: string | null;
2847
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
2848
- eventKey?: string | null;
2849
- /**
2850
- * @description Usage event source.
2851
- * @enum {string}
2852
- */
2853
- source: "usage" | "usage_set_adjustment";
2854
- /** @description Event metadata (string key/value pairs). */
2855
- metadata?: {
2856
- [key: string]: string;
2857
- };
2858
- /** @description Whether the usage event is voided. */
2859
- isVoid: boolean;
2860
- /** @description Unix timestamp (ms) when the event was voided. */
2861
- voidedAt?: number | null;
2862
- /** @description Reason the event was voided. */
2863
- voidedReason?: string | null;
2864
- };
3291
+ };
3292
+ };
3293
+ responses: {
3294
+ /** @description Bonus created */
3295
+ 200: {
3296
+ headers: {
3297
+ [name: string]: unknown;
3298
+ };
3299
+ content: {
3300
+ "application/json": {
3301
+ /**
3302
+ * Format: uuid
3303
+ * @description Bonus ID.
3304
+ */
3305
+ bonusId: string;
3306
+ /** @description Remaining amount for the newly created grant. */
3307
+ remainingAmount: number;
3308
+ /** @description Total remaining bonus amount for this customer + feature. */
3309
+ counterRemaining: number;
2865
3310
  };
2866
3311
  };
2867
3312
  };
@@ -2915,9 +3360,23 @@ export interface paths {
2915
3360
  };
2916
3361
  };
2917
3362
  };
3363
+ delete?: never;
3364
+ options?: never;
3365
+ head?: never;
3366
+ patch?: never;
3367
+ trace?: never;
3368
+ };
3369
+ "/v1/bonuses/{bonusId}": {
3370
+ parameters: {
3371
+ query?: never;
3372
+ header?: never;
3373
+ path?: never;
3374
+ cookie?: never;
3375
+ };
3376
+ get?: never;
2918
3377
  /**
2919
- * Update usage event
2920
- * @description Update a usage event by ID.
3378
+ * Update bonus
3379
+ * @description Update an existing bonus.
2921
3380
  */
2922
3381
  put: {
2923
3382
  parameters: {
@@ -2927,23 +3386,21 @@ export interface paths {
2927
3386
  "x-api-key": string;
2928
3387
  };
2929
3388
  path: {
2930
- /** @description Usage event ID. */
2931
- id: string;
3389
+ /** @description Bonus ID. */
3390
+ bonusId: string;
2932
3391
  };
2933
3392
  cookie?: never;
2934
3393
  };
2935
3394
  requestBody: {
2936
3395
  content: {
2937
3396
  "application/json": {
2938
- /** @description Optional updated usage amount. */
3397
+ /** @description Optional updated bonus amount. */
2939
3398
  amount?: number;
2940
- /** @description Optional updated Unix timestamp (ms) when the event occurred. */
2941
- occurredAt?: number;
2942
- /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. Use null to clear. */
2943
- idempotencyKey?: string | null;
2944
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. Use null to clear. */
2945
- eventKey?: string | null;
2946
- /** @description Optional updated metadata (string key/value pairs). Use null to clear. */
3399
+ /** @description Optional Unix timestamp (ms) when the bonus expires. Use null to clear. */
3400
+ expiresAt?: number | null;
3401
+ /** @description Optional reason for the bonus. Use null to clear. */
3402
+ reason?: string | null;
3403
+ /** @description Optional metadata for the bonus (string key/value pairs). Use null to clear. */
2947
3404
  metadata?: {
2948
3405
  [key: string]: string;
2949
3406
  } | null;
@@ -2951,41 +3408,41 @@ export interface paths {
2951
3408
  };
2952
3409
  };
2953
3410
  responses: {
2954
- /** @description Usage event updated */
3411
+ /** @description Bonus updated */
2955
3412
  200: {
2956
3413
  headers: {
2957
3414
  [name: string]: unknown;
2958
3415
  };
2959
3416
  content: {
2960
3417
  "application/json": {
2961
- /** @description Usage event. */
2962
- usageEvent: {
2963
- /** @description Usage event ID. */
2964
- id: string;
2965
- /** @description Usage amount recorded. */
2966
- amount: number;
2967
- /** @description Unix timestamp (ms) when the event occurred. */
2968
- occurredAt: number;
2969
- /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
2970
- idempotencyKey?: string | null;
2971
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
2972
- eventKey?: string | null;
3418
+ /** @description Updated bonus. */
3419
+ bonus: {
2973
3420
  /**
2974
- * @description Usage event source.
2975
- * @enum {string}
3421
+ * Format: uuid
3422
+ * @description Bonus ID.
2976
3423
  */
2977
- source: "usage" | "usage_set_adjustment";
2978
- /** @description Event metadata (string key/value pairs). */
3424
+ bonusId: string;
3425
+ /** @description Feature key. */
3426
+ featureKey: string;
3427
+ /** @description Bonus amount. */
3428
+ amount: number;
3429
+ /** @description Remaining bonus amount. */
3430
+ remainingAmount: number;
3431
+ /** @description Unix timestamp (ms) when the bonus expires. */
3432
+ expiresAt?: number | null;
3433
+ /** @description Bonus reason. */
3434
+ reason?: string | null;
3435
+ /** @description Bonus metadata. */
2979
3436
  metadata?: {
2980
3437
  [key: string]: string;
2981
3438
  };
2982
- /** @description Whether the usage event is voided. */
2983
- isVoid: boolean;
2984
- /** @description Unix timestamp (ms) when the event was voided. */
2985
- voidedAt?: number | null;
2986
- /** @description Reason the event was voided. */
2987
- voidedReason?: string | null;
3439
+ /** @description Unix timestamp (ms) when the bonus was created. */
3440
+ createdAt: number;
3441
+ /** @description Unix timestamp (ms) when the bonus was last updated. */
3442
+ updatedAt: number;
2988
3443
  };
3444
+ /** @description Total remaining bonus amount for this customer + feature. */
3445
+ counterRemaining: number;
2989
3446
  };
2990
3447
  };
2991
3448
  };
@@ -3041,8 +3498,8 @@ export interface paths {
3041
3498
  };
3042
3499
  post?: never;
3043
3500
  /**
3044
- * Delete usage event
3045
- * @description Delete a usage event by ID.
3501
+ * Delete bonus
3502
+ * @description Delete an existing bonus that has not been consumed.
3046
3503
  */
3047
3504
  delete: {
3048
3505
  parameters: {
@@ -3052,22 +3509,32 @@ export interface paths {
3052
3509
  "x-api-key": string;
3053
3510
  };
3054
3511
  path: {
3055
- /** @description Usage event ID. */
3056
- id: string;
3512
+ /** @description Bonus ID. */
3513
+ bonusId: string;
3057
3514
  };
3058
3515
  cookie?: never;
3059
3516
  };
3060
3517
  requestBody?: never;
3061
3518
  responses: {
3062
- /** @description Usage event deleted */
3519
+ /** @description Bonus deleted */
3063
3520
  200: {
3064
3521
  headers: {
3065
3522
  [name: string]: unknown;
3066
3523
  };
3067
3524
  content: {
3068
3525
  "application/json": {
3069
- /** @description Number of usage events deleted. */
3070
- deletedCount: number;
3526
+ /**
3527
+ * @description Whether the bonus was deleted.
3528
+ * @enum {boolean}
3529
+ */
3530
+ deleted: true;
3531
+ /**
3532
+ * Format: uuid
3533
+ * @description Deleted bonus ID.
3534
+ */
3535
+ bonusId: string;
3536
+ /** @description Total remaining bonus amount for this customer + feature. */
3537
+ counterRemaining: number;
3071
3538
  };
3072
3539
  };
3073
3540
  };
@@ -3126,7 +3593,7 @@ export interface paths {
3126
3593
  patch?: never;
3127
3594
  trace?: never;
3128
3595
  };
3129
- "/v1/usage/idempotency-key/{idempotencyKey}": {
3596
+ "/v1/usage/{id}": {
3130
3597
  parameters: {
3131
3598
  query?: never;
3132
3599
  header?: never;
@@ -3134,8 +3601,8 @@ export interface paths {
3134
3601
  cookie?: never;
3135
3602
  };
3136
3603
  /**
3137
- * Get usage event by idempotency key
3138
- * @description Get a usage event by idempotency key.
3604
+ * Get usage event
3605
+ * @description Get a usage event by ID.
3139
3606
  */
3140
3607
  get: {
3141
3608
  parameters: {
@@ -3145,8 +3612,8 @@ export interface paths {
3145
3612
  "x-api-key": string;
3146
3613
  };
3147
3614
  path: {
3148
- /** @description Usage event idempotency key. */
3149
- idempotencyKey: string;
3615
+ /** @description Usage event ID. */
3616
+ id: string;
3150
3617
  };
3151
3618
  cookie?: never;
3152
3619
  };
@@ -3159,33 +3626,22 @@ export interface paths {
3159
3626
  };
3160
3627
  content: {
3161
3628
  "application/json": {
3162
- /** @description Usage event. */
3163
- usageEvent: {
3164
- /** @description Usage event ID. */
3165
- id: string;
3166
- /** @description Usage amount recorded. */
3167
- amount: number;
3168
- /** @description Unix timestamp (ms) when the event occurred. */
3169
- occurredAt: number;
3170
- /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
3171
- idempotencyKey?: string | null;
3172
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
3173
- eventKey?: string | null;
3174
- /**
3175
- * @description Usage event source.
3176
- * @enum {string}
3177
- */
3178
- source: "usage" | "usage_set_adjustment";
3179
- /** @description Event metadata (string key/value pairs). */
3180
- metadata?: {
3181
- [key: string]: string;
3182
- };
3183
- /** @description Whether the usage event is voided. */
3184
- isVoid: boolean;
3185
- /** @description Unix timestamp (ms) when the event was voided. */
3186
- voidedAt?: number | null;
3187
- /** @description Reason the event was voided. */
3188
- voidedReason?: string | null;
3629
+ /** @description Usage event ID. */
3630
+ id: string;
3631
+ /** @description Usage amount recorded. */
3632
+ amount: number;
3633
+ /** @description Unix timestamp (ms) when the event occurred. */
3634
+ occurredAt: number;
3635
+ /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
3636
+ idempotencyKey?: string | null;
3637
+ /**
3638
+ * @description Usage event source.
3639
+ * @enum {string}
3640
+ */
3641
+ source: "usage" | "usage_set_adjustment";
3642
+ /** @description Event metadata (string key/value pairs). */
3643
+ metadata?: {
3644
+ [key: string]: string;
3189
3645
  };
3190
3646
  };
3191
3647
  };
@@ -3240,27 +3696,11 @@ export interface paths {
3240
3696
  };
3241
3697
  };
3242
3698
  };
3243
- put?: never;
3244
- post?: never;
3245
- delete?: never;
3246
- options?: never;
3247
- head?: never;
3248
- patch?: never;
3249
- trace?: never;
3250
- };
3251
- "/v1/usage/event-key/{eventKey}": {
3252
- parameters: {
3253
- query?: never;
3254
- header?: never;
3255
- path?: never;
3256
- cookie?: never;
3257
- };
3258
3699
  /**
3259
- * Get usage event by event key (legacy)
3260
- * @deprecated
3261
- * @description Legacy alias for get usage event by idempotency key.
3700
+ * Update usage event
3701
+ * @description Update a usage event by ID.
3262
3702
  */
3263
- get: {
3703
+ put: {
3264
3704
  parameters: {
3265
3705
  query?: never;
3266
3706
  header: {
@@ -3268,47 +3708,51 @@ export interface paths {
3268
3708
  "x-api-key": string;
3269
3709
  };
3270
3710
  path: {
3271
- /** @description Legacy usage event key. */
3272
- eventKey: string;
3711
+ /** @description Usage event ID. */
3712
+ id: string;
3273
3713
  };
3274
3714
  cookie?: never;
3275
3715
  };
3276
- requestBody?: never;
3716
+ requestBody: {
3717
+ content: {
3718
+ "application/json": {
3719
+ /** @description Optional updated usage amount. */
3720
+ amount?: number;
3721
+ /** @description Optional updated Unix timestamp (ms) when the event occurred. */
3722
+ occurredAt?: number;
3723
+ /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. Use null to clear. */
3724
+ idempotencyKey?: string | null;
3725
+ /** @description Optional updated metadata (string key/value pairs). Use null to clear. */
3726
+ metadata?: {
3727
+ [key: string]: string;
3728
+ } | null;
3729
+ };
3730
+ };
3731
+ };
3277
3732
  responses: {
3278
- /** @description Usage event */
3733
+ /** @description Usage event updated */
3279
3734
  200: {
3280
3735
  headers: {
3281
3736
  [name: string]: unknown;
3282
3737
  };
3283
3738
  content: {
3284
3739
  "application/json": {
3285
- /** @description Usage event. */
3286
- usageEvent: {
3287
- /** @description Usage event ID. */
3288
- id: string;
3289
- /** @description Usage amount recorded. */
3290
- amount: number;
3291
- /** @description Unix timestamp (ms) when the event occurred. */
3292
- occurredAt: number;
3293
- /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
3294
- idempotencyKey?: string | null;
3295
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
3296
- eventKey?: string | null;
3297
- /**
3298
- * @description Usage event source.
3299
- * @enum {string}
3300
- */
3301
- source: "usage" | "usage_set_adjustment";
3302
- /** @description Event metadata (string key/value pairs). */
3303
- metadata?: {
3304
- [key: string]: string;
3305
- };
3306
- /** @description Whether the usage event is voided. */
3307
- isVoid: boolean;
3308
- /** @description Unix timestamp (ms) when the event was voided. */
3309
- voidedAt?: number | null;
3310
- /** @description Reason the event was voided. */
3311
- voidedReason?: string | null;
3740
+ /** @description Usage event ID. */
3741
+ id: string;
3742
+ /** @description Usage amount recorded. */
3743
+ amount: number;
3744
+ /** @description Unix timestamp (ms) when the event occurred. */
3745
+ occurredAt: number;
3746
+ /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
3747
+ idempotencyKey?: string | null;
3748
+ /**
3749
+ * @description Usage event source.
3750
+ * @enum {string}
3751
+ */
3752
+ source: "usage" | "usage_set_adjustment";
3753
+ /** @description Event metadata (string key/value pairs). */
3754
+ metadata?: {
3755
+ [key: string]: string;
3312
3756
  };
3313
3757
  };
3314
3758
  };
@@ -3363,28 +3807,12 @@ export interface paths {
3363
3807
  };
3364
3808
  };
3365
3809
  };
3366
- put?: never;
3367
3810
  post?: never;
3368
- delete?: never;
3369
- options?: never;
3370
- head?: never;
3371
- patch?: never;
3372
- trace?: never;
3373
- };
3374
- "/v1/usage/{id}/void": {
3375
- parameters: {
3376
- query?: never;
3377
- header?: never;
3378
- path?: never;
3379
- cookie?: never;
3380
- };
3381
- get?: never;
3382
- put?: never;
3383
3811
  /**
3384
- * Void usage event
3385
- * @description Void a single usage event by ID.
3812
+ * Delete usage event
3813
+ * @description Delete a usage event by ID.
3386
3814
  */
3387
- post: {
3815
+ delete: {
3388
3816
  parameters: {
3389
3817
  query?: never;
3390
3818
  header: {
@@ -3397,50 +3825,17 @@ export interface paths {
3397
3825
  };
3398
3826
  cookie?: never;
3399
3827
  };
3400
- requestBody: {
3401
- content: {
3402
- "application/json": {
3403
- /** @description Optional reason for voiding the usage event. */
3404
- reason?: string | null;
3405
- };
3406
- };
3407
- };
3828
+ requestBody?: never;
3408
3829
  responses: {
3409
- /** @description Usage event voided */
3830
+ /** @description Usage event deleted */
3410
3831
  200: {
3411
3832
  headers: {
3412
3833
  [name: string]: unknown;
3413
3834
  };
3414
3835
  content: {
3415
3836
  "application/json": {
3416
- /** @description Usage event. */
3417
- usageEvent: {
3418
- /** @description Usage event ID. */
3419
- id: string;
3420
- /** @description Usage amount recorded. */
3421
- amount: number;
3422
- /** @description Unix timestamp (ms) when the event occurred. */
3423
- occurredAt: number;
3424
- /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
3425
- idempotencyKey?: string | null;
3426
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
3427
- eventKey?: string | null;
3428
- /**
3429
- * @description Usage event source.
3430
- * @enum {string}
3431
- */
3432
- source: "usage" | "usage_set_adjustment";
3433
- /** @description Event metadata (string key/value pairs). */
3434
- metadata?: {
3435
- [key: string]: string;
3436
- };
3437
- /** @description Whether the usage event is voided. */
3438
- isVoid: boolean;
3439
- /** @description Unix timestamp (ms) when the event was voided. */
3440
- voidedAt?: number | null;
3441
- /** @description Reason the event was voided. */
3442
- voidedReason?: string | null;
3443
- };
3837
+ /** @description Number of usage events deleted. */
3838
+ deletedCount: number;
3444
3839
  };
3445
3840
  };
3446
3841
  };
@@ -3494,7 +3889,6 @@ export interface paths {
3494
3889
  };
3495
3890
  };
3496
3891
  };
3497
- delete?: never;
3498
3892
  options?: never;
3499
3893
  head?: never;
3500
3894
  patch?: never;
@@ -3655,8 +4049,6 @@ export interface paths {
3655
4049
  amount?: number;
3656
4050
  /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
3657
4051
  idempotencyKey?: string;
3658
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
3659
- eventKey?: string;
3660
4052
  /** @description Unix timestamp (ms) when the event occurred. */
3661
4053
  occurredAt?: number;
3662
4054
  /** @description Optional metadata for the event (string key/value pairs). */
@@ -3836,8 +4228,6 @@ export interface paths {
3836
4228
  occurredAt: number;
3837
4229
  /** @description Stable unique identifier for this event. Reuse it on retries for idempotency and to reference the event later. */
3838
4230
  idempotencyKey?: string | null;
3839
- /** @description Deprecated alias for idempotencyKey. Prefer idempotencyKey. */
3840
- eventKey?: string | null;
3841
4231
  /**
3842
4232
  * @description Usage event source.
3843
4233
  * @enum {string}