@structbuild/sdk 0.1.15 → 0.1.17

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.
@@ -27,6 +27,26 @@ export interface paths {
27
27
  patch?: never;
28
28
  trace?: never;
29
29
  };
30
+ "/webhooks/events": {
31
+ parameters: {
32
+ query?: never;
33
+ header?: never;
34
+ path?: never;
35
+ cookie?: never;
36
+ };
37
+ /**
38
+ * List event types
39
+ * @description Retrieve all available webhook event types with descriptions
40
+ */
41
+ get: operations["list_events"];
42
+ put?: never;
43
+ post?: never;
44
+ delete?: never;
45
+ options?: never;
46
+ head?: never;
47
+ patch?: never;
48
+ trace?: never;
49
+ };
30
50
  "/webhooks/{webhook_id}": {
31
51
  parameters: {
32
52
  query?: never;
@@ -55,6 +75,26 @@ export interface paths {
55
75
  patch?: never;
56
76
  trace?: never;
57
77
  };
78
+ "/webhooks/{webhook_id}/rotate-secret": {
79
+ parameters: {
80
+ query?: never;
81
+ header?: never;
82
+ path?: never;
83
+ cookie?: never;
84
+ };
85
+ get?: never;
86
+ put?: never;
87
+ /**
88
+ * Rotate webhook secret
89
+ * @description Generate a new HMAC secret for a webhook. The new secret is returned once — store it securely
90
+ */
91
+ post: operations["rotate_secret"];
92
+ delete?: never;
93
+ options?: never;
94
+ head?: never;
95
+ patch?: never;
96
+ trace?: never;
97
+ };
58
98
  "/webhooks/{webhook_id}/test": {
59
99
  parameters: {
60
100
  query?: never;
@@ -97,6 +137,46 @@ export interface webhooks {
97
137
  patch?: never;
98
138
  trace?: never;
99
139
  };
140
+ "new-market": {
141
+ parameters: {
142
+ query?: never;
143
+ header?: never;
144
+ path?: never;
145
+ cookie?: never;
146
+ };
147
+ get?: never;
148
+ put?: never;
149
+ /**
150
+ * New market entry callback
151
+ * @description Fired when a trader places their first trade in a specific market/condition (fires once per trader+market pair)
152
+ */
153
+ post: operations["new-market"];
154
+ delete?: never;
155
+ options?: never;
156
+ head?: never;
157
+ patch?: never;
158
+ trace?: never;
159
+ };
160
+ "whale-trade": {
161
+ parameters: {
162
+ query?: never;
163
+ header?: never;
164
+ path?: never;
165
+ cookie?: never;
166
+ };
167
+ get?: never;
168
+ put?: never;
169
+ /**
170
+ * Whale trade callback
171
+ * @description Fired when a trade exceeds the configured USD threshold within the configured probability range (e.g. >$10k between 5–95% probability). Requires `min_usd_value` in the subscription filter.
172
+ */
173
+ post: operations["whale-trade"];
174
+ delete?: never;
175
+ options?: never;
176
+ head?: never;
177
+ patch?: never;
178
+ trace?: never;
179
+ };
100
180
  "global-pnl": {
101
181
  parameters: {
102
182
  query?: never;
@@ -297,9 +377,141 @@ export interface webhooks {
297
377
  patch?: never;
298
378
  trace?: never;
299
379
  };
380
+ "volume-spike": {
381
+ parameters: {
382
+ query?: never;
383
+ header?: never;
384
+ path?: never;
385
+ cookie?: never;
386
+ };
387
+ get?: never;
388
+ put?: never;
389
+ /**
390
+ * Volume spike callback
391
+ * @description Fired when a market's volume in a timeframe exceeds the user-defined baseline by the configured ratio (e.g. 2x baseline). Requires `baseline_volume_usd` and `spike_ratio` in the subscription filter.
392
+ */
393
+ post: operations["volume-spike"];
394
+ delete?: never;
395
+ options?: never;
396
+ head?: never;
397
+ patch?: never;
398
+ trace?: never;
399
+ };
400
+ "close-to-bond": {
401
+ parameters: {
402
+ query?: never;
403
+ header?: never;
404
+ path?: never;
405
+ cookie?: never;
406
+ };
407
+ get?: never;
408
+ put?: never;
409
+ /**
410
+ * Close to bond callback
411
+ * @description Fired when a position's probability enters the bond zone (e.g. YES ≥ 95% or ≤ 5%). Requires `min_probability` and/or `max_probability` in the subscription filter.
412
+ */
413
+ post: operations["close-to-bond"];
414
+ delete?: never;
415
+ options?: never;
416
+ head?: never;
417
+ patch?: never;
418
+ trace?: never;
419
+ };
420
+ "market-created": {
421
+ parameters: {
422
+ query?: never;
423
+ header?: never;
424
+ path?: never;
425
+ cookie?: never;
426
+ };
427
+ get?: never;
428
+ put?: never;
429
+ /**
430
+ * Market created callback
431
+ * @description Fired when a new prediction market is detected on-chain (ConditionPreparation event), enriched with Gamma API metadata. Filterable by `tags`, `condition_ids`, and `event_slugs`.
432
+ */
433
+ post: operations["market-created"];
434
+ delete?: never;
435
+ options?: never;
436
+ head?: never;
437
+ patch?: never;
438
+ trace?: never;
439
+ };
300
440
  }
301
441
  export interface components {
302
442
  schemas: {
443
+ /** @description Close-to-bond webhook payload */
444
+ CloseToBondPayload: {
445
+ /** @description Trader address (the limit-order maker) */
446
+ trader: string;
447
+ /** @description Taker address (the order filler — often the exchange contract) */
448
+ taker: string;
449
+ /** @description Position ID (ERC1155 token ID) */
450
+ position_id: string;
451
+ /** @description Condition ID (parent market) */
452
+ condition_id?: string | null;
453
+ /** @description Outcome name (e.g. "Yes", "No") */
454
+ outcome?: string | null;
455
+ /**
456
+ * Format: int32
457
+ * @description Outcome index (0 = Yes, 1 = No)
458
+ */
459
+ outcome_index?: number | null;
460
+ /** @description Market question */
461
+ question?: string | null;
462
+ /** @description Market slug */
463
+ market_slug?: string | null;
464
+ /** @description Event slug */
465
+ event_slug?: string | null;
466
+ /** @description Trade ID */
467
+ trade_id: string;
468
+ /** @description Transaction hash */
469
+ hash: string;
470
+ /**
471
+ * Format: int64
472
+ * @description Block number
473
+ */
474
+ block: number;
475
+ /**
476
+ * Format: int64
477
+ * @description Confirmed timestamp (Unix seconds)
478
+ */
479
+ confirmed_at: number;
480
+ /**
481
+ * Format: double
482
+ * @description USD size of the trade
483
+ */
484
+ amount_usd: number;
485
+ /**
486
+ * Format: double
487
+ * @description Outcome shares traded
488
+ */
489
+ shares_amount: number;
490
+ /**
491
+ * Format: double
492
+ * @description Fee paid (USD)
493
+ */
494
+ fee: number;
495
+ /** @description Trade side ("Buy" or "Sell") */
496
+ side: string;
497
+ /**
498
+ * Format: double
499
+ * @description Price per share (0.0–1.0) — the value that triggered the notification
500
+ */
501
+ price: number;
502
+ /**
503
+ * Format: double
504
+ * @description Implied probability of the outcome (0.0–1.0)
505
+ */
506
+ probability?: number | null;
507
+ /** @description Which bond zone was entered: `"high"` (YES near-certain) or `"low"` (NO near-certain) */
508
+ bond_side: string;
509
+ /**
510
+ * Format: double
511
+ * @description The probability threshold from the subscriber's filter that was breached
512
+ */
513
+ threshold: number;
514
+ };
303
515
  /** @description Condition metrics webhook payload (Arc-optimized, no internal metadata) */
304
516
  ConditionMetricsPayload: {
305
517
  condition_id?: string | null;
@@ -317,14 +529,18 @@ export interface components {
317
529
  CreateWebhookRequestBody: {
318
530
  /** @description Destination URL for webhook deliveries (must be HTTPS) */
319
531
  url: string;
320
- /** @description Events to subscribe to */
321
- events: components["schemas"]["PolymarketWebhookEvent"][];
532
+ /** @description Event to subscribe to */
533
+ event: components["schemas"]["PolymarketWebhookEvent"];
322
534
  /** @description Optional secret for HMAC signature verification */
323
535
  secret?: string | null;
324
536
  filters?: null | components["schemas"]["WebhookFiltersBody"];
325
537
  /** @description Optional description/name */
326
538
  description?: string | null;
327
539
  };
540
+ /** @description Delete webhook response */
541
+ DeleteWebhookResponse: {
542
+ deleted: boolean;
543
+ };
328
544
  /** @description Event metrics webhook payload (Arc-optimized, no internal metadata) */
329
545
  EventMetricsPayload: {
330
546
  event_slug?: string | null;
@@ -340,7 +556,10 @@ export interface components {
340
556
  };
341
557
  /** @description Event PnL webhook payload (Arc-optimized) */
342
558
  EventPnlPayload: {
559
+ trader?: string | null;
343
560
  event_slug?: string | null;
561
+ /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
562
+ timeframe: string;
344
563
  /** Format: int64 */
345
564
  markets_traded?: number | null;
346
565
  /** Format: int64 */
@@ -403,16 +622,12 @@ export interface components {
403
622
  };
404
623
  /** @description First trade webhook payload with zero-copy Arc<str> for string sharing */
405
624
  FirstTradePayload: {
406
- /** @description Event type identifier */
407
- event_type: string;
408
625
  /** @description Trader/taker address (zero-copy Arc) */
409
626
  trader: string;
410
627
  /** @description Taker address (same as trader, zero-copy Arc) */
411
628
  taker: string;
412
629
  /** @description Position ID (ERC1155 token ID, zero-copy Arc) */
413
630
  position_id: string;
414
- /** @description Market ID (same as position_id for compatibility, zero-copy Arc) */
415
- market_id: string;
416
631
  /** @description Condition ID (market condition, zero-copy Arc) */
417
632
  condition_id?: string | null;
418
633
  /** @description Market outcome (e.g., "Yes", "No", zero-copy Arc) */
@@ -425,7 +640,7 @@ export interface components {
425
640
  /** @description Market question (zero-copy Arc) */
426
641
  question?: string | null;
427
642
  /** @description Market slug (zero-copy Arc) */
428
- slug?: string | null;
643
+ market_slug?: string | null;
429
644
  /** @description Event slug (parent event, zero-copy Arc) */
430
645
  event_slug?: string | null;
431
646
  /** @description Trade ID (zero-copy Arc) */
@@ -442,14 +657,12 @@ export interface components {
442
657
  * @description Confirmed timestamp (Unix seconds)
443
658
  */
444
659
  confirmed_at: number;
445
- /**
446
- * Format: int64
447
- * @description Timestamp (same as confirmed_at for compatibility)
448
- */
449
- timestamp: number;
450
- amount_usd: string;
451
- shares_amount: string;
452
- fee: string;
660
+ /** Format: double */
661
+ amount_usd: number;
662
+ /** Format: double */
663
+ shares_amount: number;
664
+ /** Format: double */
665
+ fee: number;
453
666
  /** @description Trade side (Buy/Sell, zero-copy Arc) */
454
667
  side: string;
455
668
  /**
@@ -457,17 +670,14 @@ export interface components {
457
670
  * @description Price per share (0.0 - 1.0)
458
671
  */
459
672
  price: number;
460
- /**
461
- * Format: double
462
- * @description Implied probability (0.0 - 1.0)
463
- */
464
- probability?: number | null;
465
673
  exchange: string;
466
674
  trade_type: string;
467
675
  };
468
676
  /** @description Global PnL webhook payload (Arc-optimized) */
469
677
  GlobalPnlPayload: {
470
678
  trader?: string | null;
679
+ /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
680
+ timeframe: string;
471
681
  /** Format: double */
472
682
  realized_pnl_usd?: number | null;
473
683
  /** Format: int64 */
@@ -517,10 +727,70 @@ export interface components {
517
727
  /** Format: int64 */
518
728
  last_trade_at?: number | null;
519
729
  };
730
+ /** @description Response for GET /v1/webhook/events */
731
+ ListEventsResponse: {
732
+ events: components["schemas"]["WebhookEventInfo"][];
733
+ };
734
+ /** @description Outcome entry in the market created payload — mirrors `NewMarketOutcome` */
735
+ MarketCreatedOutcome: {
736
+ /**
737
+ * Format: int32
738
+ * @description Outcome index (0 = Yes, 1 = No)
739
+ */
740
+ index: number;
741
+ /** @description Outcome name (e.g. "Yes", "No") */
742
+ name: string;
743
+ /** @description ERC1155 position token ID */
744
+ position_id: string;
745
+ };
746
+ /** @description Market created webhook payload — mirrors `NewMarketPayload` field-for-field */
747
+ MarketCreatedPayload: {
748
+ /** @description Condition ID (0x-prefixed hex, lowercase) */
749
+ condition_id: string;
750
+ /** @description Market slug */
751
+ market_slug: string;
752
+ /** @description Event slug (parent event) */
753
+ event_slug?: string | null;
754
+ /** @description Event ID */
755
+ event_id?: string | null;
756
+ /** @description Event title */
757
+ event_title?: string | null;
758
+ /** @description Series slug */
759
+ series_slug?: string | null;
760
+ /** @description Outcomes with their position IDs, index, and name */
761
+ outcomes: components["schemas"]["MarketCreatedOutcome"][];
762
+ /** @description Market question */
763
+ question: string;
764
+ /** @description Market title (short display name) */
765
+ title?: string | null;
766
+ /** @description Market description */
767
+ description: string;
768
+ /** @description Market category (e.g. "Sports", "Politics") */
769
+ category?: string | null;
770
+ /** @description Market tags */
771
+ tags: string[];
772
+ /** @description Cover image URL */
773
+ image_url?: string | null;
774
+ /** @description Whether this is a neg-risk market */
775
+ neg_risk: boolean;
776
+ /**
777
+ * Format: int64
778
+ * @description Block number where ConditionPreparation was emitted
779
+ */
780
+ block: number;
781
+ /**
782
+ * Format: int64
783
+ * @description Block timestamp (Unix seconds)
784
+ */
785
+ block_timestamp: number;
786
+ };
520
787
  /** @description Market PnL webhook payload (Arc-optimized) */
521
788
  MarketPnlPayload: {
789
+ trader?: string | null;
522
790
  condition_id?: string | null;
523
791
  event_slug?: string | null;
792
+ /** @description Aggregation timeframe: "1d", "7d", "30d", or "lifetime" */
793
+ timeframe: string;
524
794
  /** Format: int64 */
525
795
  outcomes_traded?: number | null;
526
796
  /** Format: int64 */
@@ -550,6 +820,78 @@ export interface components {
550
820
  /** Format: int64 */
551
821
  last_trade_at?: number | null;
552
822
  };
823
+ /**
824
+ * @description New market entry webhook payload
825
+ *
826
+ * Fired when a trader places their first trade in a specific condition/market.
827
+ * The payload contains the full details of the triggering trade.
828
+ */
829
+ NewMarketPayload: {
830
+ /** @description Trader address (placed the limit order) */
831
+ trader: string;
832
+ /** @description Taker address (filled the order — often the exchange contract) */
833
+ taker: string;
834
+ /** @description Position ID (ERC1155 token ID) */
835
+ position_id: string;
836
+ /** @description Condition ID (market condition) */
837
+ condition_id?: string | null;
838
+ /** @description Outcome name (e.g. "Yes", "No") */
839
+ outcome?: string | null;
840
+ /**
841
+ * Format: int32
842
+ * @description Outcome index (0 = Yes, 1 = No)
843
+ */
844
+ outcome_index?: number | null;
845
+ /** @description Market question */
846
+ question?: string | null;
847
+ /** @description Market slug */
848
+ market_slug?: string | null;
849
+ /** @description Event slug (parent event) */
850
+ event_slug?: string | null;
851
+ /** @description Trade ID */
852
+ trade_id: string;
853
+ /** @description Transaction hash */
854
+ hash: string;
855
+ /**
856
+ * Format: int64
857
+ * @description Block number
858
+ */
859
+ block: number;
860
+ /**
861
+ * Format: int64
862
+ * @description Confirmed timestamp (Unix seconds)
863
+ */
864
+ confirmed_at: number;
865
+ /**
866
+ * Format: double
867
+ * @description USD size of the trade
868
+ */
869
+ amount_usd: number;
870
+ /**
871
+ * Format: double
872
+ * @description Outcome shares traded
873
+ */
874
+ shares_amount: number;
875
+ /**
876
+ * Format: double
877
+ * @description Fee paid (USD)
878
+ */
879
+ fee: number;
880
+ /** @description Trade side ("Buy" or "Sell") */
881
+ side: string;
882
+ /**
883
+ * Format: double
884
+ * @description Price per share (0.0–1.0)
885
+ */
886
+ price: number;
887
+ /**
888
+ * Format: double
889
+ * @description Implied probability (0.0–1.0); None when outcome is unknown
890
+ */
891
+ probability?: number | null;
892
+ exchange: string;
893
+ trade_type: string;
894
+ };
553
895
  /**
554
896
  * @description PnL timeframe enum for webhook filtering
555
897
  * @enum {string}
@@ -559,12 +901,14 @@ export interface components {
559
901
  * @description Polymarket webhook event types
560
902
  * @enum {string}
561
903
  */
562
- PolymarketWebhookEvent: "first_trade" | "global_pnl" | "market_pnl" | "event_pnl" | "condition_metrics" | "event_metrics" | "position_metrics" | "volume_milestone" | "event_volume_milestone" | "position_volume_milestone" | "probability_spike" | "volume_spike" | "*";
904
+ PolymarketWebhookEvent: "first_trade" | "new_market" | "whale_trade" | "global_pnl" | "market_pnl" | "event_pnl" | "condition_metrics" | "event_metrics" | "position_metrics" | "volume_milestone" | "event_volume_milestone" | "position_volume_milestone" | "probability_spike" | "volume_spike" | "close_to_bond" | "market_created";
563
905
  /**
564
906
  * @description Polymarket-specific webhook filters
565
907
  *
566
908
  * Different webhook handlers use different subsets of these fields:
567
909
  * - first_trade: wallet_addresses, min_usd_value, min_probability, max_probability, condition_ids, event_slugs, tags
910
+ * - new_market: wallet_addresses, condition_ids, event_slugs, min_usd_value, min_probability, max_probability
911
+ * - whale_trade: min_usd_value (required), min_probability, max_probability, condition_ids, event_slugs
568
912
  * - global_pnl: traders, min_realized_pnl_usd, max_realized_pnl_usd, min_volume_usd, min_win_rate, min_markets_traded
569
913
  * - market_pnl: traders, min_realized_pnl_usd, max_realized_pnl_usd, min_buy_usd, condition_ids, event_slugs
570
914
  * - event_pnl: traders, min_realized_pnl_usd, max_realized_pnl_usd, min_volume_usd, event_slugs, min_markets_traded
@@ -572,6 +916,7 @@ export interface components {
572
916
  * - event_metrics: event_slugs, min_volume_usd, max_volume_usd, min_fees, min_txns, timeframes
573
917
  * - position_metrics: position_ids, condition_ids, outcomes, min_volume_usd, max_volume_usd, min_buy_usd, min_sell_volume_usd, min_fees, min_txns, min_price_change_pct, min_probability_change_pct, timeframes
574
918
  * - volume_milestone: condition_ids, timeframes, milestone_amounts
919
+ * - close_to_bond: min_probability (high zone threshold), max_probability (low zone threshold), condition_ids, position_ids, outcomes, timeframes
575
920
  *
576
921
  * Implements Hash + Eq manually (f64 fields use bit representation)
577
922
  */
@@ -660,6 +1005,11 @@ export interface components {
660
1005
  * @description Minimum transaction count - for metrics webhooks
661
1006
  */
662
1007
  min_txns?: number | null;
1008
+ /**
1009
+ * Format: int64
1010
+ * @description Minimum unique traders - for metrics webhooks
1011
+ */
1012
+ min_unique_traders?: number | null;
663
1013
  /**
664
1014
  * Format: double
665
1015
  * @description Minimum sell volume (USD) - for position metrics webhooks
@@ -675,7 +1025,7 @@ export interface components {
675
1025
  * @description Minimum probability change percentage - for position metrics webhooks
676
1026
  */
677
1027
  min_probability_change_pct?: number | null;
678
- /** @description Timeframes to track - for metrics webhooks (1m, 5m, 30m, 1h, 6h, 24h) */
1028
+ /** @description Timeframes to track - for metrics webhooks (1m, 5m, 30m, 1h, 6h, 24h, 7d, 30d) */
679
1029
  timeframes?: string[];
680
1030
  /** @description Milestone amounts to track - for volume milestone webhooks (e.g., 10000, 100000, 1000000) */
681
1031
  milestone_amounts?: number[];
@@ -696,7 +1046,7 @@ export interface components {
696
1046
  * Filters out event slugs containing these timeframe patterns (auto-wrapped: "5m" → "-5m-")
697
1047
  * Example: Excludes "btc-updown-5m-1771678800" when "5m" is in the list
698
1048
  */
699
- exclude_shortterm_market_timeframes?: string[];
1049
+ exclude_shorterm_market_timeframes?: string[];
700
1050
  };
701
1051
  /** @description Position metrics webhook payload (Arc-optimized, no internal metadata) */
702
1052
  PositionMetricsPayload: {
@@ -835,12 +1185,21 @@ export interface components {
835
1185
  */
836
1186
  txns: number;
837
1187
  };
1188
+ /** @description Response for POST /v1/webhook/{id}/rotate-secret */
1189
+ RotateSecretResponse: {
1190
+ /** @description The new HMAC secret (only returned once — store it securely) */
1191
+ secret: string;
1192
+ /**
1193
+ * Format: int64
1194
+ * @description Timestamp of rotation (ms since epoch)
1195
+ */
1196
+ rotated_at: number;
1197
+ };
838
1198
  /** @description Request body for updating a webhook */
839
1199
  UpdateWebhookRequestBody: {
840
1200
  /** @description Destination URL for webhook deliveries (must be HTTPS) */
841
1201
  url?: string | null;
842
- /** @description Events to subscribe to */
843
- events?: components["schemas"]["PolymarketWebhookEvent"][] | null;
1202
+ event?: null | components["schemas"]["PolymarketWebhookEvent"];
844
1203
  /** @description New secret for HMAC signature verification */
845
1204
  secret?: string | null;
846
1205
  filters?: null | components["schemas"]["WebhookFiltersBody"];
@@ -873,19 +1232,67 @@ export interface components {
873
1232
  */
874
1233
  txns: number;
875
1234
  };
876
- /** @description Webhook filters request body */
877
- WebhookFiltersBody: {
878
- /** @description Filter by wallet addresses */
879
- wallet_addresses?: string[];
880
- /** @description Filter by market/condition IDs */
881
- condition_ids?: string[];
1235
+ /** @description Volume spike webhook payload */
1236
+ VolumeSpikePayload: {
1237
+ condition_id: string;
1238
+ timeframe: string;
882
1239
  /**
883
1240
  * Format: double
884
- * @description Filter by minimum USD value
1241
+ * @description Current volume that triggered the spike (USD)
885
1242
  */
886
- min_usd_value?: number | null;
887
- /** @description Filter by event slugs */
888
- event_slugs?: string[];
1243
+ current_volume_usd: number;
1244
+ /**
1245
+ * Format: double
1246
+ * @description User's baseline volume for comparison (USD)
1247
+ */
1248
+ baseline_volume_usd: number;
1249
+ /**
1250
+ * Format: double
1251
+ * @description Spike ratio threshold that was triggered
1252
+ */
1253
+ spike_ratio: number;
1254
+ /**
1255
+ * Format: double
1256
+ * @description Calculated threshold that was crossed (baseline * ratio)
1257
+ */
1258
+ threshold_usd: number;
1259
+ /**
1260
+ * Format: int64
1261
+ * @description Total transactions in this timeframe
1262
+ */
1263
+ txns: number;
1264
+ /**
1265
+ * Format: double
1266
+ * @description Total fees in this timeframe
1267
+ */
1268
+ fees: number;
1269
+ };
1270
+ /** @description Single event type entry for the events list */
1271
+ WebhookEventInfo: {
1272
+ /** @description Event type identifier (e.g. "first_trade") */
1273
+ event: string;
1274
+ /** @description Human-readable description */
1275
+ description: string;
1276
+ };
1277
+ /** @description Webhook filters request body */
1278
+ WebhookFiltersBody: {
1279
+ /** @description Filter by wallet addresses (for first_trade / new_market / whale_trade) */
1280
+ wallet_addresses?: string[];
1281
+ /** @description Filter by trader addresses (for PnL webhooks) */
1282
+ traders?: string[];
1283
+ /** @description Filter by market/condition IDs */
1284
+ condition_ids?: string[];
1285
+ /** @description Filter by position IDs (for position metrics / close_to_bond) */
1286
+ position_ids?: string[];
1287
+ /** @description Filter by event slugs */
1288
+ event_slugs?: string[];
1289
+ /** @description Filter by outcomes (e.g. "Yes", "No") — for position metrics / close_to_bond */
1290
+ outcomes?: string[];
1291
+ /**
1292
+ * Format: double
1293
+ * @description Minimum USD trade size (for whale_trade / first_trade)
1294
+ */
1295
+ min_usd_value?: number | null;
889
1296
  /**
890
1297
  * Format: double
891
1298
  * @description Minimum probability threshold (0.0 - 1.0)
@@ -896,8 +1303,87 @@ export interface components {
896
1303
  * @description Maximum probability threshold (0.0 - 1.0)
897
1304
  */
898
1305
  max_probability?: number | null;
899
- /** @description Exclude short-term trading markets by timeframe (e.g., ["5m", "15m"]) */
900
- exclude_shortterm_market_timeframes?: string[];
1306
+ /**
1307
+ * Format: double
1308
+ * @description Minimum realized PnL (USD) — for global_pnl / market_pnl / event_pnl
1309
+ */
1310
+ min_realized_pnl_usd?: number | null;
1311
+ /**
1312
+ * Format: double
1313
+ * @description Maximum realized PnL (USD) — for global_pnl / market_pnl / event_pnl
1314
+ */
1315
+ max_realized_pnl_usd?: number | null;
1316
+ /**
1317
+ * Format: double
1318
+ * @description Minimum total volume (USD) — for global_pnl / event_pnl / metrics
1319
+ */
1320
+ min_volume_usd?: number | null;
1321
+ /**
1322
+ * Format: double
1323
+ * @description Maximum total volume (USD) — for metrics webhooks
1324
+ */
1325
+ max_volume_usd?: number | null;
1326
+ /**
1327
+ * Format: double
1328
+ * @description Minimum buy volume (USD) — for market_pnl / position metrics
1329
+ */
1330
+ min_buy_usd?: number | null;
1331
+ /**
1332
+ * Format: double
1333
+ * @description Minimum sell volume (USD) — for position metrics
1334
+ */
1335
+ min_sell_volume_usd?: number | null;
1336
+ /**
1337
+ * Format: double
1338
+ * @description Minimum win rate (0.0 - 100.0) — for global_pnl
1339
+ */
1340
+ min_win_rate?: number | null;
1341
+ /**
1342
+ * Format: int64
1343
+ * @description Minimum markets traded — for global_pnl / event_pnl
1344
+ */
1345
+ min_markets_traded?: number | null;
1346
+ /**
1347
+ * Format: double
1348
+ * @description Minimum fees (USD) — for metrics webhooks
1349
+ */
1350
+ min_fees?: number | null;
1351
+ /**
1352
+ * Format: int64
1353
+ * @description Minimum transaction count — for metrics webhooks
1354
+ */
1355
+ min_txns?: number | null;
1356
+ /**
1357
+ * Format: int64
1358
+ * @description Minimum unique traders — for metrics webhooks
1359
+ */
1360
+ min_unique_traders?: number | null;
1361
+ /**
1362
+ * Format: double
1363
+ * @description Minimum price change percentage — for position metrics
1364
+ */
1365
+ min_price_change_pct?: number | null;
1366
+ /**
1367
+ * Format: double
1368
+ * @description Minimum probability change percentage — for probability_spike
1369
+ */
1370
+ min_probability_change_pct?: number | null;
1371
+ /** @description Timeframes to track (e.g. ["1m", "5m", "1h", "24h", "7d", "30d"]) — for metrics webhooks */
1372
+ timeframes?: string[];
1373
+ /** @description Milestone amounts to trigger on (USD) — for volume_milestone webhooks */
1374
+ milestone_amounts?: number[];
1375
+ /**
1376
+ * Format: double
1377
+ * @description User-defined baseline volume for spike detection (USD) — for volume_spike
1378
+ */
1379
+ baseline_volume_usd?: number | null;
1380
+ /**
1381
+ * Format: double
1382
+ * @description Spike ratio multiplier (must be > 1.0) — for volume_spike. E.g. 2.0 for 2x baseline
1383
+ */
1384
+ spike_ratio?: number | null;
1385
+ /** @description Exclude short-term trading markets by timeframe pattern (e.g. ["5m", "15m"]) */
1386
+ exclude_shorterm_market_timeframes?: string[];
901
1387
  };
902
1388
  /** @description List webhooks response */
903
1389
  WebhookListResponseBody: {
@@ -912,42 +1398,25 @@ export interface components {
912
1398
  id: string;
913
1399
  /** @description Destination URL */
914
1400
  url: string;
915
- /** @description Subscribed events */
916
- events: components["schemas"]["PolymarketWebhookEvent"][];
917
- /** @description Filters */
918
- filters: components["schemas"]["WebhookFiltersBody"];
919
- /** @description Current status */
1401
+ /** @description Subscribed event */
1402
+ event: components["schemas"]["PolymarketWebhookEvent"];
1403
+ /** @description Active filters (omitted when no filters are set) */
1404
+ filters?: components["schemas"]["PolymarketWebhookFilter"];
1405
+ /** @description Current status: "active", "paused", or "disabled" */
920
1406
  status: string;
921
- /**
922
- * Format: int32
923
- * @description Consecutive failure count
924
- */
925
- failure_count: number;
926
- /**
927
- * Format: int64
928
- * @description Last successful delivery timestamp
929
- */
930
- last_success_at?: number | null;
931
1407
  /**
932
1408
  * Format: int64
933
- * @description Last failed delivery timestamp
934
- */
935
- last_failure_at?: number | null;
936
- /** @description Last failure reason */
937
- last_failure_reason?: string | null;
938
- /**
939
- * Format: int64
940
- * @description Created timestamp
1409
+ * @description Created timestamp (ms)
941
1410
  */
942
1411
  created_at: number;
943
1412
  /**
944
1413
  * Format: int64
945
- * @description Updated timestamp
1414
+ * @description Updated timestamp (ms)
946
1415
  */
947
1416
  updated_at: number;
948
- /** @description Description */
1417
+ /** @description Description/name */
949
1418
  description?: string | null;
950
- /** @description Whether a secret is configured */
1419
+ /** @description Whether an HMAC secret is configured */
951
1420
  has_secret: boolean;
952
1421
  };
953
1422
  /**
@@ -972,6 +1441,73 @@ export interface components {
972
1441
  */
973
1442
  duration_ms: number;
974
1443
  };
1444
+ /** @description Whale trade webhook payload */
1445
+ WhaleTradePayload: {
1446
+ /** @description Trader address (the limit-order maker) */
1447
+ trader: string;
1448
+ /** @description Taker address (the order filler — often the exchange contract) */
1449
+ taker: string;
1450
+ /** @description Position ID (ERC1155 token ID) */
1451
+ position_id: string;
1452
+ /** @description Condition ID */
1453
+ condition_id?: string | null;
1454
+ /** @description Outcome name (e.g. "Yes", "No") */
1455
+ outcome?: string | null;
1456
+ /**
1457
+ * Format: int32
1458
+ * @description Outcome index (0 = Yes, 1 = No)
1459
+ */
1460
+ outcome_index?: number | null;
1461
+ /** @description Market question */
1462
+ question?: string | null;
1463
+ /** @description Market slug */
1464
+ market_slug?: string | null;
1465
+ /** @description Event slug */
1466
+ event_slug?: string | null;
1467
+ /** @description Trade ID */
1468
+ trade_id: string;
1469
+ /** @description Transaction hash */
1470
+ hash: string;
1471
+ /**
1472
+ * Format: int64
1473
+ * @description Block number
1474
+ */
1475
+ block: number;
1476
+ /**
1477
+ * Format: int64
1478
+ * @description Confirmed timestamp (Unix seconds)
1479
+ */
1480
+ confirmed_at: number;
1481
+ /**
1482
+ * Format: double
1483
+ * @description USD size of the trade
1484
+ */
1485
+ amount_usd: number;
1486
+ /**
1487
+ * Format: double
1488
+ * @description Outcome shares traded
1489
+ */
1490
+ shares_amount: number;
1491
+ /**
1492
+ * Format: double
1493
+ * @description Fee paid (USD)
1494
+ */
1495
+ fee: number;
1496
+ /** @description Trade side ("Buy" or "Sell") */
1497
+ side: string;
1498
+ /**
1499
+ * Format: double
1500
+ * @description Price per share (0.0–1.0)
1501
+ */
1502
+ price: number;
1503
+ /**
1504
+ * Format: double
1505
+ * @description Implied probability of the event (0.0–1.0); None when outcome is unknown
1506
+ */
1507
+ probability?: number | null;
1508
+ exchange: string;
1509
+ trade_type: string;
1510
+ };
975
1511
  };
976
1512
  responses: never;
977
1513
  parameters: never;
@@ -1069,6 +1605,33 @@ export interface operations {
1069
1605
  };
1070
1606
  };
1071
1607
  };
1608
+ list_events: {
1609
+ parameters: {
1610
+ query?: never;
1611
+ header?: never;
1612
+ path?: never;
1613
+ cookie?: never;
1614
+ };
1615
+ requestBody?: never;
1616
+ responses: {
1617
+ /** @description List of available event types */
1618
+ 200: {
1619
+ headers: {
1620
+ [name: string]: unknown;
1621
+ };
1622
+ content: {
1623
+ "application/json": components["schemas"]["ListEventsResponse"];
1624
+ };
1625
+ };
1626
+ /** @description Missing or invalid API key */
1627
+ 401: {
1628
+ headers: {
1629
+ [name: string]: unknown;
1630
+ };
1631
+ content?: never;
1632
+ };
1633
+ };
1634
+ };
1072
1635
  get_webhook: {
1073
1636
  parameters: {
1074
1637
  query?: never;
@@ -1167,12 +1730,51 @@ export interface operations {
1167
1730
  requestBody?: never;
1168
1731
  responses: {
1169
1732
  /** @description Webhook deleted successfully */
1170
- 204: {
1733
+ 200: {
1734
+ headers: {
1735
+ [name: string]: unknown;
1736
+ };
1737
+ content: {
1738
+ "application/json": components["schemas"]["DeleteWebhookResponse"];
1739
+ };
1740
+ };
1741
+ /** @description Missing or invalid API key */
1742
+ 401: {
1171
1743
  headers: {
1172
1744
  [name: string]: unknown;
1173
1745
  };
1174
1746
  content?: never;
1175
1747
  };
1748
+ /** @description Webhook not found or not owned by user */
1749
+ 404: {
1750
+ headers: {
1751
+ [name: string]: unknown;
1752
+ };
1753
+ content?: never;
1754
+ };
1755
+ };
1756
+ };
1757
+ rotate_secret: {
1758
+ parameters: {
1759
+ query?: never;
1760
+ header?: never;
1761
+ path: {
1762
+ /** @description Webhook UUID */
1763
+ webhook_id: string;
1764
+ };
1765
+ cookie?: never;
1766
+ };
1767
+ requestBody?: never;
1768
+ responses: {
1769
+ /** @description New secret generated */
1770
+ 200: {
1771
+ headers: {
1772
+ [name: string]: unknown;
1773
+ };
1774
+ content: {
1775
+ "application/json": components["schemas"]["RotateSecretResponse"];
1776
+ };
1777
+ };
1176
1778
  /** @description Missing or invalid API key */
1177
1779
  401: {
1178
1780
  headers: {
@@ -1255,6 +1857,64 @@ export interface operations {
1255
1857
  };
1256
1858
  };
1257
1859
  };
1860
+ "new-market": {
1861
+ parameters: {
1862
+ query?: never;
1863
+ header?: never;
1864
+ path?: never;
1865
+ cookie?: never;
1866
+ };
1867
+ requestBody: {
1868
+ content: {
1869
+ "application/json": components["schemas"]["NewMarketPayload"];
1870
+ };
1871
+ };
1872
+ responses: {
1873
+ /** @description Webhook delivery acknowledged */
1874
+ 200: {
1875
+ headers: {
1876
+ [name: string]: unknown;
1877
+ };
1878
+ content?: never;
1879
+ };
1880
+ /** @description Server error (will retry) */
1881
+ 500: {
1882
+ headers: {
1883
+ [name: string]: unknown;
1884
+ };
1885
+ content?: never;
1886
+ };
1887
+ };
1888
+ };
1889
+ "whale-trade": {
1890
+ parameters: {
1891
+ query?: never;
1892
+ header?: never;
1893
+ path?: never;
1894
+ cookie?: never;
1895
+ };
1896
+ requestBody: {
1897
+ content: {
1898
+ "application/json": components["schemas"]["WhaleTradePayload"];
1899
+ };
1900
+ };
1901
+ responses: {
1902
+ /** @description Webhook delivery acknowledged */
1903
+ 200: {
1904
+ headers: {
1905
+ [name: string]: unknown;
1906
+ };
1907
+ content?: never;
1908
+ };
1909
+ /** @description Server error (will retry) */
1910
+ 500: {
1911
+ headers: {
1912
+ [name: string]: unknown;
1913
+ };
1914
+ content?: never;
1915
+ };
1916
+ };
1917
+ };
1258
1918
  "global-pnl": {
1259
1919
  parameters: {
1260
1920
  query?: never;
@@ -1545,4 +2205,91 @@ export interface operations {
1545
2205
  };
1546
2206
  };
1547
2207
  };
2208
+ "volume-spike": {
2209
+ parameters: {
2210
+ query?: never;
2211
+ header?: never;
2212
+ path?: never;
2213
+ cookie?: never;
2214
+ };
2215
+ requestBody: {
2216
+ content: {
2217
+ "application/json": components["schemas"]["VolumeSpikePayload"];
2218
+ };
2219
+ };
2220
+ responses: {
2221
+ /** @description Webhook delivery acknowledged */
2222
+ 200: {
2223
+ headers: {
2224
+ [name: string]: unknown;
2225
+ };
2226
+ content?: never;
2227
+ };
2228
+ /** @description Server error (will retry) */
2229
+ 500: {
2230
+ headers: {
2231
+ [name: string]: unknown;
2232
+ };
2233
+ content?: never;
2234
+ };
2235
+ };
2236
+ };
2237
+ "close-to-bond": {
2238
+ parameters: {
2239
+ query?: never;
2240
+ header?: never;
2241
+ path?: never;
2242
+ cookie?: never;
2243
+ };
2244
+ requestBody: {
2245
+ content: {
2246
+ "application/json": components["schemas"]["CloseToBondPayload"];
2247
+ };
2248
+ };
2249
+ responses: {
2250
+ /** @description Webhook delivery acknowledged */
2251
+ 200: {
2252
+ headers: {
2253
+ [name: string]: unknown;
2254
+ };
2255
+ content?: never;
2256
+ };
2257
+ /** @description Server error (will retry) */
2258
+ 500: {
2259
+ headers: {
2260
+ [name: string]: unknown;
2261
+ };
2262
+ content?: never;
2263
+ };
2264
+ };
2265
+ };
2266
+ "market-created": {
2267
+ parameters: {
2268
+ query?: never;
2269
+ header?: never;
2270
+ path?: never;
2271
+ cookie?: never;
2272
+ };
2273
+ requestBody: {
2274
+ content: {
2275
+ "application/json": components["schemas"]["MarketCreatedPayload"];
2276
+ };
2277
+ };
2278
+ responses: {
2279
+ /** @description Webhook delivery acknowledged */
2280
+ 200: {
2281
+ headers: {
2282
+ [name: string]: unknown;
2283
+ };
2284
+ content?: never;
2285
+ };
2286
+ /** @description Server error (will retry) */
2287
+ 500: {
2288
+ headers: {
2289
+ [name: string]: unknown;
2290
+ };
2291
+ content?: never;
2292
+ };
2293
+ };
2294
+ };
1548
2295
  }