smartletter 1.1.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
@@ -126,9 +126,9 @@ interface EmailsSendParams {
126
126
  contentId?: string;
127
127
  }[];
128
128
  }
129
- type EmailsSendResponse = {
129
+ interface EmailsSendResponse {
130
130
  id: string;
131
- };
131
+ }
132
132
  type BatchSendParams = {
133
133
  /**
134
134
  * `Name <address@your-domain>`; the domain must be verified. Required, except with a `template` that has one.
@@ -178,7 +178,7 @@ type BatchSendParams = {
178
178
  */
179
179
  topicId?: string | null;
180
180
  }[];
181
- type BatchSendResponse = {
181
+ interface BatchSendResponse {
182
182
  data: {
183
183
  id: string;
184
184
  }[];
@@ -186,7 +186,7 @@ type BatchSendResponse = {
186
186
  index: number;
187
187
  message: string;
188
188
  }[];
189
- };
189
+ }
190
190
  interface EmailsListParams {
191
191
  /**
192
192
  * 1–100, default 20.
@@ -201,11 +201,11 @@ interface EmailsListParams {
201
201
  */
202
202
  before?: string;
203
203
  }
204
- type EmailsListResponse = {
205
- object: string;
204
+ interface EmailsListResponse {
205
+ object: "list";
206
206
  has_more: boolean;
207
207
  data: {
208
- object: string;
208
+ object: "email";
209
209
  id: string;
210
210
  message_id: string | null;
211
211
  to: string[];
@@ -219,12 +219,12 @@ type EmailsListResponse = {
219
219
  scheduled_at: string | null;
220
220
  topic_id: string | null;
221
221
  }[];
222
- };
222
+ }
223
223
  interface EmailsGetParams {
224
224
  id: string;
225
225
  }
226
- type EmailsGetResponse = {
227
- object: string;
226
+ interface EmailsGetResponse {
227
+ object: "email";
228
228
  id: string;
229
229
  message_id: string | null;
230
230
  to: string[];
@@ -243,18 +243,16 @@ type EmailsGetResponse = {
243
243
  name: string;
244
244
  value: string;
245
245
  }[];
246
- status: string;
247
- created_via: string;
248
- attachments: {
249
- filename: string;
250
- content_type: string;
251
- content_id: string | null;
252
- size: number;
253
- }[];
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
+ };
254
252
  recipients: {
255
253
  email: string;
256
- type: string;
257
- status: string;
254
+ type: "to" | "cc" | "bcc";
255
+ status: "queued" | "sent" | "delivered" | "delivery_delayed" | "bounced" | "complained" | "failed" | "suppressed" | "canceled";
258
256
  reason: string | null;
259
257
  bounce_type: string | null;
260
258
  smtp_status: string | null;
@@ -263,11 +261,13 @@ type EmailsGetResponse = {
263
261
  delay_expires_at: string | null;
264
262
  last_event_at: string | null;
265
263
  }[];
266
- smtp?: {
267
- client_ip: string | null;
268
- message_id: string | null;
269
- };
270
- };
264
+ attachments: {
265
+ filename: string;
266
+ content_type: string;
267
+ content_id: string | null;
268
+ size: number;
269
+ }[];
270
+ }
271
271
  type EmailsUpdateParams = {
272
272
  id: string;
273
273
  } & {
@@ -276,17 +276,17 @@ type EmailsUpdateParams = {
276
276
  */
277
277
  scheduledAt: string;
278
278
  };
279
- type EmailsUpdateResponse = {
280
- object: string;
279
+ interface EmailsUpdateResponse {
280
+ object: "email";
281
281
  id: string;
282
- };
282
+ }
283
283
  interface EmailsCancelParams {
284
284
  id: string;
285
285
  }
286
- type EmailsCancelResponse = {
287
- object: string;
286
+ interface EmailsCancelResponse {
287
+ object: "email";
288
288
  id: string;
289
- };
289
+ }
290
290
  interface TemplatesCreateParams {
291
291
  name: string;
292
292
  /**
@@ -326,10 +326,10 @@ interface TemplatesCreateParams {
326
326
  required?: boolean;
327
327
  }[];
328
328
  }
329
- type TemplatesCreateResponse = {
330
- object: string;
329
+ interface TemplatesCreateResponse {
330
+ object: "template";
331
331
  id: string;
332
- };
332
+ }
333
333
  interface TemplatesListParams {
334
334
  /**
335
335
  * 1–100, default 20.
@@ -344,25 +344,25 @@ interface TemplatesListParams {
344
344
  */
345
345
  before?: string;
346
346
  }
347
- type TemplatesListResponse = {
348
- object: string;
347
+ interface TemplatesListResponse {
348
+ object: "list";
349
349
  has_more: boolean;
350
350
  data: {
351
351
  id: string;
352
352
  name: string;
353
353
  alias: string | null;
354
- status: string;
354
+ status: "draft" | "published";
355
355
  published_at: string | null;
356
356
  archived: boolean;
357
357
  created_at: string;
358
358
  updated_at: string;
359
359
  }[];
360
- };
360
+ }
361
361
  interface TemplatesGetParams {
362
362
  id: string;
363
363
  }
364
- type TemplatesGetResponse = {
365
- object: string;
364
+ interface TemplatesGetResponse {
365
+ object: "template";
366
366
  id: string;
367
367
  current_version_id: string | null;
368
368
  current_version_number: number | null;
@@ -372,7 +372,7 @@ type TemplatesGetResponse = {
372
372
  name: string;
373
373
  created_at: string;
374
374
  updated_at: string;
375
- status: string;
375
+ status: "draft" | "published";
376
376
  published_at: string | null;
377
377
  archived: boolean;
378
378
  from: string | null;
@@ -383,14 +383,14 @@ type TemplatesGetResponse = {
383
383
  variables: {
384
384
  id: string;
385
385
  key: string;
386
- type: string;
387
- fallback_value: string | number | null;
386
+ type: "string" | "number";
387
+ fallback_value: (string | number) | null;
388
388
  required: boolean;
389
389
  created_at: string;
390
390
  updated_at: string;
391
391
  }[];
392
392
  has_unpublished_versions: boolean;
393
- };
393
+ }
394
394
  type TemplatesUpdateParams = {
395
395
  id: string;
396
396
  } & {
@@ -436,18 +436,18 @@ type TemplatesUpdateParams = {
436
436
  */
437
437
  changeNote?: string;
438
438
  };
439
- type TemplatesUpdateResponse = {
440
- object: string;
439
+ interface TemplatesUpdateResponse {
440
+ object: "template";
441
441
  id: string;
442
- };
442
+ }
443
443
  interface TemplatesRemoveParams {
444
444
  id: string;
445
445
  }
446
- type TemplatesRemoveResponse = {
447
- object: string;
446
+ interface TemplatesRemoveResponse {
447
+ object: "template";
448
448
  id: string;
449
- deleted: boolean;
450
- };
449
+ deleted: true;
450
+ }
451
451
  type TemplatesPublishParams = {
452
452
  id: string;
453
453
  } & {
@@ -456,17 +456,17 @@ type TemplatesPublishParams = {
456
456
  */
457
457
  versionId?: string;
458
458
  };
459
- type TemplatesPublishResponse = {
460
- object: string;
459
+ interface TemplatesPublishResponse {
460
+ object: "template";
461
461
  id: string;
462
- };
462
+ }
463
463
  interface TemplatesDuplicateParams {
464
464
  id: string;
465
465
  }
466
- type TemplatesDuplicateResponse = {
467
- object: string;
466
+ interface TemplatesDuplicateResponse {
467
+ object: "template";
468
468
  id: string;
469
- };
469
+ }
470
470
  type TemplatesVersionsParams = {
471
471
  id: string;
472
472
  } & {
@@ -483,21 +483,21 @@ type TemplatesVersionsParams = {
483
483
  */
484
484
  before?: string;
485
485
  };
486
- type TemplatesVersionsResponse = {
487
- object: string;
486
+ interface TemplatesVersionsResponse {
487
+ object: "list";
488
488
  has_more: boolean;
489
489
  data: {
490
- object: string;
490
+ object: "template_version";
491
491
  id: string;
492
492
  number: number;
493
493
  subject: string | null;
494
- source: string;
494
+ source: "html" | "doc";
495
495
  change_note: string | null;
496
- created_via: string;
496
+ created_via: "api" | "mcp" | "dashboard";
497
497
  published: boolean;
498
498
  created_at: string;
499
499
  }[];
500
- };
500
+ }
501
501
  interface NewslettersListParams {
502
502
  /**
503
503
  * 1–100, default 20.
@@ -511,38 +511,50 @@ interface NewslettersListParams {
511
511
  * Id of the first item of the previous page (newer items).
512
512
  */
513
513
  before?: string;
514
- status?: "draft" | "scheduled" | "sending" | "paused" | "sent" | "failed" | "held";
514
+ status?: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
515
515
  }
516
- type NewslettersListResponse = {
517
- object: string;
516
+ interface NewslettersListResponse {
517
+ object: "list";
518
518
  has_more: boolean;
519
519
  data: {
520
- object: string;
520
+ object: "newsletter";
521
521
  id: string;
522
522
  segment_id: string;
523
- topic_id: unknown;
523
+ topic_id: string | null;
524
524
  subject: string;
525
- preheader: string;
526
- status: string;
527
- body: {
528
- format: string;
529
- content: unknown;
530
- blocks: {
531
- blockId: string;
532
- kind: string;
533
- 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;
534
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;
535
553
  };
536
- audience_limit: unknown;
537
- scheduled_for: unknown;
538
- pause_reason: unknown;
539
- recipient_estimate: unknown;
540
- ab_test: unknown;
541
- ab_winner: unknown;
542
554
  created_at: string;
543
555
  updated_at: string;
544
556
  }[];
545
- };
557
+ }
546
558
  interface NewslettersCreateParams {
547
559
  /**
548
560
  * Subject line.
@@ -684,61 +696,115 @@ interface NewslettersCreateParams {
684
696
  winnerMode?: "auto" | "manual";
685
697
  } | null;
686
698
  }
687
- type NewslettersCreateResponse = {
688
- object: string;
699
+ interface NewslettersCreateResponse {
700
+ object: "newsletter";
689
701
  id: string;
690
702
  segment_id: string;
691
- topic_id: unknown;
703
+ topic_id: string | null;
692
704
  subject: string;
693
- preheader: string;
694
- status: string;
705
+ preheader: string | null;
706
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
695
707
  body: {
696
- format: string;
697
- content: unknown;
708
+ format: "markdown" | "html";
709
+ content: string;
710
+ } | {
711
+ format: "sections";
712
+ content: null;
713
+ } | {
714
+ format: "document";
715
+ content: null;
698
716
  blocks: {
699
- blockId: string;
717
+ block_id: string;
700
718
  kind: string;
701
719
  text: string;
702
720
  }[];
703
721
  };
704
- audience_limit: unknown;
705
- scheduled_for: unknown;
706
- pause_reason: unknown;
707
- recipient_estimate: unknown;
708
- ab_test: unknown;
709
- 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
+ };
710
749
  created_at: string;
711
750
  updated_at: string;
712
- };
751
+ }
713
752
  interface NewslettersGetParams {
714
753
  id: string;
715
754
  }
716
- type NewslettersGetResponse = {
717
- object: string;
755
+ interface NewslettersGetResponse {
756
+ object: "newsletter";
718
757
  id: string;
719
758
  segment_id: string;
720
- topic_id: unknown;
759
+ topic_id: string | null;
721
760
  subject: string;
722
- preheader: string;
723
- status: string;
761
+ preheader: string | null;
762
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
724
763
  body: {
725
- format: string;
726
- content: unknown;
764
+ format: "markdown" | "html";
765
+ content: string;
766
+ } | {
767
+ format: "sections";
768
+ content: null;
769
+ } | {
770
+ format: "document";
771
+ content: null;
727
772
  blocks: {
728
- blockId: string;
773
+ block_id: string;
729
774
  kind: string;
730
775
  text: string;
731
776
  }[];
732
777
  };
733
- audience_limit: unknown;
734
- scheduled_for: unknown;
735
- pause_reason: unknown;
736
- recipient_estimate: unknown;
737
- ab_test: unknown;
738
- 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
+ };
739
805
  created_at: string;
740
806
  updated_at: string;
741
- };
807
+ }
742
808
  type NewslettersUpdateParams = {
743
809
  id: string;
744
810
  } & {
@@ -863,90 +929,151 @@ type NewslettersUpdateParams = {
863
929
  winnerMode?: "auto" | "manual";
864
930
  } | null;
865
931
  };
866
- type NewslettersUpdateResponse = {
867
- object: string;
932
+ interface NewslettersUpdateResponse {
933
+ object: "newsletter";
868
934
  id: string;
869
935
  segment_id: string;
870
- topic_id: unknown;
936
+ topic_id: string | null;
871
937
  subject: string;
872
- preheader: string;
873
- status: string;
938
+ preheader: string | null;
939
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
874
940
  body: {
875
- format: string;
876
- content: unknown;
941
+ format: "markdown" | "html";
942
+ content: string;
943
+ } | {
944
+ format: "sections";
945
+ content: null;
946
+ } | {
947
+ format: "document";
948
+ content: null;
877
949
  blocks: {
878
- blockId: string;
950
+ block_id: string;
879
951
  kind: string;
880
952
  text: string;
881
953
  }[];
882
954
  };
883
- audience_limit: unknown;
884
- scheduled_for: unknown;
885
- pause_reason: unknown;
886
- recipient_estimate: unknown;
887
- ab_test: unknown;
888
- 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
+ };
889
982
  created_at: string;
890
983
  updated_at: string;
891
- };
984
+ }
892
985
  interface NewslettersRemoveParams {
893
986
  id: string;
894
987
  }
895
- type NewslettersRemoveResponse = {
896
- object: string;
988
+ interface NewslettersRemoveResponse {
989
+ object: "newsletter";
897
990
  id: string;
898
- deleted: boolean;
899
- };
991
+ deleted: true;
992
+ }
900
993
  interface NewslettersDuplicateParams {
901
994
  id: string;
902
995
  }
903
- type NewslettersDuplicateResponse = {
904
- object: string;
996
+ interface NewslettersDuplicateResponse {
997
+ object: "newsletter";
905
998
  id: string;
906
999
  segment_id: string;
907
- topic_id: unknown;
1000
+ topic_id: string | null;
908
1001
  subject: string;
909
- preheader: string;
910
- status: string;
1002
+ preheader: string | null;
1003
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
911
1004
  body: {
912
- format: string;
913
- content: unknown;
1005
+ format: "markdown" | "html";
1006
+ content: string;
1007
+ } | {
1008
+ format: "sections";
1009
+ content: null;
1010
+ } | {
1011
+ format: "document";
1012
+ content: null;
914
1013
  blocks: {
915
- blockId: string;
1014
+ block_id: string;
916
1015
  kind: string;
917
1016
  text: string;
918
1017
  }[];
919
1018
  };
920
- audience_limit: unknown;
921
- scheduled_for: unknown;
922
- pause_reason: unknown;
923
- recipient_estimate: unknown;
924
- ab_test: unknown;
925
- 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
+ };
926
1046
  created_at: string;
927
1047
  updated_at: string;
928
- };
1048
+ }
929
1049
  interface NewslettersReviewParams {
930
1050
  id: string;
931
1051
  }
932
- type NewslettersReviewResponse = {
933
- object: string;
1052
+ interface NewslettersReviewResponse {
1053
+ object: "review";
1054
+ id: string;
934
1055
  blocking: boolean;
935
1056
  items: {
936
- id: string;
937
- level: string;
1057
+ id: "subject" | "preheader" | "unsubscribe" | "postal_address" | "size" | "links" | "images_alt" | "domain" | "content" | "html_size" | "variables";
1058
+ level: "ok" | "warning" | "blocking";
938
1059
  values?: {
939
- kb: number;
1060
+ max?: number;
1061
+ length?: number;
1062
+ kb?: number;
1063
+ count?: number;
1064
+ percent?: number;
940
1065
  };
941
1066
  }[];
942
- };
1067
+ }
943
1068
  interface NewslettersTestParams {
944
1069
  id: string;
945
1070
  }
946
- type NewslettersTestResponse = {
947
- object: string;
1071
+ interface NewslettersTestResponse {
1072
+ object: "test_email";
1073
+ id: string;
948
1074
  to: string;
949
- };
1075
+ variants: number;
1076
+ }
950
1077
  type NewslettersSendParams = {
951
1078
  id: string;
952
1079
  } & {
@@ -955,11 +1082,59 @@ type NewslettersSendParams = {
955
1082
  */
956
1083
  audienceLimit?: number;
957
1084
  };
958
- type NewslettersSendResponse = {
959
- object: string;
1085
+ interface NewslettersSendResponse {
1086
+ object: "newsletter";
960
1087
  id: string;
961
- status: string;
962
- };
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
+ }
963
1138
  type NewslettersScheduleParams = {
964
1139
  id: string;
965
1140
  } & {
@@ -972,57 +1147,296 @@ type NewslettersScheduleParams = {
972
1147
  */
973
1148
  audienceLimit?: number;
974
1149
  };
975
- type NewslettersScheduleResponse = {
976
- object: string;
977
- id: string;
978
- status: string;
979
- scheduled_for: string;
980
- };
981
- interface NewslettersUnscheduleParams {
982
- id: string;
983
- }
984
- type NewslettersUnscheduleResponse = {
985
- object: string;
986
- id: string;
987
- status: string;
988
- };
989
- interface NewslettersPauseParams {
990
- id: string;
991
- }
992
- type NewslettersPauseResponse = {
993
- object: string;
994
- id: string;
995
- status: string;
996
- };
997
- interface NewslettersResumeParams {
1150
+ interface NewslettersScheduleResponse {
1151
+ object: "newsletter";
998
1152
  id: string;
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: {
1192
+ sent: number;
1193
+ delivered: number;
1194
+ opened: number;
1195
+ clicked: number;
1196
+ bounced: number;
1197
+ complained: number;
1198
+ unsubscribed: number;
1199
+ };
1200
+ created_at: string;
1201
+ updated_at: string;
999
1202
  }
1000
- type NewslettersResumeResponse = {
1001
- object: string;
1002
- id: string;
1003
- status: string;
1004
- };
1005
- type NewslettersSendMoreParams = {
1006
- id: string;
1007
- } & {
1008
- /**
1009
- * How many of the next most engaged contacts to add.
1010
- */
1011
- count: number;
1012
- };
1013
- type NewslettersSendMoreResponse = {
1014
- object: string;
1015
- id: string;
1016
- status: string;
1017
- };
1018
- interface NewslettersReportParams {
1203
+ interface NewslettersUnscheduleParams {
1019
1204
  id: string;
1020
1205
  }
1021
- type NewslettersReportResponse = {
1022
- object: string;
1206
+ interface NewslettersUnscheduleResponse {
1207
+ object: "newsletter";
1023
1208
  id: string;
1024
- status: string;
1025
- totals: {
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
+ }[];
1241
+ sample_pct: number;
1242
+ metric: "opens" | "clicks";
1243
+ wait_hours: number;
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: {
1292
+ variants: {
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: {
1026
1440
  sent: number;
1027
1441
  delivered: number;
1028
1442
  opened: number;
@@ -1040,12 +1454,12 @@ type NewslettersReportResponse = {
1040
1454
  unsubscribe: number;
1041
1455
  };
1042
1456
  progress: {
1043
- attempted: number;
1044
- recipient_estimate: number;
1045
- audience_limit: unknown;
1457
+ attempted: number | null;
1458
+ recipient_estimate: number | null;
1459
+ audience_limit: number | null;
1046
1460
  };
1047
1461
  providers: {
1048
- provider: string;
1462
+ provider: "gmail" | "microsoft" | "yahoo" | "apple" | "fr_isp" | "gmx" | "proton" | "other";
1049
1463
  sent: number;
1050
1464
  delivered: number;
1051
1465
  opened: number;
@@ -1054,19 +1468,19 @@ type NewslettersReportResponse = {
1054
1468
  complained: number;
1055
1469
  }[];
1056
1470
  ab_test: {
1057
- phase: string;
1471
+ phase: ("testing" | "waiting" | "winner") | null;
1058
1472
  sample_pct: number;
1059
- metric: string;
1473
+ metric: "opens" | "clicks";
1060
1474
  wait_hours: number;
1061
- winner_mode: string;
1062
- winner: unknown;
1063
- decided_at: unknown;
1064
- decided_by: unknown;
1065
- decide_at: string;
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;
1066
1480
  variants: {
1067
- key: string;
1481
+ key: "A" | "B" | "C" | "D";
1068
1482
  subject: string;
1069
- preheader: string;
1483
+ preheader: string | null;
1070
1484
  total: {
1071
1485
  attempted: number;
1072
1486
  sent: number;
@@ -1079,13 +1493,9 @@ type NewslettersReportResponse = {
1079
1493
  };
1080
1494
  }[];
1081
1495
  report: {
1082
- metric: string;
1083
- leader: string;
1084
- winner: unknown;
1085
- p_value: number;
1086
- significant: boolean;
1496
+ metric: "opens" | "clicks";
1087
1497
  variants: {
1088
- variant: string;
1498
+ variant: "A" | "B" | "C" | "D";
1089
1499
  sent: number;
1090
1500
  opened: number;
1091
1501
  clicked: number;
@@ -1095,17 +1505,21 @@ type NewslettersReportResponse = {
1095
1505
  ci_high: number;
1096
1506
  leader: boolean;
1097
1507
  }[];
1508
+ leader: "A" | "B" | "C" | "D";
1509
+ winner: ("A" | "B" | "C" | "D") | null;
1510
+ p_value: number;
1511
+ significant: boolean;
1098
1512
  };
1099
- };
1513
+ } | null;
1100
1514
  links: {
1101
1515
  url: string;
1102
- label: string;
1516
+ label: string | null;
1103
1517
  clicks: number;
1104
1518
  unique_clickers: number;
1105
1519
  share: number;
1106
1520
  }[];
1107
1521
  links_total: number;
1108
- };
1522
+ }
1109
1523
  type NewslettersAbWinnerParams = {
1110
1524
  id: string;
1111
1525
  } & {
@@ -1114,32 +1528,59 @@ type NewslettersAbWinnerParams = {
1114
1528
  */
1115
1529
  variant: "A" | "B" | "C" | "D";
1116
1530
  };
1117
- type NewslettersAbWinnerResponse = {
1118
- object: string;
1531
+ interface NewslettersAbWinnerResponse {
1532
+ object: "newsletter";
1119
1533
  id: string;
1120
1534
  segment_id: string;
1121
- topic_id: unknown;
1535
+ topic_id: string | null;
1122
1536
  subject: string;
1123
- preheader: string;
1124
- status: string;
1537
+ preheader: string | null;
1538
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1125
1539
  body: {
1126
- format: string;
1127
- content: unknown;
1540
+ format: "markdown" | "html";
1541
+ content: string;
1542
+ } | {
1543
+ format: "sections";
1544
+ content: null;
1545
+ } | {
1546
+ format: "document";
1547
+ content: null;
1128
1548
  blocks: {
1129
- blockId: string;
1549
+ block_id: string;
1130
1550
  kind: string;
1131
1551
  text: string;
1132
1552
  }[];
1133
1553
  };
1134
- audience_limit: unknown;
1135
- scheduled_for: unknown;
1136
- pause_reason: unknown;
1137
- recipient_estimate: unknown;
1138
- ab_test: unknown;
1139
- 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
+ };
1140
1581
  created_at: string;
1141
1582
  updated_at: string;
1142
- };
1583
+ }
1143
1584
  interface ContactsListParams {
1144
1585
  /**
1145
1586
  * 1–100, default 20.
@@ -1164,17 +1605,36 @@ interface ContactsListParams {
1164
1605
  */
1165
1606
  tag?: string;
1166
1607
  }
1167
- type ContactsListResponse = {
1168
- object: string;
1608
+ interface ContactsListResponse {
1609
+ object: "list";
1169
1610
  has_more: boolean;
1170
1611
  data: {
1171
- object: string;
1612
+ object: "contact";
1172
1613
  id: string;
1173
1614
  email: string;
1174
- status: string;
1615
+ name: string | null;
1616
+ first_name: string | null;
1617
+ last_name: string | null;
1618
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1175
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
+ };
1176
1636
  }[];
1177
- };
1637
+ }
1178
1638
  interface ContactsCreateParams {
1179
1639
  email: string;
1180
1640
  /**
@@ -1199,13 +1659,33 @@ interface ContactsCreateParams {
1199
1659
  */
1200
1660
  tags?: string[];
1201
1661
  }
1202
- type ContactsCreateResponse = {
1203
- object: string;
1662
+ interface ContactsCreateResponse {
1663
+ object: "contact";
1204
1664
  id: string;
1205
1665
  email: string;
1206
- 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
+ };
1207
1687
  existed: boolean;
1208
- };
1688
+ }
1209
1689
  interface ContactsImportParams {
1210
1690
  segmentId?: string;
1211
1691
  /**
@@ -1250,13 +1730,14 @@ interface ContactsImportParams {
1250
1730
  unsubscribedAt?: string | null;
1251
1731
  }[];
1252
1732
  }
1253
- type ContactsImportResponse = {
1254
- object: string;
1733
+ interface ContactsImportResponse {
1734
+ object: "import";
1255
1735
  total: number;
1256
1736
  inserted: number;
1257
1737
  rejected: number;
1258
1738
  reasons: {
1259
- invalid: number;
1739
+ invalid_syntax: number;
1740
+ source_unsubscribed: number;
1260
1741
  typo: number;
1261
1742
  spam_trap: number;
1262
1743
  role: number;
@@ -1269,11 +1750,18 @@ type ContactsImportResponse = {
1269
1750
  rejected_rows: {
1270
1751
  line: number;
1271
1752
  email: string;
1272
- reason: string;
1753
+ reason: "invalid_syntax" | "source_unsubscribed" | "typo" | "spam_trap" | "role" | "disposable" | "no_mx" | "duplicate" | "suppressed" | "capped";
1273
1754
  suggestion?: string;
1274
1755
  }[];
1756
+ report_truncated: boolean;
1757
+ engagement_imported: number;
1758
+ capped: boolean;
1759
+ remaining_capacity: number | null;
1275
1760
  pending_review: boolean;
1276
- };
1761
+ verifying: boolean;
1762
+ tagged: number;
1763
+ unsubscribed: number;
1764
+ }
1277
1765
  interface ContactsExportParams {
1278
1766
  segmentId?: string;
1279
1767
  status?: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
@@ -1282,49 +1770,106 @@ type ContactsExportResponse = string;
1282
1770
  interface ContactsGetParams {
1283
1771
  id: string;
1284
1772
  }
1285
- type ContactsGetResponse = {
1286
- object: string;
1773
+ interface ContactsGetResponse {
1774
+ object: "contact";
1287
1775
  id: string;
1288
1776
  email: string;
1289
- 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[];
1290
1791
  engagement: {
1291
1792
  emails_sent: number;
1292
1793
  emails_opened: number;
1293
1794
  emails_clicked: number;
1795
+ last_opened_at: string | null;
1796
+ last_clicked_at: string | null;
1294
1797
  };
1295
1798
  status_history: {
1296
1799
  at: string;
1297
- from_status: string;
1298
- to_status: string;
1299
- 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";
1300
1803
  actor: string;
1301
- detail: unknown;
1804
+ detail: string | null;
1302
1805
  }[];
1303
- };
1806
+ }
1304
1807
  interface ContactsUnsubscribeParams {
1305
1808
  id: string;
1306
1809
  }
1307
- type ContactsUnsubscribeResponse = {
1308
- object: string;
1810
+ interface ContactsUnsubscribeResponse {
1811
+ object: "contact";
1309
1812
  id: string;
1310
- status: string;
1311
- };
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
+ }
1312
1836
  interface ContactsReactivateParams {
1313
1837
  id: string;
1314
1838
  }
1315
- type ContactsReactivateResponse = {
1316
- object: string;
1839
+ interface ContactsReactivateResponse {
1840
+ object: "contact";
1317
1841
  id: string;
1318
- status: string;
1319
- };
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
+ }
1320
1865
  interface ContactsRemoveParams {
1321
1866
  id: string;
1322
1867
  }
1323
- type ContactsRemoveResponse = {
1324
- object: string;
1868
+ interface ContactsRemoveResponse {
1869
+ object: "contact";
1325
1870
  id: string;
1326
- deleted: boolean;
1327
- };
1871
+ deleted: true;
1872
+ }
1328
1873
  type ContactsUpdateParams = {
1329
1874
  id: string;
1330
1875
  } & {
@@ -1351,31 +1896,49 @@ type ContactsUpdateParams = {
1351
1896
  */
1352
1897
  removeTags?: string[];
1353
1898
  };
1354
- type ContactsUpdateResponse = {
1355
- object: string;
1899
+ interface ContactsUpdateResponse {
1900
+ object: "contact";
1356
1901
  id: string;
1357
- 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;
1358
1913
  custom_fields: {
1359
- plan: string;
1914
+ [k: string]: string | number | boolean;
1360
1915
  };
1361
- };
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
+ }
1362
1925
  type ContactFieldsListParams = Record<string, never>;
1363
- type ContactFieldsListResponse = {
1364
- object: string;
1926
+ interface ContactFieldsListResponse {
1927
+ object: "list";
1365
1928
  has_more: boolean;
1366
1929
  data: {
1367
- object: string;
1930
+ object: "contact_field";
1368
1931
  id: string;
1369
1932
  key: string;
1370
1933
  label: string;
1371
- type: string;
1372
- options: string[];
1373
- default_value: unknown;
1934
+ type: "text" | "number" | "date" | "boolean" | "choice";
1935
+ options: string[] | null;
1936
+ default_value: (string | number | boolean) | null;
1374
1937
  in_signup: boolean;
1375
1938
  position: number;
1376
1939
  created_at: string;
1377
1940
  }[];
1378
- };
1941
+ }
1379
1942
  interface ContactFieldsCreateParams {
1380
1943
  /**
1381
1944
  * Lowercase letters, digits, `_`. Used as `{{custom.<key>}}`. Immutable.
@@ -1399,18 +1962,18 @@ interface ContactFieldsCreateParams {
1399
1962
  */
1400
1963
  inSignup?: boolean;
1401
1964
  }
1402
- type ContactFieldsCreateResponse = {
1403
- object: string;
1965
+ interface ContactFieldsCreateResponse {
1966
+ object: "contact_field";
1404
1967
  id: string;
1405
1968
  key: string;
1406
1969
  label: string;
1407
- type: string;
1408
- options: string[];
1409
- default_value: unknown;
1970
+ type: "text" | "number" | "date" | "boolean" | "choice";
1971
+ options: string[] | null;
1972
+ default_value: (string | number | boolean) | null;
1410
1973
  in_signup: boolean;
1411
1974
  position: number;
1412
1975
  created_at: string;
1413
- };
1976
+ }
1414
1977
  type ContactFieldsUpdateParams = {
1415
1978
  id: string;
1416
1979
  } & {
@@ -1420,26 +1983,26 @@ type ContactFieldsUpdateParams = {
1420
1983
  inSignup?: boolean;
1421
1984
  position?: number;
1422
1985
  };
1423
- type ContactFieldsUpdateResponse = {
1424
- object: string;
1986
+ interface ContactFieldsUpdateResponse {
1987
+ object: "contact_field";
1425
1988
  id: string;
1426
1989
  key: string;
1427
1990
  label: string;
1428
- type: string;
1429
- options: string[];
1430
- default_value: unknown;
1991
+ type: "text" | "number" | "date" | "boolean" | "choice";
1992
+ options: string[] | null;
1993
+ default_value: (string | number | boolean) | null;
1431
1994
  in_signup: boolean;
1432
1995
  position: number;
1433
1996
  created_at: string;
1434
- };
1997
+ }
1435
1998
  interface ContactFieldsRemoveParams {
1436
1999
  id: string;
1437
2000
  }
1438
- type ContactFieldsRemoveResponse = {
1439
- object: string;
2001
+ interface ContactFieldsRemoveResponse {
2002
+ object: "contact_field";
1440
2003
  id: string;
1441
- deleted: boolean;
1442
- };
2004
+ deleted: true;
2005
+ }
1443
2006
  interface EventsSendParams {
1444
2007
  /**
1445
2008
  * Give `email` or `contact_id`.
@@ -1469,18 +2032,17 @@ interface EventsSendParams {
1469
2032
  */
1470
2033
  segmentId?: string;
1471
2034
  }
1472
- type EventsSendResponse = {
1473
- object: string;
2035
+ interface EventsSendResponse {
2036
+ object: "event";
1474
2037
  id: string;
1475
2038
  email: string;
1476
2039
  event: string;
1477
2040
  properties: {
1478
- plan: string;
1479
- amount: number;
2041
+ [k: string]: unknown;
1480
2042
  };
1481
2043
  occurred_at: string;
1482
2044
  contact_created: boolean;
1483
- };
2045
+ }
1484
2046
  interface AudienceFiltersListParams {
1485
2047
  /**
1486
2048
  * 1–100, default 20.
@@ -1495,28 +2057,21 @@ interface AudienceFiltersListParams {
1495
2057
  */
1496
2058
  before?: string;
1497
2059
  }
1498
- type AudienceFiltersListResponse = {
1499
- object: string;
2060
+ interface AudienceFiltersListResponse {
2061
+ object: "list";
1500
2062
  has_more: boolean;
1501
2063
  data: {
1502
- object: string;
2064
+ object: "audience_filter";
1503
2065
  id: string;
1504
2066
  name: string;
1505
- description: unknown;
2067
+ description: string | null;
1506
2068
  rules: {
1507
- op: string;
1508
- rules: {
1509
- field?: string;
1510
- op: string;
1511
- value?: string;
1512
- event?: string;
1513
- within_days?: number;
1514
- }[];
2069
+ [k: string]: unknown;
1515
2070
  };
1516
2071
  created_at: string;
1517
2072
  updated_at: string;
1518
2073
  }[];
1519
- };
2074
+ }
1520
2075
  interface AudienceFiltersCreateParams {
1521
2076
  name: string;
1522
2077
  description?: string | null;
@@ -1527,45 +2082,31 @@ interface AudienceFiltersCreateParams {
1527
2082
  [k: string]: unknown;
1528
2083
  };
1529
2084
  }
1530
- type AudienceFiltersCreateResponse = {
1531
- object: string;
2085
+ interface AudienceFiltersCreateResponse {
2086
+ object: "audience_filter";
1532
2087
  id: string;
1533
2088
  name: string;
1534
- description: unknown;
2089
+ description: string | null;
1535
2090
  rules: {
1536
- op: string;
1537
- rules: {
1538
- field?: string;
1539
- op: string;
1540
- value?: string;
1541
- event?: string;
1542
- within_days?: number;
1543
- }[];
2091
+ [k: string]: unknown;
1544
2092
  };
1545
2093
  created_at: string;
1546
2094
  updated_at: string;
1547
- };
2095
+ }
1548
2096
  interface AudienceFiltersGetParams {
1549
2097
  id: string;
1550
2098
  }
1551
- type AudienceFiltersGetResponse = {
1552
- object: string;
2099
+ interface AudienceFiltersGetResponse {
2100
+ object: "audience_filter";
1553
2101
  id: string;
1554
2102
  name: string;
1555
- description: unknown;
2103
+ description: string | null;
1556
2104
  rules: {
1557
- op: string;
1558
- rules: {
1559
- field?: string;
1560
- op: string;
1561
- value?: string;
1562
- event?: string;
1563
- within_days?: number;
1564
- }[];
2105
+ [k: string]: unknown;
1565
2106
  };
1566
2107
  created_at: string;
1567
2108
  updated_at: string;
1568
- };
2109
+ }
1569
2110
  type AudienceFiltersUpdateParams = {
1570
2111
  id: string;
1571
2112
  } & {
@@ -1578,32 +2119,25 @@ type AudienceFiltersUpdateParams = {
1578
2119
  [k: string]: unknown;
1579
2120
  };
1580
2121
  };
1581
- type AudienceFiltersUpdateResponse = {
1582
- object: string;
2122
+ interface AudienceFiltersUpdateResponse {
2123
+ object: "audience_filter";
1583
2124
  id: string;
1584
2125
  name: string;
1585
- description: unknown;
2126
+ description: string | null;
1586
2127
  rules: {
1587
- op: string;
1588
- rules: {
1589
- field?: string;
1590
- op: string;
1591
- value?: string;
1592
- event?: string;
1593
- within_days?: number;
1594
- }[];
2128
+ [k: string]: unknown;
1595
2129
  };
1596
2130
  created_at: string;
1597
2131
  updated_at: string;
1598
- };
2132
+ }
1599
2133
  interface AudienceFiltersRemoveParams {
1600
2134
  id: string;
1601
2135
  }
1602
- type AudienceFiltersRemoveResponse = {
1603
- object: string;
2136
+ interface AudienceFiltersRemoveResponse {
2137
+ object: "audience_filter";
1604
2138
  id: string;
1605
- deleted: boolean;
1606
- };
2139
+ deleted: true;
2140
+ }
1607
2141
  interface AudienceFiltersCountParams {
1608
2142
  /**
1609
2143
  * A saved filter. Give `filter_id` or `rules`.
@@ -1620,11 +2154,11 @@ interface AudienceFiltersCountParams {
1620
2154
  */
1621
2155
  segmentId?: string;
1622
2156
  }
1623
- type AudienceFiltersCountResponse = {
1624
- object: string;
2157
+ interface AudienceFiltersCountResponse {
2158
+ object: "audience_filter_count";
1625
2159
  total: number;
1626
2160
  active: number;
1627
- };
2161
+ }
1628
2162
  interface SignupsCreateParams {
1629
2163
  email: string;
1630
2164
  name?: string;
@@ -1645,10 +2179,10 @@ interface SignupsCreateParams {
1645
2179
  [k: string]: string | number | boolean | null;
1646
2180
  };
1647
2181
  }
1648
- type SignupsCreateResponse = {
1649
- object: string;
1650
- status: string;
1651
- };
2182
+ interface SignupsCreateResponse {
2183
+ object: "signup";
2184
+ status: "pending";
2185
+ }
1652
2186
  interface SegmentsListParams {
1653
2187
  /**
1654
2188
  * 1–100, default 20.
@@ -1663,16 +2197,19 @@ interface SegmentsListParams {
1663
2197
  */
1664
2198
  before?: string;
1665
2199
  }
1666
- type SegmentsListResponse = {
1667
- object: string;
2200
+ interface SegmentsListResponse {
2201
+ object: "list";
1668
2202
  has_more: boolean;
1669
2203
  data: {
1670
- object: string;
2204
+ object: "segment";
1671
2205
  id: string;
1672
2206
  name: string;
1673
2207
  slug: string;
2208
+ language: string;
2209
+ status: "active" | "archived";
2210
+ created_at: string;
1674
2211
  }[];
1675
- };
2212
+ }
1676
2213
  interface SegmentsCreateParams {
1677
2214
  name: string;
1678
2215
  slug: string;
@@ -1680,43 +2217,55 @@ interface SegmentsCreateParams {
1680
2217
  description?: string;
1681
2218
  themes?: string[];
1682
2219
  }
1683
- type SegmentsCreateResponse = {
1684
- object: string;
2220
+ interface SegmentsCreateResponse {
2221
+ object: "segment";
1685
2222
  id: string;
1686
2223
  name: string;
1687
2224
  slug: string;
1688
- };
2225
+ language: string;
2226
+ status: "active" | "archived";
2227
+ created_at: string;
2228
+ }
1689
2229
  interface TopicsListParams {
1690
2230
  segmentId: string;
1691
2231
  }
1692
- type TopicsListResponse = {
1693
- object: string;
2232
+ interface TopicsListResponse {
2233
+ object: "list";
1694
2234
  has_more: boolean;
1695
2235
  data: {
1696
- object: string;
2236
+ object: "topic";
1697
2237
  id: string;
1698
2238
  segment_id: string;
1699
2239
  name: string;
2240
+ slug: string;
2241
+ status: "active" | "archived";
2242
+ created_at: string;
1700
2243
  }[];
1701
- };
2244
+ }
1702
2245
  interface SegmentsArchiveGetParams {
1703
2246
  id: string;
1704
2247
  }
1705
- type SegmentsArchiveGetResponse = {
1706
- object: string;
2248
+ interface SegmentsArchiveGetResponse {
2249
+ object: "archive";
1707
2250
  segment_id: string;
1708
2251
  enabled: boolean;
1709
2252
  slug: string;
1710
2253
  url: string;
1711
- custom_domain: string;
1712
- description: string;
1713
- author: string;
1714
- about: unknown;
1715
- 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;
1716
2259
  links: {
1717
- x: string;
2260
+ website?: string;
2261
+ x?: string;
2262
+ linkedin?: string;
2263
+ youtube?: string;
2264
+ instagram?: string;
2265
+ github?: string;
2266
+ bluesky?: string;
1718
2267
  };
1719
- };
2268
+ }
1720
2269
  type SegmentsArchiveUpdateParams = {
1721
2270
  id: string;
1722
2271
  } & {
@@ -1754,21 +2303,27 @@ type SegmentsArchiveUpdateParams = {
1754
2303
  bluesky?: string | null;
1755
2304
  };
1756
2305
  };
1757
- type SegmentsArchiveUpdateResponse = {
1758
- object: string;
2306
+ interface SegmentsArchiveUpdateResponse {
2307
+ object: "archive";
1759
2308
  segment_id: string;
1760
2309
  enabled: boolean;
1761
2310
  slug: string;
1762
2311
  url: string;
1763
- custom_domain: string;
1764
- description: string;
1765
- author: string;
1766
- about: unknown;
1767
- 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;
1768
2317
  links: {
1769
- x: string;
2318
+ website?: string;
2319
+ x?: string;
2320
+ linkedin?: string;
2321
+ youtube?: string;
2322
+ instagram?: string;
2323
+ github?: string;
2324
+ bluesky?: string;
1770
2325
  };
1771
- };
2326
+ }
1772
2327
  type NewslettersArchiveUpdateParams = {
1773
2328
  id: string;
1774
2329
  } & {
@@ -1781,32 +2336,32 @@ type NewslettersArchiveUpdateParams = {
1781
2336
  */
1782
2337
  hidden?: boolean;
1783
2338
  };
1784
- type NewslettersArchiveUpdateResponse = {
1785
- object: string;
2339
+ interface NewslettersArchiveUpdateResponse {
2340
+ object: "newsletter_archive";
1786
2341
  id: string;
1787
2342
  pinned: boolean;
1788
2343
  hidden: boolean;
1789
- };
2344
+ }
1790
2345
  interface SegmentsDomainGetParams {
1791
2346
  id: string;
1792
2347
  }
1793
- type SegmentsDomainGetResponse = {
1794
- object: string;
2348
+ interface SegmentsDomainGetResponse {
2349
+ object: "custom_domain";
1795
2350
  id: string;
1796
2351
  segment_id: string;
1797
2352
  domain: string;
1798
- status: string;
1799
- uses: string[];
2353
+ status: "pending" | "verified" | "failed";
2354
+ uses: ("tracking" | "preferences" | "archive")[];
1800
2355
  records: {
1801
2356
  type: string;
1802
2357
  name: string;
1803
2358
  value: string;
1804
2359
  }[];
1805
- last_checked_at: unknown;
1806
- verified_at: unknown;
1807
- last_error: unknown;
2360
+ last_checked_at: string | null;
2361
+ verified_at: string | null;
2362
+ last_error: string | null;
1808
2363
  created_at: string;
1809
- };
2364
+ }
1810
2365
  type SegmentsDomainSetParams = {
1811
2366
  id: string;
1812
2367
  } & {
@@ -1815,31 +2370,32 @@ type SegmentsDomainSetParams = {
1815
2370
  */
1816
2371
  domain: string;
1817
2372
  };
1818
- type SegmentsDomainSetResponse = {
1819
- object: string;
2373
+ interface SegmentsDomainSetResponse {
2374
+ object: "custom_domain";
1820
2375
  id: string;
1821
2376
  segment_id: string;
1822
2377
  domain: string;
1823
- status: string;
1824
- uses: string[];
2378
+ status: "pending" | "verified" | "failed";
2379
+ uses: ("tracking" | "preferences" | "archive")[];
1825
2380
  records: {
1826
2381
  type: string;
1827
2382
  name: string;
1828
2383
  value: string;
1829
2384
  }[];
1830
- last_checked_at: unknown;
1831
- verified_at: unknown;
1832
- last_error: unknown;
2385
+ last_checked_at: string | null;
2386
+ verified_at: string | null;
2387
+ last_error: string | null;
1833
2388
  created_at: string;
1834
- };
2389
+ }
1835
2390
  interface SegmentsDomainRemoveParams {
1836
2391
  id: string;
1837
2392
  }
1838
- type SegmentsDomainRemoveResponse = {
1839
- object: string;
2393
+ interface SegmentsDomainRemoveResponse {
2394
+ object: "custom_domain";
2395
+ id: string;
1840
2396
  segment_id: string;
1841
- deleted: boolean;
1842
- };
2397
+ deleted: true;
2398
+ }
1843
2399
  interface SuppressionsListParams {
1844
2400
  /**
1845
2401
  * 1–100, default 20.
@@ -1855,36 +2411,41 @@ interface SuppressionsListParams {
1855
2411
  before?: string;
1856
2412
  reason?: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr" | "ses_suppressed" | "soft_bounce_repeated";
1857
2413
  }
1858
- type SuppressionsListResponse = {
1859
- object: string;
2414
+ interface SuppressionsListResponse {
2415
+ object: "list";
1860
2416
  has_more: boolean;
1861
2417
  data: {
1862
- object: string;
2418
+ object: "suppression";
1863
2419
  id: string;
1864
2420
  email: string;
1865
- reason: string;
1866
- 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;
1867
2425
  }[];
1868
- };
2426
+ }
1869
2427
  interface SuppressionsCreateParams {
1870
2428
  email: string;
1871
2429
  reason?: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr";
1872
2430
  notes?: string;
1873
2431
  }
1874
- type SuppressionsCreateResponse = {
1875
- object: string;
2432
+ interface SuppressionsCreateResponse {
2433
+ object: "suppression";
1876
2434
  id: string;
1877
2435
  email: string;
1878
- reason: string;
1879
- };
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
+ }
1880
2441
  interface SuppressionsRemoveParams {
1881
2442
  id: string;
1882
2443
  }
1883
- type SuppressionsRemoveResponse = {
1884
- object: string;
2444
+ interface SuppressionsRemoveResponse {
2445
+ object: "suppression";
1885
2446
  id: string;
1886
- deleted: boolean;
1887
- };
2447
+ deleted: true;
2448
+ }
1888
2449
  interface ImagesListParams {
1889
2450
  /**
1890
2451
  * 1–100, default 20.
@@ -1899,26 +2460,36 @@ interface ImagesListParams {
1899
2460
  */
1900
2461
  before?: string;
1901
2462
  }
1902
- type ImagesListResponse = {
1903
- object: string;
2463
+ interface ImagesListResponse {
2464
+ object: "list";
1904
2465
  has_more: boolean;
1905
2466
  data: {
1906
- object: string;
2467
+ object: "image";
1907
2468
  id: string;
1908
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;
1909
2476
  }[];
1910
- };
2477
+ }
1911
2478
  type ImagesCreateParams = Blob | ArrayBuffer | Uint8Array | string;
1912
- type ImagesCreateResponse = {
1913
- object: string;
2479
+ interface ImagesCreateResponse {
2480
+ object: "image";
1914
2481
  id: string;
1915
2482
  url: string;
1916
- content_type: string;
1917
- size_bytes: number;
1918
- };
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
+ }
1919
2490
  type StatsOverviewParams = Record<string, never>;
1920
- type StatsOverviewResponse = {
1921
- object: string;
2491
+ interface StatsOverviewResponse {
2492
+ object: "overview";
1922
2493
  subscribers: {
1923
2494
  active: number;
1924
2495
  new_last_30_days: number;
@@ -1935,29 +2506,29 @@ type StatsOverviewResponse = {
1935
2506
  sent_last_30_days: number;
1936
2507
  newsletters_sent_last_30_days: number;
1937
2508
  };
1938
- };
2509
+ }
1939
2510
  interface DomainsCreateParams {
1940
2511
  name: string;
1941
2512
  trackingSubdomain?: string;
1942
2513
  }
1943
- type DomainsCreateResponse = {
1944
- object: string;
2514
+ interface DomainsCreateResponse {
2515
+ object: "domain";
1945
2516
  id: string;
1946
2517
  name: string;
1947
- status: string;
2518
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
1948
2519
  created_at: string;
1949
2520
  region: string;
1950
2521
  records: {
1951
- record: string;
2522
+ record: "SPF" | "DKIM" | "MX" | "TXT";
1952
2523
  name: string;
1953
- type: string;
1954
- ttl: string;
1955
- status: string;
2524
+ type: "CNAME" | "MX" | "TXT";
2525
+ ttl: "Auto";
2526
+ status: "verified" | "pending";
1956
2527
  value: string;
1957
2528
  priority?: number;
1958
2529
  }[];
1959
2530
  tracking_subdomain?: string;
1960
- };
2531
+ }
1961
2532
  interface DomainsListParams {
1962
2533
  /**
1963
2534
  * 1–100, default 20.
@@ -1972,44 +2543,44 @@ interface DomainsListParams {
1972
2543
  */
1973
2544
  before?: string;
1974
2545
  }
1975
- type DomainsListResponse = {
1976
- object: string;
2546
+ interface DomainsListResponse {
2547
+ object: "list";
1977
2548
  has_more: boolean;
1978
2549
  data: {
1979
2550
  id: string;
1980
2551
  name: string;
1981
- status: string;
2552
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
1982
2553
  created_at: string;
1983
2554
  region: string;
1984
2555
  }[];
1985
- };
2556
+ }
1986
2557
  interface DomainsGetParams {
1987
2558
  id: string;
1988
2559
  }
1989
- type DomainsGetResponse = {
1990
- object: string;
2560
+ interface DomainsGetResponse {
2561
+ object: "domain";
1991
2562
  id: string;
1992
2563
  name: string;
1993
- status: string;
2564
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
1994
2565
  created_at: string;
1995
2566
  region: string;
1996
2567
  records: {
1997
- record: string;
2568
+ record: "SPF" | "DKIM" | "MX" | "TXT";
1998
2569
  name: string;
1999
- type: string;
2000
- ttl: string;
2001
- status: string;
2570
+ type: "CNAME" | "MX" | "TXT";
2571
+ ttl: "Auto";
2572
+ status: "verified" | "pending";
2002
2573
  value: string;
2003
2574
  priority?: number;
2004
2575
  }[];
2005
- };
2576
+ }
2006
2577
  interface DomainsVerifyParams {
2007
2578
  id: string;
2008
2579
  }
2009
- type DomainsVerifyResponse = {
2010
- object: string;
2580
+ interface DomainsVerifyResponse {
2581
+ object: "domain";
2011
2582
  id: string;
2012
- };
2583
+ }
2013
2584
  interface ApiKeysCreateParams {
2014
2585
  name: string;
2015
2586
  permission?: "full_access" | "sending_access" | "signups";
@@ -2018,10 +2589,10 @@ interface ApiKeysCreateParams {
2018
2589
  */
2019
2590
  domainId?: string;
2020
2591
  }
2021
- type ApiKeysCreateResponse = {
2592
+ interface ApiKeysCreateResponse {
2022
2593
  id: string;
2023
2594
  token: string;
2024
- };
2595
+ }
2025
2596
  interface ApiKeysListParams {
2026
2597
  /**
2027
2598
  * 1–100, default 20.
@@ -2036,8 +2607,8 @@ interface ApiKeysListParams {
2036
2607
  */
2037
2608
  before?: string;
2038
2609
  }
2039
- type ApiKeysListResponse = {
2040
- object: string;
2610
+ interface ApiKeysListResponse {
2611
+ object: "list";
2041
2612
  has_more: boolean;
2042
2613
  data: {
2043
2614
  id: string;
@@ -2045,24 +2616,24 @@ type ApiKeysListResponse = {
2045
2616
  created_at: string;
2046
2617
  last_used_at: string | null;
2047
2618
  }[];
2048
- };
2619
+ }
2049
2620
  type ApiKeysUpdateParams = {
2050
2621
  id: string;
2051
2622
  } & {
2052
2623
  name: string;
2053
2624
  };
2054
- type ApiKeysUpdateResponse = {
2055
- object: string;
2625
+ interface ApiKeysUpdateResponse {
2626
+ object: "api_key";
2056
2627
  id: string;
2057
- };
2628
+ }
2058
2629
  interface ApiKeysRemoveParams {
2059
2630
  id: string;
2060
2631
  }
2061
- type ApiKeysRemoveResponse = {
2062
- object: string;
2632
+ interface ApiKeysRemoveResponse {
2633
+ object: "api_key";
2063
2634
  id: string;
2064
- deleted: boolean;
2065
- };
2635
+ deleted: true;
2636
+ }
2066
2637
  interface LogsListParams {
2067
2638
  /**
2068
2639
  * 1–100, default 20.
@@ -2077,93 +2648,224 @@ interface LogsListParams {
2077
2648
  */
2078
2649
  before?: string;
2079
2650
  }
2080
- type LogsListResponse = {
2081
- object: string;
2651
+ interface LogsListResponse {
2652
+ object: "list";
2082
2653
  has_more: boolean;
2083
2654
  data: {
2084
2655
  id: string;
2656
+ created_at: string;
2085
2657
  endpoint: string;
2086
2658
  method: string;
2087
2659
  response_status: number;
2088
- source: string;
2660
+ user_agent: string | null;
2661
+ source: "api" | "smtp";
2089
2662
  }[];
2090
- };
2663
+ }
2091
2664
  interface LogsGetParams {
2092
2665
  id: string;
2093
2666
  }
2094
- type LogsGetResponse = {
2095
- object: string;
2667
+ interface LogsGetResponse {
2668
+ object: "log";
2096
2669
  id: string;
2670
+ created_at: string;
2097
2671
  endpoint: string;
2098
- request_body: Record<string, unknown>;
2099
- response_body: Record<string, unknown>;
2100
- };
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
+ }
2101
2700
  type UsageGetParams = Record<string, never>;
2102
- type UsageGetResponse = {
2103
- object: string;
2701
+ interface UsageGetResponse {
2702
+ object: "usage";
2104
2703
  emails: {
2704
+ daily: {
2705
+ used: number;
2706
+ limit: number | null;
2707
+ sent: number;
2708
+ received: number;
2709
+ resets_at: string;
2710
+ };
2105
2711
  monthly: {
2106
2712
  used: number;
2107
- limit: number;
2713
+ limit: number | null;
2714
+ overage_ceiling: number | null;
2715
+ sent: number;
2716
+ received: number;
2717
+ resets_at: string;
2108
2718
  };
2109
2719
  };
2110
2720
  contacts: {
2111
2721
  used: number;
2112
- limit: unknown;
2722
+ limit: number | null;
2113
2723
  };
2114
- };
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
+ }
2115
2737
  interface SequencesListParams {
2116
2738
  /**
2117
2739
  * Archived sequences are hidden unless `true`.
2118
2740
  */
2119
2741
  includeArchived?: "true" | "false";
2120
2742
  }
2121
- type SequencesListResponse = {
2122
- object: string;
2743
+ interface SequencesListResponse {
2744
+ object: "list";
2123
2745
  has_more: boolean;
2124
2746
  data: {
2125
- object: string;
2747
+ object: "sequence";
2126
2748
  id: string;
2127
2749
  name: string;
2128
- description: unknown;
2129
- status: string;
2750
+ description: string | null;
2751
+ status: "draft" | "active" | "paused" | "archived";
2130
2752
  segment_id: string;
2131
- topic_id: unknown;
2753
+ topic_id: string | null;
2132
2754
  trigger: {
2133
- type: string;
2134
- 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";
2135
2775
  };
2136
2776
  reentry: {
2137
- mode: string;
2138
- days: unknown;
2777
+ mode: "once" | "always" | "after_days";
2778
+ days: number | null;
2139
2779
  };
2140
2780
  exit: {
2141
2781
  events: string[];
2142
- filter_id: unknown;
2782
+ filter_id: string | null;
2143
2783
  };
2144
- steps: {
2784
+ steps: ({
2145
2785
  id: string;
2146
- type: string;
2147
- subject?: string;
2148
- preheader?: unknown;
2149
- doc?: {
2150
- type: string;
2151
- content: unknown[];
2786
+ type: "email";
2787
+ subject: string;
2788
+ preheader: string | null;
2789
+ doc: {
2790
+ [k: string]: unknown;
2152
2791
  };
2153
- amount?: number;
2154
- unit?: string;
2155
- }[];
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
+ })[];
2156
2858
  published_version: {
2157
2859
  id: string;
2158
- number: number;
2159
- };
2860
+ number: number | null;
2861
+ } | null;
2160
2862
  has_unpublished_changes: boolean;
2161
- activated_at: string;
2162
- archived_at: unknown;
2863
+ activated_at: string | null;
2864
+ archived_at: string | null;
2163
2865
  created_at: string;
2164
2866
  updated_at: string;
2165
2867
  }[];
2166
- };
2868
+ }
2167
2869
  interface SequencesCreateParams {
2168
2870
  name: string;
2169
2871
  description?: string | null;
@@ -2335,90 +3037,253 @@ interface SequencesCreateParams {
2335
3037
  [k: string]: unknown;
2336
3038
  }[];
2337
3039
  }
2338
- type SequencesCreateResponse = {
2339
- object: string;
3040
+ interface SequencesCreateResponse {
3041
+ object: "sequence";
2340
3042
  id: string;
2341
3043
  name: string;
2342
- description: unknown;
2343
- status: string;
3044
+ description: string | null;
3045
+ status: "draft" | "active" | "paused" | "archived";
2344
3046
  segment_id: string;
2345
- topic_id: unknown;
3047
+ topic_id: string | null;
2346
3048
  trigger: {
2347
- type: string;
2348
- 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";
2349
3069
  };
2350
3070
  reentry: {
2351
- mode: string;
2352
- days: unknown;
3071
+ mode: "once" | "always" | "after_days";
3072
+ days: number | null;
2353
3073
  };
2354
3074
  exit: {
2355
3075
  events: string[];
2356
- filter_id: unknown;
3076
+ filter_id: string | null;
2357
3077
  };
2358
- steps: {
3078
+ steps: ({
2359
3079
  id: string;
2360
- type: string;
2361
- subject?: string;
2362
- preheader?: unknown;
2363
- doc?: {
2364
- type: string;
2365
- content: unknown[];
3080
+ type: "email";
3081
+ subject: string;
3082
+ preheader: string | null;
3083
+ doc: {
3084
+ [k: string]: unknown;
2366
3085
  };
2367
- amount?: number;
2368
- unit?: string;
2369
- }[];
2370
- 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;
2371
3156
  has_unpublished_changes: boolean;
2372
- activated_at: string;
2373
- archived_at: unknown;
3157
+ activated_at: string | null;
3158
+ archived_at: string | null;
2374
3159
  created_at: string;
2375
3160
  updated_at: string;
2376
- };
3161
+ }
2377
3162
  interface SequencesGetParams {
2378
3163
  id: string;
2379
3164
  }
2380
- type SequencesGetResponse = {
2381
- object: string;
3165
+ interface SequencesGetResponse {
3166
+ object: "sequence";
2382
3167
  id: string;
2383
3168
  name: string;
2384
- description: unknown;
2385
- status: string;
3169
+ description: string | null;
3170
+ status: "draft" | "active" | "paused" | "archived";
2386
3171
  segment_id: string;
2387
- topic_id: unknown;
3172
+ topic_id: string | null;
2388
3173
  trigger: {
2389
- type: string;
2390
- 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";
2391
3194
  };
2392
3195
  reentry: {
2393
- mode: string;
2394
- days: unknown;
3196
+ mode: "once" | "always" | "after_days";
3197
+ days: number | null;
2395
3198
  };
2396
3199
  exit: {
2397
3200
  events: string[];
2398
- filter_id: unknown;
3201
+ filter_id: string | null;
2399
3202
  };
2400
- steps: {
3203
+ steps: ({
2401
3204
  id: string;
2402
- type: string;
2403
- subject?: string;
2404
- preheader?: unknown;
2405
- doc?: {
2406
- type: string;
2407
- content: unknown[];
3205
+ type: "email";
3206
+ subject: string;
3207
+ preheader: string | null;
3208
+ doc: {
3209
+ [k: string]: unknown;
2408
3210
  };
2409
- amount?: number;
2410
- unit?: string;
2411
- }[];
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
+ } | {
3231
+ id: string;
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;
3251
+ };
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
+ })[];
2412
3277
  published_version: {
2413
3278
  id: string;
2414
- number: number;
2415
- };
3279
+ number: number | null;
3280
+ } | null;
2416
3281
  has_unpublished_changes: boolean;
2417
- activated_at: string;
2418
- archived_at: unknown;
3282
+ activated_at: string | null;
3283
+ archived_at: string | null;
2419
3284
  created_at: string;
2420
3285
  updated_at: string;
2421
- };
3286
+ }
2422
3287
  type SequencesUpdateParams = {
2423
3288
  id: string;
2424
3289
  } & {
@@ -2592,219 +3457,552 @@ type SequencesUpdateParams = {
2592
3457
  [k: string]: unknown;
2593
3458
  }[];
2594
3459
  };
2595
- type SequencesUpdateResponse = {
2596
- object: string;
3460
+ interface SequencesUpdateResponse {
3461
+ object: "sequence";
2597
3462
  id: string;
2598
3463
  name: string;
2599
- description: unknown;
2600
- status: string;
3464
+ description: string | null;
3465
+ status: "draft" | "active" | "paused" | "archived";
2601
3466
  segment_id: string;
2602
- topic_id: unknown;
3467
+ topic_id: string | null;
2603
3468
  trigger: {
2604
- type: string;
2605
- 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";
2606
3489
  };
2607
3490
  reentry: {
2608
- mode: string;
2609
- days: unknown;
3491
+ mode: "once" | "always" | "after_days";
3492
+ days: number | null;
2610
3493
  };
2611
3494
  exit: {
2612
3495
  events: string[];
2613
- filter_id: unknown;
3496
+ filter_id: string | null;
2614
3497
  };
2615
- steps: {
3498
+ steps: ({
2616
3499
  id: string;
2617
- type: string;
2618
- subject?: string;
2619
- preheader?: unknown;
2620
- doc?: {
2621
- type: string;
2622
- content: unknown[];
3500
+ type: "email";
3501
+ subject: string;
3502
+ preheader: string | null;
3503
+ doc: {
3504
+ [k: string]: unknown;
2623
3505
  };
2624
- amount?: number;
2625
- unit?: string;
2626
- }[];
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
+ })[];
2627
3572
  published_version: {
2628
3573
  id: string;
2629
- number: number;
2630
- };
3574
+ number: number | null;
3575
+ } | null;
2631
3576
  has_unpublished_changes: boolean;
2632
- activated_at: string;
2633
- archived_at: unknown;
3577
+ activated_at: string | null;
3578
+ archived_at: string | null;
2634
3579
  created_at: string;
2635
3580
  updated_at: string;
2636
- };
3581
+ }
2637
3582
  interface SequencesRemoveParams {
2638
3583
  id: string;
2639
3584
  }
2640
3585
  type SequencesRemoveResponse = {
2641
- object: string;
3586
+ object: "sequence";
3587
+ id: string;
3588
+ deleted: true;
3589
+ } | {
3590
+ object: "sequence";
2642
3591
  id: string;
2643
- deleted: boolean;
3592
+ deleted: false;
3593
+ archived: true;
2644
3594
  };
2645
3595
  interface SequencesActivateParams {
2646
3596
  id: string;
2647
3597
  }
2648
- type SequencesActivateResponse = {
2649
- object: string;
3598
+ interface SequencesActivateResponse {
3599
+ object: "sequence";
2650
3600
  id: string;
2651
3601
  name: string;
2652
- description: unknown;
2653
- status: string;
3602
+ description: string | null;
3603
+ status: "draft" | "active" | "paused" | "archived";
2654
3604
  segment_id: string;
2655
- topic_id: unknown;
3605
+ topic_id: string | null;
2656
3606
  trigger: {
2657
- type: string;
2658
- 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";
2659
3627
  };
2660
3628
  reentry: {
2661
- mode: string;
2662
- days: unknown;
3629
+ mode: "once" | "always" | "after_days";
3630
+ days: number | null;
2663
3631
  };
2664
3632
  exit: {
2665
3633
  events: string[];
2666
- filter_id: unknown;
3634
+ filter_id: string | null;
2667
3635
  };
2668
- steps: {
3636
+ steps: ({
2669
3637
  id: string;
2670
- type: string;
2671
- subject?: string;
2672
- preheader?: unknown;
2673
- doc?: {
2674
- type: string;
2675
- content: unknown[];
3638
+ type: "email";
3639
+ subject: string;
3640
+ preheader: string | null;
3641
+ doc: {
3642
+ [k: string]: unknown;
2676
3643
  };
2677
- amount?: number;
2678
- unit?: string;
2679
- }[];
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
+ })[];
2680
3710
  published_version: {
2681
3711
  id: string;
2682
- number: number;
2683
- };
3712
+ number: number | null;
3713
+ } | null;
2684
3714
  has_unpublished_changes: boolean;
2685
- activated_at: string;
2686
- archived_at: unknown;
3715
+ activated_at: string | null;
3716
+ archived_at: string | null;
2687
3717
  created_at: string;
2688
3718
  updated_at: string;
2689
- };
3719
+ }
2690
3720
  interface SequencesPauseParams {
2691
3721
  id: string;
2692
3722
  }
2693
- type SequencesPauseResponse = {
2694
- object: string;
3723
+ interface SequencesPauseResponse {
3724
+ object: "sequence";
2695
3725
  id: string;
2696
3726
  name: string;
2697
- description: unknown;
2698
- status: string;
3727
+ description: string | null;
3728
+ status: "draft" | "active" | "paused" | "archived";
2699
3729
  segment_id: string;
2700
- topic_id: unknown;
3730
+ topic_id: string | null;
2701
3731
  trigger: {
2702
- type: string;
2703
- 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";
2704
3752
  };
2705
3753
  reentry: {
2706
- mode: string;
2707
- days: unknown;
3754
+ mode: "once" | "always" | "after_days";
3755
+ days: number | null;
2708
3756
  };
2709
3757
  exit: {
2710
3758
  events: string[];
2711
- filter_id: unknown;
3759
+ filter_id: string | null;
2712
3760
  };
2713
- steps: {
3761
+ steps: ({
2714
3762
  id: string;
2715
- type: string;
2716
- subject?: string;
2717
- preheader?: unknown;
2718
- doc?: {
2719
- type: string;
2720
- content: unknown[];
3763
+ type: "email";
3764
+ subject: string;
3765
+ preheader: string | null;
3766
+ doc: {
3767
+ [k: string]: unknown;
2721
3768
  };
2722
- amount?: number;
2723
- unit?: string;
2724
- }[];
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
+ })[];
2725
3835
  published_version: {
2726
3836
  id: string;
2727
- number: number;
2728
- };
3837
+ number: number | null;
3838
+ } | null;
2729
3839
  has_unpublished_changes: boolean;
2730
- activated_at: string;
2731
- archived_at: unknown;
3840
+ activated_at: string | null;
3841
+ archived_at: string | null;
2732
3842
  created_at: string;
2733
3843
  updated_at: string;
2734
- };
3844
+ }
2735
3845
  interface SequencesArchiveParams {
2736
3846
  id: string;
2737
3847
  }
2738
- type SequencesArchiveResponse = {
2739
- object: string;
3848
+ interface SequencesArchiveResponse {
3849
+ object: "sequence";
2740
3850
  id: string;
2741
3851
  name: string;
2742
- description: unknown;
2743
- status: string;
3852
+ description: string | null;
3853
+ status: "draft" | "active" | "paused" | "archived";
2744
3854
  segment_id: string;
2745
- topic_id: unknown;
3855
+ topic_id: string | null;
2746
3856
  trigger: {
2747
- type: string;
2748
- 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";
2749
3877
  };
2750
3878
  reentry: {
2751
- mode: string;
2752
- days: unknown;
3879
+ mode: "once" | "always" | "after_days";
3880
+ days: number | null;
2753
3881
  };
2754
3882
  exit: {
2755
3883
  events: string[];
2756
- filter_id: unknown;
3884
+ filter_id: string | null;
2757
3885
  };
2758
- 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
+ } | {
2759
3930
  id: string;
2760
- type: string;
2761
- subject?: string;
2762
- preheader?: unknown;
2763
- doc?: {
2764
- type: string;
2765
- content: unknown[];
3931
+ type: "condition";
3932
+ rule: {
3933
+ [k: string]: unknown;
2766
3934
  };
2767
- amount?: number;
2768
- unit?: string;
2769
- }[];
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
+ })[];
2770
3960
  published_version: {
2771
3961
  id: string;
2772
- number: number;
2773
- };
3962
+ number: number | null;
3963
+ } | null;
2774
3964
  has_unpublished_changes: boolean;
2775
- activated_at: string;
2776
- archived_at: string;
3965
+ activated_at: string | null;
3966
+ archived_at: string | null;
2777
3967
  created_at: string;
2778
3968
  updated_at: string;
2779
- };
3969
+ }
2780
3970
  type SequencesEnrollmentsParams = {
2781
3971
  id: string;
2782
3972
  } & {
2783
- status?: "active" | "completed" | "exited";
2784
3973
  /**
2785
- * Newest first, 1–100 (default 100).
3974
+ * 1–100, default 100.
2786
3975
  */
2787
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";
2788
3986
  };
2789
- type SequencesEnrollmentsResponse = {
2790
- object: string;
3987
+ interface SequencesEnrollmentsResponse {
3988
+ object: "list";
2791
3989
  has_more: boolean;
2792
3990
  data: {
2793
- object: string;
3991
+ object: "sequence_enrollment";
2794
3992
  id: string;
2795
3993
  sequence_id: string;
2796
- contact_id: string;
3994
+ contact_id: string | null;
2797
3995
  email: string;
2798
- status: string;
2799
- exit_reason: unknown;
2800
- current_step_id: string;
2801
- next_run_at: string;
2802
- 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";
2803
4001
  entered_at: string;
2804
- completed_at: unknown;
2805
- exited_at: unknown;
4002
+ completed_at: string | null;
4003
+ exited_at: string | null;
2806
4004
  }[];
2807
- };
4005
+ }
2808
4006
  type SequencesEnrollParams = {
2809
4007
  id: string;
2810
4008
  } & {
@@ -2814,28 +4012,28 @@ type SequencesEnrollParams = {
2814
4012
  email?: string;
2815
4013
  contactId?: string;
2816
4014
  };
2817
- type SequencesEnrollResponse = {
2818
- object: string;
4015
+ interface SequencesEnrollResponse {
4016
+ object: "sequence_enrollment";
2819
4017
  id: string;
2820
4018
  sequence_id: string;
2821
4019
  contact_id: string;
2822
- status: string;
2823
- };
4020
+ status: "active";
4021
+ }
2824
4022
  interface SequencesUnenrollParams {
2825
4023
  id: string;
2826
4024
  enrollmentId: string;
2827
4025
  }
2828
- type SequencesUnenrollResponse = {
2829
- object: string;
4026
+ interface SequencesUnenrollResponse {
4027
+ object: "sequence_enrollment";
2830
4028
  id: string;
2831
4029
  sequence_id: string;
2832
- status: string;
2833
- };
4030
+ status: "completed" | "exited";
4031
+ }
2834
4032
  interface SequencesStatsParams {
2835
4033
  id: string;
2836
4034
  }
2837
- type SequencesStatsResponse = {
2838
- object: string;
4035
+ interface SequencesStatsResponse {
4036
+ object: "sequence_stats";
2839
4037
  sequence_id: string;
2840
4038
  entered: number;
2841
4039
  active: number;
@@ -2851,7 +4049,7 @@ type SequencesStatsResponse = {
2851
4049
  bounced: number;
2852
4050
  unsubscribed: number;
2853
4051
  }[];
2854
- };
4052
+ }
2855
4053
  interface WebhooksCreateParams {
2856
4054
  /**
2857
4055
  * Public `https://` URL that receives the events.
@@ -2875,11 +4073,11 @@ interface WebhooksCreateParams {
2875
4073
  */
2876
4074
  domains?: string[];
2877
4075
  }
2878
- type WebhooksCreateResponse = {
2879
- object: string;
4076
+ interface WebhooksCreateResponse {
4077
+ object: "webhook";
2880
4078
  id: string;
2881
4079
  signing_secret: string;
2882
- };
4080
+ }
2883
4081
  interface WebhooksListParams {
2884
4082
  /**
2885
4083
  * 1–100, default 20.
@@ -2894,45 +4092,45 @@ interface WebhooksListParams {
2894
4092
  */
2895
4093
  before?: string;
2896
4094
  }
2897
- type WebhooksListResponse = {
2898
- object: string;
4095
+ interface WebhooksListResponse {
4096
+ object: "list";
2899
4097
  has_more: boolean;
2900
4098
  data: {
2901
- object: string;
4099
+ object: "webhook";
2902
4100
  id: string;
2903
4101
  endpoint: string;
2904
- description: string;
2905
- 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")[];
2906
4104
  include_newsletters: boolean;
2907
- segment_ids: unknown[];
2908
- domains: unknown[];
2909
- status: string;
2910
- disabled_reason: unknown;
4105
+ segment_ids: string[];
4106
+ domains: string[];
4107
+ status: "enabled" | "disabled";
4108
+ disabled_reason: ("manual" | "failing") | null;
2911
4109
  consecutive_failures: number;
2912
- last_success_at: string;
2913
- last_failure_at: unknown;
4110
+ last_success_at: string | null;
4111
+ last_failure_at: string | null;
2914
4112
  created_at: string;
2915
4113
  }[];
2916
- };
4114
+ }
2917
4115
  interface WebhooksGetParams {
2918
4116
  id: string;
2919
4117
  }
2920
- type WebhooksGetResponse = {
2921
- object: string;
4118
+ interface WebhooksGetResponse {
4119
+ object: "webhook";
2922
4120
  id: string;
2923
4121
  endpoint: string;
2924
- description: string;
2925
- 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")[];
2926
4124
  include_newsletters: boolean;
2927
- segment_ids: unknown[];
2928
- domains: unknown[];
2929
- status: string;
2930
- disabled_reason: unknown;
4125
+ segment_ids: string[];
4126
+ domains: string[];
4127
+ status: "enabled" | "disabled";
4128
+ disabled_reason: ("manual" | "failing") | null;
2931
4129
  consecutive_failures: number;
2932
- last_success_at: string;
2933
- last_failure_at: unknown;
4130
+ last_success_at: string | null;
4131
+ last_failure_at: string | null;
2934
4132
  created_at: string;
2935
- };
4133
+ }
2936
4134
  type WebhooksUpdateParams = {
2937
4135
  id: string;
2938
4136
  } & {
@@ -2959,27 +4157,27 @@ type WebhooksUpdateParams = {
2959
4157
  */
2960
4158
  domains?: string[];
2961
4159
  };
2962
- type WebhooksUpdateResponse = {
2963
- object: string;
4160
+ interface WebhooksUpdateResponse {
4161
+ object: "webhook";
2964
4162
  id: string;
2965
- };
4163
+ }
2966
4164
  interface WebhooksRemoveParams {
2967
4165
  id: string;
2968
4166
  }
2969
- type WebhooksRemoveResponse = {
2970
- object: string;
4167
+ interface WebhooksRemoveResponse {
4168
+ object: "webhook";
2971
4169
  id: string;
2972
- deleted: boolean;
2973
- };
4170
+ deleted: true;
4171
+ }
2974
4172
  interface WebhooksRotateSigningSecretParams {
2975
4173
  id: string;
2976
4174
  }
2977
- type WebhooksRotateSigningSecretResponse = {
2978
- object: string;
4175
+ interface WebhooksRotateSigningSecretResponse {
4176
+ object: "webhook";
2979
4177
  id: string;
2980
4178
  signing_secret: string;
2981
4179
  previous_secret_expires_at: string;
2982
- };
4180
+ }
2983
4181
  type WebhooksTestParams = {
2984
4182
  id: string;
2985
4183
  } & {
@@ -2988,29 +4186,29 @@ type WebhooksTestParams = {
2988
4186
  */
2989
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";
2990
4188
  };
2991
- type WebhooksTestResponse = {
2992
- object: string;
4189
+ interface WebhooksTestResponse {
4190
+ object: "webhook_delivery";
2993
4191
  id: string;
2994
4192
  msg_id: string;
2995
4193
  webhook_id: string;
2996
4194
  event_type: string;
2997
- status: string;
4195
+ status: "pending" | "processing" | "delivered" | "failed";
2998
4196
  attempts: number;
2999
- next_attempt_at: unknown;
3000
- last_status_code: number;
3001
- last_response: string;
3002
- last_error: unknown;
3003
- 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;
3004
4202
  payload: {
3005
4203
  type: string;
3006
4204
  created_at: string;
3007
4205
  data: {
3008
- email_id: string;
4206
+ [k: string]: unknown;
3009
4207
  };
3010
4208
  };
3011
- delivered_at: string;
4209
+ delivered_at: string | null;
3012
4210
  created_at: string;
3013
- };
4211
+ }
3014
4212
  type WebhooksDeliveriesParams = {
3015
4213
  id: string;
3016
4214
  } & {
@@ -3028,81 +4226,81 @@ type WebhooksDeliveriesParams = {
3028
4226
  before?: string;
3029
4227
  status?: "pending" | "processing" | "delivered" | "failed";
3030
4228
  };
3031
- type WebhooksDeliveriesResponse = {
3032
- object: string;
4229
+ interface WebhooksDeliveriesResponse {
4230
+ object: "list";
3033
4231
  has_more: boolean;
3034
4232
  data: {
3035
- object: string;
4233
+ object: "webhook_delivery";
3036
4234
  id: string;
3037
4235
  msg_id: string;
3038
4236
  webhook_id: string;
3039
4237
  event_type: string;
3040
- status: string;
4238
+ status: "pending" | "processing" | "delivered" | "failed";
3041
4239
  attempts: number;
3042
- next_attempt_at: unknown;
3043
- last_status_code: number;
3044
- last_response: string;
3045
- last_error: unknown;
3046
- 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;
3047
4245
  payload: {
3048
4246
  type: string;
3049
4247
  created_at: string;
3050
4248
  data: {
3051
- email_id: string;
4249
+ [k: string]: unknown;
3052
4250
  };
3053
4251
  };
3054
- delivered_at: string;
4252
+ delivered_at: string | null;
3055
4253
  created_at: string;
3056
4254
  }[];
3057
- };
4255
+ }
3058
4256
  interface WebhooksRetryDeliveryParams {
3059
4257
  id: string;
3060
4258
  deliveryId: string;
3061
4259
  }
3062
- type WebhooksRetryDeliveryResponse = {
3063
- object: string;
4260
+ interface WebhooksRetryDeliveryResponse {
4261
+ object: "webhook_delivery";
3064
4262
  id: string;
3065
4263
  msg_id: string;
3066
4264
  webhook_id: string;
3067
4265
  event_type: string;
3068
- status: string;
4266
+ status: "pending" | "processing" | "delivered" | "failed";
3069
4267
  attempts: number;
3070
- next_attempt_at: unknown;
3071
- last_status_code: number;
3072
- last_response: string;
3073
- last_error: unknown;
3074
- 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;
3075
4273
  payload: {
3076
4274
  type: string;
3077
4275
  created_at: string;
3078
4276
  data: {
3079
- email_id: string;
4277
+ [k: string]: unknown;
3080
4278
  };
3081
4279
  };
3082
- delivered_at: string;
4280
+ delivered_at: string | null;
3083
4281
  created_at: string;
3084
- };
4282
+ }
3085
4283
  type InboxesListParams = Record<string, never>;
3086
- type InboxesListResponse = {
3087
- object: string;
4284
+ interface InboxesListResponse {
4285
+ object: "list";
3088
4286
  has_more: boolean;
3089
4287
  data: {
3090
- object: string;
4288
+ object: "inbox";
3091
4289
  id: string;
3092
4290
  address: string;
3093
4291
  name: string;
3094
- display_name: string;
3095
- description: string;
3096
- reply_from: unknown;
3097
- status: string;
4292
+ display_name: string | null;
4293
+ description: string | null;
4294
+ reply_from: string | null;
4295
+ status: "active" | "disabled";
3098
4296
  custom_domain: boolean;
3099
- domain_id: unknown;
4297
+ domain_id: string | null;
3100
4298
  dropped_count: number;
3101
- last_dropped_at: unknown;
4299
+ last_dropped_at: string | null;
3102
4300
  created_at: string;
3103
4301
  updated_at: string;
3104
4302
  }[];
3105
- };
4303
+ }
3106
4304
  interface InboxesCreateParams {
3107
4305
  /**
3108
4306
  * Local part: `support` gives `support-<workspace>@in.smartletter.ai` (or `support@<your receiving domain>` with `domain_id`).
@@ -3125,41 +4323,41 @@ interface InboxesCreateParams {
3125
4323
  */
3126
4324
  replyFrom?: string | null;
3127
4325
  }
3128
- type InboxesCreateResponse = {
3129
- object: string;
4326
+ interface InboxesCreateResponse {
4327
+ object: "inbox";
3130
4328
  id: string;
3131
4329
  address: string;
3132
4330
  name: string;
3133
- display_name: string;
3134
- description: string;
3135
- reply_from: unknown;
3136
- status: string;
4331
+ display_name: string | null;
4332
+ description: string | null;
4333
+ reply_from: string | null;
4334
+ status: "active" | "disabled";
3137
4335
  custom_domain: boolean;
3138
- domain_id: unknown;
4336
+ domain_id: string | null;
3139
4337
  dropped_count: number;
3140
- last_dropped_at: unknown;
4338
+ last_dropped_at: string | null;
3141
4339
  created_at: string;
3142
4340
  updated_at: string;
3143
- };
4341
+ }
3144
4342
  interface InboxesGetParams {
3145
4343
  id: string;
3146
4344
  }
3147
- type InboxesGetResponse = {
3148
- object: string;
4345
+ interface InboxesGetResponse {
4346
+ object: "inbox";
3149
4347
  id: string;
3150
4348
  address: string;
3151
4349
  name: string;
3152
- display_name: string;
3153
- description: string;
3154
- reply_from: unknown;
3155
- status: string;
4350
+ display_name: string | null;
4351
+ description: string | null;
4352
+ reply_from: string | null;
4353
+ status: "active" | "disabled";
3156
4354
  custom_domain: boolean;
3157
- domain_id: unknown;
4355
+ domain_id: string | null;
3158
4356
  dropped_count: number;
3159
- last_dropped_at: unknown;
4357
+ last_dropped_at: string | null;
3160
4358
  created_at: string;
3161
4359
  updated_at: string;
3162
- };
4360
+ }
3163
4361
  type InboxesUpdateParams = {
3164
4362
  id: string;
3165
4363
  } & {
@@ -3180,31 +4378,43 @@ type InboxesUpdateParams = {
3180
4378
  */
3181
4379
  status?: "active" | "disabled";
3182
4380
  };
3183
- type InboxesUpdateResponse = {
3184
- object: string;
4381
+ interface InboxesUpdateResponse {
4382
+ object: "inbox";
3185
4383
  id: string;
3186
4384
  address: string;
3187
4385
  name: string;
3188
- display_name: string;
3189
- description: string;
3190
- reply_from: unknown;
3191
- status: string;
4386
+ display_name: string | null;
4387
+ description: string | null;
4388
+ reply_from: string | null;
4389
+ status: "active" | "disabled";
3192
4390
  custom_domain: boolean;
3193
- domain_id: unknown;
4391
+ domain_id: string | null;
3194
4392
  dropped_count: number;
3195
- last_dropped_at: unknown;
4393
+ last_dropped_at: string | null;
3196
4394
  created_at: string;
3197
4395
  updated_at: string;
3198
- };
4396
+ }
3199
4397
  interface InboxesRemoveParams {
3200
4398
  id: string;
3201
4399
  }
3202
- type InboxesRemoveResponse = {
3203
- object: string;
4400
+ interface InboxesRemoveResponse {
4401
+ object: "inbox";
3204
4402
  id: string;
3205
- deleted: boolean;
3206
- };
4403
+ deleted: true;
4404
+ }
3207
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;
3208
4418
  inboxId?: string;
3209
4419
  /**
3210
4420
  * Default: every status but `archived`.
@@ -3217,111 +4427,139 @@ interface ThreadsListParams {
3217
4427
  spam?: "exclude" | "only" | "include";
3218
4428
  assigneeAgent?: string;
3219
4429
  unread?: "true" | "false";
3220
- /**
3221
- * 1–100, default 20.
3222
- */
3223
- limit?: number;
3224
- /**
3225
- * Id of the last thread of the previous page.
3226
- */
3227
- after?: string;
3228
4430
  }
3229
- type ThreadsListResponse = {
3230
- object: string;
4431
+ interface ThreadsListResponse {
4432
+ object: "list";
3231
4433
  has_more: boolean;
3232
4434
  data: {
3233
- object: string;
4435
+ object: "inbox_thread";
3234
4436
  id: string;
3235
4437
  inbox_id: string;
3236
- subject: string;
3237
- status: string;
4438
+ subject: string | null;
4439
+ status: "open" | "pending" | "done" | "archived";
3238
4440
  spam: boolean;
3239
- labels: unknown[];
3240
- assignee_user_id: unknown;
3241
- assignee_agent: unknown;
4441
+ labels: string[];
4442
+ assignee_user_id: string | null;
4443
+ assignee_agent: string | null;
3242
4444
  message_count: number;
3243
4445
  unread: boolean;
3244
4446
  participants: string[];
3245
4447
  last_message_at: string;
3246
- last_inbound_at: string;
4448
+ last_inbound_at: string | null;
3247
4449
  created_at: string;
3248
4450
  updated_at: string;
3249
4451
  last_message: {
3250
4452
  id: string;
3251
- direction: string;
4453
+ direction: "inbound" | "outbound";
3252
4454
  from: string;
3253
- snippet: string;
4455
+ snippet: string | null;
3254
4456
  received_at: string;
3255
- };
4457
+ } | null;
3256
4458
  }[];
3257
- };
4459
+ }
3258
4460
  interface ThreadsGetParams {
3259
4461
  id: string;
3260
4462
  }
3261
- type ThreadsGetResponse = {
3262
- object: string;
4463
+ interface ThreadsGetResponse {
4464
+ object: "inbox_thread";
3263
4465
  id: string;
3264
4466
  inbox_id: string;
3265
- subject: string;
3266
- status: string;
4467
+ subject: string | null;
4468
+ status: "open" | "pending" | "done" | "archived";
3267
4469
  spam: boolean;
3268
- labels: unknown[];
3269
- assignee_user_id: unknown;
3270
- assignee_agent: unknown;
4470
+ labels: string[];
4471
+ assignee_user_id: string | null;
4472
+ assignee_agent: string | null;
3271
4473
  message_count: number;
3272
4474
  unread: boolean;
3273
4475
  participants: string[];
3274
4476
  last_message_at: string;
3275
- last_inbound_at: string;
4477
+ last_inbound_at: string | null;
3276
4478
  created_at: string;
3277
4479
  updated_at: string;
3278
- messages: {
3279
- object: string;
4480
+ messages: ({
4481
+ object: "inbox_message";
3280
4482
  id: string;
3281
- thread_id: string;
4483
+ thread_id: string | null;
3282
4484
  inbox_id: string;
3283
- direction: string;
3284
- status: string;
3285
4485
  from: string;
3286
4486
  from_address: string;
3287
- from_name: string;
4487
+ from_name: string | null;
3288
4488
  to: string[];
3289
- cc: unknown[];
3290
- reply_to: unknown[];
3291
- subject: string;
3292
- text: string;
3293
- html: string;
3294
- 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;
3295
4495
  remote_images: number;
3296
4496
  body_truncated: boolean;
3297
- message_id: string;
3298
- in_reply_to: unknown;
3299
- 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";
3300
4514
  spam: {
3301
- score: number;
3302
- verdict: string;
3303
- virus: string;
3304
- spf: string;
3305
- dkim: string;
3306
- dmarc: string;
3307
- 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[];
3308
4522
  };
3309
4523
  auto_submitted: boolean;
3310
- 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[];
3311
4545
  attachments: {
3312
4546
  id: string;
3313
4547
  filename: string;
3314
4548
  content_type: string;
3315
4549
  size: number;
3316
4550
  inline: boolean;
3317
- content_id: unknown;
4551
+ content_id: string | null;
3318
4552
  available: boolean;
3319
4553
  expires_at: string;
3320
4554
  }[];
3321
4555
  received_at: string;
3322
4556
  created_at: string;
3323
- }[];
3324
- };
4557
+ direction: "outbound";
4558
+ status: "draft" | "sent";
4559
+ email_id: string | null;
4560
+ delivery: string | null;
4561
+ })[];
4562
+ }
3325
4563
  type ThreadsUpdateParams = {
3326
4564
  id: string;
3327
4565
  } & {
@@ -3346,24 +4584,24 @@ type ThreadsUpdateParams = {
3346
4584
  spam?: boolean;
3347
4585
  unread?: boolean;
3348
4586
  };
3349
- type ThreadsUpdateResponse = {
3350
- object: string;
4587
+ interface ThreadsUpdateResponse {
4588
+ object: "inbox_thread";
3351
4589
  id: string;
3352
4590
  inbox_id: string;
3353
- subject: string;
3354
- status: string;
4591
+ subject: string | null;
4592
+ status: "open" | "pending" | "done" | "archived";
3355
4593
  spam: boolean;
3356
4594
  labels: string[];
3357
- assignee_user_id: unknown;
3358
- assignee_agent: string;
4595
+ assignee_user_id: string | null;
4596
+ assignee_agent: string | null;
3359
4597
  message_count: number;
3360
4598
  unread: boolean;
3361
4599
  participants: string[];
3362
4600
  last_message_at: string;
3363
- last_inbound_at: string;
4601
+ last_inbound_at: string | null;
3364
4602
  created_at: string;
3365
4603
  updated_at: string;
3366
- };
4604
+ }
3367
4605
  type ThreadsReplyParams = {
3368
4606
  id: string;
3369
4607
  } & {
@@ -3395,101 +4633,166 @@ type ThreadsReplyParams = {
3395
4633
  status?: "open" | "pending" | "done" | "archived";
3396
4634
  };
3397
4635
  type ThreadsReplyResponse = {
3398
- object: string;
4636
+ object: "inbox_message";
3399
4637
  id: string;
3400
- thread_id: string;
4638
+ thread_id: string | null;
3401
4639
  inbox_id: string;
3402
- direction: string;
3403
- status: string;
3404
4640
  from: string;
3405
4641
  from_address: string;
3406
- from_name: string;
4642
+ from_name: string | null;
3407
4643
  to: string[];
3408
- cc: unknown[];
3409
- reply_to: unknown[];
3410
- subject: string;
3411
- text: string;
3412
- html: string;
3413
- 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;
3414
4650
  remote_images: number;
3415
4651
  body_truncated: boolean;
3416
- message_id: string;
3417
- in_reply_to: unknown;
3418
- references: unknown[];
3419
- spam: {
3420
- score: number;
3421
- verdict: string;
3422
- virus: string;
3423
- spf: string;
3424
- dkim: string;
3425
- dmarc: string;
3426
- reasons: unknown[];
3427
- };
3428
- auto_submitted: boolean;
3429
- automation_reason: unknown;
4652
+ message_id: string | null;
4653
+ in_reply_to: string | null;
4654
+ references: string[];
3430
4655
  attachments: {
3431
4656
  id: string;
3432
4657
  filename: string;
3433
4658
  content_type: string;
3434
4659
  size: number;
3435
4660
  inline: boolean;
3436
- content_id: unknown;
4661
+ content_id: string | null;
3437
4662
  available: boolean;
3438
4663
  expires_at: string;
3439
4664
  }[];
3440
4665
  received_at: string;
3441
4666
  created_at: string;
4667
+ direction: "outbound";
4668
+ status: "sent";
3442
4669
  email_id: string;
3443
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";
3444
4711
  };
3445
4712
  interface MessagesGetParams {
3446
4713
  id: string;
3447
4714
  }
3448
4715
  type MessagesGetResponse = {
3449
- object: string;
4716
+ object: "inbox_message";
3450
4717
  id: string;
3451
- thread_id: string;
4718
+ thread_id: string | null;
3452
4719
  inbox_id: string;
3453
- direction: string;
3454
- status: string;
3455
4720
  from: string;
3456
4721
  from_address: string;
3457
- from_name: string;
4722
+ from_name: string | null;
3458
4723
  to: string[];
3459
- cc: unknown[];
3460
- reply_to: unknown[];
3461
- subject: string;
3462
- text: string;
3463
- html: string;
3464
- 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;
3465
4730
  remote_images: number;
3466
4731
  body_truncated: boolean;
3467
- message_id: string;
3468
- in_reply_to: unknown;
3469
- 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";
3470
4749
  spam: {
3471
- score: number;
3472
- verdict: string;
3473
- virus: string;
3474
- spf: string;
3475
- dkim: string;
3476
- dmarc: string;
3477
- 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[];
3478
4757
  };
3479
4758
  auto_submitted: boolean;
3480
- 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[];
3481
4780
  attachments: {
3482
4781
  id: string;
3483
4782
  filename: string;
3484
4783
  content_type: string;
3485
4784
  size: number;
3486
4785
  inline: boolean;
3487
- content_id: unknown;
4786
+ content_id: string | null;
3488
4787
  available: boolean;
3489
4788
  expires_at: string;
3490
4789
  }[];
3491
4790
  received_at: string;
3492
4791
  created_at: string;
4792
+ direction: "outbound";
4793
+ status: "draft" | "sent";
4794
+ email_id: string | null;
4795
+ delivery: string | null;
3493
4796
  };
3494
4797
  type MessagesUpdateParams = {
3495
4798
  id: string;
@@ -3498,124 +4801,110 @@ type MessagesUpdateParams = {
3498
4801
  html?: string | null;
3499
4802
  cc?: string[];
3500
4803
  };
3501
- type MessagesUpdateResponse = {
3502
- object: string;
4804
+ interface MessagesUpdateResponse {
4805
+ object: "inbox_message";
3503
4806
  id: string;
3504
- thread_id: string;
4807
+ thread_id: string | null;
3505
4808
  inbox_id: string;
3506
- direction: string;
3507
- status: string;
3508
4809
  from: string;
3509
4810
  from_address: string;
3510
- from_name: string;
4811
+ from_name: string | null;
3511
4812
  to: string[];
3512
- cc: unknown[];
3513
- reply_to: unknown[];
3514
- subject: string;
3515
- text: string;
3516
- html: string;
3517
- 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;
3518
4819
  remote_images: number;
3519
4820
  body_truncated: boolean;
3520
- message_id: string;
3521
- in_reply_to: unknown;
3522
- references: unknown[];
3523
- spam: {
3524
- score: number;
3525
- verdict: string;
3526
- virus: string;
3527
- spf: string;
3528
- dkim: string;
3529
- dmarc: string;
3530
- reasons: unknown[];
3531
- };
3532
- auto_submitted: boolean;
3533
- automation_reason: unknown;
4821
+ message_id: string | null;
4822
+ in_reply_to: string | null;
4823
+ references: string[];
3534
4824
  attachments: {
3535
4825
  id: string;
3536
4826
  filename: string;
3537
4827
  content_type: string;
3538
4828
  size: number;
3539
4829
  inline: boolean;
3540
- content_id: unknown;
4830
+ content_id: string | null;
3541
4831
  available: boolean;
3542
4832
  expires_at: string;
3543
4833
  }[];
3544
4834
  received_at: string;
3545
4835
  created_at: string;
3546
- };
4836
+ direction: "outbound";
4837
+ status: "draft" | "sent";
4838
+ email_id: string | null;
4839
+ delivery: string | null;
4840
+ }
3547
4841
  type MessagesSendParams = {
3548
4842
  id: string;
3549
4843
  } & {
3550
4844
  status?: "open" | "pending" | "done" | "archived";
3551
4845
  };
3552
4846
  type MessagesSendResponse = {
3553
- object: string;
4847
+ object: "inbox_message";
3554
4848
  id: string;
3555
- thread_id: string;
4849
+ thread_id: string | null;
3556
4850
  inbox_id: string;
3557
- direction: string;
3558
- status: string;
3559
4851
  from: string;
3560
4852
  from_address: string;
3561
- from_name: string;
4853
+ from_name: string | null;
3562
4854
  to: string[];
3563
- cc: unknown[];
3564
- reply_to: unknown[];
3565
- subject: string;
3566
- text: string;
3567
- html: string;
3568
- 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;
3569
4861
  remote_images: number;
3570
4862
  body_truncated: boolean;
3571
- message_id: string;
3572
- in_reply_to: unknown;
3573
- references: unknown[];
3574
- spam: {
3575
- score: number;
3576
- verdict: string;
3577
- virus: string;
3578
- spf: string;
3579
- dkim: string;
3580
- dmarc: string;
3581
- reasons: unknown[];
3582
- };
3583
- auto_submitted: boolean;
3584
- automation_reason: unknown;
4863
+ message_id: string | null;
4864
+ in_reply_to: string | null;
4865
+ references: string[];
3585
4866
  attachments: {
3586
4867
  id: string;
3587
4868
  filename: string;
3588
4869
  content_type: string;
3589
4870
  size: number;
3590
4871
  inline: boolean;
3591
- content_id: unknown;
4872
+ content_id: string | null;
3592
4873
  available: boolean;
3593
4874
  expires_at: string;
3594
4875
  }[];
3595
4876
  received_at: string;
3596
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";
3597
4886
  };
3598
4887
  interface MessagesRemoveParams {
3599
4888
  id: string;
3600
4889
  }
3601
- type MessagesRemoveResponse = {
3602
- object: string;
4890
+ interface MessagesRemoveResponse {
4891
+ object: "inbox_message";
3603
4892
  id: string;
3604
- deleted: boolean;
3605
- };
4893
+ deleted: true;
4894
+ }
3606
4895
  interface MessagesAttachmentParams {
3607
4896
  id: string;
3608
4897
  attachmentId: string;
3609
4898
  }
3610
- type MessagesAttachmentResponse = {
3611
- object: string;
4899
+ interface MessagesAttachmentResponse {
4900
+ object: "attachment_url";
3612
4901
  id: string;
3613
4902
  filename: string;
3614
4903
  content_type: string;
3615
4904
  size: number;
3616
4905
  url: string;
3617
4906
  expires_at: string;
3618
- };
4907
+ }
3619
4908
 
3620
4909
  interface SmartletterResources {
3621
4910
  emails: {