smartletter 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -54,17 +54,17 @@ declare class Client {
54
54
 
55
55
  interface EmailsSendParams {
56
56
  /**
57
- * `Name <address@your-domain>`; the domain must be verified. Optional with a template that has one.
57
+ * `Name <address@your-domain>`; the domain must be verified. Required, except with a `template` that has one.
58
58
  */
59
- from: string;
59
+ from?: string;
60
60
  /**
61
61
  * Up to 50 addresses.
62
62
  */
63
63
  to: string | string[];
64
64
  /**
65
- * Optional with a template that has one.
65
+ * Required, except with a `template` that has one.
66
66
  */
67
- subject: string;
67
+ subject?: string;
68
68
  /**
69
69
  * Send a published template instead of `html` / `text` (which are then refused). `from`, `subject` and `reply_to` override the template's.
70
70
  */
@@ -96,6 +96,10 @@ interface EmailsSendParams {
96
96
  * Send later: ISO 8601 (`2026-10-20T09:00:00Z`) or English like `in 1 hour`, `tomorrow at 9am`. Up to 30 days.
97
97
  */
98
98
  scheduledAt?: string;
99
+ /**
100
+ * Only recipients eligible to this topic receive the email (topic preferences, like a newsletter); the others are marked `suppressed`. `null` = no topic.
101
+ */
102
+ topicId?: string | null;
99
103
  /**
100
104
  * Up to 20 files, 10 MB in total. Executable types (.exe, .js, .bat…) are refused.
101
105
  */
@@ -122,22 +126,22 @@ interface EmailsSendParams {
122
126
  contentId?: string;
123
127
  }[];
124
128
  }
125
- type EmailsSendResponse = {
129
+ interface EmailsSendResponse {
126
130
  id: string;
127
- };
131
+ }
128
132
  type BatchSendParams = {
129
133
  /**
130
- * `Name <address@your-domain>`; the domain must be verified. Optional with a template that has one.
134
+ * `Name <address@your-domain>`; the domain must be verified. Required, except with a `template` that has one.
131
135
  */
132
- from: string;
136
+ from?: string;
133
137
  /**
134
138
  * Up to 50 addresses.
135
139
  */
136
140
  to: string | string[];
137
141
  /**
138
- * Optional with a template that has one.
142
+ * Required, except with a `template` that has one.
139
143
  */
140
- subject: string;
144
+ subject?: string;
141
145
  /**
142
146
  * Send a published template instead of `html` / `text` (which are then refused). `from`, `subject` and `reply_to` override the template's.
143
147
  */
@@ -169,8 +173,12 @@ type BatchSendParams = {
169
173
  * Send later: ISO 8601 (`2026-10-20T09:00:00Z`) or English like `in 1 hour`, `tomorrow at 9am`. Up to 30 days.
170
174
  */
171
175
  scheduledAt?: string;
176
+ /**
177
+ * Only recipients eligible to this topic receive the email (topic preferences, like a newsletter); the others are marked `suppressed`. `null` = no topic.
178
+ */
179
+ topicId?: string | null;
172
180
  }[];
173
- type BatchSendResponse = {
181
+ interface BatchSendResponse {
174
182
  data: {
175
183
  id: string;
176
184
  }[];
@@ -178,7 +186,7 @@ type BatchSendResponse = {
178
186
  index: number;
179
187
  message: string;
180
188
  }[];
181
- };
189
+ }
182
190
  interface EmailsListParams {
183
191
  /**
184
192
  * 1–100, default 20.
@@ -193,11 +201,11 @@ interface EmailsListParams {
193
201
  */
194
202
  before?: string;
195
203
  }
196
- type EmailsListResponse = {
197
- object: string;
204
+ interface EmailsListResponse {
205
+ object: "list";
198
206
  has_more: boolean;
199
207
  data: {
200
- object: string;
208
+ object: "email";
201
209
  id: string;
202
210
  message_id: string | null;
203
211
  to: string[];
@@ -209,13 +217,14 @@ type EmailsListResponse = {
209
217
  reply_to: string[];
210
218
  last_event: string;
211
219
  scheduled_at: string | null;
220
+ topic_id: string | null;
212
221
  }[];
213
- };
222
+ }
214
223
  interface EmailsGetParams {
215
224
  id: string;
216
225
  }
217
- type EmailsGetResponse = {
218
- object: string;
226
+ interface EmailsGetResponse {
227
+ object: "email";
219
228
  id: string;
220
229
  message_id: string | null;
221
230
  to: string[];
@@ -227,24 +236,23 @@ type EmailsGetResponse = {
227
236
  reply_to: string[];
228
237
  last_event: string;
229
238
  scheduled_at: string | null;
239
+ topic_id: string | null;
230
240
  html: string | null;
231
241
  text: string | null;
232
242
  tags: {
233
243
  name: string;
234
244
  value: string;
235
245
  }[];
236
- status: string;
237
- created_via: string;
238
- attachments: {
239
- filename: string;
240
- content_type: string;
241
- content_id: string | null;
242
- size: number;
243
- }[];
246
+ status: "scheduled" | "queued" | "sent" | "partially_failed" | "failed" | "canceled";
247
+ created_via: "api" | "mcp" | "smtp" | "inbox";
248
+ smtp?: {
249
+ client_ip: string | null;
250
+ message_id: string | null;
251
+ };
244
252
  recipients: {
245
253
  email: string;
246
- type: string;
247
- status: string;
254
+ type: "to" | "cc" | "bcc";
255
+ status: "queued" | "sent" | "delivered" | "delivery_delayed" | "bounced" | "complained" | "failed" | "suppressed" | "canceled";
248
256
  reason: string | null;
249
257
  bounce_type: string | null;
250
258
  smtp_status: string | null;
@@ -253,11 +261,13 @@ type EmailsGetResponse = {
253
261
  delay_expires_at: string | null;
254
262
  last_event_at: string | null;
255
263
  }[];
256
- smtp?: {
257
- client_ip: string | null;
258
- message_id: string | null;
259
- };
260
- };
264
+ attachments: {
265
+ filename: string;
266
+ content_type: string;
267
+ content_id: string | null;
268
+ size: number;
269
+ }[];
270
+ }
261
271
  type EmailsUpdateParams = {
262
272
  id: string;
263
273
  } & {
@@ -266,17 +276,17 @@ type EmailsUpdateParams = {
266
276
  */
267
277
  scheduledAt: string;
268
278
  };
269
- type EmailsUpdateResponse = {
270
- object: string;
279
+ interface EmailsUpdateResponse {
280
+ object: "email";
271
281
  id: string;
272
- };
282
+ }
273
283
  interface EmailsCancelParams {
274
284
  id: string;
275
285
  }
276
- type EmailsCancelResponse = {
277
- object: string;
286
+ interface EmailsCancelResponse {
287
+ object: "email";
278
288
  id: string;
279
- };
289
+ }
280
290
  interface TemplatesCreateParams {
281
291
  name: string;
282
292
  /**
@@ -316,10 +326,10 @@ interface TemplatesCreateParams {
316
326
  required?: boolean;
317
327
  }[];
318
328
  }
319
- type TemplatesCreateResponse = {
320
- object: string;
329
+ interface TemplatesCreateResponse {
330
+ object: "template";
321
331
  id: string;
322
- };
332
+ }
323
333
  interface TemplatesListParams {
324
334
  /**
325
335
  * 1–100, default 20.
@@ -334,25 +344,25 @@ interface TemplatesListParams {
334
344
  */
335
345
  before?: string;
336
346
  }
337
- type TemplatesListResponse = {
338
- object: string;
347
+ interface TemplatesListResponse {
348
+ object: "list";
339
349
  has_more: boolean;
340
350
  data: {
341
351
  id: string;
342
352
  name: string;
343
353
  alias: string | null;
344
- status: string;
354
+ status: "draft" | "published";
345
355
  published_at: string | null;
346
356
  archived: boolean;
347
357
  created_at: string;
348
358
  updated_at: string;
349
359
  }[];
350
- };
360
+ }
351
361
  interface TemplatesGetParams {
352
362
  id: string;
353
363
  }
354
- type TemplatesGetResponse = {
355
- object: string;
364
+ interface TemplatesGetResponse {
365
+ object: "template";
356
366
  id: string;
357
367
  current_version_id: string | null;
358
368
  current_version_number: number | null;
@@ -362,7 +372,7 @@ type TemplatesGetResponse = {
362
372
  name: string;
363
373
  created_at: string;
364
374
  updated_at: string;
365
- status: string;
375
+ status: "draft" | "published";
366
376
  published_at: string | null;
367
377
  archived: boolean;
368
378
  from: string | null;
@@ -373,14 +383,14 @@ type TemplatesGetResponse = {
373
383
  variables: {
374
384
  id: string;
375
385
  key: string;
376
- type: string;
377
- fallback_value: string | number | null;
386
+ type: "string" | "number";
387
+ fallback_value: (string | number) | null;
378
388
  required: boolean;
379
389
  created_at: string;
380
390
  updated_at: string;
381
391
  }[];
382
392
  has_unpublished_versions: boolean;
383
- };
393
+ }
384
394
  type TemplatesUpdateParams = {
385
395
  id: string;
386
396
  } & {
@@ -426,18 +436,18 @@ type TemplatesUpdateParams = {
426
436
  */
427
437
  changeNote?: string;
428
438
  };
429
- type TemplatesUpdateResponse = {
430
- object: string;
439
+ interface TemplatesUpdateResponse {
440
+ object: "template";
431
441
  id: string;
432
- };
442
+ }
433
443
  interface TemplatesRemoveParams {
434
444
  id: string;
435
445
  }
436
- type TemplatesRemoveResponse = {
437
- object: string;
446
+ interface TemplatesRemoveResponse {
447
+ object: "template";
438
448
  id: string;
439
- deleted: boolean;
440
- };
449
+ deleted: true;
450
+ }
441
451
  type TemplatesPublishParams = {
442
452
  id: string;
443
453
  } & {
@@ -446,17 +456,17 @@ type TemplatesPublishParams = {
446
456
  */
447
457
  versionId?: string;
448
458
  };
449
- type TemplatesPublishResponse = {
450
- object: string;
459
+ interface TemplatesPublishResponse {
460
+ object: "template";
451
461
  id: string;
452
- };
462
+ }
453
463
  interface TemplatesDuplicateParams {
454
464
  id: string;
455
465
  }
456
- type TemplatesDuplicateResponse = {
457
- object: string;
466
+ interface TemplatesDuplicateResponse {
467
+ object: "template";
458
468
  id: string;
459
- };
469
+ }
460
470
  type TemplatesVersionsParams = {
461
471
  id: string;
462
472
  } & {
@@ -473,21 +483,21 @@ type TemplatesVersionsParams = {
473
483
  */
474
484
  before?: string;
475
485
  };
476
- type TemplatesVersionsResponse = {
477
- object: string;
486
+ interface TemplatesVersionsResponse {
487
+ object: "list";
478
488
  has_more: boolean;
479
489
  data: {
480
- object: string;
490
+ object: "template_version";
481
491
  id: string;
482
492
  number: number;
483
493
  subject: string | null;
484
- source: string;
494
+ source: "html" | "doc";
485
495
  change_note: string | null;
486
- created_via: string;
496
+ created_via: "api" | "mcp" | "dashboard";
487
497
  published: boolean;
488
498
  created_at: string;
489
499
  }[];
490
- };
500
+ }
491
501
  interface NewslettersListParams {
492
502
  /**
493
503
  * 1–100, default 20.
@@ -501,38 +511,50 @@ interface NewslettersListParams {
501
511
  * Id of the first item of the previous page (newer items).
502
512
  */
503
513
  before?: string;
504
- status?: "draft" | "scheduled" | "sending" | "paused" | "sent" | "failed" | "held";
514
+ status?: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
505
515
  }
506
- type NewslettersListResponse = {
507
- object: string;
516
+ interface NewslettersListResponse {
517
+ object: "list";
508
518
  has_more: boolean;
509
519
  data: {
510
- object: string;
520
+ object: "newsletter";
511
521
  id: string;
512
522
  segment_id: string;
513
- topic_id: unknown;
523
+ topic_id: string | null;
514
524
  subject: string;
515
- preheader: string;
516
- status: string;
517
- body: {
518
- format: string;
519
- content: unknown;
520
- blocks: {
521
- blockId: string;
522
- kind: string;
523
- text: string;
525
+ preheader: string | null;
526
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
527
+ audience_limit: number | null;
528
+ scheduled_for: string | null;
529
+ send_started_at: string | null;
530
+ send_finished_at: string | null;
531
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
532
+ recipient_estimate: number | null;
533
+ ab_test: {
534
+ variants: {
535
+ key: "A" | "B" | "C" | "D";
536
+ subject: string;
537
+ preheader: string | null;
524
538
  }[];
539
+ sample_pct: number;
540
+ metric: "opens" | "clicks";
541
+ wait_hours: number;
542
+ winner_mode: "auto" | "manual";
543
+ } | null;
544
+ ab_winner: ("A" | "B" | "C" | "D") | null;
545
+ stats: {
546
+ sent: number;
547
+ delivered: number;
548
+ opened: number;
549
+ clicked: number;
550
+ bounced: number;
551
+ complained: number;
552
+ unsubscribed: number;
525
553
  };
526
- audience_limit: unknown;
527
- scheduled_for: unknown;
528
- pause_reason: unknown;
529
- recipient_estimate: unknown;
530
- ab_test: unknown;
531
- ab_winner: unknown;
532
554
  created_at: string;
533
555
  updated_at: string;
534
556
  }[];
535
- };
557
+ }
536
558
  interface NewslettersCreateParams {
537
559
  /**
538
560
  * Subject line.
@@ -674,61 +696,115 @@ interface NewslettersCreateParams {
674
696
  winnerMode?: "auto" | "manual";
675
697
  } | null;
676
698
  }
677
- type NewslettersCreateResponse = {
678
- object: string;
699
+ interface NewslettersCreateResponse {
700
+ object: "newsletter";
679
701
  id: string;
680
702
  segment_id: string;
681
- topic_id: unknown;
703
+ topic_id: string | null;
682
704
  subject: string;
683
- preheader: string;
684
- status: string;
705
+ preheader: string | null;
706
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
685
707
  body: {
686
- format: string;
687
- content: unknown;
708
+ format: "markdown" | "html";
709
+ content: string;
710
+ } | {
711
+ format: "sections";
712
+ content: null;
713
+ } | {
714
+ format: "document";
715
+ content: null;
688
716
  blocks: {
689
- blockId: string;
717
+ block_id: string;
690
718
  kind: string;
691
719
  text: string;
692
720
  }[];
693
721
  };
694
- audience_limit: unknown;
695
- scheduled_for: unknown;
696
- pause_reason: unknown;
697
- recipient_estimate: unknown;
698
- ab_test: unknown;
699
- ab_winner: unknown;
722
+ audience_limit: number | null;
723
+ scheduled_for: string | null;
724
+ send_started_at: string | null;
725
+ send_finished_at: string | null;
726
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
727
+ recipient_estimate: number | null;
728
+ ab_test: {
729
+ variants: {
730
+ key: "A" | "B" | "C" | "D";
731
+ subject: string;
732
+ preheader: string | null;
733
+ }[];
734
+ sample_pct: number;
735
+ metric: "opens" | "clicks";
736
+ wait_hours: number;
737
+ winner_mode: "auto" | "manual";
738
+ } | null;
739
+ ab_winner: ("A" | "B" | "C" | "D") | null;
740
+ stats: {
741
+ sent: number;
742
+ delivered: number;
743
+ opened: number;
744
+ clicked: number;
745
+ bounced: number;
746
+ complained: number;
747
+ unsubscribed: number;
748
+ };
700
749
  created_at: string;
701
750
  updated_at: string;
702
- };
751
+ }
703
752
  interface NewslettersGetParams {
704
753
  id: string;
705
754
  }
706
- type NewslettersGetResponse = {
707
- object: string;
755
+ interface NewslettersGetResponse {
756
+ object: "newsletter";
708
757
  id: string;
709
758
  segment_id: string;
710
- topic_id: unknown;
759
+ topic_id: string | null;
711
760
  subject: string;
712
- preheader: string;
713
- status: string;
761
+ preheader: string | null;
762
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
714
763
  body: {
715
- format: string;
716
- content: unknown;
764
+ format: "markdown" | "html";
765
+ content: string;
766
+ } | {
767
+ format: "sections";
768
+ content: null;
769
+ } | {
770
+ format: "document";
771
+ content: null;
717
772
  blocks: {
718
- blockId: string;
773
+ block_id: string;
719
774
  kind: string;
720
775
  text: string;
721
776
  }[];
722
777
  };
723
- audience_limit: unknown;
724
- scheduled_for: unknown;
725
- pause_reason: unknown;
726
- recipient_estimate: unknown;
727
- ab_test: unknown;
728
- ab_winner: unknown;
778
+ audience_limit: number | null;
779
+ scheduled_for: string | null;
780
+ send_started_at: string | null;
781
+ send_finished_at: string | null;
782
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
783
+ recipient_estimate: number | null;
784
+ ab_test: {
785
+ variants: {
786
+ key: "A" | "B" | "C" | "D";
787
+ subject: string;
788
+ preheader: string | null;
789
+ }[];
790
+ sample_pct: number;
791
+ metric: "opens" | "clicks";
792
+ wait_hours: number;
793
+ winner_mode: "auto" | "manual";
794
+ } | null;
795
+ ab_winner: ("A" | "B" | "C" | "D") | null;
796
+ stats: {
797
+ sent: number;
798
+ delivered: number;
799
+ opened: number;
800
+ clicked: number;
801
+ bounced: number;
802
+ complained: number;
803
+ unsubscribed: number;
804
+ };
729
805
  created_at: string;
730
806
  updated_at: string;
731
- };
807
+ }
732
808
  type NewslettersUpdateParams = {
733
809
  id: string;
734
810
  } & {
@@ -853,90 +929,151 @@ type NewslettersUpdateParams = {
853
929
  winnerMode?: "auto" | "manual";
854
930
  } | null;
855
931
  };
856
- type NewslettersUpdateResponse = {
857
- object: string;
932
+ interface NewslettersUpdateResponse {
933
+ object: "newsletter";
858
934
  id: string;
859
935
  segment_id: string;
860
- topic_id: unknown;
936
+ topic_id: string | null;
861
937
  subject: string;
862
- preheader: string;
863
- status: string;
938
+ preheader: string | null;
939
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
864
940
  body: {
865
- format: string;
866
- content: unknown;
941
+ format: "markdown" | "html";
942
+ content: string;
943
+ } | {
944
+ format: "sections";
945
+ content: null;
946
+ } | {
947
+ format: "document";
948
+ content: null;
867
949
  blocks: {
868
- blockId: string;
950
+ block_id: string;
869
951
  kind: string;
870
952
  text: string;
871
953
  }[];
872
954
  };
873
- audience_limit: unknown;
874
- scheduled_for: unknown;
875
- pause_reason: unknown;
876
- recipient_estimate: unknown;
877
- ab_test: unknown;
878
- ab_winner: unknown;
955
+ audience_limit: number | null;
956
+ scheduled_for: string | null;
957
+ send_started_at: string | null;
958
+ send_finished_at: string | null;
959
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
960
+ recipient_estimate: number | null;
961
+ ab_test: {
962
+ variants: {
963
+ key: "A" | "B" | "C" | "D";
964
+ subject: string;
965
+ preheader: string | null;
966
+ }[];
967
+ sample_pct: number;
968
+ metric: "opens" | "clicks";
969
+ wait_hours: number;
970
+ winner_mode: "auto" | "manual";
971
+ } | null;
972
+ ab_winner: ("A" | "B" | "C" | "D") | null;
973
+ stats: {
974
+ sent: number;
975
+ delivered: number;
976
+ opened: number;
977
+ clicked: number;
978
+ bounced: number;
979
+ complained: number;
980
+ unsubscribed: number;
981
+ };
879
982
  created_at: string;
880
983
  updated_at: string;
881
- };
984
+ }
882
985
  interface NewslettersRemoveParams {
883
986
  id: string;
884
987
  }
885
- type NewslettersRemoveResponse = {
886
- object: string;
988
+ interface NewslettersRemoveResponse {
989
+ object: "newsletter";
887
990
  id: string;
888
- deleted: boolean;
889
- };
991
+ deleted: true;
992
+ }
890
993
  interface NewslettersDuplicateParams {
891
994
  id: string;
892
995
  }
893
- type NewslettersDuplicateResponse = {
894
- object: string;
996
+ interface NewslettersDuplicateResponse {
997
+ object: "newsletter";
895
998
  id: string;
896
999
  segment_id: string;
897
- topic_id: unknown;
1000
+ topic_id: string | null;
898
1001
  subject: string;
899
- preheader: string;
900
- status: string;
1002
+ preheader: string | null;
1003
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
901
1004
  body: {
902
- format: string;
903
- content: unknown;
1005
+ format: "markdown" | "html";
1006
+ content: string;
1007
+ } | {
1008
+ format: "sections";
1009
+ content: null;
1010
+ } | {
1011
+ format: "document";
1012
+ content: null;
904
1013
  blocks: {
905
- blockId: string;
1014
+ block_id: string;
906
1015
  kind: string;
907
1016
  text: string;
908
1017
  }[];
909
1018
  };
910
- audience_limit: unknown;
911
- scheduled_for: unknown;
912
- pause_reason: unknown;
913
- recipient_estimate: unknown;
914
- ab_test: unknown;
915
- ab_winner: unknown;
1019
+ audience_limit: number | null;
1020
+ scheduled_for: string | null;
1021
+ send_started_at: string | null;
1022
+ send_finished_at: string | null;
1023
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
1024
+ recipient_estimate: number | null;
1025
+ ab_test: {
1026
+ variants: {
1027
+ key: "A" | "B" | "C" | "D";
1028
+ subject: string;
1029
+ preheader: string | null;
1030
+ }[];
1031
+ sample_pct: number;
1032
+ metric: "opens" | "clicks";
1033
+ wait_hours: number;
1034
+ winner_mode: "auto" | "manual";
1035
+ } | null;
1036
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1037
+ stats: {
1038
+ sent: number;
1039
+ delivered: number;
1040
+ opened: number;
1041
+ clicked: number;
1042
+ bounced: number;
1043
+ complained: number;
1044
+ unsubscribed: number;
1045
+ };
916
1046
  created_at: string;
917
1047
  updated_at: string;
918
- };
1048
+ }
919
1049
  interface NewslettersReviewParams {
920
1050
  id: string;
921
1051
  }
922
- type NewslettersReviewResponse = {
923
- object: string;
1052
+ interface NewslettersReviewResponse {
1053
+ object: "review";
1054
+ id: string;
924
1055
  blocking: boolean;
925
1056
  items: {
926
- id: string;
927
- level: string;
1057
+ id: "subject" | "preheader" | "unsubscribe" | "postal_address" | "size" | "links" | "images_alt" | "domain" | "content" | "html_size" | "variables";
1058
+ level: "ok" | "warning" | "blocking";
928
1059
  values?: {
929
- kb: number;
1060
+ max?: number;
1061
+ length?: number;
1062
+ kb?: number;
1063
+ count?: number;
1064
+ percent?: number;
930
1065
  };
931
1066
  }[];
932
- };
1067
+ }
933
1068
  interface NewslettersTestParams {
934
1069
  id: string;
935
1070
  }
936
- type NewslettersTestResponse = {
937
- object: string;
1071
+ interface NewslettersTestResponse {
1072
+ object: "test_email";
1073
+ id: string;
938
1074
  to: string;
939
- };
1075
+ variants: number;
1076
+ }
940
1077
  type NewslettersSendParams = {
941
1078
  id: string;
942
1079
  } & {
@@ -945,11 +1082,59 @@ type NewslettersSendParams = {
945
1082
  */
946
1083
  audienceLimit?: number;
947
1084
  };
948
- type NewslettersSendResponse = {
949
- object: string;
1085
+ interface NewslettersSendResponse {
1086
+ object: "newsletter";
950
1087
  id: string;
951
- status: string;
952
- };
1088
+ segment_id: string;
1089
+ topic_id: string | null;
1090
+ subject: string;
1091
+ preheader: string | null;
1092
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1093
+ body: {
1094
+ format: "markdown" | "html";
1095
+ content: string;
1096
+ } | {
1097
+ format: "sections";
1098
+ content: null;
1099
+ } | {
1100
+ format: "document";
1101
+ content: null;
1102
+ blocks: {
1103
+ block_id: string;
1104
+ kind: string;
1105
+ text: string;
1106
+ }[];
1107
+ };
1108
+ audience_limit: number | null;
1109
+ scheduled_for: string | null;
1110
+ send_started_at: string | null;
1111
+ send_finished_at: string | null;
1112
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
1113
+ recipient_estimate: number | null;
1114
+ ab_test: {
1115
+ variants: {
1116
+ key: "A" | "B" | "C" | "D";
1117
+ subject: string;
1118
+ preheader: string | null;
1119
+ }[];
1120
+ sample_pct: number;
1121
+ metric: "opens" | "clicks";
1122
+ wait_hours: number;
1123
+ winner_mode: "auto" | "manual";
1124
+ } | null;
1125
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1126
+ stats: {
1127
+ sent: number;
1128
+ delivered: number;
1129
+ opened: number;
1130
+ clicked: number;
1131
+ bounced: number;
1132
+ complained: number;
1133
+ unsubscribed: number;
1134
+ };
1135
+ created_at: string;
1136
+ updated_at: string;
1137
+ }
953
1138
  type NewslettersScheduleParams = {
954
1139
  id: string;
955
1140
  } & {
@@ -962,57 +1147,48 @@ type NewslettersScheduleParams = {
962
1147
  */
963
1148
  audienceLimit?: number;
964
1149
  };
965
- type NewslettersScheduleResponse = {
966
- object: string;
967
- id: string;
968
- status: string;
969
- scheduled_for: string;
970
- };
971
- interface NewslettersUnscheduleParams {
972
- id: string;
973
- }
974
- type NewslettersUnscheduleResponse = {
975
- object: string;
976
- id: string;
977
- status: string;
978
- };
979
- interface NewslettersPauseParams {
980
- id: string;
981
- }
982
- type NewslettersPauseResponse = {
983
- object: string;
984
- id: string;
985
- status: string;
986
- };
987
- interface NewslettersResumeParams {
988
- id: string;
989
- }
990
- type NewslettersResumeResponse = {
991
- object: string;
992
- id: string;
993
- status: string;
994
- };
995
- type NewslettersSendMoreParams = {
996
- id: string;
997
- } & {
998
- /**
999
- * How many of the next most engaged contacts to add.
1000
- */
1001
- count: number;
1002
- };
1003
- type NewslettersSendMoreResponse = {
1004
- object: string;
1005
- id: string;
1006
- status: string;
1007
- };
1008
- interface NewslettersReportParams {
1150
+ interface NewslettersScheduleResponse {
1151
+ object: "newsletter";
1009
1152
  id: string;
1010
- }
1011
- type NewslettersReportResponse = {
1012
- object: string;
1013
- id: string;
1014
- status: string;
1015
- totals: {
1153
+ segment_id: string;
1154
+ topic_id: string | null;
1155
+ subject: string;
1156
+ preheader: string | null;
1157
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1158
+ body: {
1159
+ format: "markdown" | "html";
1160
+ content: string;
1161
+ } | {
1162
+ format: "sections";
1163
+ content: null;
1164
+ } | {
1165
+ format: "document";
1166
+ content: null;
1167
+ blocks: {
1168
+ block_id: string;
1169
+ kind: string;
1170
+ text: string;
1171
+ }[];
1172
+ };
1173
+ audience_limit: number | null;
1174
+ scheduled_for: string | null;
1175
+ send_started_at: string | null;
1176
+ send_finished_at: string | null;
1177
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
1178
+ recipient_estimate: number | null;
1179
+ ab_test: {
1180
+ variants: {
1181
+ key: "A" | "B" | "C" | "D";
1182
+ subject: string;
1183
+ preheader: string | null;
1184
+ }[];
1185
+ sample_pct: number;
1186
+ metric: "opens" | "clicks";
1187
+ wait_hours: number;
1188
+ winner_mode: "auto" | "manual";
1189
+ } | null;
1190
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1191
+ stats: {
1016
1192
  sent: number;
1017
1193
  delivered: number;
1018
1194
  opened: number;
@@ -1021,42 +1197,290 @@ type NewslettersReportResponse = {
1021
1197
  complained: number;
1022
1198
  unsubscribed: number;
1023
1199
  };
1024
- rates: {
1025
- delivery: number;
1026
- open: number;
1027
- click: number;
1028
- bounce: number;
1029
- complaint: number;
1030
- unsubscribe: number;
1031
- };
1032
- progress: {
1033
- attempted: number;
1034
- recipient_estimate: number;
1035
- audience_limit: unknown;
1036
- };
1037
- providers: {
1038
- provider: string;
1039
- sent: number;
1040
- delivered: number;
1041
- opened: number;
1042
- clicked: number;
1043
- bounced: number;
1044
- complained: number;
1045
- }[];
1046
- ab_test: {
1047
- phase: string;
1200
+ created_at: string;
1201
+ updated_at: string;
1202
+ }
1203
+ interface NewslettersUnscheduleParams {
1204
+ id: string;
1205
+ }
1206
+ interface NewslettersUnscheduleResponse {
1207
+ object: "newsletter";
1208
+ id: string;
1209
+ segment_id: string;
1210
+ topic_id: string | null;
1211
+ subject: string;
1212
+ preheader: string | null;
1213
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1214
+ body: {
1215
+ format: "markdown" | "html";
1216
+ content: string;
1217
+ } | {
1218
+ format: "sections";
1219
+ content: null;
1220
+ } | {
1221
+ format: "document";
1222
+ content: null;
1223
+ blocks: {
1224
+ block_id: string;
1225
+ kind: string;
1226
+ text: string;
1227
+ }[];
1228
+ };
1229
+ audience_limit: number | null;
1230
+ scheduled_for: string | null;
1231
+ send_started_at: string | null;
1232
+ send_finished_at: string | null;
1233
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
1234
+ recipient_estimate: number | null;
1235
+ ab_test: {
1236
+ variants: {
1237
+ key: "A" | "B" | "C" | "D";
1238
+ subject: string;
1239
+ preheader: string | null;
1240
+ }[];
1048
1241
  sample_pct: number;
1049
- metric: string;
1242
+ metric: "opens" | "clicks";
1050
1243
  wait_hours: number;
1051
- winner_mode: string;
1052
- winner: unknown;
1053
- decided_at: unknown;
1054
- decided_by: unknown;
1055
- decide_at: string;
1244
+ winner_mode: "auto" | "manual";
1245
+ } | null;
1246
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1247
+ stats: {
1248
+ sent: number;
1249
+ delivered: number;
1250
+ opened: number;
1251
+ clicked: number;
1252
+ bounced: number;
1253
+ complained: number;
1254
+ unsubscribed: number;
1255
+ };
1256
+ created_at: string;
1257
+ updated_at: string;
1258
+ }
1259
+ interface NewslettersPauseParams {
1260
+ id: string;
1261
+ }
1262
+ interface NewslettersPauseResponse {
1263
+ object: "newsletter";
1264
+ id: string;
1265
+ segment_id: string;
1266
+ topic_id: string | null;
1267
+ subject: string;
1268
+ preheader: string | null;
1269
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1270
+ body: {
1271
+ format: "markdown" | "html";
1272
+ content: string;
1273
+ } | {
1274
+ format: "sections";
1275
+ content: null;
1276
+ } | {
1277
+ format: "document";
1278
+ content: null;
1279
+ blocks: {
1280
+ block_id: string;
1281
+ kind: string;
1282
+ text: string;
1283
+ }[];
1284
+ };
1285
+ audience_limit: number | null;
1286
+ scheduled_for: string | null;
1287
+ send_started_at: string | null;
1288
+ send_finished_at: string | null;
1289
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
1290
+ recipient_estimate: number | null;
1291
+ ab_test: {
1056
1292
  variants: {
1057
- key: string;
1293
+ key: "A" | "B" | "C" | "D";
1294
+ subject: string;
1295
+ preheader: string | null;
1296
+ }[];
1297
+ sample_pct: number;
1298
+ metric: "opens" | "clicks";
1299
+ wait_hours: number;
1300
+ winner_mode: "auto" | "manual";
1301
+ } | null;
1302
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1303
+ stats: {
1304
+ sent: number;
1305
+ delivered: number;
1306
+ opened: number;
1307
+ clicked: number;
1308
+ bounced: number;
1309
+ complained: number;
1310
+ unsubscribed: number;
1311
+ };
1312
+ created_at: string;
1313
+ updated_at: string;
1314
+ }
1315
+ interface NewslettersResumeParams {
1316
+ id: string;
1317
+ }
1318
+ interface NewslettersResumeResponse {
1319
+ object: "newsletter";
1320
+ id: string;
1321
+ segment_id: string;
1322
+ topic_id: string | null;
1323
+ subject: string;
1324
+ preheader: string | null;
1325
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1326
+ body: {
1327
+ format: "markdown" | "html";
1328
+ content: string;
1329
+ } | {
1330
+ format: "sections";
1331
+ content: null;
1332
+ } | {
1333
+ format: "document";
1334
+ content: null;
1335
+ blocks: {
1336
+ block_id: string;
1337
+ kind: string;
1338
+ text: string;
1339
+ }[];
1340
+ };
1341
+ audience_limit: number | null;
1342
+ scheduled_for: string | null;
1343
+ send_started_at: string | null;
1344
+ send_finished_at: string | null;
1345
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
1346
+ recipient_estimate: number | null;
1347
+ ab_test: {
1348
+ variants: {
1349
+ key: "A" | "B" | "C" | "D";
1350
+ subject: string;
1351
+ preheader: string | null;
1352
+ }[];
1353
+ sample_pct: number;
1354
+ metric: "opens" | "clicks";
1355
+ wait_hours: number;
1356
+ winner_mode: "auto" | "manual";
1357
+ } | null;
1358
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1359
+ stats: {
1360
+ sent: number;
1361
+ delivered: number;
1362
+ opened: number;
1363
+ clicked: number;
1364
+ bounced: number;
1365
+ complained: number;
1366
+ unsubscribed: number;
1367
+ };
1368
+ created_at: string;
1369
+ updated_at: string;
1370
+ }
1371
+ type NewslettersSendMoreParams = {
1372
+ id: string;
1373
+ } & {
1374
+ /**
1375
+ * How many of the next most engaged contacts to add.
1376
+ */
1377
+ count: number;
1378
+ };
1379
+ interface NewslettersSendMoreResponse {
1380
+ object: "newsletter";
1381
+ id: string;
1382
+ segment_id: string;
1383
+ topic_id: string | null;
1384
+ subject: string;
1385
+ preheader: string | null;
1386
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1387
+ body: {
1388
+ format: "markdown" | "html";
1389
+ content: string;
1390
+ } | {
1391
+ format: "sections";
1392
+ content: null;
1393
+ } | {
1394
+ format: "document";
1395
+ content: null;
1396
+ blocks: {
1397
+ block_id: string;
1398
+ kind: string;
1399
+ text: string;
1400
+ }[];
1401
+ };
1402
+ audience_limit: number | null;
1403
+ scheduled_for: string | null;
1404
+ send_started_at: string | null;
1405
+ send_finished_at: string | null;
1406
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
1407
+ recipient_estimate: number | null;
1408
+ ab_test: {
1409
+ variants: {
1410
+ key: "A" | "B" | "C" | "D";
1411
+ subject: string;
1412
+ preheader: string | null;
1413
+ }[];
1414
+ sample_pct: number;
1415
+ metric: "opens" | "clicks";
1416
+ wait_hours: number;
1417
+ winner_mode: "auto" | "manual";
1418
+ } | null;
1419
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1420
+ stats: {
1421
+ sent: number;
1422
+ delivered: number;
1423
+ opened: number;
1424
+ clicked: number;
1425
+ bounced: number;
1426
+ complained: number;
1427
+ unsubscribed: number;
1428
+ };
1429
+ created_at: string;
1430
+ updated_at: string;
1431
+ }
1432
+ interface NewslettersReportParams {
1433
+ id: string;
1434
+ }
1435
+ interface NewslettersReportResponse {
1436
+ object: "report";
1437
+ id: string;
1438
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1439
+ totals: {
1440
+ sent: number;
1441
+ delivered: number;
1442
+ opened: number;
1443
+ clicked: number;
1444
+ bounced: number;
1445
+ complained: number;
1446
+ unsubscribed: number;
1447
+ };
1448
+ rates: {
1449
+ delivery: number;
1450
+ open: number;
1451
+ click: number;
1452
+ bounce: number;
1453
+ complaint: number;
1454
+ unsubscribe: number;
1455
+ };
1456
+ progress: {
1457
+ attempted: number | null;
1458
+ recipient_estimate: number | null;
1459
+ audience_limit: number | null;
1460
+ };
1461
+ providers: {
1462
+ provider: "gmail" | "microsoft" | "yahoo" | "apple" | "fr_isp" | "gmx" | "proton" | "other";
1463
+ sent: number;
1464
+ delivered: number;
1465
+ opened: number;
1466
+ clicked: number;
1467
+ bounced: number;
1468
+ complained: number;
1469
+ }[];
1470
+ ab_test: {
1471
+ phase: ("testing" | "waiting" | "winner") | null;
1472
+ sample_pct: number;
1473
+ metric: "opens" | "clicks";
1474
+ wait_hours: number;
1475
+ winner_mode: "auto" | "manual";
1476
+ winner: ("A" | "B" | "C" | "D") | null;
1477
+ decided_at: string | null;
1478
+ decided_by: ("auto" | "manual" | "fallback" | "skipped") | null;
1479
+ decide_at: string | null;
1480
+ variants: {
1481
+ key: "A" | "B" | "C" | "D";
1058
1482
  subject: string;
1059
- preheader: string;
1483
+ preheader: string | null;
1060
1484
  total: {
1061
1485
  attempted: number;
1062
1486
  sent: number;
@@ -1069,13 +1493,9 @@ type NewslettersReportResponse = {
1069
1493
  };
1070
1494
  }[];
1071
1495
  report: {
1072
- metric: string;
1073
- leader: string;
1074
- winner: unknown;
1075
- p_value: number;
1076
- significant: boolean;
1496
+ metric: "opens" | "clicks";
1077
1497
  variants: {
1078
- variant: string;
1498
+ variant: "A" | "B" | "C" | "D";
1079
1499
  sent: number;
1080
1500
  opened: number;
1081
1501
  clicked: number;
@@ -1085,17 +1505,21 @@ type NewslettersReportResponse = {
1085
1505
  ci_high: number;
1086
1506
  leader: boolean;
1087
1507
  }[];
1508
+ leader: "A" | "B" | "C" | "D";
1509
+ winner: ("A" | "B" | "C" | "D") | null;
1510
+ p_value: number;
1511
+ significant: boolean;
1088
1512
  };
1089
- };
1513
+ } | null;
1090
1514
  links: {
1091
1515
  url: string;
1092
- label: string;
1516
+ label: string | null;
1093
1517
  clicks: number;
1094
1518
  unique_clickers: number;
1095
1519
  share: number;
1096
1520
  }[];
1097
1521
  links_total: number;
1098
- };
1522
+ }
1099
1523
  type NewslettersAbWinnerParams = {
1100
1524
  id: string;
1101
1525
  } & {
@@ -1104,32 +1528,59 @@ type NewslettersAbWinnerParams = {
1104
1528
  */
1105
1529
  variant: "A" | "B" | "C" | "D";
1106
1530
  };
1107
- type NewslettersAbWinnerResponse = {
1108
- object: string;
1531
+ interface NewslettersAbWinnerResponse {
1532
+ object: "newsletter";
1109
1533
  id: string;
1110
1534
  segment_id: string;
1111
- topic_id: unknown;
1535
+ topic_id: string | null;
1112
1536
  subject: string;
1113
- preheader: string;
1114
- status: string;
1537
+ preheader: string | null;
1538
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1115
1539
  body: {
1116
- format: string;
1117
- content: unknown;
1540
+ format: "markdown" | "html";
1541
+ content: string;
1542
+ } | {
1543
+ format: "sections";
1544
+ content: null;
1545
+ } | {
1546
+ format: "document";
1547
+ content: null;
1118
1548
  blocks: {
1119
- blockId: string;
1549
+ block_id: string;
1120
1550
  kind: string;
1121
1551
  text: string;
1122
1552
  }[];
1123
1553
  };
1124
- audience_limit: unknown;
1125
- scheduled_for: unknown;
1126
- pause_reason: unknown;
1127
- recipient_estimate: unknown;
1128
- ab_test: unknown;
1129
- ab_winner: string;
1554
+ audience_limit: number | null;
1555
+ scheduled_for: string | null;
1556
+ send_started_at: string | null;
1557
+ send_finished_at: string | null;
1558
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate") | null;
1559
+ recipient_estimate: number | null;
1560
+ ab_test: {
1561
+ variants: {
1562
+ key: "A" | "B" | "C" | "D";
1563
+ subject: string;
1564
+ preheader: string | null;
1565
+ }[];
1566
+ sample_pct: number;
1567
+ metric: "opens" | "clicks";
1568
+ wait_hours: number;
1569
+ winner_mode: "auto" | "manual";
1570
+ } | null;
1571
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1572
+ stats: {
1573
+ sent: number;
1574
+ delivered: number;
1575
+ opened: number;
1576
+ clicked: number;
1577
+ bounced: number;
1578
+ complained: number;
1579
+ unsubscribed: number;
1580
+ };
1130
1581
  created_at: string;
1131
1582
  updated_at: string;
1132
- };
1583
+ }
1133
1584
  interface ContactsListParams {
1134
1585
  /**
1135
1586
  * 1–100, default 20.
@@ -1154,17 +1605,36 @@ interface ContactsListParams {
1154
1605
  */
1155
1606
  tag?: string;
1156
1607
  }
1157
- type ContactsListResponse = {
1158
- object: string;
1608
+ interface ContactsListResponse {
1609
+ object: "list";
1159
1610
  has_more: boolean;
1160
1611
  data: {
1161
- object: string;
1612
+ object: "contact";
1162
1613
  id: string;
1163
1614
  email: string;
1164
- status: string;
1615
+ name: string | null;
1616
+ first_name: string | null;
1617
+ last_name: string | null;
1618
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1165
1619
  segment_id: string;
1620
+ language: string | null;
1621
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1622
+ subscribed_at: string | null;
1623
+ unsubscribed_at: string | null;
1624
+ created_at: string;
1625
+ custom_fields: {
1626
+ [k: string]: string | number | boolean;
1627
+ };
1628
+ tags: string[];
1629
+ engagement: {
1630
+ emails_sent: number;
1631
+ emails_opened: number;
1632
+ emails_clicked: number;
1633
+ last_opened_at: string | null;
1634
+ last_clicked_at: string | null;
1635
+ };
1166
1636
  }[];
1167
- };
1637
+ }
1168
1638
  interface ContactsCreateParams {
1169
1639
  email: string;
1170
1640
  /**
@@ -1189,13 +1659,33 @@ interface ContactsCreateParams {
1189
1659
  */
1190
1660
  tags?: string[];
1191
1661
  }
1192
- type ContactsCreateResponse = {
1193
- object: string;
1662
+ interface ContactsCreateResponse {
1663
+ object: "contact";
1194
1664
  id: string;
1195
1665
  email: string;
1196
- status: string;
1666
+ name: string | null;
1667
+ first_name: string | null;
1668
+ last_name: string | null;
1669
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1670
+ segment_id: string;
1671
+ language: string | null;
1672
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1673
+ subscribed_at: string | null;
1674
+ unsubscribed_at: string | null;
1675
+ created_at: string;
1676
+ custom_fields: {
1677
+ [k: string]: string | number | boolean;
1678
+ };
1679
+ tags: string[];
1680
+ engagement: {
1681
+ emails_sent: number;
1682
+ emails_opened: number;
1683
+ emails_clicked: number;
1684
+ last_opened_at: string | null;
1685
+ last_clicked_at: string | null;
1686
+ };
1197
1687
  existed: boolean;
1198
- };
1688
+ }
1199
1689
  interface ContactsImportParams {
1200
1690
  segmentId?: string;
1201
1691
  /**
@@ -1240,13 +1730,14 @@ interface ContactsImportParams {
1240
1730
  unsubscribedAt?: string | null;
1241
1731
  }[];
1242
1732
  }
1243
- type ContactsImportResponse = {
1244
- object: string;
1733
+ interface ContactsImportResponse {
1734
+ object: "import";
1245
1735
  total: number;
1246
1736
  inserted: number;
1247
1737
  rejected: number;
1248
1738
  reasons: {
1249
- invalid: number;
1739
+ invalid_syntax: number;
1740
+ source_unsubscribed: number;
1250
1741
  typo: number;
1251
1742
  spam_trap: number;
1252
1743
  role: number;
@@ -1259,11 +1750,18 @@ type ContactsImportResponse = {
1259
1750
  rejected_rows: {
1260
1751
  line: number;
1261
1752
  email: string;
1262
- reason: string;
1753
+ reason: "invalid_syntax" | "source_unsubscribed" | "typo" | "spam_trap" | "role" | "disposable" | "no_mx" | "duplicate" | "suppressed" | "capped";
1263
1754
  suggestion?: string;
1264
1755
  }[];
1756
+ report_truncated: boolean;
1757
+ engagement_imported: number;
1758
+ capped: boolean;
1759
+ remaining_capacity: number | null;
1265
1760
  pending_review: boolean;
1266
- };
1761
+ verifying: boolean;
1762
+ tagged: number;
1763
+ unsubscribed: number;
1764
+ }
1267
1765
  interface ContactsExportParams {
1268
1766
  segmentId?: string;
1269
1767
  status?: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
@@ -1272,49 +1770,106 @@ type ContactsExportResponse = string;
1272
1770
  interface ContactsGetParams {
1273
1771
  id: string;
1274
1772
  }
1275
- type ContactsGetResponse = {
1276
- object: string;
1773
+ interface ContactsGetResponse {
1774
+ object: "contact";
1277
1775
  id: string;
1278
1776
  email: string;
1279
- status: string;
1777
+ name: string | null;
1778
+ first_name: string | null;
1779
+ last_name: string | null;
1780
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1781
+ segment_id: string;
1782
+ language: string | null;
1783
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1784
+ subscribed_at: string | null;
1785
+ unsubscribed_at: string | null;
1786
+ created_at: string;
1787
+ custom_fields: {
1788
+ [k: string]: string | number | boolean;
1789
+ };
1790
+ tags: string[];
1280
1791
  engagement: {
1281
1792
  emails_sent: number;
1282
1793
  emails_opened: number;
1283
1794
  emails_clicked: number;
1795
+ last_opened_at: string | null;
1796
+ last_clicked_at: string | null;
1284
1797
  };
1285
1798
  status_history: {
1286
1799
  at: string;
1287
- from_status: string;
1288
- to_status: string;
1289
- source: string;
1800
+ from_status: ("active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant") | null;
1801
+ to_status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1802
+ source: "signup" | "confirm" | "unsubscribe_link" | "list_unsubscribe" | "bounce" | "complaint" | "dormant_cleanup" | "keep_click" | "suppression_expired" | "import" | "import_verification" | "admin" | "dashboard" | "api" | "mcp" | "resubscribe" | "commerce" | "integration" | "unknown";
1290
1803
  actor: string;
1291
- detail: unknown;
1804
+ detail: string | null;
1292
1805
  }[];
1293
- };
1806
+ }
1294
1807
  interface ContactsUnsubscribeParams {
1295
1808
  id: string;
1296
1809
  }
1297
- type ContactsUnsubscribeResponse = {
1298
- object: string;
1810
+ interface ContactsUnsubscribeResponse {
1811
+ object: "contact";
1299
1812
  id: string;
1300
- status: string;
1301
- };
1813
+ email: string;
1814
+ name: string | null;
1815
+ first_name: string | null;
1816
+ last_name: string | null;
1817
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1818
+ segment_id: string;
1819
+ language: string | null;
1820
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1821
+ subscribed_at: string | null;
1822
+ unsubscribed_at: string | null;
1823
+ created_at: string;
1824
+ custom_fields: {
1825
+ [k: string]: string | number | boolean;
1826
+ };
1827
+ tags: string[];
1828
+ engagement: {
1829
+ emails_sent: number;
1830
+ emails_opened: number;
1831
+ emails_clicked: number;
1832
+ last_opened_at: string | null;
1833
+ last_clicked_at: string | null;
1834
+ };
1835
+ }
1302
1836
  interface ContactsReactivateParams {
1303
1837
  id: string;
1304
1838
  }
1305
- type ContactsReactivateResponse = {
1306
- object: string;
1839
+ interface ContactsReactivateResponse {
1840
+ object: "contact";
1307
1841
  id: string;
1308
- status: string;
1309
- };
1842
+ email: string;
1843
+ name: string | null;
1844
+ first_name: string | null;
1845
+ last_name: string | null;
1846
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1847
+ segment_id: string;
1848
+ language: string | null;
1849
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1850
+ subscribed_at: string | null;
1851
+ unsubscribed_at: string | null;
1852
+ created_at: string;
1853
+ custom_fields: {
1854
+ [k: string]: string | number | boolean;
1855
+ };
1856
+ tags: string[];
1857
+ engagement: {
1858
+ emails_sent: number;
1859
+ emails_opened: number;
1860
+ emails_clicked: number;
1861
+ last_opened_at: string | null;
1862
+ last_clicked_at: string | null;
1863
+ };
1864
+ }
1310
1865
  interface ContactsRemoveParams {
1311
1866
  id: string;
1312
1867
  }
1313
- type ContactsRemoveResponse = {
1314
- object: string;
1868
+ interface ContactsRemoveResponse {
1869
+ object: "contact";
1315
1870
  id: string;
1316
- deleted: boolean;
1317
- };
1871
+ deleted: true;
1872
+ }
1318
1873
  type ContactsUpdateParams = {
1319
1874
  id: string;
1320
1875
  } & {
@@ -1341,31 +1896,49 @@ type ContactsUpdateParams = {
1341
1896
  */
1342
1897
  removeTags?: string[];
1343
1898
  };
1344
- type ContactsUpdateResponse = {
1345
- object: string;
1899
+ interface ContactsUpdateResponse {
1900
+ object: "contact";
1346
1901
  id: string;
1347
- first_name: string;
1902
+ email: string;
1903
+ name: string | null;
1904
+ first_name: string | null;
1905
+ last_name: string | null;
1906
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1907
+ segment_id: string;
1908
+ language: string | null;
1909
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1910
+ subscribed_at: string | null;
1911
+ unsubscribed_at: string | null;
1912
+ created_at: string;
1348
1913
  custom_fields: {
1349
- plan: string;
1914
+ [k: string]: string | number | boolean;
1350
1915
  };
1351
- };
1916
+ tags: string[];
1917
+ engagement: {
1918
+ emails_sent: number;
1919
+ emails_opened: number;
1920
+ emails_clicked: number;
1921
+ last_opened_at: string | null;
1922
+ last_clicked_at: string | null;
1923
+ };
1924
+ }
1352
1925
  type ContactFieldsListParams = Record<string, never>;
1353
- type ContactFieldsListResponse = {
1354
- object: string;
1926
+ interface ContactFieldsListResponse {
1927
+ object: "list";
1355
1928
  has_more: boolean;
1356
1929
  data: {
1357
- object: string;
1930
+ object: "contact_field";
1358
1931
  id: string;
1359
1932
  key: string;
1360
1933
  label: string;
1361
- type: string;
1362
- options: string[];
1363
- default_value: unknown;
1934
+ type: "text" | "number" | "date" | "boolean" | "choice";
1935
+ options: string[] | null;
1936
+ default_value: (string | number | boolean) | null;
1364
1937
  in_signup: boolean;
1365
1938
  position: number;
1366
1939
  created_at: string;
1367
1940
  }[];
1368
- };
1941
+ }
1369
1942
  interface ContactFieldsCreateParams {
1370
1943
  /**
1371
1944
  * Lowercase letters, digits, `_`. Used as `{{custom.<key>}}`. Immutable.
@@ -1389,18 +1962,18 @@ interface ContactFieldsCreateParams {
1389
1962
  */
1390
1963
  inSignup?: boolean;
1391
1964
  }
1392
- type ContactFieldsCreateResponse = {
1393
- object: string;
1965
+ interface ContactFieldsCreateResponse {
1966
+ object: "contact_field";
1394
1967
  id: string;
1395
1968
  key: string;
1396
1969
  label: string;
1397
- type: string;
1398
- options: string[];
1399
- default_value: unknown;
1970
+ type: "text" | "number" | "date" | "boolean" | "choice";
1971
+ options: string[] | null;
1972
+ default_value: (string | number | boolean) | null;
1400
1973
  in_signup: boolean;
1401
1974
  position: number;
1402
1975
  created_at: string;
1403
- };
1976
+ }
1404
1977
  type ContactFieldsUpdateParams = {
1405
1978
  id: string;
1406
1979
  } & {
@@ -1410,26 +1983,26 @@ type ContactFieldsUpdateParams = {
1410
1983
  inSignup?: boolean;
1411
1984
  position?: number;
1412
1985
  };
1413
- type ContactFieldsUpdateResponse = {
1414
- object: string;
1986
+ interface ContactFieldsUpdateResponse {
1987
+ object: "contact_field";
1415
1988
  id: string;
1416
1989
  key: string;
1417
1990
  label: string;
1418
- type: string;
1419
- options: string[];
1420
- default_value: unknown;
1991
+ type: "text" | "number" | "date" | "boolean" | "choice";
1992
+ options: string[] | null;
1993
+ default_value: (string | number | boolean) | null;
1421
1994
  in_signup: boolean;
1422
1995
  position: number;
1423
1996
  created_at: string;
1424
- };
1997
+ }
1425
1998
  interface ContactFieldsRemoveParams {
1426
1999
  id: string;
1427
2000
  }
1428
- type ContactFieldsRemoveResponse = {
1429
- object: string;
2001
+ interface ContactFieldsRemoveResponse {
2002
+ object: "contact_field";
1430
2003
  id: string;
1431
- deleted: boolean;
1432
- };
2004
+ deleted: true;
2005
+ }
1433
2006
  interface EventsSendParams {
1434
2007
  /**
1435
2008
  * Give `email` or `contact_id`.
@@ -1459,18 +2032,17 @@ interface EventsSendParams {
1459
2032
  */
1460
2033
  segmentId?: string;
1461
2034
  }
1462
- type EventsSendResponse = {
1463
- object: string;
2035
+ interface EventsSendResponse {
2036
+ object: "event";
1464
2037
  id: string;
1465
2038
  email: string;
1466
2039
  event: string;
1467
2040
  properties: {
1468
- plan: string;
1469
- amount: number;
2041
+ [k: string]: unknown;
1470
2042
  };
1471
2043
  occurred_at: string;
1472
2044
  contact_created: boolean;
1473
- };
2045
+ }
1474
2046
  interface AudienceFiltersListParams {
1475
2047
  /**
1476
2048
  * 1–100, default 20.
@@ -1485,28 +2057,21 @@ interface AudienceFiltersListParams {
1485
2057
  */
1486
2058
  before?: string;
1487
2059
  }
1488
- type AudienceFiltersListResponse = {
1489
- object: string;
2060
+ interface AudienceFiltersListResponse {
2061
+ object: "list";
1490
2062
  has_more: boolean;
1491
2063
  data: {
1492
- object: string;
2064
+ object: "audience_filter";
1493
2065
  id: string;
1494
2066
  name: string;
1495
- description: unknown;
2067
+ description: string | null;
1496
2068
  rules: {
1497
- op: string;
1498
- rules: {
1499
- field?: string;
1500
- op: string;
1501
- value?: string;
1502
- event?: string;
1503
- within_days?: number;
1504
- }[];
2069
+ [k: string]: unknown;
1505
2070
  };
1506
2071
  created_at: string;
1507
2072
  updated_at: string;
1508
2073
  }[];
1509
- };
2074
+ }
1510
2075
  interface AudienceFiltersCreateParams {
1511
2076
  name: string;
1512
2077
  description?: string | null;
@@ -1517,45 +2082,31 @@ interface AudienceFiltersCreateParams {
1517
2082
  [k: string]: unknown;
1518
2083
  };
1519
2084
  }
1520
- type AudienceFiltersCreateResponse = {
1521
- object: string;
2085
+ interface AudienceFiltersCreateResponse {
2086
+ object: "audience_filter";
1522
2087
  id: string;
1523
2088
  name: string;
1524
- description: unknown;
2089
+ description: string | null;
1525
2090
  rules: {
1526
- op: string;
1527
- rules: {
1528
- field?: string;
1529
- op: string;
1530
- value?: string;
1531
- event?: string;
1532
- within_days?: number;
1533
- }[];
2091
+ [k: string]: unknown;
1534
2092
  };
1535
2093
  created_at: string;
1536
2094
  updated_at: string;
1537
- };
2095
+ }
1538
2096
  interface AudienceFiltersGetParams {
1539
2097
  id: string;
1540
2098
  }
1541
- type AudienceFiltersGetResponse = {
1542
- object: string;
2099
+ interface AudienceFiltersGetResponse {
2100
+ object: "audience_filter";
1543
2101
  id: string;
1544
2102
  name: string;
1545
- description: unknown;
2103
+ description: string | null;
1546
2104
  rules: {
1547
- op: string;
1548
- rules: {
1549
- field?: string;
1550
- op: string;
1551
- value?: string;
1552
- event?: string;
1553
- within_days?: number;
1554
- }[];
2105
+ [k: string]: unknown;
1555
2106
  };
1556
2107
  created_at: string;
1557
2108
  updated_at: string;
1558
- };
2109
+ }
1559
2110
  type AudienceFiltersUpdateParams = {
1560
2111
  id: string;
1561
2112
  } & {
@@ -1568,32 +2119,25 @@ type AudienceFiltersUpdateParams = {
1568
2119
  [k: string]: unknown;
1569
2120
  };
1570
2121
  };
1571
- type AudienceFiltersUpdateResponse = {
1572
- object: string;
2122
+ interface AudienceFiltersUpdateResponse {
2123
+ object: "audience_filter";
1573
2124
  id: string;
1574
2125
  name: string;
1575
- description: unknown;
2126
+ description: string | null;
1576
2127
  rules: {
1577
- op: string;
1578
- rules: {
1579
- field?: string;
1580
- op: string;
1581
- value?: string;
1582
- event?: string;
1583
- within_days?: number;
1584
- }[];
2128
+ [k: string]: unknown;
1585
2129
  };
1586
2130
  created_at: string;
1587
2131
  updated_at: string;
1588
- };
2132
+ }
1589
2133
  interface AudienceFiltersRemoveParams {
1590
2134
  id: string;
1591
2135
  }
1592
- type AudienceFiltersRemoveResponse = {
1593
- object: string;
2136
+ interface AudienceFiltersRemoveResponse {
2137
+ object: "audience_filter";
1594
2138
  id: string;
1595
- deleted: boolean;
1596
- };
2139
+ deleted: true;
2140
+ }
1597
2141
  interface AudienceFiltersCountParams {
1598
2142
  /**
1599
2143
  * A saved filter. Give `filter_id` or `rules`.
@@ -1610,11 +2154,11 @@ interface AudienceFiltersCountParams {
1610
2154
  */
1611
2155
  segmentId?: string;
1612
2156
  }
1613
- type AudienceFiltersCountResponse = {
1614
- object: string;
2157
+ interface AudienceFiltersCountResponse {
2158
+ object: "audience_filter_count";
1615
2159
  total: number;
1616
2160
  active: number;
1617
- };
2161
+ }
1618
2162
  interface SignupsCreateParams {
1619
2163
  email: string;
1620
2164
  name?: string;
@@ -1635,10 +2179,10 @@ interface SignupsCreateParams {
1635
2179
  [k: string]: string | number | boolean | null;
1636
2180
  };
1637
2181
  }
1638
- type SignupsCreateResponse = {
1639
- object: string;
1640
- status: string;
1641
- };
2182
+ interface SignupsCreateResponse {
2183
+ object: "signup";
2184
+ status: "pending";
2185
+ }
1642
2186
  interface SegmentsListParams {
1643
2187
  /**
1644
2188
  * 1–100, default 20.
@@ -1653,16 +2197,19 @@ interface SegmentsListParams {
1653
2197
  */
1654
2198
  before?: string;
1655
2199
  }
1656
- type SegmentsListResponse = {
1657
- object: string;
2200
+ interface SegmentsListResponse {
2201
+ object: "list";
1658
2202
  has_more: boolean;
1659
2203
  data: {
1660
- object: string;
2204
+ object: "segment";
1661
2205
  id: string;
1662
2206
  name: string;
1663
2207
  slug: string;
2208
+ language: string;
2209
+ status: "active" | "archived";
2210
+ created_at: string;
1664
2211
  }[];
1665
- };
2212
+ }
1666
2213
  interface SegmentsCreateParams {
1667
2214
  name: string;
1668
2215
  slug: string;
@@ -1670,43 +2217,55 @@ interface SegmentsCreateParams {
1670
2217
  description?: string;
1671
2218
  themes?: string[];
1672
2219
  }
1673
- type SegmentsCreateResponse = {
1674
- object: string;
2220
+ interface SegmentsCreateResponse {
2221
+ object: "segment";
1675
2222
  id: string;
1676
2223
  name: string;
1677
2224
  slug: string;
1678
- };
2225
+ language: string;
2226
+ status: "active" | "archived";
2227
+ created_at: string;
2228
+ }
1679
2229
  interface TopicsListParams {
1680
2230
  segmentId: string;
1681
2231
  }
1682
- type TopicsListResponse = {
1683
- object: string;
2232
+ interface TopicsListResponse {
2233
+ object: "list";
1684
2234
  has_more: boolean;
1685
2235
  data: {
1686
- object: string;
2236
+ object: "topic";
1687
2237
  id: string;
1688
2238
  segment_id: string;
1689
2239
  name: string;
2240
+ slug: string;
2241
+ status: "active" | "archived";
2242
+ created_at: string;
1690
2243
  }[];
1691
- };
2244
+ }
1692
2245
  interface SegmentsArchiveGetParams {
1693
2246
  id: string;
1694
2247
  }
1695
- type SegmentsArchiveGetResponse = {
1696
- object: string;
2248
+ interface SegmentsArchiveGetResponse {
2249
+ object: "archive";
1697
2250
  segment_id: string;
1698
2251
  enabled: boolean;
1699
2252
  slug: string;
1700
2253
  url: string;
1701
- custom_domain: string;
1702
- description: string;
1703
- author: string;
1704
- about: unknown;
1705
- avatar_url: unknown;
2254
+ custom_domain: string | null;
2255
+ description: string | null;
2256
+ author: string | null;
2257
+ about: string | null;
2258
+ avatar_url: string | null;
1706
2259
  links: {
1707
- x: string;
2260
+ website?: string;
2261
+ x?: string;
2262
+ linkedin?: string;
2263
+ youtube?: string;
2264
+ instagram?: string;
2265
+ github?: string;
2266
+ bluesky?: string;
1708
2267
  };
1709
- };
2268
+ }
1710
2269
  type SegmentsArchiveUpdateParams = {
1711
2270
  id: string;
1712
2271
  } & {
@@ -1744,21 +2303,27 @@ type SegmentsArchiveUpdateParams = {
1744
2303
  bluesky?: string | null;
1745
2304
  };
1746
2305
  };
1747
- type SegmentsArchiveUpdateResponse = {
1748
- object: string;
2306
+ interface SegmentsArchiveUpdateResponse {
2307
+ object: "archive";
1749
2308
  segment_id: string;
1750
2309
  enabled: boolean;
1751
2310
  slug: string;
1752
2311
  url: string;
1753
- custom_domain: string;
1754
- description: string;
1755
- author: string;
1756
- about: unknown;
1757
- avatar_url: unknown;
2312
+ custom_domain: string | null;
2313
+ description: string | null;
2314
+ author: string | null;
2315
+ about: string | null;
2316
+ avatar_url: string | null;
1758
2317
  links: {
1759
- x: string;
2318
+ website?: string;
2319
+ x?: string;
2320
+ linkedin?: string;
2321
+ youtube?: string;
2322
+ instagram?: string;
2323
+ github?: string;
2324
+ bluesky?: string;
1760
2325
  };
1761
- };
2326
+ }
1762
2327
  type NewslettersArchiveUpdateParams = {
1763
2328
  id: string;
1764
2329
  } & {
@@ -1771,32 +2336,32 @@ type NewslettersArchiveUpdateParams = {
1771
2336
  */
1772
2337
  hidden?: boolean;
1773
2338
  };
1774
- type NewslettersArchiveUpdateResponse = {
1775
- object: string;
2339
+ interface NewslettersArchiveUpdateResponse {
2340
+ object: "newsletter_archive";
1776
2341
  id: string;
1777
2342
  pinned: boolean;
1778
2343
  hidden: boolean;
1779
- };
2344
+ }
1780
2345
  interface SegmentsDomainGetParams {
1781
2346
  id: string;
1782
2347
  }
1783
- type SegmentsDomainGetResponse = {
1784
- object: string;
2348
+ interface SegmentsDomainGetResponse {
2349
+ object: "custom_domain";
1785
2350
  id: string;
1786
2351
  segment_id: string;
1787
2352
  domain: string;
1788
- status: string;
1789
- uses: string[];
2353
+ status: "pending" | "verified" | "failed";
2354
+ uses: ("tracking" | "preferences" | "archive")[];
1790
2355
  records: {
1791
2356
  type: string;
1792
2357
  name: string;
1793
2358
  value: string;
1794
2359
  }[];
1795
- last_checked_at: unknown;
1796
- verified_at: unknown;
1797
- last_error: unknown;
2360
+ last_checked_at: string | null;
2361
+ verified_at: string | null;
2362
+ last_error: string | null;
1798
2363
  created_at: string;
1799
- };
2364
+ }
1800
2365
  type SegmentsDomainSetParams = {
1801
2366
  id: string;
1802
2367
  } & {
@@ -1805,31 +2370,32 @@ type SegmentsDomainSetParams = {
1805
2370
  */
1806
2371
  domain: string;
1807
2372
  };
1808
- type SegmentsDomainSetResponse = {
1809
- object: string;
2373
+ interface SegmentsDomainSetResponse {
2374
+ object: "custom_domain";
1810
2375
  id: string;
1811
2376
  segment_id: string;
1812
2377
  domain: string;
1813
- status: string;
1814
- uses: string[];
2378
+ status: "pending" | "verified" | "failed";
2379
+ uses: ("tracking" | "preferences" | "archive")[];
1815
2380
  records: {
1816
2381
  type: string;
1817
2382
  name: string;
1818
2383
  value: string;
1819
2384
  }[];
1820
- last_checked_at: unknown;
1821
- verified_at: unknown;
1822
- last_error: unknown;
2385
+ last_checked_at: string | null;
2386
+ verified_at: string | null;
2387
+ last_error: string | null;
1823
2388
  created_at: string;
1824
- };
2389
+ }
1825
2390
  interface SegmentsDomainRemoveParams {
1826
2391
  id: string;
1827
2392
  }
1828
- type SegmentsDomainRemoveResponse = {
1829
- object: string;
2393
+ interface SegmentsDomainRemoveResponse {
2394
+ object: "custom_domain";
2395
+ id: string;
1830
2396
  segment_id: string;
1831
- deleted: boolean;
1832
- };
2397
+ deleted: true;
2398
+ }
1833
2399
  interface SuppressionsListParams {
1834
2400
  /**
1835
2401
  * 1–100, default 20.
@@ -1845,36 +2411,41 @@ interface SuppressionsListParams {
1845
2411
  before?: string;
1846
2412
  reason?: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr" | "ses_suppressed" | "soft_bounce_repeated";
1847
2413
  }
1848
- type SuppressionsListResponse = {
1849
- object: string;
2414
+ interface SuppressionsListResponse {
2415
+ object: "list";
1850
2416
  has_more: boolean;
1851
2417
  data: {
1852
- object: string;
2418
+ object: "suppression";
1853
2419
  id: string;
1854
2420
  email: string;
1855
- reason: string;
1856
- expires_at: string;
2421
+ reason: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr" | "ses_suppressed" | "soft_bounce_repeated";
2422
+ notes: string | null;
2423
+ created_at: string;
2424
+ expires_at: string | null;
1857
2425
  }[];
1858
- };
2426
+ }
1859
2427
  interface SuppressionsCreateParams {
1860
2428
  email: string;
1861
2429
  reason?: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr";
1862
2430
  notes?: string;
1863
2431
  }
1864
- type SuppressionsCreateResponse = {
1865
- object: string;
2432
+ interface SuppressionsCreateResponse {
2433
+ object: "suppression";
1866
2434
  id: string;
1867
2435
  email: string;
1868
- reason: string;
1869
- };
2436
+ reason: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr" | "ses_suppressed" | "soft_bounce_repeated";
2437
+ notes: string | null;
2438
+ created_at: string;
2439
+ expires_at: string | null;
2440
+ }
1870
2441
  interface SuppressionsRemoveParams {
1871
2442
  id: string;
1872
2443
  }
1873
- type SuppressionsRemoveResponse = {
1874
- object: string;
2444
+ interface SuppressionsRemoveResponse {
2445
+ object: "suppression";
1875
2446
  id: string;
1876
- deleted: boolean;
1877
- };
2447
+ deleted: true;
2448
+ }
1878
2449
  interface ImagesListParams {
1879
2450
  /**
1880
2451
  * 1–100, default 20.
@@ -1889,26 +2460,36 @@ interface ImagesListParams {
1889
2460
  */
1890
2461
  before?: string;
1891
2462
  }
1892
- type ImagesListResponse = {
1893
- object: string;
2463
+ interface ImagesListResponse {
2464
+ object: "list";
1894
2465
  has_more: boolean;
1895
2466
  data: {
1896
- object: string;
2467
+ object: "image";
1897
2468
  id: string;
1898
2469
  url: string;
2470
+ content_type: string | null;
2471
+ size_bytes: number | null;
2472
+ width: number | null;
2473
+ height: number | null;
2474
+ kind: "upload" | "generated_image";
2475
+ created_at: string;
1899
2476
  }[];
1900
- };
2477
+ }
1901
2478
  type ImagesCreateParams = Blob | ArrayBuffer | Uint8Array | string;
1902
- type ImagesCreateResponse = {
1903
- object: string;
2479
+ interface ImagesCreateResponse {
2480
+ object: "image";
1904
2481
  id: string;
1905
2482
  url: string;
1906
- content_type: string;
1907
- size_bytes: number;
1908
- };
2483
+ content_type: string | null;
2484
+ size_bytes: number | null;
2485
+ width: number | null;
2486
+ height: number | null;
2487
+ kind: "upload" | "generated_image";
2488
+ created_at: string;
2489
+ }
1909
2490
  type StatsOverviewParams = Record<string, never>;
1910
- type StatsOverviewResponse = {
1911
- object: string;
2491
+ interface StatsOverviewResponse {
2492
+ object: "overview";
1912
2493
  subscribers: {
1913
2494
  active: number;
1914
2495
  new_last_30_days: number;
@@ -1925,29 +2506,29 @@ type StatsOverviewResponse = {
1925
2506
  sent_last_30_days: number;
1926
2507
  newsletters_sent_last_30_days: number;
1927
2508
  };
1928
- };
2509
+ }
1929
2510
  interface DomainsCreateParams {
1930
2511
  name: string;
1931
2512
  trackingSubdomain?: string;
1932
2513
  }
1933
- type DomainsCreateResponse = {
1934
- object: string;
2514
+ interface DomainsCreateResponse {
2515
+ object: "domain";
1935
2516
  id: string;
1936
2517
  name: string;
1937
- status: string;
2518
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
1938
2519
  created_at: string;
1939
2520
  region: string;
1940
2521
  records: {
1941
- record: string;
2522
+ record: "SPF" | "DKIM" | "MX" | "TXT";
1942
2523
  name: string;
1943
- type: string;
1944
- ttl: string;
1945
- status: string;
2524
+ type: "CNAME" | "MX" | "TXT";
2525
+ ttl: "Auto";
2526
+ status: "verified" | "pending";
1946
2527
  value: string;
1947
2528
  priority?: number;
1948
2529
  }[];
1949
2530
  tracking_subdomain?: string;
1950
- };
2531
+ }
1951
2532
  interface DomainsListParams {
1952
2533
  /**
1953
2534
  * 1–100, default 20.
@@ -1962,44 +2543,44 @@ interface DomainsListParams {
1962
2543
  */
1963
2544
  before?: string;
1964
2545
  }
1965
- type DomainsListResponse = {
1966
- object: string;
2546
+ interface DomainsListResponse {
2547
+ object: "list";
1967
2548
  has_more: boolean;
1968
2549
  data: {
1969
2550
  id: string;
1970
2551
  name: string;
1971
- status: string;
2552
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
1972
2553
  created_at: string;
1973
2554
  region: string;
1974
2555
  }[];
1975
- };
2556
+ }
1976
2557
  interface DomainsGetParams {
1977
2558
  id: string;
1978
2559
  }
1979
- type DomainsGetResponse = {
1980
- object: string;
2560
+ interface DomainsGetResponse {
2561
+ object: "domain";
1981
2562
  id: string;
1982
2563
  name: string;
1983
- status: string;
2564
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
1984
2565
  created_at: string;
1985
2566
  region: string;
1986
2567
  records: {
1987
- record: string;
2568
+ record: "SPF" | "DKIM" | "MX" | "TXT";
1988
2569
  name: string;
1989
- type: string;
1990
- ttl: string;
1991
- status: string;
2570
+ type: "CNAME" | "MX" | "TXT";
2571
+ ttl: "Auto";
2572
+ status: "verified" | "pending";
1992
2573
  value: string;
1993
2574
  priority?: number;
1994
2575
  }[];
1995
- };
2576
+ }
1996
2577
  interface DomainsVerifyParams {
1997
2578
  id: string;
1998
2579
  }
1999
- type DomainsVerifyResponse = {
2000
- object: string;
2580
+ interface DomainsVerifyResponse {
2581
+ object: "domain";
2001
2582
  id: string;
2002
- };
2583
+ }
2003
2584
  interface ApiKeysCreateParams {
2004
2585
  name: string;
2005
2586
  permission?: "full_access" | "sending_access" | "signups";
@@ -2008,10 +2589,10 @@ interface ApiKeysCreateParams {
2008
2589
  */
2009
2590
  domainId?: string;
2010
2591
  }
2011
- type ApiKeysCreateResponse = {
2592
+ interface ApiKeysCreateResponse {
2012
2593
  id: string;
2013
2594
  token: string;
2014
- };
2595
+ }
2015
2596
  interface ApiKeysListParams {
2016
2597
  /**
2017
2598
  * 1–100, default 20.
@@ -2026,8 +2607,8 @@ interface ApiKeysListParams {
2026
2607
  */
2027
2608
  before?: string;
2028
2609
  }
2029
- type ApiKeysListResponse = {
2030
- object: string;
2610
+ interface ApiKeysListResponse {
2611
+ object: "list";
2031
2612
  has_more: boolean;
2032
2613
  data: {
2033
2614
  id: string;
@@ -2035,24 +2616,24 @@ type ApiKeysListResponse = {
2035
2616
  created_at: string;
2036
2617
  last_used_at: string | null;
2037
2618
  }[];
2038
- };
2619
+ }
2039
2620
  type ApiKeysUpdateParams = {
2040
2621
  id: string;
2041
2622
  } & {
2042
2623
  name: string;
2043
2624
  };
2044
- type ApiKeysUpdateResponse = {
2045
- object: string;
2625
+ interface ApiKeysUpdateResponse {
2626
+ object: "api_key";
2046
2627
  id: string;
2047
- };
2628
+ }
2048
2629
  interface ApiKeysRemoveParams {
2049
2630
  id: string;
2050
2631
  }
2051
- type ApiKeysRemoveResponse = {
2052
- object: string;
2632
+ interface ApiKeysRemoveResponse {
2633
+ object: "api_key";
2053
2634
  id: string;
2054
- deleted: boolean;
2055
- };
2635
+ deleted: true;
2636
+ }
2056
2637
  interface LogsListParams {
2057
2638
  /**
2058
2639
  * 1–100, default 20.
@@ -2067,93 +2648,224 @@ interface LogsListParams {
2067
2648
  */
2068
2649
  before?: string;
2069
2650
  }
2070
- type LogsListResponse = {
2071
- object: string;
2651
+ interface LogsListResponse {
2652
+ object: "list";
2072
2653
  has_more: boolean;
2073
2654
  data: {
2074
2655
  id: string;
2656
+ created_at: string;
2075
2657
  endpoint: string;
2076
2658
  method: string;
2077
2659
  response_status: number;
2078
- source: string;
2660
+ user_agent: string | null;
2661
+ source: "api" | "smtp";
2079
2662
  }[];
2080
- };
2663
+ }
2081
2664
  interface LogsGetParams {
2082
2665
  id: string;
2083
2666
  }
2084
- type LogsGetResponse = {
2085
- object: string;
2667
+ interface LogsGetResponse {
2668
+ object: "log";
2086
2669
  id: string;
2670
+ created_at: string;
2087
2671
  endpoint: string;
2088
- request_body: Record<string, unknown>;
2089
- response_body: Record<string, unknown>;
2090
- };
2672
+ method: string;
2673
+ response_status: number;
2674
+ user_agent: string | null;
2675
+ source: "api" | "smtp";
2676
+ request_body: unknown;
2677
+ response_body: unknown;
2678
+ email?: {
2679
+ id: string;
2680
+ last_event: string;
2681
+ created_via: "api" | "mcp" | "smtp" | "inbox";
2682
+ smtp?: {
2683
+ client_ip: string | null;
2684
+ message_id: string | null;
2685
+ };
2686
+ recipients: {
2687
+ email: string;
2688
+ type: "to" | "cc" | "bcc";
2689
+ status: "queued" | "sent" | "delivered" | "delivery_delayed" | "bounced" | "complained" | "failed" | "suppressed" | "canceled";
2690
+ reason: string | null;
2691
+ bounce_type: string | null;
2692
+ smtp_status: string | null;
2693
+ diagnostic_code: string | null;
2694
+ delay_type: string | null;
2695
+ delay_expires_at: string | null;
2696
+ last_event_at: string | null;
2697
+ }[];
2698
+ };
2699
+ }
2091
2700
  type UsageGetParams = Record<string, never>;
2092
- type UsageGetResponse = {
2093
- object: string;
2701
+ interface UsageGetResponse {
2702
+ object: "usage";
2094
2703
  emails: {
2704
+ daily: {
2705
+ used: number;
2706
+ limit: number | null;
2707
+ sent: number;
2708
+ received: number;
2709
+ resets_at: string;
2710
+ };
2095
2711
  monthly: {
2096
2712
  used: number;
2097
- limit: number;
2713
+ limit: number | null;
2714
+ overage_ceiling: number | null;
2715
+ sent: number;
2716
+ received: number;
2717
+ resets_at: string;
2098
2718
  };
2099
2719
  };
2100
2720
  contacts: {
2101
2721
  used: number;
2102
- limit: unknown;
2722
+ limit: number | null;
2103
2723
  };
2104
- };
2724
+ publications: {
2725
+ used: number;
2726
+ limit: number | null;
2727
+ };
2728
+ domains: {
2729
+ used: number;
2730
+ limit: number | null;
2731
+ };
2732
+ rate_limit: {
2733
+ limit: number;
2734
+ duration: "1000ms";
2735
+ };
2736
+ }
2105
2737
  interface SequencesListParams {
2106
2738
  /**
2107
2739
  * Archived sequences are hidden unless `true`.
2108
2740
  */
2109
2741
  includeArchived?: "true" | "false";
2110
2742
  }
2111
- type SequencesListResponse = {
2112
- object: string;
2743
+ interface SequencesListResponse {
2744
+ object: "list";
2113
2745
  has_more: boolean;
2114
2746
  data: {
2115
- object: string;
2747
+ object: "sequence";
2116
2748
  id: string;
2117
2749
  name: string;
2118
- description: unknown;
2119
- status: string;
2750
+ description: string | null;
2751
+ status: "draft" | "active" | "paused" | "archived";
2120
2752
  segment_id: string;
2121
- topic_id: unknown;
2753
+ topic_id: string | null;
2122
2754
  trigger: {
2123
- type: string;
2124
- lead_magnet_id: unknown;
2755
+ type: "subscribed";
2756
+ include_imports: boolean;
2757
+ } | {
2758
+ type: "topic_subscribed";
2759
+ topic_id: string;
2760
+ } | {
2761
+ type: "lead_magnet";
2762
+ lead_magnet_id: string | null;
2763
+ } | {
2764
+ type: "event";
2765
+ event: string;
2766
+ } | {
2767
+ type: "email_opened" | "email_clicked";
2768
+ newsletter_id: string | null;
2769
+ } | {
2770
+ type: "filter";
2771
+ filter_id: string;
2772
+ include_existing: boolean;
2773
+ } | {
2774
+ type: "manual";
2125
2775
  };
2126
2776
  reentry: {
2127
- mode: string;
2128
- days: unknown;
2777
+ mode: "once" | "always" | "after_days";
2778
+ days: number | null;
2129
2779
  };
2130
2780
  exit: {
2131
2781
  events: string[];
2132
- filter_id: unknown;
2782
+ filter_id: string | null;
2133
2783
  };
2134
- steps: {
2784
+ steps: ({
2135
2785
  id: string;
2136
- type: string;
2137
- subject?: string;
2138
- preheader?: unknown;
2139
- doc?: {
2140
- type: string;
2141
- content: unknown[];
2786
+ type: "email";
2787
+ subject: string;
2788
+ preheader: string | null;
2789
+ doc: {
2790
+ [k: string]: unknown;
2142
2791
  };
2143
- amount?: number;
2144
- unit?: string;
2145
- }[];
2792
+ } | {
2793
+ id: string;
2794
+ type: "email";
2795
+ subject: string;
2796
+ preheader: string | null;
2797
+ template_id: string;
2798
+ } | {
2799
+ id: string;
2800
+ type: "delay";
2801
+ amount: number;
2802
+ unit: "minutes" | "hours" | "days";
2803
+ } | {
2804
+ id: string;
2805
+ type: "delay";
2806
+ until: {
2807
+ time: string;
2808
+ weekdays?: number[];
2809
+ timezone: "contact" | "newsletter";
2810
+ };
2811
+ } | {
2812
+ id: string;
2813
+ type: "wait_event";
2814
+ event: string;
2815
+ timeout_hours: number;
2816
+ on_timeout: "continue" | "exit";
2817
+ } | {
2818
+ id: string;
2819
+ type: "condition";
2820
+ filter_id: string;
2821
+ yes: {
2822
+ [k: string]: unknown;
2823
+ }[];
2824
+ no: {
2825
+ [k: string]: unknown;
2826
+ }[];
2827
+ } | {
2828
+ id: string;
2829
+ type: "condition";
2830
+ rule: {
2831
+ [k: string]: unknown;
2832
+ };
2833
+ yes: {
2834
+ [k: string]: unknown;
2835
+ }[];
2836
+ no: {
2837
+ [k: string]: unknown;
2838
+ }[];
2839
+ } | {
2840
+ id: string;
2841
+ type: "update_contact";
2842
+ action: "set_field";
2843
+ key: string;
2844
+ value: (string | number | boolean) | null;
2845
+ } | {
2846
+ id: string;
2847
+ type: "update_contact";
2848
+ action: "subscribe_topic" | "unsubscribe_topic";
2849
+ topic_id: string;
2850
+ } | {
2851
+ id: string;
2852
+ type: "webhook";
2853
+ webhook_id: string;
2854
+ } | {
2855
+ id: string;
2856
+ type: "exit";
2857
+ })[];
2146
2858
  published_version: {
2147
2859
  id: string;
2148
- number: number;
2149
- };
2860
+ number: number | null;
2861
+ } | null;
2150
2862
  has_unpublished_changes: boolean;
2151
- activated_at: string;
2152
- archived_at: unknown;
2863
+ activated_at: string | null;
2864
+ archived_at: string | null;
2153
2865
  created_at: string;
2154
2866
  updated_at: string;
2155
2867
  }[];
2156
- };
2868
+ }
2157
2869
  interface SequencesCreateParams {
2158
2870
  name: string;
2159
2871
  description?: string | null;
@@ -2325,90 +3037,253 @@ interface SequencesCreateParams {
2325
3037
  [k: string]: unknown;
2326
3038
  }[];
2327
3039
  }
2328
- type SequencesCreateResponse = {
2329
- object: string;
3040
+ interface SequencesCreateResponse {
3041
+ object: "sequence";
2330
3042
  id: string;
2331
3043
  name: string;
2332
- description: unknown;
2333
- status: string;
3044
+ description: string | null;
3045
+ status: "draft" | "active" | "paused" | "archived";
2334
3046
  segment_id: string;
2335
- topic_id: unknown;
3047
+ topic_id: string | null;
2336
3048
  trigger: {
2337
- type: string;
2338
- lead_magnet_id: unknown;
3049
+ type: "subscribed";
3050
+ include_imports: boolean;
3051
+ } | {
3052
+ type: "topic_subscribed";
3053
+ topic_id: string;
3054
+ } | {
3055
+ type: "lead_magnet";
3056
+ lead_magnet_id: string | null;
3057
+ } | {
3058
+ type: "event";
3059
+ event: string;
3060
+ } | {
3061
+ type: "email_opened" | "email_clicked";
3062
+ newsletter_id: string | null;
3063
+ } | {
3064
+ type: "filter";
3065
+ filter_id: string;
3066
+ include_existing: boolean;
3067
+ } | {
3068
+ type: "manual";
2339
3069
  };
2340
3070
  reentry: {
2341
- mode: string;
2342
- days: unknown;
3071
+ mode: "once" | "always" | "after_days";
3072
+ days: number | null;
2343
3073
  };
2344
3074
  exit: {
2345
3075
  events: string[];
2346
- filter_id: unknown;
3076
+ filter_id: string | null;
2347
3077
  };
2348
- steps: {
3078
+ steps: ({
2349
3079
  id: string;
2350
- type: string;
2351
- subject?: string;
2352
- preheader?: unknown;
2353
- doc?: {
2354
- type: string;
2355
- content: unknown[];
3080
+ type: "email";
3081
+ subject: string;
3082
+ preheader: string | null;
3083
+ doc: {
3084
+ [k: string]: unknown;
2356
3085
  };
2357
- amount?: number;
2358
- unit?: string;
2359
- }[];
2360
- published_version: unknown;
3086
+ } | {
3087
+ id: string;
3088
+ type: "email";
3089
+ subject: string;
3090
+ preheader: string | null;
3091
+ template_id: string;
3092
+ } | {
3093
+ id: string;
3094
+ type: "delay";
3095
+ amount: number;
3096
+ unit: "minutes" | "hours" | "days";
3097
+ } | {
3098
+ id: string;
3099
+ type: "delay";
3100
+ until: {
3101
+ time: string;
3102
+ weekdays?: number[];
3103
+ timezone: "contact" | "newsletter";
3104
+ };
3105
+ } | {
3106
+ id: string;
3107
+ type: "wait_event";
3108
+ event: string;
3109
+ timeout_hours: number;
3110
+ on_timeout: "continue" | "exit";
3111
+ } | {
3112
+ id: string;
3113
+ type: "condition";
3114
+ filter_id: string;
3115
+ yes: {
3116
+ [k: string]: unknown;
3117
+ }[];
3118
+ no: {
3119
+ [k: string]: unknown;
3120
+ }[];
3121
+ } | {
3122
+ id: string;
3123
+ type: "condition";
3124
+ rule: {
3125
+ [k: string]: unknown;
3126
+ };
3127
+ yes: {
3128
+ [k: string]: unknown;
3129
+ }[];
3130
+ no: {
3131
+ [k: string]: unknown;
3132
+ }[];
3133
+ } | {
3134
+ id: string;
3135
+ type: "update_contact";
3136
+ action: "set_field";
3137
+ key: string;
3138
+ value: (string | number | boolean) | null;
3139
+ } | {
3140
+ id: string;
3141
+ type: "update_contact";
3142
+ action: "subscribe_topic" | "unsubscribe_topic";
3143
+ topic_id: string;
3144
+ } | {
3145
+ id: string;
3146
+ type: "webhook";
3147
+ webhook_id: string;
3148
+ } | {
3149
+ id: string;
3150
+ type: "exit";
3151
+ })[];
3152
+ published_version: {
3153
+ id: string;
3154
+ number: number | null;
3155
+ } | null;
2361
3156
  has_unpublished_changes: boolean;
2362
- activated_at: string;
2363
- archived_at: unknown;
3157
+ activated_at: string | null;
3158
+ archived_at: string | null;
2364
3159
  created_at: string;
2365
3160
  updated_at: string;
2366
- };
3161
+ }
2367
3162
  interface SequencesGetParams {
2368
3163
  id: string;
2369
3164
  }
2370
- type SequencesGetResponse = {
2371
- object: string;
3165
+ interface SequencesGetResponse {
3166
+ object: "sequence";
2372
3167
  id: string;
2373
3168
  name: string;
2374
- description: unknown;
2375
- status: string;
3169
+ description: string | null;
3170
+ status: "draft" | "active" | "paused" | "archived";
2376
3171
  segment_id: string;
2377
- topic_id: unknown;
3172
+ topic_id: string | null;
2378
3173
  trigger: {
2379
- type: string;
2380
- lead_magnet_id: unknown;
3174
+ type: "subscribed";
3175
+ include_imports: boolean;
3176
+ } | {
3177
+ type: "topic_subscribed";
3178
+ topic_id: string;
3179
+ } | {
3180
+ type: "lead_magnet";
3181
+ lead_magnet_id: string | null;
3182
+ } | {
3183
+ type: "event";
3184
+ event: string;
3185
+ } | {
3186
+ type: "email_opened" | "email_clicked";
3187
+ newsletter_id: string | null;
3188
+ } | {
3189
+ type: "filter";
3190
+ filter_id: string;
3191
+ include_existing: boolean;
3192
+ } | {
3193
+ type: "manual";
2381
3194
  };
2382
3195
  reentry: {
2383
- mode: string;
2384
- days: unknown;
3196
+ mode: "once" | "always" | "after_days";
3197
+ days: number | null;
2385
3198
  };
2386
3199
  exit: {
2387
3200
  events: string[];
2388
- filter_id: unknown;
3201
+ filter_id: string | null;
2389
3202
  };
2390
- steps: {
3203
+ steps: ({
3204
+ id: string;
3205
+ type: "email";
3206
+ subject: string;
3207
+ preheader: string | null;
3208
+ doc: {
3209
+ [k: string]: unknown;
3210
+ };
3211
+ } | {
3212
+ id: string;
3213
+ type: "email";
3214
+ subject: string;
3215
+ preheader: string | null;
3216
+ template_id: string;
3217
+ } | {
3218
+ id: string;
3219
+ type: "delay";
3220
+ amount: number;
3221
+ unit: "minutes" | "hours" | "days";
3222
+ } | {
3223
+ id: string;
3224
+ type: "delay";
3225
+ until: {
3226
+ time: string;
3227
+ weekdays?: number[];
3228
+ timezone: "contact" | "newsletter";
3229
+ };
3230
+ } | {
2391
3231
  id: string;
2392
- type: string;
2393
- subject?: string;
2394
- preheader?: unknown;
2395
- doc?: {
2396
- type: string;
2397
- content: unknown[];
3232
+ type: "wait_event";
3233
+ event: string;
3234
+ timeout_hours: number;
3235
+ on_timeout: "continue" | "exit";
3236
+ } | {
3237
+ id: string;
3238
+ type: "condition";
3239
+ filter_id: string;
3240
+ yes: {
3241
+ [k: string]: unknown;
3242
+ }[];
3243
+ no: {
3244
+ [k: string]: unknown;
3245
+ }[];
3246
+ } | {
3247
+ id: string;
3248
+ type: "condition";
3249
+ rule: {
3250
+ [k: string]: unknown;
2398
3251
  };
2399
- amount?: number;
2400
- unit?: string;
2401
- }[];
3252
+ yes: {
3253
+ [k: string]: unknown;
3254
+ }[];
3255
+ no: {
3256
+ [k: string]: unknown;
3257
+ }[];
3258
+ } | {
3259
+ id: string;
3260
+ type: "update_contact";
3261
+ action: "set_field";
3262
+ key: string;
3263
+ value: (string | number | boolean) | null;
3264
+ } | {
3265
+ id: string;
3266
+ type: "update_contact";
3267
+ action: "subscribe_topic" | "unsubscribe_topic";
3268
+ topic_id: string;
3269
+ } | {
3270
+ id: string;
3271
+ type: "webhook";
3272
+ webhook_id: string;
3273
+ } | {
3274
+ id: string;
3275
+ type: "exit";
3276
+ })[];
2402
3277
  published_version: {
2403
3278
  id: string;
2404
- number: number;
2405
- };
3279
+ number: number | null;
3280
+ } | null;
2406
3281
  has_unpublished_changes: boolean;
2407
- activated_at: string;
2408
- archived_at: unknown;
3282
+ activated_at: string | null;
3283
+ archived_at: string | null;
2409
3284
  created_at: string;
2410
3285
  updated_at: string;
2411
- };
3286
+ }
2412
3287
  type SequencesUpdateParams = {
2413
3288
  id: string;
2414
3289
  } & {
@@ -2582,219 +3457,552 @@ type SequencesUpdateParams = {
2582
3457
  [k: string]: unknown;
2583
3458
  }[];
2584
3459
  };
2585
- type SequencesUpdateResponse = {
2586
- object: string;
3460
+ interface SequencesUpdateResponse {
3461
+ object: "sequence";
2587
3462
  id: string;
2588
3463
  name: string;
2589
- description: unknown;
2590
- status: string;
3464
+ description: string | null;
3465
+ status: "draft" | "active" | "paused" | "archived";
2591
3466
  segment_id: string;
2592
- topic_id: unknown;
3467
+ topic_id: string | null;
2593
3468
  trigger: {
2594
- type: string;
2595
- lead_magnet_id: unknown;
3469
+ type: "subscribed";
3470
+ include_imports: boolean;
3471
+ } | {
3472
+ type: "topic_subscribed";
3473
+ topic_id: string;
3474
+ } | {
3475
+ type: "lead_magnet";
3476
+ lead_magnet_id: string | null;
3477
+ } | {
3478
+ type: "event";
3479
+ event: string;
3480
+ } | {
3481
+ type: "email_opened" | "email_clicked";
3482
+ newsletter_id: string | null;
3483
+ } | {
3484
+ type: "filter";
3485
+ filter_id: string;
3486
+ include_existing: boolean;
3487
+ } | {
3488
+ type: "manual";
2596
3489
  };
2597
3490
  reentry: {
2598
- mode: string;
2599
- days: unknown;
3491
+ mode: "once" | "always" | "after_days";
3492
+ days: number | null;
2600
3493
  };
2601
3494
  exit: {
2602
3495
  events: string[];
2603
- filter_id: unknown;
3496
+ filter_id: string | null;
2604
3497
  };
2605
- steps: {
3498
+ steps: ({
2606
3499
  id: string;
2607
- type: string;
2608
- subject?: string;
2609
- preheader?: unknown;
2610
- doc?: {
2611
- type: string;
2612
- content: unknown[];
3500
+ type: "email";
3501
+ subject: string;
3502
+ preheader: string | null;
3503
+ doc: {
3504
+ [k: string]: unknown;
2613
3505
  };
2614
- amount?: number;
2615
- unit?: string;
2616
- }[];
3506
+ } | {
3507
+ id: string;
3508
+ type: "email";
3509
+ subject: string;
3510
+ preheader: string | null;
3511
+ template_id: string;
3512
+ } | {
3513
+ id: string;
3514
+ type: "delay";
3515
+ amount: number;
3516
+ unit: "minutes" | "hours" | "days";
3517
+ } | {
3518
+ id: string;
3519
+ type: "delay";
3520
+ until: {
3521
+ time: string;
3522
+ weekdays?: number[];
3523
+ timezone: "contact" | "newsletter";
3524
+ };
3525
+ } | {
3526
+ id: string;
3527
+ type: "wait_event";
3528
+ event: string;
3529
+ timeout_hours: number;
3530
+ on_timeout: "continue" | "exit";
3531
+ } | {
3532
+ id: string;
3533
+ type: "condition";
3534
+ filter_id: string;
3535
+ yes: {
3536
+ [k: string]: unknown;
3537
+ }[];
3538
+ no: {
3539
+ [k: string]: unknown;
3540
+ }[];
3541
+ } | {
3542
+ id: string;
3543
+ type: "condition";
3544
+ rule: {
3545
+ [k: string]: unknown;
3546
+ };
3547
+ yes: {
3548
+ [k: string]: unknown;
3549
+ }[];
3550
+ no: {
3551
+ [k: string]: unknown;
3552
+ }[];
3553
+ } | {
3554
+ id: string;
3555
+ type: "update_contact";
3556
+ action: "set_field";
3557
+ key: string;
3558
+ value: (string | number | boolean) | null;
3559
+ } | {
3560
+ id: string;
3561
+ type: "update_contact";
3562
+ action: "subscribe_topic" | "unsubscribe_topic";
3563
+ topic_id: string;
3564
+ } | {
3565
+ id: string;
3566
+ type: "webhook";
3567
+ webhook_id: string;
3568
+ } | {
3569
+ id: string;
3570
+ type: "exit";
3571
+ })[];
2617
3572
  published_version: {
2618
3573
  id: string;
2619
- number: number;
2620
- };
3574
+ number: number | null;
3575
+ } | null;
2621
3576
  has_unpublished_changes: boolean;
2622
- activated_at: string;
2623
- archived_at: unknown;
3577
+ activated_at: string | null;
3578
+ archived_at: string | null;
2624
3579
  created_at: string;
2625
3580
  updated_at: string;
2626
- };
3581
+ }
2627
3582
  interface SequencesRemoveParams {
2628
3583
  id: string;
2629
3584
  }
2630
3585
  type SequencesRemoveResponse = {
2631
- object: string;
3586
+ object: "sequence";
3587
+ id: string;
3588
+ deleted: true;
3589
+ } | {
3590
+ object: "sequence";
2632
3591
  id: string;
2633
- deleted: boolean;
3592
+ deleted: false;
3593
+ archived: true;
2634
3594
  };
2635
3595
  interface SequencesActivateParams {
2636
3596
  id: string;
2637
3597
  }
2638
- type SequencesActivateResponse = {
2639
- object: string;
3598
+ interface SequencesActivateResponse {
3599
+ object: "sequence";
2640
3600
  id: string;
2641
3601
  name: string;
2642
- description: unknown;
2643
- status: string;
3602
+ description: string | null;
3603
+ status: "draft" | "active" | "paused" | "archived";
2644
3604
  segment_id: string;
2645
- topic_id: unknown;
3605
+ topic_id: string | null;
2646
3606
  trigger: {
2647
- type: string;
2648
- lead_magnet_id: unknown;
3607
+ type: "subscribed";
3608
+ include_imports: boolean;
3609
+ } | {
3610
+ type: "topic_subscribed";
3611
+ topic_id: string;
3612
+ } | {
3613
+ type: "lead_magnet";
3614
+ lead_magnet_id: string | null;
3615
+ } | {
3616
+ type: "event";
3617
+ event: string;
3618
+ } | {
3619
+ type: "email_opened" | "email_clicked";
3620
+ newsletter_id: string | null;
3621
+ } | {
3622
+ type: "filter";
3623
+ filter_id: string;
3624
+ include_existing: boolean;
3625
+ } | {
3626
+ type: "manual";
2649
3627
  };
2650
3628
  reentry: {
2651
- mode: string;
2652
- days: unknown;
3629
+ mode: "once" | "always" | "after_days";
3630
+ days: number | null;
2653
3631
  };
2654
3632
  exit: {
2655
3633
  events: string[];
2656
- filter_id: unknown;
3634
+ filter_id: string | null;
2657
3635
  };
2658
- steps: {
3636
+ steps: ({
2659
3637
  id: string;
2660
- type: string;
2661
- subject?: string;
2662
- preheader?: unknown;
2663
- doc?: {
2664
- type: string;
2665
- content: unknown[];
3638
+ type: "email";
3639
+ subject: string;
3640
+ preheader: string | null;
3641
+ doc: {
3642
+ [k: string]: unknown;
2666
3643
  };
2667
- amount?: number;
2668
- unit?: string;
2669
- }[];
3644
+ } | {
3645
+ id: string;
3646
+ type: "email";
3647
+ subject: string;
3648
+ preheader: string | null;
3649
+ template_id: string;
3650
+ } | {
3651
+ id: string;
3652
+ type: "delay";
3653
+ amount: number;
3654
+ unit: "minutes" | "hours" | "days";
3655
+ } | {
3656
+ id: string;
3657
+ type: "delay";
3658
+ until: {
3659
+ time: string;
3660
+ weekdays?: number[];
3661
+ timezone: "contact" | "newsletter";
3662
+ };
3663
+ } | {
3664
+ id: string;
3665
+ type: "wait_event";
3666
+ event: string;
3667
+ timeout_hours: number;
3668
+ on_timeout: "continue" | "exit";
3669
+ } | {
3670
+ id: string;
3671
+ type: "condition";
3672
+ filter_id: string;
3673
+ yes: {
3674
+ [k: string]: unknown;
3675
+ }[];
3676
+ no: {
3677
+ [k: string]: unknown;
3678
+ }[];
3679
+ } | {
3680
+ id: string;
3681
+ type: "condition";
3682
+ rule: {
3683
+ [k: string]: unknown;
3684
+ };
3685
+ yes: {
3686
+ [k: string]: unknown;
3687
+ }[];
3688
+ no: {
3689
+ [k: string]: unknown;
3690
+ }[];
3691
+ } | {
3692
+ id: string;
3693
+ type: "update_contact";
3694
+ action: "set_field";
3695
+ key: string;
3696
+ value: (string | number | boolean) | null;
3697
+ } | {
3698
+ id: string;
3699
+ type: "update_contact";
3700
+ action: "subscribe_topic" | "unsubscribe_topic";
3701
+ topic_id: string;
3702
+ } | {
3703
+ id: string;
3704
+ type: "webhook";
3705
+ webhook_id: string;
3706
+ } | {
3707
+ id: string;
3708
+ type: "exit";
3709
+ })[];
2670
3710
  published_version: {
2671
3711
  id: string;
2672
- number: number;
2673
- };
3712
+ number: number | null;
3713
+ } | null;
2674
3714
  has_unpublished_changes: boolean;
2675
- activated_at: string;
2676
- archived_at: unknown;
3715
+ activated_at: string | null;
3716
+ archived_at: string | null;
2677
3717
  created_at: string;
2678
3718
  updated_at: string;
2679
- };
3719
+ }
2680
3720
  interface SequencesPauseParams {
2681
3721
  id: string;
2682
3722
  }
2683
- type SequencesPauseResponse = {
2684
- object: string;
3723
+ interface SequencesPauseResponse {
3724
+ object: "sequence";
2685
3725
  id: string;
2686
3726
  name: string;
2687
- description: unknown;
2688
- status: string;
3727
+ description: string | null;
3728
+ status: "draft" | "active" | "paused" | "archived";
2689
3729
  segment_id: string;
2690
- topic_id: unknown;
3730
+ topic_id: string | null;
2691
3731
  trigger: {
2692
- type: string;
2693
- lead_magnet_id: unknown;
3732
+ type: "subscribed";
3733
+ include_imports: boolean;
3734
+ } | {
3735
+ type: "topic_subscribed";
3736
+ topic_id: string;
3737
+ } | {
3738
+ type: "lead_magnet";
3739
+ lead_magnet_id: string | null;
3740
+ } | {
3741
+ type: "event";
3742
+ event: string;
3743
+ } | {
3744
+ type: "email_opened" | "email_clicked";
3745
+ newsletter_id: string | null;
3746
+ } | {
3747
+ type: "filter";
3748
+ filter_id: string;
3749
+ include_existing: boolean;
3750
+ } | {
3751
+ type: "manual";
2694
3752
  };
2695
3753
  reentry: {
2696
- mode: string;
2697
- days: unknown;
3754
+ mode: "once" | "always" | "after_days";
3755
+ days: number | null;
2698
3756
  };
2699
3757
  exit: {
2700
3758
  events: string[];
2701
- filter_id: unknown;
3759
+ filter_id: string | null;
2702
3760
  };
2703
- steps: {
3761
+ steps: ({
2704
3762
  id: string;
2705
- type: string;
2706
- subject?: string;
2707
- preheader?: unknown;
2708
- doc?: {
2709
- type: string;
2710
- content: unknown[];
3763
+ type: "email";
3764
+ subject: string;
3765
+ preheader: string | null;
3766
+ doc: {
3767
+ [k: string]: unknown;
2711
3768
  };
2712
- amount?: number;
2713
- unit?: string;
2714
- }[];
3769
+ } | {
3770
+ id: string;
3771
+ type: "email";
3772
+ subject: string;
3773
+ preheader: string | null;
3774
+ template_id: string;
3775
+ } | {
3776
+ id: string;
3777
+ type: "delay";
3778
+ amount: number;
3779
+ unit: "minutes" | "hours" | "days";
3780
+ } | {
3781
+ id: string;
3782
+ type: "delay";
3783
+ until: {
3784
+ time: string;
3785
+ weekdays?: number[];
3786
+ timezone: "contact" | "newsletter";
3787
+ };
3788
+ } | {
3789
+ id: string;
3790
+ type: "wait_event";
3791
+ event: string;
3792
+ timeout_hours: number;
3793
+ on_timeout: "continue" | "exit";
3794
+ } | {
3795
+ id: string;
3796
+ type: "condition";
3797
+ filter_id: string;
3798
+ yes: {
3799
+ [k: string]: unknown;
3800
+ }[];
3801
+ no: {
3802
+ [k: string]: unknown;
3803
+ }[];
3804
+ } | {
3805
+ id: string;
3806
+ type: "condition";
3807
+ rule: {
3808
+ [k: string]: unknown;
3809
+ };
3810
+ yes: {
3811
+ [k: string]: unknown;
3812
+ }[];
3813
+ no: {
3814
+ [k: string]: unknown;
3815
+ }[];
3816
+ } | {
3817
+ id: string;
3818
+ type: "update_contact";
3819
+ action: "set_field";
3820
+ key: string;
3821
+ value: (string | number | boolean) | null;
3822
+ } | {
3823
+ id: string;
3824
+ type: "update_contact";
3825
+ action: "subscribe_topic" | "unsubscribe_topic";
3826
+ topic_id: string;
3827
+ } | {
3828
+ id: string;
3829
+ type: "webhook";
3830
+ webhook_id: string;
3831
+ } | {
3832
+ id: string;
3833
+ type: "exit";
3834
+ })[];
2715
3835
  published_version: {
2716
3836
  id: string;
2717
- number: number;
2718
- };
3837
+ number: number | null;
3838
+ } | null;
2719
3839
  has_unpublished_changes: boolean;
2720
- activated_at: string;
2721
- archived_at: unknown;
3840
+ activated_at: string | null;
3841
+ archived_at: string | null;
2722
3842
  created_at: string;
2723
3843
  updated_at: string;
2724
- };
3844
+ }
2725
3845
  interface SequencesArchiveParams {
2726
3846
  id: string;
2727
3847
  }
2728
- type SequencesArchiveResponse = {
2729
- object: string;
3848
+ interface SequencesArchiveResponse {
3849
+ object: "sequence";
2730
3850
  id: string;
2731
3851
  name: string;
2732
- description: unknown;
2733
- status: string;
3852
+ description: string | null;
3853
+ status: "draft" | "active" | "paused" | "archived";
2734
3854
  segment_id: string;
2735
- topic_id: unknown;
3855
+ topic_id: string | null;
2736
3856
  trigger: {
2737
- type: string;
2738
- lead_magnet_id: unknown;
3857
+ type: "subscribed";
3858
+ include_imports: boolean;
3859
+ } | {
3860
+ type: "topic_subscribed";
3861
+ topic_id: string;
3862
+ } | {
3863
+ type: "lead_magnet";
3864
+ lead_magnet_id: string | null;
3865
+ } | {
3866
+ type: "event";
3867
+ event: string;
3868
+ } | {
3869
+ type: "email_opened" | "email_clicked";
3870
+ newsletter_id: string | null;
3871
+ } | {
3872
+ type: "filter";
3873
+ filter_id: string;
3874
+ include_existing: boolean;
3875
+ } | {
3876
+ type: "manual";
2739
3877
  };
2740
3878
  reentry: {
2741
- mode: string;
2742
- days: unknown;
3879
+ mode: "once" | "always" | "after_days";
3880
+ days: number | null;
2743
3881
  };
2744
3882
  exit: {
2745
3883
  events: string[];
2746
- filter_id: unknown;
3884
+ filter_id: string | null;
2747
3885
  };
2748
- steps: {
3886
+ steps: ({
3887
+ id: string;
3888
+ type: "email";
3889
+ subject: string;
3890
+ preheader: string | null;
3891
+ doc: {
3892
+ [k: string]: unknown;
3893
+ };
3894
+ } | {
3895
+ id: string;
3896
+ type: "email";
3897
+ subject: string;
3898
+ preheader: string | null;
3899
+ template_id: string;
3900
+ } | {
3901
+ id: string;
3902
+ type: "delay";
3903
+ amount: number;
3904
+ unit: "minutes" | "hours" | "days";
3905
+ } | {
3906
+ id: string;
3907
+ type: "delay";
3908
+ until: {
3909
+ time: string;
3910
+ weekdays?: number[];
3911
+ timezone: "contact" | "newsletter";
3912
+ };
3913
+ } | {
3914
+ id: string;
3915
+ type: "wait_event";
3916
+ event: string;
3917
+ timeout_hours: number;
3918
+ on_timeout: "continue" | "exit";
3919
+ } | {
3920
+ id: string;
3921
+ type: "condition";
3922
+ filter_id: string;
3923
+ yes: {
3924
+ [k: string]: unknown;
3925
+ }[];
3926
+ no: {
3927
+ [k: string]: unknown;
3928
+ }[];
3929
+ } | {
2749
3930
  id: string;
2750
- type: string;
2751
- subject?: string;
2752
- preheader?: unknown;
2753
- doc?: {
2754
- type: string;
2755
- content: unknown[];
3931
+ type: "condition";
3932
+ rule: {
3933
+ [k: string]: unknown;
2756
3934
  };
2757
- amount?: number;
2758
- unit?: string;
2759
- }[];
3935
+ yes: {
3936
+ [k: string]: unknown;
3937
+ }[];
3938
+ no: {
3939
+ [k: string]: unknown;
3940
+ }[];
3941
+ } | {
3942
+ id: string;
3943
+ type: "update_contact";
3944
+ action: "set_field";
3945
+ key: string;
3946
+ value: (string | number | boolean) | null;
3947
+ } | {
3948
+ id: string;
3949
+ type: "update_contact";
3950
+ action: "subscribe_topic" | "unsubscribe_topic";
3951
+ topic_id: string;
3952
+ } | {
3953
+ id: string;
3954
+ type: "webhook";
3955
+ webhook_id: string;
3956
+ } | {
3957
+ id: string;
3958
+ type: "exit";
3959
+ })[];
2760
3960
  published_version: {
2761
3961
  id: string;
2762
- number: number;
2763
- };
3962
+ number: number | null;
3963
+ } | null;
2764
3964
  has_unpublished_changes: boolean;
2765
- activated_at: string;
2766
- archived_at: string;
3965
+ activated_at: string | null;
3966
+ archived_at: string | null;
2767
3967
  created_at: string;
2768
3968
  updated_at: string;
2769
- };
3969
+ }
2770
3970
  type SequencesEnrollmentsParams = {
2771
3971
  id: string;
2772
3972
  } & {
2773
- status?: "active" | "completed" | "exited";
2774
3973
  /**
2775
- * Newest first, 1–100 (default 100).
3974
+ * 1–100, default 100.
2776
3975
  */
2777
3976
  limit?: number;
3977
+ /**
3978
+ * Id of the last item of the previous page (older items).
3979
+ */
3980
+ after?: string;
3981
+ /**
3982
+ * Id of the first item of the previous page (newer items).
3983
+ */
3984
+ before?: string;
3985
+ status?: "active" | "completed" | "exited";
2778
3986
  };
2779
- type SequencesEnrollmentsResponse = {
2780
- object: string;
3987
+ interface SequencesEnrollmentsResponse {
3988
+ object: "list";
2781
3989
  has_more: boolean;
2782
3990
  data: {
2783
- object: string;
3991
+ object: "sequence_enrollment";
2784
3992
  id: string;
2785
3993
  sequence_id: string;
2786
- contact_id: string;
3994
+ contact_id: string | null;
2787
3995
  email: string;
2788
- status: string;
2789
- exit_reason: unknown;
2790
- current_step_id: string;
2791
- next_run_at: string;
2792
- source: string;
3996
+ status: "active" | "completed" | "exited";
3997
+ exit_reason: string | null;
3998
+ current_step_id: string | null;
3999
+ next_run_at: string | null;
4000
+ source: "trigger" | "filter" | "manual" | "api" | "mcp";
2793
4001
  entered_at: string;
2794
- completed_at: unknown;
2795
- exited_at: unknown;
4002
+ completed_at: string | null;
4003
+ exited_at: string | null;
2796
4004
  }[];
2797
- };
4005
+ }
2798
4006
  type SequencesEnrollParams = {
2799
4007
  id: string;
2800
4008
  } & {
@@ -2804,28 +4012,28 @@ type SequencesEnrollParams = {
2804
4012
  email?: string;
2805
4013
  contactId?: string;
2806
4014
  };
2807
- type SequencesEnrollResponse = {
2808
- object: string;
4015
+ interface SequencesEnrollResponse {
4016
+ object: "sequence_enrollment";
2809
4017
  id: string;
2810
4018
  sequence_id: string;
2811
4019
  contact_id: string;
2812
- status: string;
2813
- };
4020
+ status: "active";
4021
+ }
2814
4022
  interface SequencesUnenrollParams {
2815
4023
  id: string;
2816
4024
  enrollmentId: string;
2817
4025
  }
2818
- type SequencesUnenrollResponse = {
2819
- object: string;
4026
+ interface SequencesUnenrollResponse {
4027
+ object: "sequence_enrollment";
2820
4028
  id: string;
2821
4029
  sequence_id: string;
2822
- status: string;
2823
- };
4030
+ status: "completed" | "exited";
4031
+ }
2824
4032
  interface SequencesStatsParams {
2825
4033
  id: string;
2826
4034
  }
2827
- type SequencesStatsResponse = {
2828
- object: string;
4035
+ interface SequencesStatsResponse {
4036
+ object: "sequence_stats";
2829
4037
  sequence_id: string;
2830
4038
  entered: number;
2831
4039
  active: number;
@@ -2841,7 +4049,7 @@ type SequencesStatsResponse = {
2841
4049
  bounced: number;
2842
4050
  unsubscribed: number;
2843
4051
  }[];
2844
- };
4052
+ }
2845
4053
  interface WebhooksCreateParams {
2846
4054
  /**
2847
4055
  * Public `https://` URL that receives the events.
@@ -2865,11 +4073,11 @@ interface WebhooksCreateParams {
2865
4073
  */
2866
4074
  domains?: string[];
2867
4075
  }
2868
- type WebhooksCreateResponse = {
2869
- object: string;
4076
+ interface WebhooksCreateResponse {
4077
+ object: "webhook";
2870
4078
  id: string;
2871
4079
  signing_secret: string;
2872
- };
4080
+ }
2873
4081
  interface WebhooksListParams {
2874
4082
  /**
2875
4083
  * 1–100, default 20.
@@ -2884,45 +4092,45 @@ interface WebhooksListParams {
2884
4092
  */
2885
4093
  before?: string;
2886
4094
  }
2887
- type WebhooksListResponse = {
2888
- object: string;
4095
+ interface WebhooksListResponse {
4096
+ object: "list";
2889
4097
  has_more: boolean;
2890
4098
  data: {
2891
- object: string;
4099
+ object: "webhook";
2892
4100
  id: string;
2893
4101
  endpoint: string;
2894
- description: string;
2895
- events: string[];
4102
+ description: string | null;
4103
+ events: ("email.sent" | "email.delivered" | "email.delivery_delayed" | "email.bounced" | "email.complained" | "email.opened" | "email.clicked" | "email.failed" | "email.scheduled" | "contact.created" | "contact.updated" | "contact.deleted" | "domain.created" | "domain.updated" | "domain.deleted" | "sequence.entered" | "sequence.completed" | "sequence.exited" | "inbound.received")[];
2896
4104
  include_newsletters: boolean;
2897
- segment_ids: unknown[];
2898
- domains: unknown[];
2899
- status: string;
2900
- disabled_reason: unknown;
4105
+ segment_ids: string[];
4106
+ domains: string[];
4107
+ status: "enabled" | "disabled";
4108
+ disabled_reason: ("manual" | "failing") | null;
2901
4109
  consecutive_failures: number;
2902
- last_success_at: string;
2903
- last_failure_at: unknown;
4110
+ last_success_at: string | null;
4111
+ last_failure_at: string | null;
2904
4112
  created_at: string;
2905
4113
  }[];
2906
- };
4114
+ }
2907
4115
  interface WebhooksGetParams {
2908
4116
  id: string;
2909
4117
  }
2910
- type WebhooksGetResponse = {
2911
- object: string;
4118
+ interface WebhooksGetResponse {
4119
+ object: "webhook";
2912
4120
  id: string;
2913
4121
  endpoint: string;
2914
- description: string;
2915
- events: string[];
4122
+ description: string | null;
4123
+ events: ("email.sent" | "email.delivered" | "email.delivery_delayed" | "email.bounced" | "email.complained" | "email.opened" | "email.clicked" | "email.failed" | "email.scheduled" | "contact.created" | "contact.updated" | "contact.deleted" | "domain.created" | "domain.updated" | "domain.deleted" | "sequence.entered" | "sequence.completed" | "sequence.exited" | "inbound.received")[];
2916
4124
  include_newsletters: boolean;
2917
- segment_ids: unknown[];
2918
- domains: unknown[];
2919
- status: string;
2920
- disabled_reason: unknown;
4125
+ segment_ids: string[];
4126
+ domains: string[];
4127
+ status: "enabled" | "disabled";
4128
+ disabled_reason: ("manual" | "failing") | null;
2921
4129
  consecutive_failures: number;
2922
- last_success_at: string;
2923
- last_failure_at: unknown;
4130
+ last_success_at: string | null;
4131
+ last_failure_at: string | null;
2924
4132
  created_at: string;
2925
- };
4133
+ }
2926
4134
  type WebhooksUpdateParams = {
2927
4135
  id: string;
2928
4136
  } & {
@@ -2949,27 +4157,27 @@ type WebhooksUpdateParams = {
2949
4157
  */
2950
4158
  domains?: string[];
2951
4159
  };
2952
- type WebhooksUpdateResponse = {
2953
- object: string;
4160
+ interface WebhooksUpdateResponse {
4161
+ object: "webhook";
2954
4162
  id: string;
2955
- };
4163
+ }
2956
4164
  interface WebhooksRemoveParams {
2957
4165
  id: string;
2958
4166
  }
2959
- type WebhooksRemoveResponse = {
2960
- object: string;
4167
+ interface WebhooksRemoveResponse {
4168
+ object: "webhook";
2961
4169
  id: string;
2962
- deleted: boolean;
2963
- };
4170
+ deleted: true;
4171
+ }
2964
4172
  interface WebhooksRotateSigningSecretParams {
2965
4173
  id: string;
2966
4174
  }
2967
- type WebhooksRotateSigningSecretResponse = {
2968
- object: string;
4175
+ interface WebhooksRotateSigningSecretResponse {
4176
+ object: "webhook";
2969
4177
  id: string;
2970
4178
  signing_secret: string;
2971
4179
  previous_secret_expires_at: string;
2972
- };
4180
+ }
2973
4181
  type WebhooksTestParams = {
2974
4182
  id: string;
2975
4183
  } & {
@@ -2978,29 +4186,29 @@ type WebhooksTestParams = {
2978
4186
  */
2979
4187
  type?: "email.sent" | "email.delivered" | "email.delivery_delayed" | "email.bounced" | "email.complained" | "email.opened" | "email.clicked" | "email.failed" | "email.scheduled" | "contact.created" | "contact.updated" | "contact.deleted" | "domain.created" | "domain.updated" | "domain.deleted" | "sequence.entered" | "sequence.completed" | "sequence.exited" | "inbound.received";
2980
4188
  };
2981
- type WebhooksTestResponse = {
2982
- object: string;
4189
+ interface WebhooksTestResponse {
4190
+ object: "webhook_delivery";
2983
4191
  id: string;
2984
4192
  msg_id: string;
2985
4193
  webhook_id: string;
2986
4194
  event_type: string;
2987
- status: string;
4195
+ status: "pending" | "processing" | "delivered" | "failed";
2988
4196
  attempts: number;
2989
- next_attempt_at: unknown;
2990
- last_status_code: number;
2991
- last_response: string;
2992
- last_error: unknown;
2993
- last_duration_ms: number;
4197
+ next_attempt_at: string | null;
4198
+ last_status_code: number | null;
4199
+ last_response: string | null;
4200
+ last_error: string | null;
4201
+ last_duration_ms: number | null;
2994
4202
  payload: {
2995
4203
  type: string;
2996
4204
  created_at: string;
2997
4205
  data: {
2998
- email_id: string;
4206
+ [k: string]: unknown;
2999
4207
  };
3000
4208
  };
3001
- delivered_at: string;
4209
+ delivered_at: string | null;
3002
4210
  created_at: string;
3003
- };
4211
+ }
3004
4212
  type WebhooksDeliveriesParams = {
3005
4213
  id: string;
3006
4214
  } & {
@@ -3018,81 +4226,81 @@ type WebhooksDeliveriesParams = {
3018
4226
  before?: string;
3019
4227
  status?: "pending" | "processing" | "delivered" | "failed";
3020
4228
  };
3021
- type WebhooksDeliveriesResponse = {
3022
- object: string;
4229
+ interface WebhooksDeliveriesResponse {
4230
+ object: "list";
3023
4231
  has_more: boolean;
3024
4232
  data: {
3025
- object: string;
4233
+ object: "webhook_delivery";
3026
4234
  id: string;
3027
4235
  msg_id: string;
3028
4236
  webhook_id: string;
3029
4237
  event_type: string;
3030
- status: string;
4238
+ status: "pending" | "processing" | "delivered" | "failed";
3031
4239
  attempts: number;
3032
- next_attempt_at: unknown;
3033
- last_status_code: number;
3034
- last_response: string;
3035
- last_error: unknown;
3036
- last_duration_ms: number;
4240
+ next_attempt_at: string | null;
4241
+ last_status_code: number | null;
4242
+ last_response: string | null;
4243
+ last_error: string | null;
4244
+ last_duration_ms: number | null;
3037
4245
  payload: {
3038
4246
  type: string;
3039
4247
  created_at: string;
3040
4248
  data: {
3041
- email_id: string;
4249
+ [k: string]: unknown;
3042
4250
  };
3043
4251
  };
3044
- delivered_at: string;
4252
+ delivered_at: string | null;
3045
4253
  created_at: string;
3046
4254
  }[];
3047
- };
4255
+ }
3048
4256
  interface WebhooksRetryDeliveryParams {
3049
4257
  id: string;
3050
4258
  deliveryId: string;
3051
4259
  }
3052
- type WebhooksRetryDeliveryResponse = {
3053
- object: string;
4260
+ interface WebhooksRetryDeliveryResponse {
4261
+ object: "webhook_delivery";
3054
4262
  id: string;
3055
4263
  msg_id: string;
3056
4264
  webhook_id: string;
3057
4265
  event_type: string;
3058
- status: string;
4266
+ status: "pending" | "processing" | "delivered" | "failed";
3059
4267
  attempts: number;
3060
- next_attempt_at: unknown;
3061
- last_status_code: number;
3062
- last_response: string;
3063
- last_error: unknown;
3064
- last_duration_ms: number;
4268
+ next_attempt_at: string | null;
4269
+ last_status_code: number | null;
4270
+ last_response: string | null;
4271
+ last_error: string | null;
4272
+ last_duration_ms: number | null;
3065
4273
  payload: {
3066
4274
  type: string;
3067
4275
  created_at: string;
3068
4276
  data: {
3069
- email_id: string;
4277
+ [k: string]: unknown;
3070
4278
  };
3071
4279
  };
3072
- delivered_at: string;
4280
+ delivered_at: string | null;
3073
4281
  created_at: string;
3074
- };
4282
+ }
3075
4283
  type InboxesListParams = Record<string, never>;
3076
- type InboxesListResponse = {
3077
- object: string;
4284
+ interface InboxesListResponse {
4285
+ object: "list";
3078
4286
  has_more: boolean;
3079
4287
  data: {
3080
- object: string;
4288
+ object: "inbox";
3081
4289
  id: string;
3082
4290
  address: string;
3083
4291
  name: string;
3084
- display_name: string;
3085
- description: string;
3086
- reply_from: unknown;
3087
- status: string;
4292
+ display_name: string | null;
4293
+ description: string | null;
4294
+ reply_from: string | null;
4295
+ status: "active" | "disabled";
3088
4296
  custom_domain: boolean;
3089
- domain_id: unknown;
4297
+ domain_id: string | null;
3090
4298
  dropped_count: number;
3091
- last_dropped_at: unknown;
4299
+ last_dropped_at: string | null;
3092
4300
  created_at: string;
3093
4301
  updated_at: string;
3094
4302
  }[];
3095
- };
4303
+ }
3096
4304
  interface InboxesCreateParams {
3097
4305
  /**
3098
4306
  * Local part: `support` gives `support-<workspace>@in.smartletter.ai` (or `support@<your receiving domain>` with `domain_id`).
@@ -3115,41 +4323,41 @@ interface InboxesCreateParams {
3115
4323
  */
3116
4324
  replyFrom?: string | null;
3117
4325
  }
3118
- type InboxesCreateResponse = {
3119
- object: string;
4326
+ interface InboxesCreateResponse {
4327
+ object: "inbox";
3120
4328
  id: string;
3121
4329
  address: string;
3122
4330
  name: string;
3123
- display_name: string;
3124
- description: string;
3125
- reply_from: unknown;
3126
- status: string;
4331
+ display_name: string | null;
4332
+ description: string | null;
4333
+ reply_from: string | null;
4334
+ status: "active" | "disabled";
3127
4335
  custom_domain: boolean;
3128
- domain_id: unknown;
4336
+ domain_id: string | null;
3129
4337
  dropped_count: number;
3130
- last_dropped_at: unknown;
4338
+ last_dropped_at: string | null;
3131
4339
  created_at: string;
3132
4340
  updated_at: string;
3133
- };
4341
+ }
3134
4342
  interface InboxesGetParams {
3135
4343
  id: string;
3136
4344
  }
3137
- type InboxesGetResponse = {
3138
- object: string;
4345
+ interface InboxesGetResponse {
4346
+ object: "inbox";
3139
4347
  id: string;
3140
4348
  address: string;
3141
4349
  name: string;
3142
- display_name: string;
3143
- description: string;
3144
- reply_from: unknown;
3145
- status: string;
4350
+ display_name: string | null;
4351
+ description: string | null;
4352
+ reply_from: string | null;
4353
+ status: "active" | "disabled";
3146
4354
  custom_domain: boolean;
3147
- domain_id: unknown;
4355
+ domain_id: string | null;
3148
4356
  dropped_count: number;
3149
- last_dropped_at: unknown;
4357
+ last_dropped_at: string | null;
3150
4358
  created_at: string;
3151
4359
  updated_at: string;
3152
- };
4360
+ }
3153
4361
  type InboxesUpdateParams = {
3154
4362
  id: string;
3155
4363
  } & {
@@ -3170,31 +4378,43 @@ type InboxesUpdateParams = {
3170
4378
  */
3171
4379
  status?: "active" | "disabled";
3172
4380
  };
3173
- type InboxesUpdateResponse = {
3174
- object: string;
4381
+ interface InboxesUpdateResponse {
4382
+ object: "inbox";
3175
4383
  id: string;
3176
4384
  address: string;
3177
4385
  name: string;
3178
- display_name: string;
3179
- description: string;
3180
- reply_from: unknown;
3181
- status: string;
4386
+ display_name: string | null;
4387
+ description: string | null;
4388
+ reply_from: string | null;
4389
+ status: "active" | "disabled";
3182
4390
  custom_domain: boolean;
3183
- domain_id: unknown;
4391
+ domain_id: string | null;
3184
4392
  dropped_count: number;
3185
- last_dropped_at: unknown;
4393
+ last_dropped_at: string | null;
3186
4394
  created_at: string;
3187
4395
  updated_at: string;
3188
- };
4396
+ }
3189
4397
  interface InboxesRemoveParams {
3190
4398
  id: string;
3191
4399
  }
3192
- type InboxesRemoveResponse = {
3193
- object: string;
4400
+ interface InboxesRemoveResponse {
4401
+ object: "inbox";
3194
4402
  id: string;
3195
- deleted: boolean;
3196
- };
4403
+ deleted: true;
4404
+ }
3197
4405
  interface ThreadsListParams {
4406
+ /**
4407
+ * 1–100, default 20.
4408
+ */
4409
+ limit?: number;
4410
+ /**
4411
+ * Id of the last item of the previous page (older items).
4412
+ */
4413
+ after?: string;
4414
+ /**
4415
+ * Id of the first item of the previous page (newer items).
4416
+ */
4417
+ before?: string;
3198
4418
  inboxId?: string;
3199
4419
  /**
3200
4420
  * Default: every status but `archived`.
@@ -3207,111 +4427,139 @@ interface ThreadsListParams {
3207
4427
  spam?: "exclude" | "only" | "include";
3208
4428
  assigneeAgent?: string;
3209
4429
  unread?: "true" | "false";
3210
- /**
3211
- * 1–100, default 20.
3212
- */
3213
- limit?: number;
3214
- /**
3215
- * Id of the last thread of the previous page.
3216
- */
3217
- after?: string;
3218
4430
  }
3219
- type ThreadsListResponse = {
3220
- object: string;
4431
+ interface ThreadsListResponse {
4432
+ object: "list";
3221
4433
  has_more: boolean;
3222
4434
  data: {
3223
- object: string;
4435
+ object: "inbox_thread";
3224
4436
  id: string;
3225
4437
  inbox_id: string;
3226
- subject: string;
3227
- status: string;
4438
+ subject: string | null;
4439
+ status: "open" | "pending" | "done" | "archived";
3228
4440
  spam: boolean;
3229
- labels: unknown[];
3230
- assignee_user_id: unknown;
3231
- assignee_agent: unknown;
4441
+ labels: string[];
4442
+ assignee_user_id: string | null;
4443
+ assignee_agent: string | null;
3232
4444
  message_count: number;
3233
4445
  unread: boolean;
3234
4446
  participants: string[];
3235
4447
  last_message_at: string;
3236
- last_inbound_at: string;
4448
+ last_inbound_at: string | null;
3237
4449
  created_at: string;
3238
4450
  updated_at: string;
3239
4451
  last_message: {
3240
4452
  id: string;
3241
- direction: string;
4453
+ direction: "inbound" | "outbound";
3242
4454
  from: string;
3243
- snippet: string;
4455
+ snippet: string | null;
3244
4456
  received_at: string;
3245
- };
4457
+ } | null;
3246
4458
  }[];
3247
- };
4459
+ }
3248
4460
  interface ThreadsGetParams {
3249
4461
  id: string;
3250
4462
  }
3251
- type ThreadsGetResponse = {
3252
- object: string;
4463
+ interface ThreadsGetResponse {
4464
+ object: "inbox_thread";
3253
4465
  id: string;
3254
4466
  inbox_id: string;
3255
- subject: string;
3256
- status: string;
4467
+ subject: string | null;
4468
+ status: "open" | "pending" | "done" | "archived";
3257
4469
  spam: boolean;
3258
- labels: unknown[];
3259
- assignee_user_id: unknown;
3260
- assignee_agent: unknown;
4470
+ labels: string[];
4471
+ assignee_user_id: string | null;
4472
+ assignee_agent: string | null;
3261
4473
  message_count: number;
3262
4474
  unread: boolean;
3263
4475
  participants: string[];
3264
4476
  last_message_at: string;
3265
- last_inbound_at: string;
4477
+ last_inbound_at: string | null;
3266
4478
  created_at: string;
3267
4479
  updated_at: string;
3268
- messages: {
3269
- object: string;
4480
+ messages: ({
4481
+ object: "inbox_message";
3270
4482
  id: string;
3271
- thread_id: string;
4483
+ thread_id: string | null;
3272
4484
  inbox_id: string;
3273
- direction: string;
3274
- status: string;
3275
4485
  from: string;
3276
4486
  from_address: string;
3277
- from_name: string;
4487
+ from_name: string | null;
3278
4488
  to: string[];
3279
- cc: unknown[];
3280
- reply_to: unknown[];
3281
- subject: string;
3282
- text: string;
3283
- html: string;
3284
- snippet: string;
4489
+ cc: string[];
4490
+ reply_to: string[];
4491
+ subject: string | null;
4492
+ text: string | null;
4493
+ html: string | null;
4494
+ snippet: string | null;
3285
4495
  remote_images: number;
3286
4496
  body_truncated: boolean;
3287
- message_id: string;
3288
- in_reply_to: unknown;
3289
- references: unknown[];
4497
+ message_id: string | null;
4498
+ in_reply_to: string | null;
4499
+ references: string[];
4500
+ attachments: {
4501
+ id: string;
4502
+ filename: string;
4503
+ content_type: string;
4504
+ size: number;
4505
+ inline: boolean;
4506
+ content_id: string | null;
4507
+ available: boolean;
4508
+ expires_at: string;
4509
+ }[];
4510
+ received_at: string;
4511
+ created_at: string;
4512
+ direction: "inbound";
4513
+ status: "inbox" | "spam";
3290
4514
  spam: {
3291
- score: number;
3292
- verdict: string;
3293
- virus: string;
3294
- spf: string;
3295
- dkim: string;
3296
- dmarc: string;
3297
- reasons: unknown[];
4515
+ score: number | null;
4516
+ verdict: string | null;
4517
+ virus: string | null;
4518
+ spf: string | null;
4519
+ dkim: string | null;
4520
+ dmarc: string | null;
4521
+ reasons: string[];
3298
4522
  };
3299
4523
  auto_submitted: boolean;
3300
- automation_reason: unknown;
4524
+ automation_reason: string | null;
4525
+ } | {
4526
+ object: "inbox_message";
4527
+ id: string;
4528
+ thread_id: string | null;
4529
+ inbox_id: string;
4530
+ from: string;
4531
+ from_address: string;
4532
+ from_name: string | null;
4533
+ to: string[];
4534
+ cc: string[];
4535
+ reply_to: string[];
4536
+ subject: string | null;
4537
+ text: string | null;
4538
+ html: string | null;
4539
+ snippet: string | null;
4540
+ remote_images: number;
4541
+ body_truncated: boolean;
4542
+ message_id: string | null;
4543
+ in_reply_to: string | null;
4544
+ references: string[];
3301
4545
  attachments: {
3302
4546
  id: string;
3303
4547
  filename: string;
3304
4548
  content_type: string;
3305
4549
  size: number;
3306
4550
  inline: boolean;
3307
- content_id: unknown;
4551
+ content_id: string | null;
3308
4552
  available: boolean;
3309
4553
  expires_at: string;
3310
4554
  }[];
3311
4555
  received_at: string;
3312
4556
  created_at: string;
3313
- }[];
3314
- };
4557
+ direction: "outbound";
4558
+ status: "draft" | "sent";
4559
+ email_id: string | null;
4560
+ delivery: string | null;
4561
+ })[];
4562
+ }
3315
4563
  type ThreadsUpdateParams = {
3316
4564
  id: string;
3317
4565
  } & {
@@ -3336,24 +4584,24 @@ type ThreadsUpdateParams = {
3336
4584
  spam?: boolean;
3337
4585
  unread?: boolean;
3338
4586
  };
3339
- type ThreadsUpdateResponse = {
3340
- object: string;
4587
+ interface ThreadsUpdateResponse {
4588
+ object: "inbox_thread";
3341
4589
  id: string;
3342
4590
  inbox_id: string;
3343
- subject: string;
3344
- status: string;
4591
+ subject: string | null;
4592
+ status: "open" | "pending" | "done" | "archived";
3345
4593
  spam: boolean;
3346
4594
  labels: string[];
3347
- assignee_user_id: unknown;
3348
- assignee_agent: string;
4595
+ assignee_user_id: string | null;
4596
+ assignee_agent: string | null;
3349
4597
  message_count: number;
3350
4598
  unread: boolean;
3351
4599
  participants: string[];
3352
4600
  last_message_at: string;
3353
- last_inbound_at: string;
4601
+ last_inbound_at: string | null;
3354
4602
  created_at: string;
3355
4603
  updated_at: string;
3356
- };
4604
+ }
3357
4605
  type ThreadsReplyParams = {
3358
4606
  id: string;
3359
4607
  } & {
@@ -3385,101 +4633,166 @@ type ThreadsReplyParams = {
3385
4633
  status?: "open" | "pending" | "done" | "archived";
3386
4634
  };
3387
4635
  type ThreadsReplyResponse = {
3388
- object: string;
4636
+ object: "inbox_message";
3389
4637
  id: string;
3390
- thread_id: string;
4638
+ thread_id: string | null;
3391
4639
  inbox_id: string;
3392
- direction: string;
3393
- status: string;
3394
4640
  from: string;
3395
4641
  from_address: string;
3396
- from_name: string;
4642
+ from_name: string | null;
3397
4643
  to: string[];
3398
- cc: unknown[];
3399
- reply_to: unknown[];
3400
- subject: string;
3401
- text: string;
3402
- html: string;
3403
- snippet: string;
4644
+ cc: string[];
4645
+ reply_to: string[];
4646
+ subject: string | null;
4647
+ text: string | null;
4648
+ html: string | null;
4649
+ snippet: string | null;
3404
4650
  remote_images: number;
3405
4651
  body_truncated: boolean;
3406
- message_id: string;
3407
- in_reply_to: unknown;
3408
- references: unknown[];
3409
- spam: {
3410
- score: number;
3411
- verdict: string;
3412
- virus: string;
3413
- spf: string;
3414
- dkim: string;
3415
- dmarc: string;
3416
- reasons: unknown[];
3417
- };
3418
- auto_submitted: boolean;
3419
- automation_reason: unknown;
4652
+ message_id: string | null;
4653
+ in_reply_to: string | null;
4654
+ references: string[];
3420
4655
  attachments: {
3421
4656
  id: string;
3422
4657
  filename: string;
3423
4658
  content_type: string;
3424
4659
  size: number;
3425
4660
  inline: boolean;
3426
- content_id: unknown;
4661
+ content_id: string | null;
3427
4662
  available: boolean;
3428
4663
  expires_at: string;
3429
4664
  }[];
3430
4665
  received_at: string;
3431
4666
  created_at: string;
4667
+ direction: "outbound";
4668
+ status: "sent";
3432
4669
  email_id: string;
3433
4670
  delivery: string;
4671
+ } | {
4672
+ object: "inbox_message";
4673
+ id: string;
4674
+ thread_id: string | null;
4675
+ inbox_id: string;
4676
+ from: string;
4677
+ from_address: string;
4678
+ from_name: string | null;
4679
+ to: string[];
4680
+ cc: string[];
4681
+ reply_to: string[];
4682
+ subject: string | null;
4683
+ text: string | null;
4684
+ html: string | null;
4685
+ snippet: string | null;
4686
+ remote_images: number;
4687
+ body_truncated: boolean;
4688
+ message_id: string | null;
4689
+ in_reply_to: string | null;
4690
+ references: string[];
4691
+ attachments: {
4692
+ id: string;
4693
+ filename: string;
4694
+ content_type: string;
4695
+ size: number;
4696
+ inline: boolean;
4697
+ content_id: string | null;
4698
+ available: boolean;
4699
+ expires_at: string;
4700
+ }[];
4701
+ received_at: string;
4702
+ created_at: string;
4703
+ direction: "outbound";
4704
+ status: "draft";
4705
+ email_id: string | null;
4706
+ delivery: string | null;
4707
+ } | {
4708
+ object: "inbox_message";
4709
+ email_id: string;
4710
+ status: "sent";
3434
4711
  };
3435
4712
  interface MessagesGetParams {
3436
4713
  id: string;
3437
4714
  }
3438
4715
  type MessagesGetResponse = {
3439
- object: string;
4716
+ object: "inbox_message";
3440
4717
  id: string;
3441
- thread_id: string;
4718
+ thread_id: string | null;
3442
4719
  inbox_id: string;
3443
- direction: string;
3444
- status: string;
3445
4720
  from: string;
3446
4721
  from_address: string;
3447
- from_name: string;
4722
+ from_name: string | null;
3448
4723
  to: string[];
3449
- cc: unknown[];
3450
- reply_to: unknown[];
3451
- subject: string;
3452
- text: string;
3453
- html: string;
3454
- snippet: string;
4724
+ cc: string[];
4725
+ reply_to: string[];
4726
+ subject: string | null;
4727
+ text: string | null;
4728
+ html: string | null;
4729
+ snippet: string | null;
3455
4730
  remote_images: number;
3456
4731
  body_truncated: boolean;
3457
- message_id: string;
3458
- in_reply_to: unknown;
3459
- references: unknown[];
4732
+ message_id: string | null;
4733
+ in_reply_to: string | null;
4734
+ references: string[];
4735
+ attachments: {
4736
+ id: string;
4737
+ filename: string;
4738
+ content_type: string;
4739
+ size: number;
4740
+ inline: boolean;
4741
+ content_id: string | null;
4742
+ available: boolean;
4743
+ expires_at: string;
4744
+ }[];
4745
+ received_at: string;
4746
+ created_at: string;
4747
+ direction: "inbound";
4748
+ status: "inbox" | "spam";
3460
4749
  spam: {
3461
- score: number;
3462
- verdict: string;
3463
- virus: string;
3464
- spf: string;
3465
- dkim: string;
3466
- dmarc: string;
3467
- reasons: unknown[];
4750
+ score: number | null;
4751
+ verdict: string | null;
4752
+ virus: string | null;
4753
+ spf: string | null;
4754
+ dkim: string | null;
4755
+ dmarc: string | null;
4756
+ reasons: string[];
3468
4757
  };
3469
4758
  auto_submitted: boolean;
3470
- automation_reason: unknown;
4759
+ automation_reason: string | null;
4760
+ } | {
4761
+ object: "inbox_message";
4762
+ id: string;
4763
+ thread_id: string | null;
4764
+ inbox_id: string;
4765
+ from: string;
4766
+ from_address: string;
4767
+ from_name: string | null;
4768
+ to: string[];
4769
+ cc: string[];
4770
+ reply_to: string[];
4771
+ subject: string | null;
4772
+ text: string | null;
4773
+ html: string | null;
4774
+ snippet: string | null;
4775
+ remote_images: number;
4776
+ body_truncated: boolean;
4777
+ message_id: string | null;
4778
+ in_reply_to: string | null;
4779
+ references: string[];
3471
4780
  attachments: {
3472
4781
  id: string;
3473
4782
  filename: string;
3474
4783
  content_type: string;
3475
4784
  size: number;
3476
4785
  inline: boolean;
3477
- content_id: unknown;
4786
+ content_id: string | null;
3478
4787
  available: boolean;
3479
4788
  expires_at: string;
3480
4789
  }[];
3481
4790
  received_at: string;
3482
4791
  created_at: string;
4792
+ direction: "outbound";
4793
+ status: "draft" | "sent";
4794
+ email_id: string | null;
4795
+ delivery: string | null;
3483
4796
  };
3484
4797
  type MessagesUpdateParams = {
3485
4798
  id: string;
@@ -3488,124 +4801,110 @@ type MessagesUpdateParams = {
3488
4801
  html?: string | null;
3489
4802
  cc?: string[];
3490
4803
  };
3491
- type MessagesUpdateResponse = {
3492
- object: string;
4804
+ interface MessagesUpdateResponse {
4805
+ object: "inbox_message";
3493
4806
  id: string;
3494
- thread_id: string;
4807
+ thread_id: string | null;
3495
4808
  inbox_id: string;
3496
- direction: string;
3497
- status: string;
3498
4809
  from: string;
3499
4810
  from_address: string;
3500
- from_name: string;
4811
+ from_name: string | null;
3501
4812
  to: string[];
3502
- cc: unknown[];
3503
- reply_to: unknown[];
3504
- subject: string;
3505
- text: string;
3506
- html: string;
3507
- snippet: string;
4813
+ cc: string[];
4814
+ reply_to: string[];
4815
+ subject: string | null;
4816
+ text: string | null;
4817
+ html: string | null;
4818
+ snippet: string | null;
3508
4819
  remote_images: number;
3509
4820
  body_truncated: boolean;
3510
- message_id: string;
3511
- in_reply_to: unknown;
3512
- references: unknown[];
3513
- spam: {
3514
- score: number;
3515
- verdict: string;
3516
- virus: string;
3517
- spf: string;
3518
- dkim: string;
3519
- dmarc: string;
3520
- reasons: unknown[];
3521
- };
3522
- auto_submitted: boolean;
3523
- automation_reason: unknown;
4821
+ message_id: string | null;
4822
+ in_reply_to: string | null;
4823
+ references: string[];
3524
4824
  attachments: {
3525
4825
  id: string;
3526
4826
  filename: string;
3527
4827
  content_type: string;
3528
4828
  size: number;
3529
4829
  inline: boolean;
3530
- content_id: unknown;
4830
+ content_id: string | null;
3531
4831
  available: boolean;
3532
4832
  expires_at: string;
3533
4833
  }[];
3534
4834
  received_at: string;
3535
4835
  created_at: string;
3536
- };
4836
+ direction: "outbound";
4837
+ status: "draft" | "sent";
4838
+ email_id: string | null;
4839
+ delivery: string | null;
4840
+ }
3537
4841
  type MessagesSendParams = {
3538
4842
  id: string;
3539
4843
  } & {
3540
4844
  status?: "open" | "pending" | "done" | "archived";
3541
4845
  };
3542
4846
  type MessagesSendResponse = {
3543
- object: string;
4847
+ object: "inbox_message";
3544
4848
  id: string;
3545
- thread_id: string;
4849
+ thread_id: string | null;
3546
4850
  inbox_id: string;
3547
- direction: string;
3548
- status: string;
3549
4851
  from: string;
3550
4852
  from_address: string;
3551
- from_name: string;
4853
+ from_name: string | null;
3552
4854
  to: string[];
3553
- cc: unknown[];
3554
- reply_to: unknown[];
3555
- subject: string;
3556
- text: string;
3557
- html: string;
3558
- snippet: string;
4855
+ cc: string[];
4856
+ reply_to: string[];
4857
+ subject: string | null;
4858
+ text: string | null;
4859
+ html: string | null;
4860
+ snippet: string | null;
3559
4861
  remote_images: number;
3560
4862
  body_truncated: boolean;
3561
- message_id: string;
3562
- in_reply_to: unknown;
3563
- references: unknown[];
3564
- spam: {
3565
- score: number;
3566
- verdict: string;
3567
- virus: string;
3568
- spf: string;
3569
- dkim: string;
3570
- dmarc: string;
3571
- reasons: unknown[];
3572
- };
3573
- auto_submitted: boolean;
3574
- automation_reason: unknown;
4863
+ message_id: string | null;
4864
+ in_reply_to: string | null;
4865
+ references: string[];
3575
4866
  attachments: {
3576
4867
  id: string;
3577
4868
  filename: string;
3578
4869
  content_type: string;
3579
4870
  size: number;
3580
4871
  inline: boolean;
3581
- content_id: unknown;
4872
+ content_id: string | null;
3582
4873
  available: boolean;
3583
4874
  expires_at: string;
3584
4875
  }[];
3585
4876
  received_at: string;
3586
4877
  created_at: string;
4878
+ direction: "outbound";
4879
+ status: "sent";
4880
+ email_id: string;
4881
+ delivery: string;
4882
+ } | {
4883
+ object: "inbox_message";
4884
+ email_id: string;
4885
+ status: "sent";
3587
4886
  };
3588
4887
  interface MessagesRemoveParams {
3589
4888
  id: string;
3590
4889
  }
3591
- type MessagesRemoveResponse = {
3592
- object: string;
4890
+ interface MessagesRemoveResponse {
4891
+ object: "inbox_message";
3593
4892
  id: string;
3594
- deleted: boolean;
3595
- };
4893
+ deleted: true;
4894
+ }
3596
4895
  interface MessagesAttachmentParams {
3597
4896
  id: string;
3598
4897
  attachmentId: string;
3599
4898
  }
3600
- type MessagesAttachmentResponse = {
3601
- object: string;
4899
+ interface MessagesAttachmentResponse {
4900
+ object: "attachment_url";
3602
4901
  id: string;
3603
4902
  filename: string;
3604
4903
  content_type: string;
3605
4904
  size: number;
3606
4905
  url: string;
3607
4906
  expires_at: string;
3608
- };
4907
+ }
3609
4908
 
3610
4909
  interface SmartletterResources {
3611
4910
  emails: {
@@ -3774,8 +5073,10 @@ interface SmartletterResources {
3774
5073
  };
3775
5074
  }
3776
5075
 
3777
- type SendAttachment = Omit<NonNullable<EmailsSendParams["attachments"]>[number], "content"> & {
5076
+ type SendAttachment = Omit<NonNullable<EmailsSendParams["attachments"]>[number], "content" | "filename"> & {
3778
5077
  content?: string | Uint8Array;
5078
+ /** `false` (Resend 6.32) : pas de nom de fichier ; la clé est omise de la requête. Utile avec `path`. */
5079
+ filename?: string | false | undefined;
3779
5080
  };
3780
5081
  type ContentKeys = "from" | "subject" | "template" | "html" | "text";
3781
5082
  type EmailTemplate = NonNullable<EmailsSendParams["template"]>;