priceos 1.0.4 → 1.0.5

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.
@@ -0,0 +1,2653 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface paths {
7
+ "/v1/customers/{customerId}": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ /**
15
+ * Get customer
16
+ * @description Fetch a customer by internal or Stripe ID.
17
+ */
18
+ get: {
19
+ parameters: {
20
+ query?: never;
21
+ header: {
22
+ /** @description API key from your PriceOS dashboard. */
23
+ "x-api-key": string;
24
+ };
25
+ path: {
26
+ /** @description Customer ID (internal or Stripe). */
27
+ customerId: string;
28
+ };
29
+ cookie?: never;
30
+ };
31
+ requestBody?: never;
32
+ responses: {
33
+ /** @description Customer lookup */
34
+ 200: {
35
+ headers: {
36
+ [name: string]: unknown;
37
+ };
38
+ content: {
39
+ /**
40
+ * @example {
41
+ * "customerId": "customer_123",
42
+ * "stripeCustomerId": "cus_abc123",
43
+ * "name": "Ada Lovelace",
44
+ * "email": "ada@example.com",
45
+ * "created": 1735689600000,
46
+ * "usageStartedAt": 1735689600000,
47
+ * "enviroment": "test",
48
+ * "products": [
49
+ * {
50
+ * "id": "prod_123",
51
+ * "key": "starter",
52
+ * "name": "Starter",
53
+ * "type": "stripe",
54
+ * "isDefault": false,
55
+ * "status": "active",
56
+ * "version": 1,
57
+ * "metadata": {
58
+ * "tier": "starter"
59
+ * },
60
+ * "canceledAt": null,
61
+ * "startedAt": 1735689600000,
62
+ * "currentPeriodStart": 1735689600000,
63
+ * "currentPeriodEnd": 1738368000000,
64
+ * "prices": [
65
+ * {
66
+ * "stripePriceId": "price_123",
67
+ * "quantity": 1,
68
+ * "currency": "usd",
69
+ * "unitAmount": 2000,
70
+ * "recurringInterval": "month",
71
+ * "isActive": true,
72
+ * "isDefault": true,
73
+ * "recurringIntervalCount": 1
74
+ * }
75
+ * ]
76
+ * }
77
+ * ],
78
+ * "featureAccess": {
79
+ * "api_calls": {
80
+ * "hasAccess": true,
81
+ * "type": "limit",
82
+ * "limit": 1000,
83
+ * "isUnlimited": false,
84
+ * "usage": {
85
+ * "used": 120,
86
+ * "remaining": 880,
87
+ * "bonusRemaining": 25,
88
+ * "bonusUsed": 5,
89
+ * "nextReset": 1738368000000,
90
+ * "lastReset": 1735689600000
91
+ * }
92
+ * },
93
+ * "team_seats": {
94
+ * "hasAccess": true,
95
+ * "type": "boolean"
96
+ * }
97
+ * },
98
+ * "bonuses": [
99
+ * {
100
+ * "bonusId": "9e9be7e5-55d2-4b44-93af-c3687f4b8af5",
101
+ * "featureKey": "api_calls",
102
+ * "amount": 50,
103
+ * "remainingAmount": 50,
104
+ * "expiresAt": 1738368000000,
105
+ * "reason": "Support credit",
106
+ * "metadata": {
107
+ * "source": "support"
108
+ * },
109
+ * "createdAt": 1735689600000,
110
+ * "updatedAt": 1735689600000
111
+ * }
112
+ * ]
113
+ * }
114
+ */
115
+ "application/json": {
116
+ /** @description Customer ID (internal or Stripe). */
117
+ customerId?: string;
118
+ /** @description Stripe customer ID. */
119
+ stripeCustomerId?: string;
120
+ /** @description Customer name. */
121
+ name?: string;
122
+ /** @description Customer email address. */
123
+ email?: string;
124
+ /** @description Unix timestamp (ms) when the customer was created. */
125
+ created?: number;
126
+ /** @description Unix timestamp (ms) when usage tracking started. */
127
+ usageStartedAt?: number;
128
+ /**
129
+ * @description Customer environment.
130
+ * @enum {string}
131
+ */
132
+ enviroment: "test" | "live";
133
+ /** @description Subscribed or assigned products. */
134
+ products: {
135
+ /** @description Product ID. */
136
+ id: string;
137
+ /** @description Product key. */
138
+ key: string;
139
+ /** @description Product name. */
140
+ name: string;
141
+ /**
142
+ * @description Product type.
143
+ * @enum {string}
144
+ */
145
+ type: "stripe" | "custom";
146
+ /** @description Whether this product is the default custom product. */
147
+ isDefault: boolean;
148
+ /**
149
+ * @description Stripe subscription status (Stripe customers only).
150
+ * @enum {string}
151
+ */
152
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
153
+ /** @description Product version number. */
154
+ version: number;
155
+ /** @description Custom product metadata (custom products only). */
156
+ metadata?: {
157
+ [key: string]: string;
158
+ };
159
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
160
+ canceledAt?: number | null;
161
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
162
+ startedAt?: number;
163
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
164
+ currentPeriodStart?: number;
165
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
166
+ currentPeriodEnd?: number;
167
+ /** @description Prices tied to this product (Stripe customers only). */
168
+ prices?: {
169
+ /** @description Stripe price ID. */
170
+ stripePriceId: string;
171
+ /** @description Price quantity. */
172
+ quantity: number;
173
+ /** @description ISO currency code. */
174
+ currency: string;
175
+ /** @description Unit amount in the smallest currency unit. */
176
+ unitAmount: number;
177
+ /** @description Recurring interval, if any. */
178
+ recurringInterval: string | null;
179
+ /** @description Whether the price is active. */
180
+ isActive: boolean;
181
+ /** @description Whether this is the default price. */
182
+ isDefault: boolean;
183
+ /** @description Number of intervals between charges. */
184
+ recurringIntervalCount: number;
185
+ }[];
186
+ }[];
187
+ /** @description Feature access map. */
188
+ featureAccess: {
189
+ [key: string]: {
190
+ /**
191
+ * @description Feature access type.
192
+ * @enum {string}
193
+ */
194
+ type: "boolean";
195
+ /** @description Whether the customer has access. */
196
+ hasAccess: boolean;
197
+ } | {
198
+ /**
199
+ * @description Feature access type.
200
+ * @enum {string}
201
+ */
202
+ type: "limit";
203
+ /** @description Whether the customer has access. */
204
+ hasAccess: boolean;
205
+ /** @description Whether the feature is unlimited. */
206
+ isUnlimited: boolean;
207
+ /** @description Limit for the feature, when applicable. */
208
+ limit: number | null;
209
+ /** @description Usage details for tracked features. */
210
+ usage?: {
211
+ /** @description Usage consumed for the feature. */
212
+ used: number;
213
+ /** @description Remaining base limit (limit - used). */
214
+ remaining: number | null;
215
+ /** @description Remaining bonus amount. */
216
+ bonusRemaining: number;
217
+ /** @description Bonus amount consumed. */
218
+ bonusUsed: number;
219
+ /** @description Unix timestamp (ms) for the next reset, when applicable. */
220
+ nextReset: number | null;
221
+ /** @description Unix timestamp (ms) for the last reset, when applicable. */
222
+ lastReset: number | null;
223
+ };
224
+ };
225
+ };
226
+ /** @description Customer bonuses. */
227
+ bonuses: {
228
+ /**
229
+ * Format: uuid
230
+ * @description Bonus ID.
231
+ */
232
+ bonusId: string;
233
+ /** @description Feature key. */
234
+ featureKey: string;
235
+ /** @description Bonus amount. */
236
+ amount: number;
237
+ /** @description Remaining bonus amount. */
238
+ remainingAmount: number;
239
+ /** @description Unix timestamp (ms) when the bonus expires. */
240
+ expiresAt?: number | null;
241
+ /** @description Bonus reason. */
242
+ reason?: string | null;
243
+ /** @description Bonus metadata. */
244
+ metadata?: {
245
+ [key: string]: string;
246
+ };
247
+ /** @description Unix timestamp (ms) when the bonus was created. */
248
+ createdAt: number;
249
+ /** @description Unix timestamp (ms) when the bonus was updated. */
250
+ updatedAt: number;
251
+ }[];
252
+ } | null;
253
+ };
254
+ };
255
+ /** @description Bad request */
256
+ 400: {
257
+ headers: {
258
+ [name: string]: unknown;
259
+ };
260
+ content: {
261
+ "application/json": {
262
+ /** @description Error message. */
263
+ error: string;
264
+ };
265
+ };
266
+ };
267
+ /** @description Unauthorized */
268
+ 401: {
269
+ headers: {
270
+ [name: string]: unknown;
271
+ };
272
+ content: {
273
+ "application/json": {
274
+ /** @description Error message. */
275
+ error: string;
276
+ };
277
+ };
278
+ };
279
+ /** @description Server error */
280
+ 500: {
281
+ headers: {
282
+ [name: string]: unknown;
283
+ };
284
+ content: {
285
+ "application/json": {
286
+ /** @description Error message. */
287
+ error: string;
288
+ };
289
+ };
290
+ };
291
+ };
292
+ };
293
+ /**
294
+ * Update customer
295
+ * @description Update a customer record.
296
+ */
297
+ put: {
298
+ parameters: {
299
+ query?: never;
300
+ header: {
301
+ /** @description API key from your PriceOS dashboard. */
302
+ "x-api-key": string;
303
+ };
304
+ path: {
305
+ /** @description Customer ID (internal or Stripe). */
306
+ customerId: string;
307
+ };
308
+ cookie?: never;
309
+ };
310
+ requestBody: {
311
+ content: {
312
+ "application/json": {
313
+ /** @description Customer name. */
314
+ name?: string;
315
+ /** @description Customer email address. */
316
+ email?: string;
317
+ /** @description Unix timestamp (ms) when usage tracking started. */
318
+ usageStartedAt?: number;
319
+ /** @description Assigned product keys for non-Stripe customers. */
320
+ productKeys?: string[];
321
+ };
322
+ };
323
+ };
324
+ responses: {
325
+ /** @description Customer updated */
326
+ 200: {
327
+ headers: {
328
+ [name: string]: unknown;
329
+ };
330
+ content: {
331
+ /**
332
+ * @example {
333
+ * "customerId": "customer_123",
334
+ * "stripeCustomerId": "cus_abc123",
335
+ * "name": "Ada Lovelace",
336
+ * "email": "ada@example.com",
337
+ * "created": 1735689600000,
338
+ * "usageStartedAt": 1735689600000,
339
+ * "enviroment": "test",
340
+ * "products": [
341
+ * {
342
+ * "id": "prod_123",
343
+ * "key": "starter",
344
+ * "name": "Starter",
345
+ * "type": "stripe",
346
+ * "isDefault": false,
347
+ * "status": "active",
348
+ * "version": 1,
349
+ * "metadata": {
350
+ * "tier": "starter"
351
+ * },
352
+ * "canceledAt": null,
353
+ * "startedAt": 1735689600000,
354
+ * "currentPeriodStart": 1735689600000,
355
+ * "currentPeriodEnd": 1738368000000,
356
+ * "prices": [
357
+ * {
358
+ * "stripePriceId": "price_123",
359
+ * "quantity": 1,
360
+ * "currency": "usd",
361
+ * "unitAmount": 2000,
362
+ * "recurringInterval": "month",
363
+ * "isActive": true,
364
+ * "isDefault": true,
365
+ * "recurringIntervalCount": 1
366
+ * }
367
+ * ]
368
+ * }
369
+ * ],
370
+ * "featureAccess": {
371
+ * "api_calls": {
372
+ * "hasAccess": true,
373
+ * "type": "limit",
374
+ * "limit": 1000,
375
+ * "isUnlimited": false,
376
+ * "usage": {
377
+ * "used": 120,
378
+ * "remaining": 880,
379
+ * "bonusRemaining": 25,
380
+ * "bonusUsed": 5,
381
+ * "nextReset": 1738368000000,
382
+ * "lastReset": 1735689600000
383
+ * }
384
+ * },
385
+ * "team_seats": {
386
+ * "hasAccess": true,
387
+ * "type": "boolean"
388
+ * }
389
+ * },
390
+ * "bonuses": [
391
+ * {
392
+ * "bonusId": "9e9be7e5-55d2-4b44-93af-c3687f4b8af5",
393
+ * "featureKey": "api_calls",
394
+ * "amount": 50,
395
+ * "remainingAmount": 50,
396
+ * "expiresAt": 1738368000000,
397
+ * "reason": "Support credit",
398
+ * "metadata": {
399
+ * "source": "support"
400
+ * },
401
+ * "createdAt": 1735689600000,
402
+ * "updatedAt": 1735689600000
403
+ * }
404
+ * ]
405
+ * }
406
+ */
407
+ "application/json": {
408
+ /** @description Customer ID (internal or Stripe). */
409
+ customerId?: string;
410
+ /** @description Stripe customer ID. */
411
+ stripeCustomerId?: string;
412
+ /** @description Customer name. */
413
+ name?: string;
414
+ /** @description Customer email address. */
415
+ email?: string;
416
+ /** @description Unix timestamp (ms) when the customer was created. */
417
+ created?: number;
418
+ /** @description Unix timestamp (ms) when usage tracking started. */
419
+ usageStartedAt?: number;
420
+ /**
421
+ * @description Customer environment.
422
+ * @enum {string}
423
+ */
424
+ enviroment: "test" | "live";
425
+ /** @description Subscribed or assigned products. */
426
+ products: {
427
+ /** @description Product ID. */
428
+ id: string;
429
+ /** @description Product key. */
430
+ key: string;
431
+ /** @description Product name. */
432
+ name: string;
433
+ /**
434
+ * @description Product type.
435
+ * @enum {string}
436
+ */
437
+ type: "stripe" | "custom";
438
+ /** @description Whether this product is the default custom product. */
439
+ isDefault: boolean;
440
+ /**
441
+ * @description Stripe subscription status (Stripe customers only).
442
+ * @enum {string}
443
+ */
444
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
445
+ /** @description Product version number. */
446
+ version: number;
447
+ /** @description Custom product metadata (custom products only). */
448
+ metadata?: {
449
+ [key: string]: string;
450
+ };
451
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
452
+ canceledAt?: number | null;
453
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
454
+ startedAt?: number;
455
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
456
+ currentPeriodStart?: number;
457
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
458
+ currentPeriodEnd?: number;
459
+ /** @description Prices tied to this product (Stripe customers only). */
460
+ prices?: {
461
+ /** @description Stripe price ID. */
462
+ stripePriceId: string;
463
+ /** @description Price quantity. */
464
+ quantity: number;
465
+ /** @description ISO currency code. */
466
+ currency: string;
467
+ /** @description Unit amount in the smallest currency unit. */
468
+ unitAmount: number;
469
+ /** @description Recurring interval, if any. */
470
+ recurringInterval: string | null;
471
+ /** @description Whether the price is active. */
472
+ isActive: boolean;
473
+ /** @description Whether this is the default price. */
474
+ isDefault: boolean;
475
+ /** @description Number of intervals between charges. */
476
+ recurringIntervalCount: number;
477
+ }[];
478
+ }[];
479
+ /** @description Feature access map. */
480
+ featureAccess: {
481
+ [key: string]: {
482
+ /**
483
+ * @description Feature access type.
484
+ * @enum {string}
485
+ */
486
+ type: "boolean";
487
+ /** @description Whether the customer has access. */
488
+ hasAccess: boolean;
489
+ } | {
490
+ /**
491
+ * @description Feature access type.
492
+ * @enum {string}
493
+ */
494
+ type: "limit";
495
+ /** @description Whether the customer has access. */
496
+ hasAccess: boolean;
497
+ /** @description Whether the feature is unlimited. */
498
+ isUnlimited: boolean;
499
+ /** @description Limit for the feature, when applicable. */
500
+ limit: number | null;
501
+ /** @description Usage details for tracked features. */
502
+ usage?: {
503
+ /** @description Usage consumed for the feature. */
504
+ used: number;
505
+ /** @description Remaining base limit (limit - used). */
506
+ remaining: number | null;
507
+ /** @description Remaining bonus amount. */
508
+ bonusRemaining: number;
509
+ /** @description Bonus amount consumed. */
510
+ bonusUsed: number;
511
+ /** @description Unix timestamp (ms) for the next reset, when applicable. */
512
+ nextReset: number | null;
513
+ /** @description Unix timestamp (ms) for the last reset, when applicable. */
514
+ lastReset: number | null;
515
+ };
516
+ };
517
+ };
518
+ /** @description Customer bonuses. */
519
+ bonuses: {
520
+ /**
521
+ * Format: uuid
522
+ * @description Bonus ID.
523
+ */
524
+ bonusId: string;
525
+ /** @description Feature key. */
526
+ featureKey: string;
527
+ /** @description Bonus amount. */
528
+ amount: number;
529
+ /** @description Remaining bonus amount. */
530
+ remainingAmount: number;
531
+ /** @description Unix timestamp (ms) when the bonus expires. */
532
+ expiresAt?: number | null;
533
+ /** @description Bonus reason. */
534
+ reason?: string | null;
535
+ /** @description Bonus metadata. */
536
+ metadata?: {
537
+ [key: string]: string;
538
+ };
539
+ /** @description Unix timestamp (ms) when the bonus was created. */
540
+ createdAt: number;
541
+ /** @description Unix timestamp (ms) when the bonus was updated. */
542
+ updatedAt: number;
543
+ }[];
544
+ };
545
+ };
546
+ };
547
+ /** @description Bad request */
548
+ 400: {
549
+ headers: {
550
+ [name: string]: unknown;
551
+ };
552
+ content: {
553
+ "application/json": {
554
+ /** @description Error message. */
555
+ error: string;
556
+ };
557
+ };
558
+ };
559
+ /** @description Unauthorized */
560
+ 401: {
561
+ headers: {
562
+ [name: string]: unknown;
563
+ };
564
+ content: {
565
+ "application/json": {
566
+ /** @description Error message. */
567
+ error: string;
568
+ };
569
+ };
570
+ };
571
+ /** @description Not found */
572
+ 404: {
573
+ headers: {
574
+ [name: string]: unknown;
575
+ };
576
+ content: {
577
+ "application/json": {
578
+ /** @description Error message. */
579
+ error: string;
580
+ };
581
+ };
582
+ };
583
+ /** @description Server error */
584
+ 500: {
585
+ headers: {
586
+ [name: string]: unknown;
587
+ };
588
+ content: {
589
+ "application/json": {
590
+ /** @description Error message. */
591
+ error: string;
592
+ };
593
+ };
594
+ };
595
+ };
596
+ };
597
+ post?: never;
598
+ /**
599
+ * Delete customer
600
+ * @description Delete a customer record.
601
+ */
602
+ delete: {
603
+ parameters: {
604
+ query?: never;
605
+ header: {
606
+ /** @description API key from your PriceOS dashboard. */
607
+ "x-api-key": string;
608
+ };
609
+ path: {
610
+ /** @description Customer ID (internal or Stripe). */
611
+ customerId: string;
612
+ };
613
+ cookie?: never;
614
+ };
615
+ requestBody?: never;
616
+ responses: {
617
+ /** @description Customer deleted */
618
+ 200: {
619
+ headers: {
620
+ [name: string]: unknown;
621
+ };
622
+ content: {
623
+ "application/json": {
624
+ /** @description Deleted customer record ID. */
625
+ id: string;
626
+ };
627
+ };
628
+ };
629
+ /** @description Bad request */
630
+ 400: {
631
+ headers: {
632
+ [name: string]: unknown;
633
+ };
634
+ content: {
635
+ "application/json": {
636
+ /** @description Error message. */
637
+ error: string;
638
+ };
639
+ };
640
+ };
641
+ /** @description Unauthorized */
642
+ 401: {
643
+ headers: {
644
+ [name: string]: unknown;
645
+ };
646
+ content: {
647
+ "application/json": {
648
+ /** @description Error message. */
649
+ error: string;
650
+ };
651
+ };
652
+ };
653
+ /** @description Not found */
654
+ 404: {
655
+ headers: {
656
+ [name: string]: unknown;
657
+ };
658
+ content: {
659
+ "application/json": {
660
+ /** @description Error message. */
661
+ error: string;
662
+ };
663
+ };
664
+ };
665
+ /** @description Server error */
666
+ 500: {
667
+ headers: {
668
+ [name: string]: unknown;
669
+ };
670
+ content: {
671
+ "application/json": {
672
+ /** @description Error message. */
673
+ error: string;
674
+ };
675
+ };
676
+ };
677
+ };
678
+ };
679
+ options?: never;
680
+ head?: never;
681
+ patch?: never;
682
+ trace?: never;
683
+ };
684
+ "/v1/customers": {
685
+ parameters: {
686
+ query?: never;
687
+ header?: never;
688
+ path?: never;
689
+ cookie?: never;
690
+ };
691
+ get?: never;
692
+ put?: never;
693
+ /**
694
+ * Create customer
695
+ * @description Create a customer record.
696
+ */
697
+ post: {
698
+ parameters: {
699
+ query?: never;
700
+ header: {
701
+ /** @description API key from your PriceOS dashboard. */
702
+ "x-api-key": string;
703
+ };
704
+ path?: never;
705
+ cookie?: never;
706
+ };
707
+ requestBody: {
708
+ content: {
709
+ "application/json": {
710
+ /** @description Customer ID (internal or Stripe). */
711
+ customerId: string;
712
+ /** @description Customer name. */
713
+ name?: string;
714
+ /** @description Customer email address. */
715
+ email?: string;
716
+ /** @description Unix timestamp (ms) when usage tracking started. */
717
+ usageStartedAt?: number;
718
+ /** @description Assigned product keys for non-Stripe customers. */
719
+ productKeys?: string[];
720
+ };
721
+ };
722
+ };
723
+ responses: {
724
+ /** @description Customer created */
725
+ 201: {
726
+ headers: {
727
+ [name: string]: unknown;
728
+ };
729
+ content: {
730
+ /**
731
+ * @example {
732
+ * "customerId": "customer_123",
733
+ * "stripeCustomerId": "cus_abc123",
734
+ * "name": "Ada Lovelace",
735
+ * "email": "ada@example.com",
736
+ * "created": 1735689600000,
737
+ * "usageStartedAt": 1735689600000,
738
+ * "enviroment": "test",
739
+ * "products": [
740
+ * {
741
+ * "id": "prod_123",
742
+ * "key": "starter",
743
+ * "name": "Starter",
744
+ * "type": "stripe",
745
+ * "isDefault": false,
746
+ * "status": "active",
747
+ * "version": 1,
748
+ * "metadata": {
749
+ * "tier": "starter"
750
+ * },
751
+ * "canceledAt": null,
752
+ * "startedAt": 1735689600000,
753
+ * "currentPeriodStart": 1735689600000,
754
+ * "currentPeriodEnd": 1738368000000,
755
+ * "prices": [
756
+ * {
757
+ * "stripePriceId": "price_123",
758
+ * "quantity": 1,
759
+ * "currency": "usd",
760
+ * "unitAmount": 2000,
761
+ * "recurringInterval": "month",
762
+ * "isActive": true,
763
+ * "isDefault": true,
764
+ * "recurringIntervalCount": 1
765
+ * }
766
+ * ]
767
+ * }
768
+ * ],
769
+ * "featureAccess": {
770
+ * "api_calls": {
771
+ * "hasAccess": true,
772
+ * "type": "limit",
773
+ * "limit": 1000,
774
+ * "isUnlimited": false,
775
+ * "usage": {
776
+ * "used": 120,
777
+ * "remaining": 880,
778
+ * "bonusRemaining": 25,
779
+ * "bonusUsed": 5,
780
+ * "nextReset": 1738368000000,
781
+ * "lastReset": 1735689600000
782
+ * }
783
+ * },
784
+ * "team_seats": {
785
+ * "hasAccess": true,
786
+ * "type": "boolean"
787
+ * }
788
+ * },
789
+ * "bonuses": [
790
+ * {
791
+ * "bonusId": "9e9be7e5-55d2-4b44-93af-c3687f4b8af5",
792
+ * "featureKey": "api_calls",
793
+ * "amount": 50,
794
+ * "remainingAmount": 50,
795
+ * "expiresAt": 1738368000000,
796
+ * "reason": "Support credit",
797
+ * "metadata": {
798
+ * "source": "support"
799
+ * },
800
+ * "createdAt": 1735689600000,
801
+ * "updatedAt": 1735689600000
802
+ * }
803
+ * ]
804
+ * }
805
+ */
806
+ "application/json": {
807
+ /** @description Customer ID (internal or Stripe). */
808
+ customerId?: string;
809
+ /** @description Stripe customer ID. */
810
+ stripeCustomerId?: string;
811
+ /** @description Customer name. */
812
+ name?: string;
813
+ /** @description Customer email address. */
814
+ email?: string;
815
+ /** @description Unix timestamp (ms) when the customer was created. */
816
+ created?: number;
817
+ /** @description Unix timestamp (ms) when usage tracking started. */
818
+ usageStartedAt?: number;
819
+ /**
820
+ * @description Customer environment.
821
+ * @enum {string}
822
+ */
823
+ enviroment: "test" | "live";
824
+ /** @description Subscribed or assigned products. */
825
+ products: {
826
+ /** @description Product ID. */
827
+ id: string;
828
+ /** @description Product key. */
829
+ key: string;
830
+ /** @description Product name. */
831
+ name: string;
832
+ /**
833
+ * @description Product type.
834
+ * @enum {string}
835
+ */
836
+ type: "stripe" | "custom";
837
+ /** @description Whether this product is the default custom product. */
838
+ isDefault: boolean;
839
+ /**
840
+ * @description Stripe subscription status (Stripe customers only).
841
+ * @enum {string}
842
+ */
843
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
844
+ /** @description Product version number. */
845
+ version: number;
846
+ /** @description Custom product metadata (custom products only). */
847
+ metadata?: {
848
+ [key: string]: string;
849
+ };
850
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
851
+ canceledAt?: number | null;
852
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
853
+ startedAt?: number;
854
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
855
+ currentPeriodStart?: number;
856
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
857
+ currentPeriodEnd?: number;
858
+ /** @description Prices tied to this product (Stripe customers only). */
859
+ prices?: {
860
+ /** @description Stripe price ID. */
861
+ stripePriceId: string;
862
+ /** @description Price quantity. */
863
+ quantity: number;
864
+ /** @description ISO currency code. */
865
+ currency: string;
866
+ /** @description Unit amount in the smallest currency unit. */
867
+ unitAmount: number;
868
+ /** @description Recurring interval, if any. */
869
+ recurringInterval: string | null;
870
+ /** @description Whether the price is active. */
871
+ isActive: boolean;
872
+ /** @description Whether this is the default price. */
873
+ isDefault: boolean;
874
+ /** @description Number of intervals between charges. */
875
+ recurringIntervalCount: number;
876
+ }[];
877
+ }[];
878
+ /** @description Feature access map. */
879
+ featureAccess: {
880
+ [key: string]: {
881
+ /**
882
+ * @description Feature access type.
883
+ * @enum {string}
884
+ */
885
+ type: "boolean";
886
+ /** @description Whether the customer has access. */
887
+ hasAccess: boolean;
888
+ } | {
889
+ /**
890
+ * @description Feature access type.
891
+ * @enum {string}
892
+ */
893
+ type: "limit";
894
+ /** @description Whether the customer has access. */
895
+ hasAccess: boolean;
896
+ /** @description Whether the feature is unlimited. */
897
+ isUnlimited: boolean;
898
+ /** @description Limit for the feature, when applicable. */
899
+ limit: number | null;
900
+ /** @description Usage details for tracked features. */
901
+ usage?: {
902
+ /** @description Usage consumed for the feature. */
903
+ used: number;
904
+ /** @description Remaining base limit (limit - used). */
905
+ remaining: number | null;
906
+ /** @description Remaining bonus amount. */
907
+ bonusRemaining: number;
908
+ /** @description Bonus amount consumed. */
909
+ bonusUsed: number;
910
+ /** @description Unix timestamp (ms) for the next reset, when applicable. */
911
+ nextReset: number | null;
912
+ /** @description Unix timestamp (ms) for the last reset, when applicable. */
913
+ lastReset: number | null;
914
+ };
915
+ };
916
+ };
917
+ /** @description Customer bonuses. */
918
+ bonuses: {
919
+ /**
920
+ * Format: uuid
921
+ * @description Bonus ID.
922
+ */
923
+ bonusId: string;
924
+ /** @description Feature key. */
925
+ featureKey: string;
926
+ /** @description Bonus amount. */
927
+ amount: number;
928
+ /** @description Remaining bonus amount. */
929
+ remainingAmount: number;
930
+ /** @description Unix timestamp (ms) when the bonus expires. */
931
+ expiresAt?: number | null;
932
+ /** @description Bonus reason. */
933
+ reason?: string | null;
934
+ /** @description Bonus metadata. */
935
+ metadata?: {
936
+ [key: string]: string;
937
+ };
938
+ /** @description Unix timestamp (ms) when the bonus was created. */
939
+ createdAt: number;
940
+ /** @description Unix timestamp (ms) when the bonus was updated. */
941
+ updatedAt: number;
942
+ }[];
943
+ };
944
+ };
945
+ };
946
+ /** @description Bad request */
947
+ 400: {
948
+ headers: {
949
+ [name: string]: unknown;
950
+ };
951
+ content: {
952
+ "application/json": {
953
+ /** @description Error message. */
954
+ error: string;
955
+ };
956
+ };
957
+ };
958
+ /** @description Unauthorized */
959
+ 401: {
960
+ headers: {
961
+ [name: string]: unknown;
962
+ };
963
+ content: {
964
+ "application/json": {
965
+ /** @description Error message. */
966
+ error: string;
967
+ };
968
+ };
969
+ };
970
+ /** @description Conflict */
971
+ 409: {
972
+ headers: {
973
+ [name: string]: unknown;
974
+ };
975
+ content: {
976
+ "application/json": {
977
+ /** @description Error message. */
978
+ error: string;
979
+ };
980
+ };
981
+ };
982
+ /** @description Server error */
983
+ 500: {
984
+ headers: {
985
+ [name: string]: unknown;
986
+ };
987
+ content: {
988
+ "application/json": {
989
+ /** @description Error message. */
990
+ error: string;
991
+ };
992
+ };
993
+ };
994
+ };
995
+ };
996
+ delete?: never;
997
+ options?: never;
998
+ head?: never;
999
+ patch?: never;
1000
+ trace?: never;
1001
+ };
1002
+ "/v1/customers/link": {
1003
+ parameters: {
1004
+ query?: never;
1005
+ header?: never;
1006
+ path?: never;
1007
+ cookie?: never;
1008
+ };
1009
+ get?: never;
1010
+ put?: never;
1011
+ /**
1012
+ * Link customer
1013
+ * @description Link a Stripe customer ID to your internal customer ID. If duplicate API and Stripe rows exist for the same person, PriceOS reconciles them.
1014
+ */
1015
+ post: {
1016
+ parameters: {
1017
+ query?: never;
1018
+ header: {
1019
+ /** @description API key from your PriceOS dashboard. */
1020
+ "x-api-key": string;
1021
+ };
1022
+ path?: never;
1023
+ cookie?: never;
1024
+ };
1025
+ requestBody: {
1026
+ content: {
1027
+ "application/json": {
1028
+ /** @description Internal customer ID. */
1029
+ customerId: string;
1030
+ /** @description Stripe customer ID. */
1031
+ stripeCustomerId: string;
1032
+ };
1033
+ };
1034
+ };
1035
+ responses: {
1036
+ /** @description Customer linked */
1037
+ 200: {
1038
+ headers: {
1039
+ [name: string]: unknown;
1040
+ };
1041
+ content: {
1042
+ /**
1043
+ * @example {
1044
+ * "customerId": "customer_123",
1045
+ * "stripeCustomerId": "cus_abc123",
1046
+ * "name": "Ada Lovelace",
1047
+ * "email": "ada@example.com",
1048
+ * "created": 1735689600000,
1049
+ * "usageStartedAt": 1735689600000,
1050
+ * "enviroment": "test",
1051
+ * "products": [
1052
+ * {
1053
+ * "id": "prod_123",
1054
+ * "key": "starter",
1055
+ * "name": "Starter",
1056
+ * "type": "stripe",
1057
+ * "isDefault": false,
1058
+ * "status": "active",
1059
+ * "version": 1,
1060
+ * "metadata": {
1061
+ * "tier": "starter"
1062
+ * },
1063
+ * "canceledAt": null,
1064
+ * "startedAt": 1735689600000,
1065
+ * "currentPeriodStart": 1735689600000,
1066
+ * "currentPeriodEnd": 1738368000000,
1067
+ * "prices": [
1068
+ * {
1069
+ * "stripePriceId": "price_123",
1070
+ * "quantity": 1,
1071
+ * "currency": "usd",
1072
+ * "unitAmount": 2000,
1073
+ * "recurringInterval": "month",
1074
+ * "isActive": true,
1075
+ * "isDefault": true,
1076
+ * "recurringIntervalCount": 1
1077
+ * }
1078
+ * ]
1079
+ * }
1080
+ * ],
1081
+ * "featureAccess": {
1082
+ * "api_calls": {
1083
+ * "hasAccess": true,
1084
+ * "type": "limit",
1085
+ * "limit": 1000,
1086
+ * "isUnlimited": false,
1087
+ * "usage": {
1088
+ * "used": 120,
1089
+ * "remaining": 880,
1090
+ * "bonusRemaining": 25,
1091
+ * "bonusUsed": 5,
1092
+ * "nextReset": 1738368000000,
1093
+ * "lastReset": 1735689600000
1094
+ * }
1095
+ * },
1096
+ * "team_seats": {
1097
+ * "hasAccess": true,
1098
+ * "type": "boolean"
1099
+ * }
1100
+ * },
1101
+ * "bonuses": [
1102
+ * {
1103
+ * "bonusId": "9e9be7e5-55d2-4b44-93af-c3687f4b8af5",
1104
+ * "featureKey": "api_calls",
1105
+ * "amount": 50,
1106
+ * "remainingAmount": 50,
1107
+ * "expiresAt": 1738368000000,
1108
+ * "reason": "Support credit",
1109
+ * "metadata": {
1110
+ * "source": "support"
1111
+ * },
1112
+ * "createdAt": 1735689600000,
1113
+ * "updatedAt": 1735689600000
1114
+ * }
1115
+ * ]
1116
+ * }
1117
+ */
1118
+ "application/json": {
1119
+ /** @description Customer ID (internal or Stripe). */
1120
+ customerId?: string;
1121
+ /** @description Stripe customer ID. */
1122
+ stripeCustomerId?: string;
1123
+ /** @description Customer name. */
1124
+ name?: string;
1125
+ /** @description Customer email address. */
1126
+ email?: string;
1127
+ /** @description Unix timestamp (ms) when the customer was created. */
1128
+ created?: number;
1129
+ /** @description Unix timestamp (ms) when usage tracking started. */
1130
+ usageStartedAt?: number;
1131
+ /**
1132
+ * @description Customer environment.
1133
+ * @enum {string}
1134
+ */
1135
+ enviroment: "test" | "live";
1136
+ /** @description Subscribed or assigned products. */
1137
+ products: {
1138
+ /** @description Product ID. */
1139
+ id: string;
1140
+ /** @description Product key. */
1141
+ key: string;
1142
+ /** @description Product name. */
1143
+ name: string;
1144
+ /**
1145
+ * @description Product type.
1146
+ * @enum {string}
1147
+ */
1148
+ type: "stripe" | "custom";
1149
+ /** @description Whether this product is the default custom product. */
1150
+ isDefault: boolean;
1151
+ /**
1152
+ * @description Stripe subscription status (Stripe customers only).
1153
+ * @enum {string}
1154
+ */
1155
+ status: "incomplete" | "incomplete_expired" | "trialing" | "active" | "past_due" | "paused" | "unpaid" | "canceled";
1156
+ /** @description Product version number. */
1157
+ version: number;
1158
+ /** @description Custom product metadata (custom products only). */
1159
+ metadata?: {
1160
+ [key: string]: string;
1161
+ };
1162
+ /** @description Unix timestamp (ms) when the subscription was canceled (Stripe customers only). */
1163
+ canceledAt?: number | null;
1164
+ /** @description Unix timestamp (ms) when the subscription started (Stripe customers only). */
1165
+ startedAt?: number;
1166
+ /** @description Unix timestamp (ms) for the current period start (Stripe customers only). */
1167
+ currentPeriodStart?: number;
1168
+ /** @description Unix timestamp (ms) for the current period end (Stripe customers only). */
1169
+ currentPeriodEnd?: number;
1170
+ /** @description Prices tied to this product (Stripe customers only). */
1171
+ prices?: {
1172
+ /** @description Stripe price ID. */
1173
+ stripePriceId: string;
1174
+ /** @description Price quantity. */
1175
+ quantity: number;
1176
+ /** @description ISO currency code. */
1177
+ currency: string;
1178
+ /** @description Unit amount in the smallest currency unit. */
1179
+ unitAmount: number;
1180
+ /** @description Recurring interval, if any. */
1181
+ recurringInterval: string | null;
1182
+ /** @description Whether the price is active. */
1183
+ isActive: boolean;
1184
+ /** @description Whether this is the default price. */
1185
+ isDefault: boolean;
1186
+ /** @description Number of intervals between charges. */
1187
+ recurringIntervalCount: number;
1188
+ }[];
1189
+ }[];
1190
+ /** @description Feature access map. */
1191
+ featureAccess: {
1192
+ [key: string]: {
1193
+ /**
1194
+ * @description Feature access type.
1195
+ * @enum {string}
1196
+ */
1197
+ type: "boolean";
1198
+ /** @description Whether the customer has access. */
1199
+ hasAccess: boolean;
1200
+ } | {
1201
+ /**
1202
+ * @description Feature access type.
1203
+ * @enum {string}
1204
+ */
1205
+ type: "limit";
1206
+ /** @description Whether the customer has access. */
1207
+ hasAccess: boolean;
1208
+ /** @description Whether the feature is unlimited. */
1209
+ isUnlimited: boolean;
1210
+ /** @description Limit for the feature, when applicable. */
1211
+ limit: number | null;
1212
+ /** @description Usage details for tracked features. */
1213
+ usage?: {
1214
+ /** @description Usage consumed for the feature. */
1215
+ used: number;
1216
+ /** @description Remaining base limit (limit - used). */
1217
+ remaining: number | null;
1218
+ /** @description Remaining bonus amount. */
1219
+ bonusRemaining: number;
1220
+ /** @description Bonus amount consumed. */
1221
+ bonusUsed: number;
1222
+ /** @description Unix timestamp (ms) for the next reset, when applicable. */
1223
+ nextReset: number | null;
1224
+ /** @description Unix timestamp (ms) for the last reset, when applicable. */
1225
+ lastReset: number | null;
1226
+ };
1227
+ };
1228
+ };
1229
+ /** @description Customer bonuses. */
1230
+ bonuses: {
1231
+ /**
1232
+ * Format: uuid
1233
+ * @description Bonus ID.
1234
+ */
1235
+ bonusId: string;
1236
+ /** @description Feature key. */
1237
+ featureKey: string;
1238
+ /** @description Bonus amount. */
1239
+ amount: number;
1240
+ /** @description Remaining bonus amount. */
1241
+ remainingAmount: number;
1242
+ /** @description Unix timestamp (ms) when the bonus expires. */
1243
+ expiresAt?: number | null;
1244
+ /** @description Bonus reason. */
1245
+ reason?: string | null;
1246
+ /** @description Bonus metadata. */
1247
+ metadata?: {
1248
+ [key: string]: string;
1249
+ };
1250
+ /** @description Unix timestamp (ms) when the bonus was created. */
1251
+ createdAt: number;
1252
+ /** @description Unix timestamp (ms) when the bonus was updated. */
1253
+ updatedAt: number;
1254
+ }[];
1255
+ };
1256
+ };
1257
+ };
1258
+ /** @description Bad request */
1259
+ 400: {
1260
+ headers: {
1261
+ [name: string]: unknown;
1262
+ };
1263
+ content: {
1264
+ "application/json": {
1265
+ /** @description Error message. */
1266
+ error: string;
1267
+ };
1268
+ };
1269
+ };
1270
+ /** @description Unauthorized */
1271
+ 401: {
1272
+ headers: {
1273
+ [name: string]: unknown;
1274
+ };
1275
+ content: {
1276
+ "application/json": {
1277
+ /** @description Error message. */
1278
+ error: string;
1279
+ };
1280
+ };
1281
+ };
1282
+ /** @description Not found */
1283
+ 404: {
1284
+ headers: {
1285
+ [name: string]: unknown;
1286
+ };
1287
+ content: {
1288
+ "application/json": {
1289
+ /** @description Error message. */
1290
+ error: string;
1291
+ };
1292
+ };
1293
+ };
1294
+ /** @description Conflict */
1295
+ 409: {
1296
+ headers: {
1297
+ [name: string]: unknown;
1298
+ };
1299
+ content: {
1300
+ "application/json": {
1301
+ /** @description Error message. */
1302
+ error: string;
1303
+ };
1304
+ };
1305
+ };
1306
+ /** @description Server error */
1307
+ 500: {
1308
+ headers: {
1309
+ [name: string]: unknown;
1310
+ };
1311
+ content: {
1312
+ "application/json": {
1313
+ /** @description Error message. */
1314
+ error: string;
1315
+ };
1316
+ };
1317
+ };
1318
+ };
1319
+ };
1320
+ delete?: never;
1321
+ options?: never;
1322
+ head?: never;
1323
+ patch?: never;
1324
+ trace?: never;
1325
+ };
1326
+ "/v1/feature-access": {
1327
+ parameters: {
1328
+ query?: never;
1329
+ header?: never;
1330
+ path?: never;
1331
+ cookie?: never;
1332
+ };
1333
+ /**
1334
+ * Get feature access
1335
+ * @description Return feature access for a customer.
1336
+ */
1337
+ get: {
1338
+ parameters: {
1339
+ query: {
1340
+ /** @description Customer ID (internal or Stripe). */
1341
+ customerId: string;
1342
+ };
1343
+ header: {
1344
+ /** @description API key from your PriceOS dashboard. */
1345
+ "x-api-key": string;
1346
+ };
1347
+ path?: never;
1348
+ cookie?: never;
1349
+ };
1350
+ requestBody?: never;
1351
+ responses: {
1352
+ /** @description Feature access lookup */
1353
+ 200: {
1354
+ headers: {
1355
+ [name: string]: unknown;
1356
+ };
1357
+ content: {
1358
+ /**
1359
+ * @example {
1360
+ * "api_calls": {
1361
+ * "hasAccess": true,
1362
+ * "type": "limit",
1363
+ * "limit": 1000,
1364
+ * "isUnlimited": false,
1365
+ * "usage": {
1366
+ * "used": 120,
1367
+ * "remaining": 880,
1368
+ * "bonusRemaining": 25,
1369
+ * "bonusUsed": 5,
1370
+ * "nextReset": 1738368000000,
1371
+ * "lastReset": 1735689600000
1372
+ * }
1373
+ * },
1374
+ * "team_seats": {
1375
+ * "hasAccess": true,
1376
+ * "type": "boolean"
1377
+ * }
1378
+ * }
1379
+ */
1380
+ "application/json": {
1381
+ [key: string]: {
1382
+ /**
1383
+ * @description Feature access type.
1384
+ * @enum {string}
1385
+ */
1386
+ type: "boolean";
1387
+ /** @description Whether the customer has access. */
1388
+ hasAccess: boolean;
1389
+ } | {
1390
+ /**
1391
+ * @description Feature access type.
1392
+ * @enum {string}
1393
+ */
1394
+ type: "limit";
1395
+ /** @description Whether the customer has access. */
1396
+ hasAccess: boolean;
1397
+ /** @description Whether the feature is unlimited. */
1398
+ isUnlimited: boolean;
1399
+ /** @description Limit for the feature, when applicable. */
1400
+ limit: number | null;
1401
+ /** @description Usage details for tracked features. */
1402
+ usage?: {
1403
+ /** @description Usage consumed for the feature. */
1404
+ used: number;
1405
+ /** @description Remaining base limit (limit - used). */
1406
+ remaining: number | null;
1407
+ /** @description Remaining bonus amount. */
1408
+ bonusRemaining: number;
1409
+ /** @description Bonus amount consumed. */
1410
+ bonusUsed: number;
1411
+ /** @description Unix timestamp (ms) for the next reset, when applicable. */
1412
+ nextReset: number | null;
1413
+ /** @description Unix timestamp (ms) for the last reset, when applicable. */
1414
+ lastReset: number | null;
1415
+ };
1416
+ };
1417
+ };
1418
+ };
1419
+ };
1420
+ /** @description Bad request */
1421
+ 400: {
1422
+ headers: {
1423
+ [name: string]: unknown;
1424
+ };
1425
+ content: {
1426
+ "application/json": {
1427
+ /** @description Error message. */
1428
+ error: string;
1429
+ };
1430
+ };
1431
+ };
1432
+ /** @description Unauthorized */
1433
+ 401: {
1434
+ headers: {
1435
+ [name: string]: unknown;
1436
+ };
1437
+ content: {
1438
+ "application/json": {
1439
+ /** @description Error message. */
1440
+ error: string;
1441
+ };
1442
+ };
1443
+ };
1444
+ /** @description Server error */
1445
+ 500: {
1446
+ headers: {
1447
+ [name: string]: unknown;
1448
+ };
1449
+ content: {
1450
+ "application/json": {
1451
+ /** @description Error message. */
1452
+ error: string;
1453
+ };
1454
+ };
1455
+ };
1456
+ };
1457
+ };
1458
+ put?: never;
1459
+ post?: never;
1460
+ delete?: never;
1461
+ options?: never;
1462
+ head?: never;
1463
+ patch?: never;
1464
+ trace?: never;
1465
+ };
1466
+ "/v1/features": {
1467
+ parameters: {
1468
+ query?: never;
1469
+ header?: never;
1470
+ path?: never;
1471
+ cookie?: never;
1472
+ };
1473
+ /**
1474
+ * Get features
1475
+ * @description List features for the workspace.
1476
+ */
1477
+ get: {
1478
+ parameters: {
1479
+ query?: never;
1480
+ header: {
1481
+ /** @description API key from your PriceOS dashboard. */
1482
+ "x-api-key": string;
1483
+ };
1484
+ path?: never;
1485
+ cookie?: never;
1486
+ };
1487
+ requestBody?: never;
1488
+ responses: {
1489
+ /** @description Feature list */
1490
+ 200: {
1491
+ headers: {
1492
+ [name: string]: unknown;
1493
+ };
1494
+ content: {
1495
+ "application/json": {
1496
+ /** @description Feature ID. */
1497
+ id: string;
1498
+ /** @description Feature key. */
1499
+ featureKey: string;
1500
+ /** @description Feature name. */
1501
+ name: string;
1502
+ /** @description Feature description. */
1503
+ description: string | null;
1504
+ /**
1505
+ * @description Feature access type.
1506
+ * @enum {string}
1507
+ */
1508
+ type: "boolean" | "limit";
1509
+ /** @description Whether the feature tracks usage. */
1510
+ tracksUsage: boolean;
1511
+ /** @description Usage unit. */
1512
+ usageUnit: string | null;
1513
+ /**
1514
+ * @description Usage reset interval.
1515
+ * @enum {string}
1516
+ */
1517
+ usageResetInterval: "never" | "day" | "week" | "month" | "year";
1518
+ /**
1519
+ * @description Usage reset anchor.
1520
+ * @enum {string}
1521
+ */
1522
+ usageResetAnchor: "billing_period" | "calendar";
1523
+ }[];
1524
+ };
1525
+ };
1526
+ /** @description Unauthorized */
1527
+ 401: {
1528
+ headers: {
1529
+ [name: string]: unknown;
1530
+ };
1531
+ content: {
1532
+ "application/json": {
1533
+ /** @description Error message. */
1534
+ error: string;
1535
+ };
1536
+ };
1537
+ };
1538
+ /** @description Server error */
1539
+ 500: {
1540
+ headers: {
1541
+ [name: string]: unknown;
1542
+ };
1543
+ content: {
1544
+ "application/json": {
1545
+ /** @description Error message. */
1546
+ error: string;
1547
+ };
1548
+ };
1549
+ };
1550
+ };
1551
+ };
1552
+ put?: never;
1553
+ post?: never;
1554
+ delete?: never;
1555
+ options?: never;
1556
+ head?: never;
1557
+ patch?: never;
1558
+ trace?: never;
1559
+ };
1560
+ "/v1/usage": {
1561
+ parameters: {
1562
+ query?: never;
1563
+ header?: never;
1564
+ path?: never;
1565
+ cookie?: never;
1566
+ };
1567
+ get?: never;
1568
+ put?: never;
1569
+ /**
1570
+ * Track usage
1571
+ * @description Record usage for a feature.
1572
+ */
1573
+ post: {
1574
+ parameters: {
1575
+ query?: never;
1576
+ header: {
1577
+ /** @description API key from your PriceOS dashboard. */
1578
+ "x-api-key": string;
1579
+ };
1580
+ path?: never;
1581
+ cookie?: never;
1582
+ };
1583
+ requestBody: {
1584
+ content: {
1585
+ "application/json": {
1586
+ /** @description Customer ID (internal or Stripe). */
1587
+ customerId: string;
1588
+ /** @description Feature key to track usage for. */
1589
+ featureKey: string;
1590
+ /** @description Usage amount to record. */
1591
+ amount: number;
1592
+ /** @description Optional idempotency key for the event. */
1593
+ idempotencyKey?: string;
1594
+ /** @description Unix timestamp (ms) when the event occurred. */
1595
+ occurredAt?: number;
1596
+ /** @description Optional metadata for the event (string key/value pairs). */
1597
+ metadata?: {
1598
+ [key: string]: string;
1599
+ };
1600
+ };
1601
+ };
1602
+ };
1603
+ responses: {
1604
+ /** @description Usage recorded */
1605
+ 200: {
1606
+ headers: {
1607
+ [name: string]: unknown;
1608
+ };
1609
+ content: {
1610
+ "application/json": {
1611
+ /** @description Whether the usage event was applied. */
1612
+ applied: boolean;
1613
+ /** @description Updated usage total, if applicable. */
1614
+ used: number | null;
1615
+ /** @description Reason the usage event was not applied. */
1616
+ reason?: string | null;
1617
+ };
1618
+ };
1619
+ };
1620
+ /** @description Bad request */
1621
+ 400: {
1622
+ headers: {
1623
+ [name: string]: unknown;
1624
+ };
1625
+ content: {
1626
+ "application/json": {
1627
+ /** @description Error message. */
1628
+ error: string;
1629
+ };
1630
+ };
1631
+ };
1632
+ /** @description Unauthorized */
1633
+ 401: {
1634
+ headers: {
1635
+ [name: string]: unknown;
1636
+ };
1637
+ content: {
1638
+ "application/json": {
1639
+ /** @description Error message. */
1640
+ error: string;
1641
+ };
1642
+ };
1643
+ };
1644
+ /** @description Not found */
1645
+ 404: {
1646
+ headers: {
1647
+ [name: string]: unknown;
1648
+ };
1649
+ content: {
1650
+ "application/json": {
1651
+ /** @description Error message. */
1652
+ error: string;
1653
+ };
1654
+ };
1655
+ };
1656
+ /** @description Server error */
1657
+ 500: {
1658
+ headers: {
1659
+ [name: string]: unknown;
1660
+ };
1661
+ content: {
1662
+ "application/json": {
1663
+ /** @description Error message. */
1664
+ error: string;
1665
+ };
1666
+ };
1667
+ };
1668
+ };
1669
+ };
1670
+ delete?: never;
1671
+ options?: never;
1672
+ head?: never;
1673
+ patch?: never;
1674
+ trace?: never;
1675
+ };
1676
+ "/v1/bonuses": {
1677
+ parameters: {
1678
+ query?: never;
1679
+ header?: never;
1680
+ path?: never;
1681
+ cookie?: never;
1682
+ };
1683
+ /**
1684
+ * List bonuses
1685
+ * @description List bonuses for a customer, optionally filtered by feature key.
1686
+ */
1687
+ get: {
1688
+ parameters: {
1689
+ query: {
1690
+ /** @description Customer ID (internal or Stripe). */
1691
+ customerId: string;
1692
+ /** @description Optional feature key to filter bonuses. */
1693
+ featureKey?: string | null;
1694
+ };
1695
+ header: {
1696
+ /** @description API key from your PriceOS dashboard. */
1697
+ "x-api-key": string;
1698
+ };
1699
+ path?: never;
1700
+ cookie?: never;
1701
+ };
1702
+ requestBody?: never;
1703
+ responses: {
1704
+ /** @description Bonus list */
1705
+ 200: {
1706
+ headers: {
1707
+ [name: string]: unknown;
1708
+ };
1709
+ content: {
1710
+ "application/json": {
1711
+ /** @description Bonuses. */
1712
+ bonuses: {
1713
+ /**
1714
+ * Format: uuid
1715
+ * @description Bonus ID.
1716
+ */
1717
+ bonusId: string;
1718
+ /** @description Feature key. */
1719
+ featureKey: string;
1720
+ /** @description Bonus amount. */
1721
+ amount: number;
1722
+ /** @description Remaining bonus amount. */
1723
+ remainingAmount: number;
1724
+ /** @description Unix timestamp (ms) when the bonus expires. */
1725
+ expiresAt?: number | null;
1726
+ /** @description Bonus reason. */
1727
+ reason?: string | null;
1728
+ /** @description Bonus metadata. */
1729
+ metadata?: {
1730
+ [key: string]: string;
1731
+ };
1732
+ /** @description Unix timestamp (ms) when the bonus was created. */
1733
+ createdAt: number;
1734
+ /** @description Unix timestamp (ms) when the bonus was last updated. */
1735
+ updatedAt: number;
1736
+ }[];
1737
+ };
1738
+ };
1739
+ };
1740
+ /** @description Bad request */
1741
+ 400: {
1742
+ headers: {
1743
+ [name: string]: unknown;
1744
+ };
1745
+ content: {
1746
+ "application/json": {
1747
+ /** @description Error message. */
1748
+ error: string;
1749
+ };
1750
+ };
1751
+ };
1752
+ /** @description Unauthorized */
1753
+ 401: {
1754
+ headers: {
1755
+ [name: string]: unknown;
1756
+ };
1757
+ content: {
1758
+ "application/json": {
1759
+ /** @description Error message. */
1760
+ error: string;
1761
+ };
1762
+ };
1763
+ };
1764
+ /** @description Not found */
1765
+ 404: {
1766
+ headers: {
1767
+ [name: string]: unknown;
1768
+ };
1769
+ content: {
1770
+ "application/json": {
1771
+ /** @description Error message. */
1772
+ error: string;
1773
+ };
1774
+ };
1775
+ };
1776
+ /** @description Server error */
1777
+ 500: {
1778
+ headers: {
1779
+ [name: string]: unknown;
1780
+ };
1781
+ content: {
1782
+ "application/json": {
1783
+ /** @description Error message. */
1784
+ error: string;
1785
+ };
1786
+ };
1787
+ };
1788
+ };
1789
+ };
1790
+ put?: never;
1791
+ /**
1792
+ * Create bonus
1793
+ * @description Create a one-time bonus amount for a customer feature.
1794
+ */
1795
+ post: {
1796
+ parameters: {
1797
+ query?: never;
1798
+ header: {
1799
+ /** @description API key from your PriceOS dashboard. */
1800
+ "x-api-key": string;
1801
+ };
1802
+ path?: never;
1803
+ cookie?: never;
1804
+ };
1805
+ requestBody: {
1806
+ content: {
1807
+ "application/json": {
1808
+ /** @description Customer ID (internal or Stripe). */
1809
+ customerId: string;
1810
+ /** @description Feature key to create bonus for. */
1811
+ featureKey: string;
1812
+ /** @description Bonus amount to create. */
1813
+ amount: number;
1814
+ /** @description Optional Unix timestamp (ms) when the bonus expires. */
1815
+ expiresAt?: number;
1816
+ /** @description Optional reason for the bonus. */
1817
+ reason?: string | null;
1818
+ /** @description Optional metadata for the bonus (string key/value pairs). */
1819
+ metadata?: {
1820
+ [key: string]: string;
1821
+ };
1822
+ };
1823
+ };
1824
+ };
1825
+ responses: {
1826
+ /** @description Bonus created */
1827
+ 200: {
1828
+ headers: {
1829
+ [name: string]: unknown;
1830
+ };
1831
+ content: {
1832
+ "application/json": {
1833
+ /**
1834
+ * Format: uuid
1835
+ * @description Bonus ID.
1836
+ */
1837
+ bonusId: string;
1838
+ /** @description Remaining amount for the newly created grant. */
1839
+ remainingAmount: number;
1840
+ /** @description Total remaining bonus amount for this customer + feature. */
1841
+ counterRemaining: number;
1842
+ };
1843
+ };
1844
+ };
1845
+ /** @description Bad request */
1846
+ 400: {
1847
+ headers: {
1848
+ [name: string]: unknown;
1849
+ };
1850
+ content: {
1851
+ "application/json": {
1852
+ /** @description Error message. */
1853
+ error: string;
1854
+ };
1855
+ };
1856
+ };
1857
+ /** @description Unauthorized */
1858
+ 401: {
1859
+ headers: {
1860
+ [name: string]: unknown;
1861
+ };
1862
+ content: {
1863
+ "application/json": {
1864
+ /** @description Error message. */
1865
+ error: string;
1866
+ };
1867
+ };
1868
+ };
1869
+ /** @description Not found */
1870
+ 404: {
1871
+ headers: {
1872
+ [name: string]: unknown;
1873
+ };
1874
+ content: {
1875
+ "application/json": {
1876
+ /** @description Error message. */
1877
+ error: string;
1878
+ };
1879
+ };
1880
+ };
1881
+ /** @description Server error */
1882
+ 500: {
1883
+ headers: {
1884
+ [name: string]: unknown;
1885
+ };
1886
+ content: {
1887
+ "application/json": {
1888
+ /** @description Error message. */
1889
+ error: string;
1890
+ };
1891
+ };
1892
+ };
1893
+ };
1894
+ };
1895
+ delete?: never;
1896
+ options?: never;
1897
+ head?: never;
1898
+ patch?: never;
1899
+ trace?: never;
1900
+ };
1901
+ "/v1/bonuses/{bonusId}": {
1902
+ parameters: {
1903
+ query?: never;
1904
+ header?: never;
1905
+ path?: never;
1906
+ cookie?: never;
1907
+ };
1908
+ get?: never;
1909
+ /**
1910
+ * Update bonus
1911
+ * @description Update an existing bonus.
1912
+ */
1913
+ put: {
1914
+ parameters: {
1915
+ query?: never;
1916
+ header: {
1917
+ /** @description API key from your PriceOS dashboard. */
1918
+ "x-api-key": string;
1919
+ };
1920
+ path: {
1921
+ /** @description Bonus ID. */
1922
+ bonusId: string;
1923
+ };
1924
+ cookie?: never;
1925
+ };
1926
+ requestBody: {
1927
+ content: {
1928
+ "application/json": {
1929
+ /** @description Optional updated bonus amount. */
1930
+ amount?: number;
1931
+ /** @description Optional Unix timestamp (ms) when the bonus expires. Use null to clear. */
1932
+ expiresAt?: number | null;
1933
+ /** @description Optional reason for the bonus. Use null to clear. */
1934
+ reason?: string | null;
1935
+ /** @description Optional metadata for the bonus (string key/value pairs). Use null to clear. */
1936
+ metadata?: {
1937
+ [key: string]: string;
1938
+ } | null;
1939
+ };
1940
+ };
1941
+ };
1942
+ responses: {
1943
+ /** @description Bonus updated */
1944
+ 200: {
1945
+ headers: {
1946
+ [name: string]: unknown;
1947
+ };
1948
+ content: {
1949
+ "application/json": {
1950
+ /** @description Updated bonus. */
1951
+ bonus: {
1952
+ /**
1953
+ * Format: uuid
1954
+ * @description Bonus ID.
1955
+ */
1956
+ bonusId: string;
1957
+ /** @description Feature key. */
1958
+ featureKey: string;
1959
+ /** @description Bonus amount. */
1960
+ amount: number;
1961
+ /** @description Remaining bonus amount. */
1962
+ remainingAmount: number;
1963
+ /** @description Unix timestamp (ms) when the bonus expires. */
1964
+ expiresAt?: number | null;
1965
+ /** @description Bonus reason. */
1966
+ reason?: string | null;
1967
+ /** @description Bonus metadata. */
1968
+ metadata?: {
1969
+ [key: string]: string;
1970
+ };
1971
+ /** @description Unix timestamp (ms) when the bonus was created. */
1972
+ createdAt: number;
1973
+ /** @description Unix timestamp (ms) when the bonus was last updated. */
1974
+ updatedAt: number;
1975
+ };
1976
+ /** @description Total remaining bonus amount for this customer + feature. */
1977
+ counterRemaining: number;
1978
+ };
1979
+ };
1980
+ };
1981
+ /** @description Bad request */
1982
+ 400: {
1983
+ headers: {
1984
+ [name: string]: unknown;
1985
+ };
1986
+ content: {
1987
+ "application/json": {
1988
+ /** @description Error message. */
1989
+ error: string;
1990
+ };
1991
+ };
1992
+ };
1993
+ /** @description Unauthorized */
1994
+ 401: {
1995
+ headers: {
1996
+ [name: string]: unknown;
1997
+ };
1998
+ content: {
1999
+ "application/json": {
2000
+ /** @description Error message. */
2001
+ error: string;
2002
+ };
2003
+ };
2004
+ };
2005
+ /** @description Not found */
2006
+ 404: {
2007
+ headers: {
2008
+ [name: string]: unknown;
2009
+ };
2010
+ content: {
2011
+ "application/json": {
2012
+ /** @description Error message. */
2013
+ error: string;
2014
+ };
2015
+ };
2016
+ };
2017
+ /** @description Server error */
2018
+ 500: {
2019
+ headers: {
2020
+ [name: string]: unknown;
2021
+ };
2022
+ content: {
2023
+ "application/json": {
2024
+ /** @description Error message. */
2025
+ error: string;
2026
+ };
2027
+ };
2028
+ };
2029
+ };
2030
+ };
2031
+ post?: never;
2032
+ /**
2033
+ * Delete bonus
2034
+ * @description Delete an existing bonus that has not been consumed.
2035
+ */
2036
+ delete: {
2037
+ parameters: {
2038
+ query?: never;
2039
+ header: {
2040
+ /** @description API key from your PriceOS dashboard. */
2041
+ "x-api-key": string;
2042
+ };
2043
+ path: {
2044
+ /** @description Bonus ID. */
2045
+ bonusId: string;
2046
+ };
2047
+ cookie?: never;
2048
+ };
2049
+ requestBody?: never;
2050
+ responses: {
2051
+ /** @description Bonus deleted */
2052
+ 200: {
2053
+ headers: {
2054
+ [name: string]: unknown;
2055
+ };
2056
+ content: {
2057
+ "application/json": {
2058
+ /**
2059
+ * @description Whether the bonus was deleted.
2060
+ * @enum {boolean}
2061
+ */
2062
+ deleted: true;
2063
+ /**
2064
+ * Format: uuid
2065
+ * @description Deleted bonus ID.
2066
+ */
2067
+ bonusId: string;
2068
+ /** @description Total remaining bonus amount for this customer + feature. */
2069
+ counterRemaining: number;
2070
+ };
2071
+ };
2072
+ };
2073
+ /** @description Bad request */
2074
+ 400: {
2075
+ headers: {
2076
+ [name: string]: unknown;
2077
+ };
2078
+ content: {
2079
+ "application/json": {
2080
+ /** @description Error message. */
2081
+ error: string;
2082
+ };
2083
+ };
2084
+ };
2085
+ /** @description Unauthorized */
2086
+ 401: {
2087
+ headers: {
2088
+ [name: string]: unknown;
2089
+ };
2090
+ content: {
2091
+ "application/json": {
2092
+ /** @description Error message. */
2093
+ error: string;
2094
+ };
2095
+ };
2096
+ };
2097
+ /** @description Not found */
2098
+ 404: {
2099
+ headers: {
2100
+ [name: string]: unknown;
2101
+ };
2102
+ content: {
2103
+ "application/json": {
2104
+ /** @description Error message. */
2105
+ error: string;
2106
+ };
2107
+ };
2108
+ };
2109
+ /** @description Server error */
2110
+ 500: {
2111
+ headers: {
2112
+ [name: string]: unknown;
2113
+ };
2114
+ content: {
2115
+ "application/json": {
2116
+ /** @description Error message. */
2117
+ error: string;
2118
+ };
2119
+ };
2120
+ };
2121
+ };
2122
+ };
2123
+ options?: never;
2124
+ head?: never;
2125
+ patch?: never;
2126
+ trace?: never;
2127
+ };
2128
+ "/v1/usage/void": {
2129
+ parameters: {
2130
+ query?: never;
2131
+ header?: never;
2132
+ path?: never;
2133
+ cookie?: never;
2134
+ };
2135
+ get?: never;
2136
+ put?: never;
2137
+ /**
2138
+ * Reset usage
2139
+ * @description Void usage events for a customer (optionally scoped to a feature).
2140
+ */
2141
+ post: {
2142
+ parameters: {
2143
+ query?: never;
2144
+ header: {
2145
+ /** @description API key from your PriceOS dashboard. */
2146
+ "x-api-key": string;
2147
+ };
2148
+ path?: never;
2149
+ cookie?: never;
2150
+ };
2151
+ requestBody: {
2152
+ content: {
2153
+ "application/json": {
2154
+ /** @description Customer ID (internal or Stripe). */
2155
+ customerId: string;
2156
+ /** @description Optional feature key to reset usage for. Omit to reset all usage for the customer. */
2157
+ featureKey?: string | null;
2158
+ /**
2159
+ * @description Optional usage period to reset (current or previous). Defaults to current.
2160
+ * @enum {string}
2161
+ */
2162
+ period?: "current" | "previous";
2163
+ /** @description Optional usage event IDs to reset. When provided, period and featureKey cannot be provided. */
2164
+ eventIds?: string[];
2165
+ /** @description Optional reason for the usage reset. */
2166
+ reason?: string | null;
2167
+ };
2168
+ };
2169
+ };
2170
+ responses: {
2171
+ /** @description Usage reset */
2172
+ 200: {
2173
+ headers: {
2174
+ [name: string]: unknown;
2175
+ };
2176
+ content: {
2177
+ "application/json": {
2178
+ /** @description Number of usage events voided. */
2179
+ voidedCount: number;
2180
+ };
2181
+ };
2182
+ };
2183
+ /** @description Bad request */
2184
+ 400: {
2185
+ headers: {
2186
+ [name: string]: unknown;
2187
+ };
2188
+ content: {
2189
+ "application/json": {
2190
+ /** @description Error message. */
2191
+ error: string;
2192
+ };
2193
+ };
2194
+ };
2195
+ /** @description Unauthorized */
2196
+ 401: {
2197
+ headers: {
2198
+ [name: string]: unknown;
2199
+ };
2200
+ content: {
2201
+ "application/json": {
2202
+ /** @description Error message. */
2203
+ error: string;
2204
+ };
2205
+ };
2206
+ };
2207
+ /** @description Not found */
2208
+ 404: {
2209
+ headers: {
2210
+ [name: string]: unknown;
2211
+ };
2212
+ content: {
2213
+ "application/json": {
2214
+ /** @description Error message. */
2215
+ error: string;
2216
+ };
2217
+ };
2218
+ };
2219
+ /** @description Server error */
2220
+ 500: {
2221
+ headers: {
2222
+ [name: string]: unknown;
2223
+ };
2224
+ content: {
2225
+ "application/json": {
2226
+ /** @description Error message. */
2227
+ error: string;
2228
+ };
2229
+ };
2230
+ };
2231
+ };
2232
+ };
2233
+ delete?: never;
2234
+ options?: never;
2235
+ head?: never;
2236
+ patch?: never;
2237
+ trace?: never;
2238
+ };
2239
+ "/v1/usage/delete": {
2240
+ parameters: {
2241
+ query?: never;
2242
+ header?: never;
2243
+ path?: never;
2244
+ cookie?: never;
2245
+ };
2246
+ get?: never;
2247
+ put?: never;
2248
+ /**
2249
+ * Delete usage events
2250
+ * @description Delete usage events either by event IDs or by customer filters (customerId with optional featureKey and optional customRange or period).
2251
+ */
2252
+ post: {
2253
+ parameters: {
2254
+ query?: never;
2255
+ header: {
2256
+ /** @description API key from your PriceOS dashboard. */
2257
+ "x-api-key": string;
2258
+ };
2259
+ path?: never;
2260
+ cookie?: never;
2261
+ };
2262
+ requestBody: {
2263
+ content: {
2264
+ "application/json": {
2265
+ /** @description Customer ID (internal or Stripe). Required when deleting by filters instead of eventIds. */
2266
+ customerId?: string | null;
2267
+ /** @description Optional feature key to scope deletes. Only valid when customerId is provided. */
2268
+ featureKey?: string | null;
2269
+ /** @description Optional custom time range (Unix ms start/end) for deletes. Only valid with customerId. Mutually exclusive with period. */
2270
+ customRange?: {
2271
+ /** @description Unix timestamp (ms) start for the custom range. */
2272
+ start: number;
2273
+ /** @description Unix timestamp (ms) end for the custom range. */
2274
+ end: number;
2275
+ };
2276
+ /**
2277
+ * @description Optional usage period to delete for (current or previous). Only valid with customerId. Mutually exclusive with customRange.
2278
+ * @enum {string}
2279
+ */
2280
+ period?: "current" | "previous";
2281
+ /** @description Optional usage event IDs to delete directly. Cannot be combined with customerId filters. */
2282
+ eventIds?: string[];
2283
+ };
2284
+ };
2285
+ };
2286
+ responses: {
2287
+ /** @description Usage events deleted */
2288
+ 200: {
2289
+ headers: {
2290
+ [name: string]: unknown;
2291
+ };
2292
+ content: {
2293
+ "application/json": {
2294
+ /** @description Number of usage events deleted. */
2295
+ deletedCount: number;
2296
+ };
2297
+ };
2298
+ };
2299
+ /** @description Bad request */
2300
+ 400: {
2301
+ headers: {
2302
+ [name: string]: unknown;
2303
+ };
2304
+ content: {
2305
+ "application/json": {
2306
+ /** @description Error message. */
2307
+ error: string;
2308
+ };
2309
+ };
2310
+ };
2311
+ /** @description Unauthorized */
2312
+ 401: {
2313
+ headers: {
2314
+ [name: string]: unknown;
2315
+ };
2316
+ content: {
2317
+ "application/json": {
2318
+ /** @description Error message. */
2319
+ error: string;
2320
+ };
2321
+ };
2322
+ };
2323
+ /** @description Not found */
2324
+ 404: {
2325
+ headers: {
2326
+ [name: string]: unknown;
2327
+ };
2328
+ content: {
2329
+ "application/json": {
2330
+ /** @description Error message. */
2331
+ error: string;
2332
+ };
2333
+ };
2334
+ };
2335
+ /** @description Server error */
2336
+ 500: {
2337
+ headers: {
2338
+ [name: string]: unknown;
2339
+ };
2340
+ content: {
2341
+ "application/json": {
2342
+ /** @description Error message. */
2343
+ error: string;
2344
+ };
2345
+ };
2346
+ };
2347
+ };
2348
+ };
2349
+ delete?: never;
2350
+ options?: never;
2351
+ head?: never;
2352
+ patch?: never;
2353
+ trace?: never;
2354
+ };
2355
+ "/v1/usage/batch": {
2356
+ parameters: {
2357
+ query?: never;
2358
+ header?: never;
2359
+ path?: never;
2360
+ cookie?: never;
2361
+ };
2362
+ get?: never;
2363
+ put?: never;
2364
+ /**
2365
+ * Track usage batch
2366
+ * @description Record usage for multiple events (max 100).
2367
+ */
2368
+ post: {
2369
+ parameters: {
2370
+ query?: never;
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: {
2379
+ content: {
2380
+ "application/json": {
2381
+ /** @description Batch usage events. */
2382
+ events: {
2383
+ /** @description Customer ID (internal or Stripe). */
2384
+ customerId: string;
2385
+ /** @description Feature key to track usage for. */
2386
+ featureKey: string;
2387
+ /** @description Usage amount to record. */
2388
+ amount: number;
2389
+ /** @description Optional idempotency key for the event. */
2390
+ idempotencyKey?: string;
2391
+ /** @description Unix timestamp (ms) when the event occurred. */
2392
+ occurredAt?: number;
2393
+ /** @description Optional metadata for the event (string key/value pairs). */
2394
+ metadata?: {
2395
+ [key: string]: string;
2396
+ };
2397
+ }[];
2398
+ };
2399
+ };
2400
+ };
2401
+ responses: {
2402
+ /** @description Usage batch recorded */
2403
+ 200: {
2404
+ headers: {
2405
+ [name: string]: unknown;
2406
+ };
2407
+ content: {
2408
+ "application/json": {
2409
+ /** @description Batch usage results, in the same order as the request. */
2410
+ results: ({
2411
+ /**
2412
+ * @description Whether the usage event was processed successfully.
2413
+ * @enum {boolean}
2414
+ */
2415
+ success: true;
2416
+ /** @description Usage result for the event. */
2417
+ result: {
2418
+ /** @description Whether the usage event was applied. */
2419
+ applied: boolean;
2420
+ /** @description Updated usage total, if applicable. */
2421
+ used: number | null;
2422
+ /** @description Reason the usage event was not applied. */
2423
+ reason?: string | null;
2424
+ };
2425
+ } | {
2426
+ /**
2427
+ * @description Whether the usage event failed.
2428
+ * @enum {boolean}
2429
+ */
2430
+ success: false;
2431
+ /** @description Error message for the failed event. */
2432
+ error: string;
2433
+ /** @description HTTP status code for the error. */
2434
+ status: number;
2435
+ })[];
2436
+ /** @description Whether any usage events failed. */
2437
+ hasErrors: boolean;
2438
+ };
2439
+ };
2440
+ };
2441
+ /** @description Bad request */
2442
+ 400: {
2443
+ headers: {
2444
+ [name: string]: unknown;
2445
+ };
2446
+ content: {
2447
+ "application/json": {
2448
+ /** @description Error message. */
2449
+ error: string;
2450
+ };
2451
+ };
2452
+ };
2453
+ /** @description Unauthorized */
2454
+ 401: {
2455
+ headers: {
2456
+ [name: string]: unknown;
2457
+ };
2458
+ content: {
2459
+ "application/json": {
2460
+ /** @description Error message. */
2461
+ error: string;
2462
+ };
2463
+ };
2464
+ };
2465
+ /** @description Not found */
2466
+ 404: {
2467
+ headers: {
2468
+ [name: string]: unknown;
2469
+ };
2470
+ content: {
2471
+ "application/json": {
2472
+ /** @description Error message. */
2473
+ error: string;
2474
+ };
2475
+ };
2476
+ };
2477
+ /** @description Server error */
2478
+ 500: {
2479
+ headers: {
2480
+ [name: string]: unknown;
2481
+ };
2482
+ content: {
2483
+ "application/json": {
2484
+ /** @description Error message. */
2485
+ error: string;
2486
+ };
2487
+ };
2488
+ };
2489
+ };
2490
+ };
2491
+ delete?: never;
2492
+ options?: never;
2493
+ head?: never;
2494
+ patch?: never;
2495
+ trace?: never;
2496
+ };
2497
+ "/v1/usage/events": {
2498
+ parameters: {
2499
+ query?: never;
2500
+ header?: never;
2501
+ path?: never;
2502
+ cookie?: never;
2503
+ };
2504
+ get?: never;
2505
+ put?: never;
2506
+ /**
2507
+ * List usage events
2508
+ * @description List usage events for a customer and feature.
2509
+ */
2510
+ post: {
2511
+ parameters: {
2512
+ query?: never;
2513
+ header: {
2514
+ /** @description API key from your PriceOS dashboard. */
2515
+ "x-api-key": string;
2516
+ };
2517
+ path?: never;
2518
+ cookie?: never;
2519
+ };
2520
+ requestBody: {
2521
+ content: {
2522
+ "application/json": {
2523
+ /** @description Customer ID (internal or Stripe). */
2524
+ customerId: string;
2525
+ /** @description Feature key to filter usage events. */
2526
+ featureKey: string;
2527
+ /**
2528
+ * @description Offset for pagination.
2529
+ * @default 0
2530
+ */
2531
+ offset?: number;
2532
+ /**
2533
+ * @description Limit for pagination.
2534
+ * @default 100
2535
+ */
2536
+ limit?: number;
2537
+ /** @description Custom time range (optional). Mutually exclusive with period. */
2538
+ customRange?: {
2539
+ /** @description Unix timestamp (ms) start for the custom range. */
2540
+ start: number;
2541
+ /** @description Unix timestamp (ms) end for the custom range. */
2542
+ end: number;
2543
+ };
2544
+ /**
2545
+ * @description Usage period to list events for (current or previous).
2546
+ * @enum {string}
2547
+ */
2548
+ period?: "current" | "previous";
2549
+ };
2550
+ };
2551
+ };
2552
+ responses: {
2553
+ /** @description Usage events list */
2554
+ 200: {
2555
+ headers: {
2556
+ [name: string]: unknown;
2557
+ };
2558
+ content: {
2559
+ "application/json": {
2560
+ /** @description Usage events. */
2561
+ usageEvents: {
2562
+ /** @description Usage event ID. */
2563
+ id: string;
2564
+ /** @description Usage amount recorded. */
2565
+ amount: number;
2566
+ /** @description Unix timestamp (ms) when the event occurred. */
2567
+ occurredAt: number;
2568
+ /** @description Idempotency key for the event. */
2569
+ idempotencyKey?: string | null;
2570
+ /** @description Event metadata (string key/value pairs). */
2571
+ metadata?: {
2572
+ [key: string]: string;
2573
+ };
2574
+ }[];
2575
+ /** @description Whether there are more results. */
2576
+ hasMore: boolean;
2577
+ /** @description Offset used for pagination. */
2578
+ offset: number;
2579
+ /** @description Limit used for pagination. */
2580
+ limit: number;
2581
+ /** @description Total usage events matching the query. */
2582
+ total: number;
2583
+ };
2584
+ };
2585
+ };
2586
+ /** @description Bad request */
2587
+ 400: {
2588
+ headers: {
2589
+ [name: string]: unknown;
2590
+ };
2591
+ content: {
2592
+ "application/json": {
2593
+ /** @description Error message. */
2594
+ error: string;
2595
+ };
2596
+ };
2597
+ };
2598
+ /** @description Unauthorized */
2599
+ 401: {
2600
+ headers: {
2601
+ [name: string]: unknown;
2602
+ };
2603
+ content: {
2604
+ "application/json": {
2605
+ /** @description Error message. */
2606
+ error: string;
2607
+ };
2608
+ };
2609
+ };
2610
+ /** @description Not found */
2611
+ 404: {
2612
+ headers: {
2613
+ [name: string]: unknown;
2614
+ };
2615
+ content: {
2616
+ "application/json": {
2617
+ /** @description Error message. */
2618
+ error: string;
2619
+ };
2620
+ };
2621
+ };
2622
+ /** @description Server error */
2623
+ 500: {
2624
+ headers: {
2625
+ [name: string]: unknown;
2626
+ };
2627
+ content: {
2628
+ "application/json": {
2629
+ /** @description Error message. */
2630
+ error: string;
2631
+ };
2632
+ };
2633
+ };
2634
+ };
2635
+ };
2636
+ delete?: never;
2637
+ options?: never;
2638
+ head?: never;
2639
+ patch?: never;
2640
+ trace?: never;
2641
+ };
2642
+ }
2643
+ export type webhooks = Record<string, never>;
2644
+ export interface components {
2645
+ schemas: never;
2646
+ responses: never;
2647
+ parameters: never;
2648
+ requestBodies: never;
2649
+ headers: never;
2650
+ pathItems: never;
2651
+ }
2652
+ export type $defs = Record<string, never>;
2653
+ export type operations = Record<string, never>;