smartletter 1.1.0 → 1.3.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.mts 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;
386
+ type: "string" | "number";
387
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,52 @@ 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
+ kind: "newsletter" | "broadcast";
528
+ from: string;
529
+ audience_limit: number | null;
530
+ scheduled_for: string | null;
531
+ send_started_at: string | null;
532
+ send_finished_at: string | null;
533
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
534
+ recipient_estimate: number | null;
535
+ ab_test: {
536
+ variants: {
537
+ key: "A" | "B" | "C" | "D";
538
+ subject: string;
539
+ preheader: string | null;
534
540
  }[];
541
+ sample_pct: number;
542
+ metric: "opens" | "clicks";
543
+ wait_hours: number;
544
+ winner_mode: "auto" | "manual";
545
+ } | null;
546
+ ab_winner: ("A" | "B" | "C" | "D") | null;
547
+ stats: {
548
+ sent: number;
549
+ delivered: number;
550
+ opened: number;
551
+ clicked: number;
552
+ bounced: number;
553
+ complained: number;
554
+ unsubscribed: number;
535
555
  };
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
556
  created_at: string;
543
557
  updated_at: string;
544
558
  }[];
545
- };
559
+ }
546
560
  interface NewslettersCreateParams {
547
561
  /**
548
562
  * Subject line.
@@ -683,68 +697,137 @@ interface NewslettersCreateParams {
683
697
  */
684
698
  winnerMode?: "auto" | "manual";
685
699
  } | null;
700
+ /**
701
+ * `newsletter` (default) goes to the subscribers of the newsletter, or of a topic. `broadcast` goes to the contacts of the group (the rule `audience_filter_id` narrows it), subscribed or not, and takes no `topic_id`. A broadcast is never published in the archive.
702
+ */
703
+ kind?: "newsletter" | "broadcast";
704
+ /**
705
+ * Sender address of this issue: `name@your-domain.com`, on the custom domain of the newsletter (a bare local part `name` also works). Omit or `null` for the address of the newsletter.
706
+ */
707
+ from?: string | null;
686
708
  }
687
- type NewslettersCreateResponse = {
688
- object: string;
709
+ interface NewslettersCreateResponse {
710
+ object: "newsletter";
689
711
  id: string;
690
712
  segment_id: string;
691
- topic_id: unknown;
713
+ topic_id: string | null;
692
714
  subject: string;
693
- preheader: string;
694
- status: string;
715
+ preheader: string | null;
716
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
717
+ kind: "newsletter" | "broadcast";
718
+ from: string;
695
719
  body: {
696
- format: string;
697
- content: unknown;
720
+ format: "markdown" | "html";
721
+ content: string;
722
+ } | {
723
+ format: "sections";
724
+ content: null;
725
+ } | {
726
+ format: "document";
727
+ content: null;
698
728
  blocks: {
699
- blockId: string;
729
+ block_id: string;
700
730
  kind: string;
701
731
  text: string;
702
732
  }[];
703
733
  };
704
- audience_limit: unknown;
705
- scheduled_for: unknown;
706
- pause_reason: unknown;
707
- recipient_estimate: unknown;
708
- ab_test: unknown;
709
- ab_winner: unknown;
734
+ audience_limit: number | null;
735
+ scheduled_for: string | null;
736
+ send_started_at: string | null;
737
+ send_finished_at: string | null;
738
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
739
+ recipient_estimate: number | null;
740
+ ab_test: {
741
+ variants: {
742
+ key: "A" | "B" | "C" | "D";
743
+ subject: string;
744
+ preheader: string | null;
745
+ }[];
746
+ sample_pct: number;
747
+ metric: "opens" | "clicks";
748
+ wait_hours: number;
749
+ winner_mode: "auto" | "manual";
750
+ } | null;
751
+ ab_winner: ("A" | "B" | "C" | "D") | null;
752
+ stats: {
753
+ sent: number;
754
+ delivered: number;
755
+ opened: number;
756
+ clicked: number;
757
+ bounced: number;
758
+ complained: number;
759
+ unsubscribed: number;
760
+ };
710
761
  created_at: string;
711
762
  updated_at: string;
712
- };
763
+ }
713
764
  interface NewslettersGetParams {
714
765
  id: string;
715
766
  }
716
- type NewslettersGetResponse = {
717
- object: string;
767
+ interface NewslettersGetResponse {
768
+ object: "newsletter";
718
769
  id: string;
719
770
  segment_id: string;
720
- topic_id: unknown;
771
+ topic_id: string | null;
721
772
  subject: string;
722
- preheader: string;
723
- status: string;
773
+ preheader: string | null;
774
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
775
+ kind: "newsletter" | "broadcast";
776
+ from: string;
724
777
  body: {
725
- format: string;
726
- content: unknown;
778
+ format: "markdown" | "html";
779
+ content: string;
780
+ } | {
781
+ format: "sections";
782
+ content: null;
783
+ } | {
784
+ format: "document";
785
+ content: null;
727
786
  blocks: {
728
- blockId: string;
787
+ block_id: string;
729
788
  kind: string;
730
789
  text: string;
731
790
  }[];
732
791
  };
733
- audience_limit: unknown;
734
- scheduled_for: unknown;
735
- pause_reason: unknown;
736
- recipient_estimate: unknown;
737
- ab_test: unknown;
738
- ab_winner: unknown;
792
+ audience_limit: number | null;
793
+ scheduled_for: string | null;
794
+ send_started_at: string | null;
795
+ send_finished_at: string | null;
796
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
797
+ recipient_estimate: number | null;
798
+ ab_test: {
799
+ variants: {
800
+ key: "A" | "B" | "C" | "D";
801
+ subject: string;
802
+ preheader: string | null;
803
+ }[];
804
+ sample_pct: number;
805
+ metric: "opens" | "clicks";
806
+ wait_hours: number;
807
+ winner_mode: "auto" | "manual";
808
+ } | null;
809
+ ab_winner: ("A" | "B" | "C" | "D") | null;
810
+ stats: {
811
+ sent: number;
812
+ delivered: number;
813
+ opened: number;
814
+ clicked: number;
815
+ bounced: number;
816
+ complained: number;
817
+ unsubscribed: number;
818
+ };
739
819
  created_at: string;
740
820
  updated_at: string;
741
- };
821
+ }
742
822
  type NewslettersUpdateParams = {
743
823
  id: string;
744
824
  } & {
745
825
  subject?: string;
746
826
  preheader?: string | null;
747
- topicId?: string;
827
+ /**
828
+ * Topic of the issue. `null` is accepted only for a broadcast, which has no topic.
829
+ */
830
+ topicId?: string | null;
748
831
  markdown?: string;
749
832
  html?: string;
750
833
  /**
@@ -862,91 +945,164 @@ type NewslettersUpdateParams = {
862
945
  */
863
946
  winnerMode?: "auto" | "manual";
864
947
  } | null;
948
+ /**
949
+ * Drafts only. See `POST /newsletters`.
950
+ */
951
+ kind?: "newsletter" | "broadcast";
952
+ /**
953
+ * Sender address of this issue; `null` goes back to the address of the newsletter.
954
+ */
955
+ from?: string | null;
865
956
  };
866
- type NewslettersUpdateResponse = {
867
- object: string;
957
+ interface NewslettersUpdateResponse {
958
+ object: "newsletter";
868
959
  id: string;
869
960
  segment_id: string;
870
- topic_id: unknown;
961
+ topic_id: string | null;
871
962
  subject: string;
872
- preheader: string;
873
- status: string;
963
+ preheader: string | null;
964
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
965
+ kind: "newsletter" | "broadcast";
966
+ from: string;
874
967
  body: {
875
- format: string;
876
- content: unknown;
968
+ format: "markdown" | "html";
969
+ content: string;
970
+ } | {
971
+ format: "sections";
972
+ content: null;
973
+ } | {
974
+ format: "document";
975
+ content: null;
877
976
  blocks: {
878
- blockId: string;
977
+ block_id: string;
879
978
  kind: string;
880
979
  text: string;
881
980
  }[];
882
981
  };
883
- audience_limit: unknown;
884
- scheduled_for: unknown;
885
- pause_reason: unknown;
886
- recipient_estimate: unknown;
887
- ab_test: unknown;
888
- ab_winner: unknown;
982
+ audience_limit: number | null;
983
+ scheduled_for: string | null;
984
+ send_started_at: string | null;
985
+ send_finished_at: string | null;
986
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
987
+ recipient_estimate: number | null;
988
+ ab_test: {
989
+ variants: {
990
+ key: "A" | "B" | "C" | "D";
991
+ subject: string;
992
+ preheader: string | null;
993
+ }[];
994
+ sample_pct: number;
995
+ metric: "opens" | "clicks";
996
+ wait_hours: number;
997
+ winner_mode: "auto" | "manual";
998
+ } | null;
999
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1000
+ stats: {
1001
+ sent: number;
1002
+ delivered: number;
1003
+ opened: number;
1004
+ clicked: number;
1005
+ bounced: number;
1006
+ complained: number;
1007
+ unsubscribed: number;
1008
+ };
889
1009
  created_at: string;
890
1010
  updated_at: string;
891
- };
1011
+ }
892
1012
  interface NewslettersRemoveParams {
893
1013
  id: string;
894
1014
  }
895
- type NewslettersRemoveResponse = {
896
- object: string;
1015
+ interface NewslettersRemoveResponse {
1016
+ object: "newsletter";
897
1017
  id: string;
898
- deleted: boolean;
899
- };
1018
+ deleted: true;
1019
+ }
900
1020
  interface NewslettersDuplicateParams {
901
1021
  id: string;
902
1022
  }
903
- type NewslettersDuplicateResponse = {
904
- object: string;
1023
+ interface NewslettersDuplicateResponse {
1024
+ object: "newsletter";
905
1025
  id: string;
906
1026
  segment_id: string;
907
- topic_id: unknown;
1027
+ topic_id: string | null;
908
1028
  subject: string;
909
- preheader: string;
910
- status: string;
1029
+ preheader: string | null;
1030
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1031
+ kind: "newsletter" | "broadcast";
1032
+ from: string;
911
1033
  body: {
912
- format: string;
913
- content: unknown;
1034
+ format: "markdown" | "html";
1035
+ content: string;
1036
+ } | {
1037
+ format: "sections";
1038
+ content: null;
1039
+ } | {
1040
+ format: "document";
1041
+ content: null;
914
1042
  blocks: {
915
- blockId: string;
1043
+ block_id: string;
916
1044
  kind: string;
917
1045
  text: string;
918
1046
  }[];
919
1047
  };
920
- audience_limit: unknown;
921
- scheduled_for: unknown;
922
- pause_reason: unknown;
923
- recipient_estimate: unknown;
924
- ab_test: unknown;
925
- ab_winner: unknown;
1048
+ audience_limit: number | null;
1049
+ scheduled_for: string | null;
1050
+ send_started_at: string | null;
1051
+ send_finished_at: string | null;
1052
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
1053
+ recipient_estimate: number | null;
1054
+ ab_test: {
1055
+ variants: {
1056
+ key: "A" | "B" | "C" | "D";
1057
+ subject: string;
1058
+ preheader: string | null;
1059
+ }[];
1060
+ sample_pct: number;
1061
+ metric: "opens" | "clicks";
1062
+ wait_hours: number;
1063
+ winner_mode: "auto" | "manual";
1064
+ } | null;
1065
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1066
+ stats: {
1067
+ sent: number;
1068
+ delivered: number;
1069
+ opened: number;
1070
+ clicked: number;
1071
+ bounced: number;
1072
+ complained: number;
1073
+ unsubscribed: number;
1074
+ };
926
1075
  created_at: string;
927
1076
  updated_at: string;
928
- };
1077
+ }
929
1078
  interface NewslettersReviewParams {
930
1079
  id: string;
931
1080
  }
932
- type NewslettersReviewResponse = {
933
- object: string;
1081
+ interface NewslettersReviewResponse {
1082
+ object: "review";
1083
+ id: string;
934
1084
  blocking: boolean;
935
1085
  items: {
936
- id: string;
937
- level: string;
1086
+ id: "subject" | "preheader" | "unsubscribe" | "postal_address" | "size" | "links" | "images_alt" | "domain" | "content" | "html_size" | "variables";
1087
+ level: "ok" | "warning" | "blocking";
938
1088
  values?: {
939
- kb: number;
1089
+ max?: number;
1090
+ length?: number;
1091
+ kb?: number;
1092
+ count?: number;
1093
+ percent?: number;
940
1094
  };
941
1095
  }[];
942
- };
1096
+ }
943
1097
  interface NewslettersTestParams {
944
1098
  id: string;
945
1099
  }
946
- type NewslettersTestResponse = {
947
- object: string;
1100
+ interface NewslettersTestResponse {
1101
+ object: "test_email";
1102
+ id: string;
948
1103
  to: string;
949
- };
1104
+ variants: number;
1105
+ }
950
1106
  type NewslettersSendParams = {
951
1107
  id: string;
952
1108
  } & {
@@ -955,11 +1111,61 @@ type NewslettersSendParams = {
955
1111
  */
956
1112
  audienceLimit?: number;
957
1113
  };
958
- type NewslettersSendResponse = {
959
- object: string;
1114
+ interface NewslettersSendResponse {
1115
+ object: "newsletter";
960
1116
  id: string;
961
- status: string;
962
- };
1117
+ segment_id: string;
1118
+ topic_id: string | null;
1119
+ subject: string;
1120
+ preheader: string | null;
1121
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1122
+ kind: "newsletter" | "broadcast";
1123
+ from: string;
1124
+ body: {
1125
+ format: "markdown" | "html";
1126
+ content: string;
1127
+ } | {
1128
+ format: "sections";
1129
+ content: null;
1130
+ } | {
1131
+ format: "document";
1132
+ content: null;
1133
+ blocks: {
1134
+ block_id: string;
1135
+ kind: string;
1136
+ text: string;
1137
+ }[];
1138
+ };
1139
+ audience_limit: number | null;
1140
+ scheduled_for: string | null;
1141
+ send_started_at: string | null;
1142
+ send_finished_at: string | null;
1143
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
1144
+ recipient_estimate: number | null;
1145
+ ab_test: {
1146
+ variants: {
1147
+ key: "A" | "B" | "C" | "D";
1148
+ subject: string;
1149
+ preheader: string | null;
1150
+ }[];
1151
+ sample_pct: number;
1152
+ metric: "opens" | "clicks";
1153
+ wait_hours: number;
1154
+ winner_mode: "auto" | "manual";
1155
+ } | null;
1156
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1157
+ stats: {
1158
+ sent: number;
1159
+ delivered: number;
1160
+ opened: number;
1161
+ clicked: number;
1162
+ bounced: number;
1163
+ complained: number;
1164
+ unsubscribed: number;
1165
+ };
1166
+ created_at: string;
1167
+ updated_at: string;
1168
+ }
963
1169
  type NewslettersScheduleParams = {
964
1170
  id: string;
965
1171
  } & {
@@ -972,57 +1178,50 @@ type NewslettersScheduleParams = {
972
1178
  */
973
1179
  audienceLimit?: number;
974
1180
  };
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 {
998
- id: string;
999
- }
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 {
1181
+ interface NewslettersScheduleResponse {
1182
+ object: "newsletter";
1019
1183
  id: string;
1020
- }
1021
- type NewslettersReportResponse = {
1022
- object: string;
1023
- id: string;
1024
- status: string;
1025
- totals: {
1184
+ segment_id: string;
1185
+ topic_id: string | null;
1186
+ subject: string;
1187
+ preheader: string | null;
1188
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1189
+ kind: "newsletter" | "broadcast";
1190
+ from: string;
1191
+ body: {
1192
+ format: "markdown" | "html";
1193
+ content: string;
1194
+ } | {
1195
+ format: "sections";
1196
+ content: null;
1197
+ } | {
1198
+ format: "document";
1199
+ content: null;
1200
+ blocks: {
1201
+ block_id: string;
1202
+ kind: string;
1203
+ text: string;
1204
+ }[];
1205
+ };
1206
+ audience_limit: number | null;
1207
+ scheduled_for: string | null;
1208
+ send_started_at: string | null;
1209
+ send_finished_at: string | null;
1210
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
1211
+ recipient_estimate: number | null;
1212
+ ab_test: {
1213
+ variants: {
1214
+ key: "A" | "B" | "C" | "D";
1215
+ subject: string;
1216
+ preheader: string | null;
1217
+ }[];
1218
+ sample_pct: number;
1219
+ metric: "opens" | "clicks";
1220
+ wait_hours: number;
1221
+ winner_mode: "auto" | "manual";
1222
+ } | null;
1223
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1224
+ stats: {
1026
1225
  sent: number;
1027
1226
  delivered: number;
1028
1227
  opened: number;
@@ -1031,21 +1230,277 @@ type NewslettersReportResponse = {
1031
1230
  complained: number;
1032
1231
  unsubscribed: number;
1033
1232
  };
1034
- rates: {
1035
- delivery: number;
1036
- open: number;
1037
- click: number;
1038
- bounce: number;
1233
+ created_at: string;
1234
+ updated_at: string;
1235
+ }
1236
+ interface NewslettersUnscheduleParams {
1237
+ id: string;
1238
+ }
1239
+ interface NewslettersUnscheduleResponse {
1240
+ object: "newsletter";
1241
+ id: string;
1242
+ segment_id: string;
1243
+ topic_id: string | null;
1244
+ subject: string;
1245
+ preheader: string | null;
1246
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1247
+ kind: "newsletter" | "broadcast";
1248
+ from: string;
1249
+ body: {
1250
+ format: "markdown" | "html";
1251
+ content: string;
1252
+ } | {
1253
+ format: "sections";
1254
+ content: null;
1255
+ } | {
1256
+ format: "document";
1257
+ content: null;
1258
+ blocks: {
1259
+ block_id: string;
1260
+ kind: string;
1261
+ text: string;
1262
+ }[];
1263
+ };
1264
+ audience_limit: number | null;
1265
+ scheduled_for: string | null;
1266
+ send_started_at: string | null;
1267
+ send_finished_at: string | null;
1268
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
1269
+ recipient_estimate: number | null;
1270
+ ab_test: {
1271
+ variants: {
1272
+ key: "A" | "B" | "C" | "D";
1273
+ subject: string;
1274
+ preheader: string | null;
1275
+ }[];
1276
+ sample_pct: number;
1277
+ metric: "opens" | "clicks";
1278
+ wait_hours: number;
1279
+ winner_mode: "auto" | "manual";
1280
+ } | null;
1281
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1282
+ stats: {
1283
+ sent: number;
1284
+ delivered: number;
1285
+ opened: number;
1286
+ clicked: number;
1287
+ bounced: number;
1288
+ complained: number;
1289
+ unsubscribed: number;
1290
+ };
1291
+ created_at: string;
1292
+ updated_at: string;
1293
+ }
1294
+ interface NewslettersPauseParams {
1295
+ id: string;
1296
+ }
1297
+ interface NewslettersPauseResponse {
1298
+ object: "newsletter";
1299
+ id: string;
1300
+ segment_id: string;
1301
+ topic_id: string | null;
1302
+ subject: string;
1303
+ preheader: string | null;
1304
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1305
+ kind: "newsletter" | "broadcast";
1306
+ from: string;
1307
+ body: {
1308
+ format: "markdown" | "html";
1309
+ content: string;
1310
+ } | {
1311
+ format: "sections";
1312
+ content: null;
1313
+ } | {
1314
+ format: "document";
1315
+ content: null;
1316
+ blocks: {
1317
+ block_id: string;
1318
+ kind: string;
1319
+ text: string;
1320
+ }[];
1321
+ };
1322
+ audience_limit: number | null;
1323
+ scheduled_for: string | null;
1324
+ send_started_at: string | null;
1325
+ send_finished_at: string | null;
1326
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
1327
+ recipient_estimate: number | null;
1328
+ ab_test: {
1329
+ variants: {
1330
+ key: "A" | "B" | "C" | "D";
1331
+ subject: string;
1332
+ preheader: string | null;
1333
+ }[];
1334
+ sample_pct: number;
1335
+ metric: "opens" | "clicks";
1336
+ wait_hours: number;
1337
+ winner_mode: "auto" | "manual";
1338
+ } | null;
1339
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1340
+ stats: {
1341
+ sent: number;
1342
+ delivered: number;
1343
+ opened: number;
1344
+ clicked: number;
1345
+ bounced: number;
1346
+ complained: number;
1347
+ unsubscribed: number;
1348
+ };
1349
+ created_at: string;
1350
+ updated_at: string;
1351
+ }
1352
+ interface NewslettersResumeParams {
1353
+ id: string;
1354
+ }
1355
+ interface NewslettersResumeResponse {
1356
+ object: "newsletter";
1357
+ id: string;
1358
+ segment_id: string;
1359
+ topic_id: string | null;
1360
+ subject: string;
1361
+ preheader: string | null;
1362
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1363
+ kind: "newsletter" | "broadcast";
1364
+ from: string;
1365
+ body: {
1366
+ format: "markdown" | "html";
1367
+ content: string;
1368
+ } | {
1369
+ format: "sections";
1370
+ content: null;
1371
+ } | {
1372
+ format: "document";
1373
+ content: null;
1374
+ blocks: {
1375
+ block_id: string;
1376
+ kind: string;
1377
+ text: string;
1378
+ }[];
1379
+ };
1380
+ audience_limit: number | null;
1381
+ scheduled_for: string | null;
1382
+ send_started_at: string | null;
1383
+ send_finished_at: string | null;
1384
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
1385
+ recipient_estimate: number | null;
1386
+ ab_test: {
1387
+ variants: {
1388
+ key: "A" | "B" | "C" | "D";
1389
+ subject: string;
1390
+ preheader: string | null;
1391
+ }[];
1392
+ sample_pct: number;
1393
+ metric: "opens" | "clicks";
1394
+ wait_hours: number;
1395
+ winner_mode: "auto" | "manual";
1396
+ } | null;
1397
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1398
+ stats: {
1399
+ sent: number;
1400
+ delivered: number;
1401
+ opened: number;
1402
+ clicked: number;
1403
+ bounced: number;
1404
+ complained: number;
1405
+ unsubscribed: number;
1406
+ };
1407
+ created_at: string;
1408
+ updated_at: string;
1409
+ }
1410
+ type NewslettersSendMoreParams = {
1411
+ id: string;
1412
+ } & {
1413
+ /**
1414
+ * How many of the next most engaged contacts to add.
1415
+ */
1416
+ count: number;
1417
+ };
1418
+ interface NewslettersSendMoreResponse {
1419
+ object: "newsletter";
1420
+ id: string;
1421
+ segment_id: string;
1422
+ topic_id: string | null;
1423
+ subject: string;
1424
+ preheader: string | null;
1425
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1426
+ kind: "newsletter" | "broadcast";
1427
+ from: string;
1428
+ body: {
1429
+ format: "markdown" | "html";
1430
+ content: string;
1431
+ } | {
1432
+ format: "sections";
1433
+ content: null;
1434
+ } | {
1435
+ format: "document";
1436
+ content: null;
1437
+ blocks: {
1438
+ block_id: string;
1439
+ kind: string;
1440
+ text: string;
1441
+ }[];
1442
+ };
1443
+ audience_limit: number | null;
1444
+ scheduled_for: string | null;
1445
+ send_started_at: string | null;
1446
+ send_finished_at: string | null;
1447
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
1448
+ recipient_estimate: number | null;
1449
+ ab_test: {
1450
+ variants: {
1451
+ key: "A" | "B" | "C" | "D";
1452
+ subject: string;
1453
+ preheader: string | null;
1454
+ }[];
1455
+ sample_pct: number;
1456
+ metric: "opens" | "clicks";
1457
+ wait_hours: number;
1458
+ winner_mode: "auto" | "manual";
1459
+ } | null;
1460
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1461
+ stats: {
1462
+ sent: number;
1463
+ delivered: number;
1464
+ opened: number;
1465
+ clicked: number;
1466
+ bounced: number;
1467
+ complained: number;
1468
+ unsubscribed: number;
1469
+ };
1470
+ created_at: string;
1471
+ updated_at: string;
1472
+ }
1473
+ interface NewslettersReportParams {
1474
+ id: string;
1475
+ }
1476
+ interface NewslettersReportResponse {
1477
+ object: "report";
1478
+ id: string;
1479
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1480
+ totals: {
1481
+ sent: number;
1482
+ delivered: number;
1483
+ opened: number;
1484
+ clicked: number;
1485
+ bounced: number;
1486
+ complained: number;
1487
+ unsubscribed: number;
1488
+ };
1489
+ rates: {
1490
+ delivery: number;
1491
+ open: number;
1492
+ click: number;
1493
+ bounce: number;
1039
1494
  complaint: number;
1040
1495
  unsubscribe: number;
1041
1496
  };
1042
1497
  progress: {
1043
- attempted: number;
1044
- recipient_estimate: number;
1045
- audience_limit: unknown;
1498
+ attempted: number | null;
1499
+ recipient_estimate: number | null;
1500
+ audience_limit: number | null;
1046
1501
  };
1047
1502
  providers: {
1048
- provider: string;
1503
+ provider: "gmail" | "microsoft" | "yahoo" | "apple" | "fr_isp" | "gmx" | "proton" | "other";
1049
1504
  sent: number;
1050
1505
  delivered: number;
1051
1506
  opened: number;
@@ -1054,19 +1509,19 @@ type NewslettersReportResponse = {
1054
1509
  complained: number;
1055
1510
  }[];
1056
1511
  ab_test: {
1057
- phase: string;
1512
+ phase: ("testing" | "waiting" | "winner") | null;
1058
1513
  sample_pct: number;
1059
- metric: string;
1514
+ metric: "opens" | "clicks";
1060
1515
  wait_hours: number;
1061
- winner_mode: string;
1062
- winner: unknown;
1063
- decided_at: unknown;
1064
- decided_by: unknown;
1065
- decide_at: string;
1516
+ winner_mode: "auto" | "manual";
1517
+ winner: ("A" | "B" | "C" | "D") | null;
1518
+ decided_at: string | null;
1519
+ decided_by: ("auto" | "manual" | "fallback" | "skipped") | null;
1520
+ decide_at: string | null;
1066
1521
  variants: {
1067
- key: string;
1522
+ key: "A" | "B" | "C" | "D";
1068
1523
  subject: string;
1069
- preheader: string;
1524
+ preheader: string | null;
1070
1525
  total: {
1071
1526
  attempted: number;
1072
1527
  sent: number;
@@ -1079,13 +1534,9 @@ type NewslettersReportResponse = {
1079
1534
  };
1080
1535
  }[];
1081
1536
  report: {
1082
- metric: string;
1083
- leader: string;
1084
- winner: unknown;
1085
- p_value: number;
1086
- significant: boolean;
1537
+ metric: "opens" | "clicks";
1087
1538
  variants: {
1088
- variant: string;
1539
+ variant: "A" | "B" | "C" | "D";
1089
1540
  sent: number;
1090
1541
  opened: number;
1091
1542
  clicked: number;
@@ -1095,17 +1546,21 @@ type NewslettersReportResponse = {
1095
1546
  ci_high: number;
1096
1547
  leader: boolean;
1097
1548
  }[];
1549
+ leader: "A" | "B" | "C" | "D";
1550
+ winner: ("A" | "B" | "C" | "D") | null;
1551
+ p_value: number;
1552
+ significant: boolean;
1098
1553
  };
1099
- };
1554
+ } | null;
1100
1555
  links: {
1101
1556
  url: string;
1102
- label: string;
1557
+ label: string | null;
1103
1558
  clicks: number;
1104
1559
  unique_clickers: number;
1105
1560
  share: number;
1106
1561
  }[];
1107
1562
  links_total: number;
1108
- };
1563
+ }
1109
1564
  type NewslettersAbWinnerParams = {
1110
1565
  id: string;
1111
1566
  } & {
@@ -1114,32 +1569,61 @@ type NewslettersAbWinnerParams = {
1114
1569
  */
1115
1570
  variant: "A" | "B" | "C" | "D";
1116
1571
  };
1117
- type NewslettersAbWinnerResponse = {
1118
- object: string;
1572
+ interface NewslettersAbWinnerResponse {
1573
+ object: "newsletter";
1119
1574
  id: string;
1120
1575
  segment_id: string;
1121
- topic_id: unknown;
1576
+ topic_id: string | null;
1122
1577
  subject: string;
1123
- preheader: string;
1124
- status: string;
1578
+ preheader: string | null;
1579
+ status: "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "held";
1580
+ kind: "newsletter" | "broadcast";
1581
+ from: string;
1125
1582
  body: {
1126
- format: string;
1127
- content: unknown;
1583
+ format: "markdown" | "html";
1584
+ content: string;
1585
+ } | {
1586
+ format: "sections";
1587
+ content: null;
1588
+ } | {
1589
+ format: "document";
1590
+ content: null;
1128
1591
  blocks: {
1129
- blockId: string;
1592
+ block_id: string;
1130
1593
  kind: string;
1131
1594
  text: string;
1132
1595
  }[];
1133
1596
  };
1134
- audience_limit: unknown;
1135
- scheduled_for: unknown;
1136
- pause_reason: unknown;
1137
- recipient_estimate: unknown;
1138
- ab_test: unknown;
1139
- ab_winner: string;
1597
+ audience_limit: number | null;
1598
+ scheduled_for: string | null;
1599
+ send_started_at: string | null;
1600
+ send_finished_at: string | null;
1601
+ pause_reason: ("manual" | "monthly_cap" | "auto_bounce_rate" | "auto_complaint_rate" | "test_batch_failed" | "workspace_suspended" | "plan_required" | "gmail_spam_rate" | "domain_required") | null;
1602
+ recipient_estimate: number | null;
1603
+ ab_test: {
1604
+ variants: {
1605
+ key: "A" | "B" | "C" | "D";
1606
+ subject: string;
1607
+ preheader: string | null;
1608
+ }[];
1609
+ sample_pct: number;
1610
+ metric: "opens" | "clicks";
1611
+ wait_hours: number;
1612
+ winner_mode: "auto" | "manual";
1613
+ } | null;
1614
+ ab_winner: ("A" | "B" | "C" | "D") | null;
1615
+ stats: {
1616
+ sent: number;
1617
+ delivered: number;
1618
+ opened: number;
1619
+ clicked: number;
1620
+ bounced: number;
1621
+ complained: number;
1622
+ unsubscribed: number;
1623
+ };
1140
1624
  created_at: string;
1141
1625
  updated_at: string;
1142
- };
1626
+ }
1143
1627
  interface ContactsListParams {
1144
1628
  /**
1145
1629
  * 1–100, default 20.
@@ -1164,17 +1648,37 @@ interface ContactsListParams {
1164
1648
  */
1165
1649
  tag?: string;
1166
1650
  }
1167
- type ContactsListResponse = {
1168
- object: string;
1651
+ interface ContactsListResponse {
1652
+ object: "list";
1169
1653
  has_more: boolean;
1170
1654
  data: {
1171
- object: string;
1655
+ object: "contact";
1172
1656
  id: string;
1173
1657
  email: string;
1174
- status: string;
1658
+ name: string | null;
1659
+ first_name: string | null;
1660
+ last_name: string | null;
1661
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1175
1662
  segment_id: string;
1663
+ language: string | null;
1664
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1665
+ subscribed_at: string | null;
1666
+ unsubscribed_at: string | null;
1667
+ created_at: string;
1668
+ custom_fields: {
1669
+ [k: string]: string | number | boolean;
1670
+ };
1671
+ tags: string[];
1672
+ newsletter_subscribed: boolean;
1673
+ engagement: {
1674
+ emails_sent: number;
1675
+ emails_opened: number;
1676
+ emails_clicked: number;
1677
+ last_opened_at: string | null;
1678
+ last_clicked_at: string | null;
1679
+ };
1176
1680
  }[];
1177
- };
1681
+ }
1178
1682
  interface ContactsCreateParams {
1179
1683
  email: string;
1180
1684
  /**
@@ -1198,14 +1702,39 @@ interface ContactsCreateParams {
1198
1702
  * Added to the contact's tags (also when the contact already exists).
1199
1703
  */
1200
1704
  tags?: string[];
1705
+ /**
1706
+ * Receives the newsletter issues (default `true` for a new contact). `false` adds the contact to the group only: they get broadcasts, not newsletters. A contact already in the group is never unsubscribed here: only `true` subscribes them.
1707
+ */
1708
+ newsletterSubscribed?: boolean;
1201
1709
  }
1202
- type ContactsCreateResponse = {
1203
- object: string;
1710
+ interface ContactsCreateResponse {
1711
+ object: "contact";
1204
1712
  id: string;
1205
1713
  email: string;
1206
- status: string;
1714
+ name: string | null;
1715
+ first_name: string | null;
1716
+ last_name: string | null;
1717
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1718
+ segment_id: string;
1719
+ language: string | null;
1720
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1721
+ subscribed_at: string | null;
1722
+ unsubscribed_at: string | null;
1723
+ created_at: string;
1724
+ custom_fields: {
1725
+ [k: string]: string | number | boolean;
1726
+ };
1727
+ tags: string[];
1728
+ newsletter_subscribed: boolean;
1729
+ engagement: {
1730
+ emails_sent: number;
1731
+ emails_opened: number;
1732
+ emails_clicked: number;
1733
+ last_opened_at: string | null;
1734
+ last_clicked_at: string | null;
1735
+ };
1207
1736
  existed: boolean;
1208
- };
1737
+ }
1209
1738
  interface ContactsImportParams {
1210
1739
  segmentId?: string;
1211
1740
  /**
@@ -1240,6 +1769,10 @@ interface ContactsImportParams {
1240
1769
  * Merged into the tags of a contact already in the newsletter (never replaced).
1241
1770
  */
1242
1771
  tags?: string[] | null;
1772
+ /**
1773
+ * New contact: default `true`. `false` keeps them in the group only. A contact already in the group changes only with an explicit `true`.
1774
+ */
1775
+ newsletterSubscribed?: boolean | null;
1243
1776
  /**
1244
1777
  * `unsubscribed` keeps a contact who left on your previous platform: stored unsubscribed, never emailed, and a contact already in the newsletter is unsubscribed too. Default `active`.
1245
1778
  */
@@ -1250,13 +1783,14 @@ interface ContactsImportParams {
1250
1783
  unsubscribedAt?: string | null;
1251
1784
  }[];
1252
1785
  }
1253
- type ContactsImportResponse = {
1254
- object: string;
1786
+ interface ContactsImportResponse {
1787
+ object: "import";
1255
1788
  total: number;
1256
1789
  inserted: number;
1257
1790
  rejected: number;
1258
1791
  reasons: {
1259
- invalid: number;
1792
+ invalid_syntax: number;
1793
+ source_unsubscribed: number;
1260
1794
  typo: number;
1261
1795
  spam_trap: number;
1262
1796
  role: number;
@@ -1269,11 +1803,18 @@ type ContactsImportResponse = {
1269
1803
  rejected_rows: {
1270
1804
  line: number;
1271
1805
  email: string;
1272
- reason: string;
1806
+ reason: "invalid_syntax" | "source_unsubscribed" | "typo" | "spam_trap" | "role" | "disposable" | "no_mx" | "duplicate" | "suppressed" | "capped";
1273
1807
  suggestion?: string;
1274
1808
  }[];
1809
+ report_truncated: boolean;
1810
+ engagement_imported: number;
1811
+ capped: boolean;
1812
+ remaining_capacity: number | null;
1275
1813
  pending_review: boolean;
1276
- };
1814
+ verifying: boolean;
1815
+ tagged: number;
1816
+ unsubscribed: number;
1817
+ }
1277
1818
  interface ContactsExportParams {
1278
1819
  segmentId?: string;
1279
1820
  status?: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
@@ -1282,49 +1823,109 @@ type ContactsExportResponse = string;
1282
1823
  interface ContactsGetParams {
1283
1824
  id: string;
1284
1825
  }
1285
- type ContactsGetResponse = {
1286
- object: string;
1826
+ interface ContactsGetResponse {
1827
+ object: "contact";
1287
1828
  id: string;
1288
1829
  email: string;
1289
- status: string;
1830
+ name: string | null;
1831
+ first_name: string | null;
1832
+ last_name: string | null;
1833
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1834
+ segment_id: string;
1835
+ language: string | null;
1836
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1837
+ subscribed_at: string | null;
1838
+ unsubscribed_at: string | null;
1839
+ created_at: string;
1840
+ custom_fields: {
1841
+ [k: string]: string | number | boolean;
1842
+ };
1843
+ tags: string[];
1844
+ newsletter_subscribed: boolean;
1290
1845
  engagement: {
1291
1846
  emails_sent: number;
1292
1847
  emails_opened: number;
1293
1848
  emails_clicked: number;
1849
+ last_opened_at: string | null;
1850
+ last_clicked_at: string | null;
1294
1851
  };
1295
1852
  status_history: {
1296
1853
  at: string;
1297
- from_status: string;
1298
- to_status: string;
1299
- source: string;
1854
+ from_status: ("active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant") | null;
1855
+ to_status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1856
+ 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
1857
  actor: string;
1301
- detail: unknown;
1858
+ detail: string | null;
1302
1859
  }[];
1303
- };
1860
+ }
1304
1861
  interface ContactsUnsubscribeParams {
1305
1862
  id: string;
1306
1863
  }
1307
- type ContactsUnsubscribeResponse = {
1308
- object: string;
1864
+ interface ContactsUnsubscribeResponse {
1865
+ object: "contact";
1309
1866
  id: string;
1310
- status: string;
1311
- };
1867
+ email: string;
1868
+ name: string | null;
1869
+ first_name: string | null;
1870
+ last_name: string | null;
1871
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1872
+ segment_id: string;
1873
+ language: string | null;
1874
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1875
+ subscribed_at: string | null;
1876
+ unsubscribed_at: string | null;
1877
+ created_at: string;
1878
+ custom_fields: {
1879
+ [k: string]: string | number | boolean;
1880
+ };
1881
+ tags: string[];
1882
+ newsletter_subscribed: boolean;
1883
+ engagement: {
1884
+ emails_sent: number;
1885
+ emails_opened: number;
1886
+ emails_clicked: number;
1887
+ last_opened_at: string | null;
1888
+ last_clicked_at: string | null;
1889
+ };
1890
+ }
1312
1891
  interface ContactsReactivateParams {
1313
1892
  id: string;
1314
1893
  }
1315
- type ContactsReactivateResponse = {
1316
- object: string;
1894
+ interface ContactsReactivateResponse {
1895
+ object: "contact";
1317
1896
  id: string;
1318
- status: string;
1319
- };
1897
+ email: string;
1898
+ name: string | null;
1899
+ first_name: string | null;
1900
+ last_name: string | null;
1901
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1902
+ segment_id: string;
1903
+ language: string | null;
1904
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1905
+ subscribed_at: string | null;
1906
+ unsubscribed_at: string | null;
1907
+ created_at: string;
1908
+ custom_fields: {
1909
+ [k: string]: string | number | boolean;
1910
+ };
1911
+ tags: string[];
1912
+ newsletter_subscribed: boolean;
1913
+ engagement: {
1914
+ emails_sent: number;
1915
+ emails_opened: number;
1916
+ emails_clicked: number;
1917
+ last_opened_at: string | null;
1918
+ last_clicked_at: string | null;
1919
+ };
1920
+ }
1320
1921
  interface ContactsRemoveParams {
1321
1922
  id: string;
1322
1923
  }
1323
- type ContactsRemoveResponse = {
1324
- object: string;
1924
+ interface ContactsRemoveResponse {
1925
+ object: "contact";
1325
1926
  id: string;
1326
- deleted: boolean;
1327
- };
1927
+ deleted: true;
1928
+ }
1328
1929
  type ContactsUpdateParams = {
1329
1930
  id: string;
1330
1931
  } & {
@@ -1350,32 +1951,55 @@ type ContactsUpdateParams = {
1350
1951
  * Removed from the current tags.
1351
1952
  */
1352
1953
  removeTags?: string[];
1954
+ /**
1955
+ * `true` subscribes the contact to the newsletter issues, `false` keeps them in the group only (broadcasts still reach them).
1956
+ */
1957
+ newsletterSubscribed?: boolean;
1353
1958
  };
1354
- type ContactsUpdateResponse = {
1355
- object: string;
1959
+ interface ContactsUpdateResponse {
1960
+ object: "contact";
1356
1961
  id: string;
1357
- first_name: string;
1962
+ email: string;
1963
+ name: string | null;
1964
+ first_name: string | null;
1965
+ last_name: string | null;
1966
+ status: "active" | "pending" | "unsubscribed" | "bounced" | "complained" | "dormant";
1967
+ segment_id: string;
1968
+ language: string | null;
1969
+ source: "unknown" | "lead_magnet" | "import" | "api" | "signup_form" | "admin" | "shopify" | "woocommerce";
1970
+ subscribed_at: string | null;
1971
+ unsubscribed_at: string | null;
1972
+ created_at: string;
1358
1973
  custom_fields: {
1359
- plan: string;
1974
+ [k: string]: string | number | boolean;
1360
1975
  };
1361
- };
1976
+ tags: string[];
1977
+ newsletter_subscribed: boolean;
1978
+ engagement: {
1979
+ emails_sent: number;
1980
+ emails_opened: number;
1981
+ emails_clicked: number;
1982
+ last_opened_at: string | null;
1983
+ last_clicked_at: string | null;
1984
+ };
1985
+ }
1362
1986
  type ContactFieldsListParams = Record<string, never>;
1363
- type ContactFieldsListResponse = {
1364
- object: string;
1987
+ interface ContactFieldsListResponse {
1988
+ object: "list";
1365
1989
  has_more: boolean;
1366
1990
  data: {
1367
- object: string;
1991
+ object: "contact_field";
1368
1992
  id: string;
1369
1993
  key: string;
1370
1994
  label: string;
1371
- type: string;
1372
- options: string[];
1373
- default_value: unknown;
1995
+ type: "text" | "number" | "date" | "boolean" | "choice";
1996
+ options: string[] | null;
1997
+ default_value: string | number | boolean | null;
1374
1998
  in_signup: boolean;
1375
1999
  position: number;
1376
2000
  created_at: string;
1377
2001
  }[];
1378
- };
2002
+ }
1379
2003
  interface ContactFieldsCreateParams {
1380
2004
  /**
1381
2005
  * Lowercase letters, digits, `_`. Used as `{{custom.<key>}}`. Immutable.
@@ -1399,18 +2023,18 @@ interface ContactFieldsCreateParams {
1399
2023
  */
1400
2024
  inSignup?: boolean;
1401
2025
  }
1402
- type ContactFieldsCreateResponse = {
1403
- object: string;
2026
+ interface ContactFieldsCreateResponse {
2027
+ object: "contact_field";
1404
2028
  id: string;
1405
2029
  key: string;
1406
2030
  label: string;
1407
- type: string;
1408
- options: string[];
1409
- default_value: unknown;
2031
+ type: "text" | "number" | "date" | "boolean" | "choice";
2032
+ options: string[] | null;
2033
+ default_value: string | number | boolean | null;
1410
2034
  in_signup: boolean;
1411
2035
  position: number;
1412
2036
  created_at: string;
1413
- };
2037
+ }
1414
2038
  type ContactFieldsUpdateParams = {
1415
2039
  id: string;
1416
2040
  } & {
@@ -1420,26 +2044,26 @@ type ContactFieldsUpdateParams = {
1420
2044
  inSignup?: boolean;
1421
2045
  position?: number;
1422
2046
  };
1423
- type ContactFieldsUpdateResponse = {
1424
- object: string;
2047
+ interface ContactFieldsUpdateResponse {
2048
+ object: "contact_field";
1425
2049
  id: string;
1426
2050
  key: string;
1427
2051
  label: string;
1428
- type: string;
1429
- options: string[];
1430
- default_value: unknown;
2052
+ type: "text" | "number" | "date" | "boolean" | "choice";
2053
+ options: string[] | null;
2054
+ default_value: string | number | boolean | null;
1431
2055
  in_signup: boolean;
1432
2056
  position: number;
1433
2057
  created_at: string;
1434
- };
2058
+ }
1435
2059
  interface ContactFieldsRemoveParams {
1436
2060
  id: string;
1437
2061
  }
1438
- type ContactFieldsRemoveResponse = {
1439
- object: string;
2062
+ interface ContactFieldsRemoveResponse {
2063
+ object: "contact_field";
1440
2064
  id: string;
1441
- deleted: boolean;
1442
- };
2065
+ deleted: true;
2066
+ }
1443
2067
  interface EventsSendParams {
1444
2068
  /**
1445
2069
  * Give `email` or `contact_id`.
@@ -1469,18 +2093,17 @@ interface EventsSendParams {
1469
2093
  */
1470
2094
  segmentId?: string;
1471
2095
  }
1472
- type EventsSendResponse = {
1473
- object: string;
2096
+ interface EventsSendResponse {
2097
+ object: "event";
1474
2098
  id: string;
1475
2099
  email: string;
1476
2100
  event: string;
1477
2101
  properties: {
1478
- plan: string;
1479
- amount: number;
2102
+ [k: string]: unknown;
1480
2103
  };
1481
2104
  occurred_at: string;
1482
2105
  contact_created: boolean;
1483
- };
2106
+ }
1484
2107
  interface AudienceFiltersListParams {
1485
2108
  /**
1486
2109
  * 1–100, default 20.
@@ -1495,28 +2118,21 @@ interface AudienceFiltersListParams {
1495
2118
  */
1496
2119
  before?: string;
1497
2120
  }
1498
- type AudienceFiltersListResponse = {
1499
- object: string;
2121
+ interface AudienceFiltersListResponse {
2122
+ object: "list";
1500
2123
  has_more: boolean;
1501
2124
  data: {
1502
- object: string;
2125
+ object: "audience_filter";
1503
2126
  id: string;
1504
2127
  name: string;
1505
- description: unknown;
2128
+ description: string | null;
1506
2129
  rules: {
1507
- op: string;
1508
- rules: {
1509
- field?: string;
1510
- op: string;
1511
- value?: string;
1512
- event?: string;
1513
- within_days?: number;
1514
- }[];
2130
+ [k: string]: unknown;
1515
2131
  };
1516
2132
  created_at: string;
1517
2133
  updated_at: string;
1518
2134
  }[];
1519
- };
2135
+ }
1520
2136
  interface AudienceFiltersCreateParams {
1521
2137
  name: string;
1522
2138
  description?: string | null;
@@ -1527,45 +2143,31 @@ interface AudienceFiltersCreateParams {
1527
2143
  [k: string]: unknown;
1528
2144
  };
1529
2145
  }
1530
- type AudienceFiltersCreateResponse = {
1531
- object: string;
2146
+ interface AudienceFiltersCreateResponse {
2147
+ object: "audience_filter";
1532
2148
  id: string;
1533
2149
  name: string;
1534
- description: unknown;
2150
+ description: string | null;
1535
2151
  rules: {
1536
- op: string;
1537
- rules: {
1538
- field?: string;
1539
- op: string;
1540
- value?: string;
1541
- event?: string;
1542
- within_days?: number;
1543
- }[];
2152
+ [k: string]: unknown;
1544
2153
  };
1545
2154
  created_at: string;
1546
2155
  updated_at: string;
1547
- };
2156
+ }
1548
2157
  interface AudienceFiltersGetParams {
1549
2158
  id: string;
1550
2159
  }
1551
- type AudienceFiltersGetResponse = {
1552
- object: string;
2160
+ interface AudienceFiltersGetResponse {
2161
+ object: "audience_filter";
1553
2162
  id: string;
1554
2163
  name: string;
1555
- description: unknown;
2164
+ description: string | null;
1556
2165
  rules: {
1557
- op: string;
1558
- rules: {
1559
- field?: string;
1560
- op: string;
1561
- value?: string;
1562
- event?: string;
1563
- within_days?: number;
1564
- }[];
2166
+ [k: string]: unknown;
1565
2167
  };
1566
2168
  created_at: string;
1567
2169
  updated_at: string;
1568
- };
2170
+ }
1569
2171
  type AudienceFiltersUpdateParams = {
1570
2172
  id: string;
1571
2173
  } & {
@@ -1578,32 +2180,25 @@ type AudienceFiltersUpdateParams = {
1578
2180
  [k: string]: unknown;
1579
2181
  };
1580
2182
  };
1581
- type AudienceFiltersUpdateResponse = {
1582
- object: string;
2183
+ interface AudienceFiltersUpdateResponse {
2184
+ object: "audience_filter";
1583
2185
  id: string;
1584
2186
  name: string;
1585
- description: unknown;
2187
+ description: string | null;
1586
2188
  rules: {
1587
- op: string;
1588
- rules: {
1589
- field?: string;
1590
- op: string;
1591
- value?: string;
1592
- event?: string;
1593
- within_days?: number;
1594
- }[];
2189
+ [k: string]: unknown;
1595
2190
  };
1596
2191
  created_at: string;
1597
2192
  updated_at: string;
1598
- };
2193
+ }
1599
2194
  interface AudienceFiltersRemoveParams {
1600
2195
  id: string;
1601
2196
  }
1602
- type AudienceFiltersRemoveResponse = {
1603
- object: string;
2197
+ interface AudienceFiltersRemoveResponse {
2198
+ object: "audience_filter";
1604
2199
  id: string;
1605
- deleted: boolean;
1606
- };
2200
+ deleted: true;
2201
+ }
1607
2202
  interface AudienceFiltersCountParams {
1608
2203
  /**
1609
2204
  * A saved filter. Give `filter_id` or `rules`.
@@ -1620,11 +2215,11 @@ interface AudienceFiltersCountParams {
1620
2215
  */
1621
2216
  segmentId?: string;
1622
2217
  }
1623
- type AudienceFiltersCountResponse = {
1624
- object: string;
2218
+ interface AudienceFiltersCountResponse {
2219
+ object: "audience_filter_count";
1625
2220
  total: number;
1626
2221
  active: number;
1627
- };
2222
+ }
1628
2223
  interface SignupsCreateParams {
1629
2224
  email: string;
1630
2225
  name?: string;
@@ -1645,10 +2240,10 @@ interface SignupsCreateParams {
1645
2240
  [k: string]: string | number | boolean | null;
1646
2241
  };
1647
2242
  }
1648
- type SignupsCreateResponse = {
1649
- object: string;
1650
- status: string;
1651
- };
2243
+ interface SignupsCreateResponse {
2244
+ object: "signup";
2245
+ status: "pending";
2246
+ }
1652
2247
  interface SegmentsListParams {
1653
2248
  /**
1654
2249
  * 1–100, default 20.
@@ -1663,16 +2258,19 @@ interface SegmentsListParams {
1663
2258
  */
1664
2259
  before?: string;
1665
2260
  }
1666
- type SegmentsListResponse = {
1667
- object: string;
2261
+ interface SegmentsListResponse {
2262
+ object: "list";
1668
2263
  has_more: boolean;
1669
2264
  data: {
1670
- object: string;
2265
+ object: "segment";
1671
2266
  id: string;
1672
2267
  name: string;
1673
2268
  slug: string;
2269
+ language: string;
2270
+ status: "active" | "archived";
2271
+ created_at: string;
1674
2272
  }[];
1675
- };
2273
+ }
1676
2274
  interface SegmentsCreateParams {
1677
2275
  name: string;
1678
2276
  slug: string;
@@ -1680,43 +2278,55 @@ interface SegmentsCreateParams {
1680
2278
  description?: string;
1681
2279
  themes?: string[];
1682
2280
  }
1683
- type SegmentsCreateResponse = {
1684
- object: string;
2281
+ interface SegmentsCreateResponse {
2282
+ object: "segment";
1685
2283
  id: string;
1686
2284
  name: string;
1687
2285
  slug: string;
1688
- };
2286
+ language: string;
2287
+ status: "active" | "archived";
2288
+ created_at: string;
2289
+ }
1689
2290
  interface TopicsListParams {
1690
2291
  segmentId: string;
1691
2292
  }
1692
- type TopicsListResponse = {
1693
- object: string;
2293
+ interface TopicsListResponse {
2294
+ object: "list";
1694
2295
  has_more: boolean;
1695
2296
  data: {
1696
- object: string;
2297
+ object: "topic";
1697
2298
  id: string;
1698
2299
  segment_id: string;
1699
2300
  name: string;
2301
+ slug: string;
2302
+ status: "active" | "archived";
2303
+ created_at: string;
1700
2304
  }[];
1701
- };
2305
+ }
1702
2306
  interface SegmentsArchiveGetParams {
1703
2307
  id: string;
1704
2308
  }
1705
- type SegmentsArchiveGetResponse = {
1706
- object: string;
2309
+ interface SegmentsArchiveGetResponse {
2310
+ object: "archive";
1707
2311
  segment_id: string;
1708
2312
  enabled: boolean;
1709
2313
  slug: string;
1710
2314
  url: string;
1711
- custom_domain: string;
1712
- description: string;
1713
- author: string;
1714
- about: unknown;
1715
- avatar_url: unknown;
2315
+ custom_domain: string | null;
2316
+ description: string | null;
2317
+ author: string | null;
2318
+ about: string | null;
2319
+ avatar_url: string | null;
1716
2320
  links: {
1717
- x: string;
2321
+ website?: string;
2322
+ x?: string;
2323
+ linkedin?: string;
2324
+ youtube?: string;
2325
+ instagram?: string;
2326
+ github?: string;
2327
+ bluesky?: string;
1718
2328
  };
1719
- };
2329
+ }
1720
2330
  type SegmentsArchiveUpdateParams = {
1721
2331
  id: string;
1722
2332
  } & {
@@ -1754,21 +2364,27 @@ type SegmentsArchiveUpdateParams = {
1754
2364
  bluesky?: string | null;
1755
2365
  };
1756
2366
  };
1757
- type SegmentsArchiveUpdateResponse = {
1758
- object: string;
2367
+ interface SegmentsArchiveUpdateResponse {
2368
+ object: "archive";
1759
2369
  segment_id: string;
1760
2370
  enabled: boolean;
1761
2371
  slug: string;
1762
2372
  url: string;
1763
- custom_domain: string;
1764
- description: string;
1765
- author: string;
1766
- about: unknown;
1767
- avatar_url: unknown;
2373
+ custom_domain: string | null;
2374
+ description: string | null;
2375
+ author: string | null;
2376
+ about: string | null;
2377
+ avatar_url: string | null;
1768
2378
  links: {
1769
- x: string;
2379
+ website?: string;
2380
+ x?: string;
2381
+ linkedin?: string;
2382
+ youtube?: string;
2383
+ instagram?: string;
2384
+ github?: string;
2385
+ bluesky?: string;
1770
2386
  };
1771
- };
2387
+ }
1772
2388
  type NewslettersArchiveUpdateParams = {
1773
2389
  id: string;
1774
2390
  } & {
@@ -1781,65 +2397,66 @@ type NewslettersArchiveUpdateParams = {
1781
2397
  */
1782
2398
  hidden?: boolean;
1783
2399
  };
1784
- type NewslettersArchiveUpdateResponse = {
1785
- object: string;
2400
+ interface NewslettersArchiveUpdateResponse {
2401
+ object: "newsletter_archive";
1786
2402
  id: string;
1787
2403
  pinned: boolean;
1788
2404
  hidden: boolean;
1789
- };
2405
+ }
1790
2406
  interface SegmentsDomainGetParams {
1791
2407
  id: string;
1792
2408
  }
1793
- type SegmentsDomainGetResponse = {
1794
- object: string;
2409
+ interface SegmentsDomainGetResponse {
2410
+ object: "custom_domain";
1795
2411
  id: string;
1796
2412
  segment_id: string;
1797
2413
  domain: string;
1798
- status: string;
1799
- uses: string[];
2414
+ status: "pending" | "verified" | "failed";
2415
+ uses: ("tracking" | "preferences" | "archive")[];
1800
2416
  records: {
1801
2417
  type: string;
1802
2418
  name: string;
1803
2419
  value: string;
1804
2420
  }[];
1805
- last_checked_at: unknown;
1806
- verified_at: unknown;
1807
- last_error: unknown;
2421
+ last_checked_at: string | null;
2422
+ verified_at: string | null;
2423
+ last_error: string | null;
1808
2424
  created_at: string;
1809
- };
2425
+ }
1810
2426
  type SegmentsDomainSetParams = {
1811
2427
  id: string;
1812
2428
  } & {
1813
2429
  /**
1814
- * Subdomain you own, e.g. `news.acme.com` (a CNAME to Vercel).
2430
+ * Subdomain you own, e.g. `news.acme.com` (a CNAME to `customers.smartletter.ai`).
1815
2431
  */
1816
2432
  domain: string;
1817
2433
  };
1818
- type SegmentsDomainSetResponse = {
1819
- object: string;
2434
+ interface SegmentsDomainSetResponse {
2435
+ object: "custom_domain";
1820
2436
  id: string;
1821
2437
  segment_id: string;
1822
2438
  domain: string;
1823
- status: string;
1824
- uses: string[];
2439
+ status: "pending" | "verified" | "failed";
2440
+ uses: ("tracking" | "preferences" | "archive")[];
1825
2441
  records: {
1826
2442
  type: string;
1827
2443
  name: string;
1828
2444
  value: string;
1829
2445
  }[];
1830
- last_checked_at: unknown;
1831
- verified_at: unknown;
1832
- last_error: unknown;
2446
+ last_checked_at: string | null;
2447
+ verified_at: string | null;
2448
+ last_error: string | null;
1833
2449
  created_at: string;
1834
- };
2450
+ }
1835
2451
  interface SegmentsDomainRemoveParams {
1836
2452
  id: string;
1837
2453
  }
1838
- type SegmentsDomainRemoveResponse = {
1839
- object: string;
2454
+ interface SegmentsDomainRemoveResponse {
2455
+ object: "custom_domain";
2456
+ id: string;
1840
2457
  segment_id: string;
1841
- deleted: boolean;
1842
- };
2458
+ deleted: true;
2459
+ }
1843
2460
  interface SuppressionsListParams {
1844
2461
  /**
1845
2462
  * 1–100, default 20.
@@ -1855,36 +2472,41 @@ interface SuppressionsListParams {
1855
2472
  before?: string;
1856
2473
  reason?: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr" | "ses_suppressed" | "soft_bounce_repeated";
1857
2474
  }
1858
- type SuppressionsListResponse = {
1859
- object: string;
2475
+ interface SuppressionsListResponse {
2476
+ object: "list";
1860
2477
  has_more: boolean;
1861
2478
  data: {
1862
- object: string;
2479
+ object: "suppression";
1863
2480
  id: string;
1864
2481
  email: string;
1865
- reason: string;
1866
- expires_at: string;
2482
+ reason: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr" | "ses_suppressed" | "soft_bounce_repeated";
2483
+ notes: string | null;
2484
+ created_at: string;
2485
+ expires_at: string | null;
1867
2486
  }[];
1868
- };
2487
+ }
1869
2488
  interface SuppressionsCreateParams {
1870
2489
  email: string;
1871
2490
  reason?: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr";
1872
2491
  notes?: string;
1873
2492
  }
1874
- type SuppressionsCreateResponse = {
1875
- object: string;
2493
+ interface SuppressionsCreateResponse {
2494
+ object: "suppression";
1876
2495
  id: string;
1877
2496
  email: string;
1878
- reason: string;
1879
- };
2497
+ reason: "bounced" | "complained" | "user_unsub" | "admin" | "gdpr" | "ses_suppressed" | "soft_bounce_repeated";
2498
+ notes: string | null;
2499
+ created_at: string;
2500
+ expires_at: string | null;
2501
+ }
1880
2502
  interface SuppressionsRemoveParams {
1881
2503
  id: string;
1882
2504
  }
1883
- type SuppressionsRemoveResponse = {
1884
- object: string;
2505
+ interface SuppressionsRemoveResponse {
2506
+ object: "suppression";
1885
2507
  id: string;
1886
- deleted: boolean;
1887
- };
2508
+ deleted: true;
2509
+ }
1888
2510
  interface ImagesListParams {
1889
2511
  /**
1890
2512
  * 1–100, default 20.
@@ -1899,26 +2521,36 @@ interface ImagesListParams {
1899
2521
  */
1900
2522
  before?: string;
1901
2523
  }
1902
- type ImagesListResponse = {
1903
- object: string;
2524
+ interface ImagesListResponse {
2525
+ object: "list";
1904
2526
  has_more: boolean;
1905
2527
  data: {
1906
- object: string;
2528
+ object: "image";
1907
2529
  id: string;
1908
2530
  url: string;
2531
+ content_type: string | null;
2532
+ size_bytes: number | null;
2533
+ width: number | null;
2534
+ height: number | null;
2535
+ kind: "upload" | "generated_image";
2536
+ created_at: string;
1909
2537
  }[];
1910
- };
2538
+ }
1911
2539
  type ImagesCreateParams = Blob | ArrayBuffer | Uint8Array | string;
1912
- type ImagesCreateResponse = {
1913
- object: string;
2540
+ interface ImagesCreateResponse {
2541
+ object: "image";
1914
2542
  id: string;
1915
2543
  url: string;
1916
- content_type: string;
1917
- size_bytes: number;
1918
- };
2544
+ content_type: string | null;
2545
+ size_bytes: number | null;
2546
+ width: number | null;
2547
+ height: number | null;
2548
+ kind: "upload" | "generated_image";
2549
+ created_at: string;
2550
+ }
1919
2551
  type StatsOverviewParams = Record<string, never>;
1920
- type StatsOverviewResponse = {
1921
- object: string;
2552
+ interface StatsOverviewResponse {
2553
+ object: "overview";
1922
2554
  subscribers: {
1923
2555
  active: number;
1924
2556
  new_last_30_days: number;
@@ -1935,29 +2567,30 @@ type StatsOverviewResponse = {
1935
2567
  sent_last_30_days: number;
1936
2568
  newsletters_sent_last_30_days: number;
1937
2569
  };
1938
- };
2570
+ }
1939
2571
  interface DomainsCreateParams {
1940
2572
  name: string;
1941
2573
  trackingSubdomain?: string;
1942
2574
  }
1943
- type DomainsCreateResponse = {
1944
- object: string;
2575
+ interface DomainsCreateResponse {
2576
+ object: "domain";
1945
2577
  id: string;
1946
2578
  name: string;
1947
- status: string;
2579
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
2580
+ review_status?: "none" | "pending" | "held" | "approved" | "rejected";
1948
2581
  created_at: string;
1949
2582
  region: string;
1950
2583
  records: {
1951
- record: string;
2584
+ record: "SPF" | "DKIM" | "MX" | "TXT";
1952
2585
  name: string;
1953
- type: string;
1954
- ttl: string;
1955
- status: string;
2586
+ type: "CNAME" | "MX" | "TXT";
2587
+ ttl: "Auto";
2588
+ status: "verified" | "pending";
1956
2589
  value: string;
1957
2590
  priority?: number;
1958
2591
  }[];
1959
2592
  tracking_subdomain?: string;
1960
- };
2593
+ }
1961
2594
  interface DomainsListParams {
1962
2595
  /**
1963
2596
  * 1–100, default 20.
@@ -1972,44 +2605,46 @@ interface DomainsListParams {
1972
2605
  */
1973
2606
  before?: string;
1974
2607
  }
1975
- type DomainsListResponse = {
1976
- object: string;
2608
+ interface DomainsListResponse {
2609
+ object: "list";
1977
2610
  has_more: boolean;
1978
2611
  data: {
1979
2612
  id: string;
1980
2613
  name: string;
1981
- status: string;
2614
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
2615
+ review_status?: "none" | "pending" | "held" | "approved" | "rejected";
1982
2616
  created_at: string;
1983
2617
  region: string;
1984
2618
  }[];
1985
- };
2619
+ }
1986
2620
  interface DomainsGetParams {
1987
2621
  id: string;
1988
2622
  }
1989
- type DomainsGetResponse = {
1990
- object: string;
2623
+ interface DomainsGetResponse {
2624
+ object: "domain";
1991
2625
  id: string;
1992
2626
  name: string;
1993
- status: string;
2627
+ status: "not_started" | "pending" | "verified" | "temporary_failure" | "failed";
2628
+ review_status?: "none" | "pending" | "held" | "approved" | "rejected";
1994
2629
  created_at: string;
1995
2630
  region: string;
1996
2631
  records: {
1997
- record: string;
2632
+ record: "SPF" | "DKIM" | "MX" | "TXT";
1998
2633
  name: string;
1999
- type: string;
2000
- ttl: string;
2001
- status: string;
2634
+ type: "CNAME" | "MX" | "TXT";
2635
+ ttl: "Auto";
2636
+ status: "verified" | "pending";
2002
2637
  value: string;
2003
2638
  priority?: number;
2004
2639
  }[];
2005
- };
2640
+ }
2006
2641
  interface DomainsVerifyParams {
2007
2642
  id: string;
2008
2643
  }
2009
- type DomainsVerifyResponse = {
2010
- object: string;
2644
+ interface DomainsVerifyResponse {
2645
+ object: "domain";
2011
2646
  id: string;
2012
- };
2647
+ }
2013
2648
  interface ApiKeysCreateParams {
2014
2649
  name: string;
2015
2650
  permission?: "full_access" | "sending_access" | "signups";
@@ -2018,10 +2653,10 @@ interface ApiKeysCreateParams {
2018
2653
  */
2019
2654
  domainId?: string;
2020
2655
  }
2021
- type ApiKeysCreateResponse = {
2656
+ interface ApiKeysCreateResponse {
2022
2657
  id: string;
2023
2658
  token: string;
2024
- };
2659
+ }
2025
2660
  interface ApiKeysListParams {
2026
2661
  /**
2027
2662
  * 1–100, default 20.
@@ -2036,8 +2671,8 @@ interface ApiKeysListParams {
2036
2671
  */
2037
2672
  before?: string;
2038
2673
  }
2039
- type ApiKeysListResponse = {
2040
- object: string;
2674
+ interface ApiKeysListResponse {
2675
+ object: "list";
2041
2676
  has_more: boolean;
2042
2677
  data: {
2043
2678
  id: string;
@@ -2045,24 +2680,24 @@ type ApiKeysListResponse = {
2045
2680
  created_at: string;
2046
2681
  last_used_at: string | null;
2047
2682
  }[];
2048
- };
2683
+ }
2049
2684
  type ApiKeysUpdateParams = {
2050
2685
  id: string;
2051
2686
  } & {
2052
2687
  name: string;
2053
2688
  };
2054
- type ApiKeysUpdateResponse = {
2055
- object: string;
2689
+ interface ApiKeysUpdateResponse {
2690
+ object: "api_key";
2056
2691
  id: string;
2057
- };
2692
+ }
2058
2693
  interface ApiKeysRemoveParams {
2059
2694
  id: string;
2060
2695
  }
2061
- type ApiKeysRemoveResponse = {
2062
- object: string;
2696
+ interface ApiKeysRemoveResponse {
2697
+ object: "api_key";
2063
2698
  id: string;
2064
- deleted: boolean;
2065
- };
2699
+ deleted: true;
2700
+ }
2066
2701
  interface LogsListParams {
2067
2702
  /**
2068
2703
  * 1–100, default 20.
@@ -2077,93 +2712,224 @@ interface LogsListParams {
2077
2712
  */
2078
2713
  before?: string;
2079
2714
  }
2080
- type LogsListResponse = {
2081
- object: string;
2715
+ interface LogsListResponse {
2716
+ object: "list";
2082
2717
  has_more: boolean;
2083
2718
  data: {
2084
2719
  id: string;
2720
+ created_at: string;
2085
2721
  endpoint: string;
2086
2722
  method: string;
2087
2723
  response_status: number;
2088
- source: string;
2724
+ user_agent: string | null;
2725
+ source: "api" | "smtp";
2089
2726
  }[];
2090
- };
2727
+ }
2091
2728
  interface LogsGetParams {
2092
2729
  id: string;
2093
2730
  }
2094
- type LogsGetResponse = {
2095
- object: string;
2731
+ interface LogsGetResponse {
2732
+ object: "log";
2096
2733
  id: string;
2734
+ created_at: string;
2097
2735
  endpoint: string;
2098
- request_body: Record<string, unknown>;
2099
- response_body: Record<string, unknown>;
2100
- };
2736
+ method: string;
2737
+ response_status: number;
2738
+ user_agent: string | null;
2739
+ source: "api" | "smtp";
2740
+ request_body: unknown;
2741
+ response_body: unknown;
2742
+ email?: {
2743
+ id: string;
2744
+ last_event: string;
2745
+ created_via: "api" | "mcp" | "smtp" | "inbox";
2746
+ smtp?: {
2747
+ client_ip: string | null;
2748
+ message_id: string | null;
2749
+ };
2750
+ recipients: {
2751
+ email: string;
2752
+ type: "to" | "cc" | "bcc";
2753
+ status: "queued" | "sent" | "delivered" | "delivery_delayed" | "bounced" | "complained" | "failed" | "suppressed" | "canceled";
2754
+ reason: string | null;
2755
+ bounce_type: string | null;
2756
+ smtp_status: string | null;
2757
+ diagnostic_code: string | null;
2758
+ delay_type: string | null;
2759
+ delay_expires_at: string | null;
2760
+ last_event_at: string | null;
2761
+ }[];
2762
+ };
2763
+ }
2101
2764
  type UsageGetParams = Record<string, never>;
2102
- type UsageGetResponse = {
2103
- object: string;
2765
+ interface UsageGetResponse {
2766
+ object: "usage";
2104
2767
  emails: {
2768
+ daily: {
2769
+ used: number;
2770
+ limit: number | null;
2771
+ sent: number;
2772
+ received: number;
2773
+ resets_at: string;
2774
+ };
2105
2775
  monthly: {
2106
2776
  used: number;
2107
- limit: number;
2777
+ limit: number | null;
2778
+ overage_ceiling: number | null;
2779
+ sent: number;
2780
+ received: number;
2781
+ resets_at: string;
2108
2782
  };
2109
2783
  };
2110
2784
  contacts: {
2111
2785
  used: number;
2112
- limit: unknown;
2786
+ limit: number | null;
2113
2787
  };
2114
- };
2788
+ publications: {
2789
+ used: number;
2790
+ limit: number | null;
2791
+ };
2792
+ domains: {
2793
+ used: number;
2794
+ limit: number | null;
2795
+ };
2796
+ rate_limit: {
2797
+ limit: number;
2798
+ duration: "1000ms";
2799
+ };
2800
+ }
2115
2801
  interface SequencesListParams {
2116
2802
  /**
2117
2803
  * Archived sequences are hidden unless `true`.
2118
2804
  */
2119
2805
  includeArchived?: "true" | "false";
2120
2806
  }
2121
- type SequencesListResponse = {
2122
- object: string;
2807
+ interface SequencesListResponse {
2808
+ object: "list";
2123
2809
  has_more: boolean;
2124
2810
  data: {
2125
- object: string;
2811
+ object: "sequence";
2126
2812
  id: string;
2127
2813
  name: string;
2128
- description: unknown;
2129
- status: string;
2814
+ description: string | null;
2815
+ status: "draft" | "active" | "paused" | "archived";
2130
2816
  segment_id: string;
2131
- topic_id: unknown;
2817
+ topic_id: string | null;
2132
2818
  trigger: {
2133
- type: string;
2134
- lead_magnet_id: unknown;
2819
+ type: "subscribed";
2820
+ include_imports: boolean;
2821
+ } | {
2822
+ type: "topic_subscribed";
2823
+ topic_id: string;
2824
+ } | {
2825
+ type: "lead_magnet";
2826
+ lead_magnet_id: string | null;
2827
+ } | {
2828
+ type: "event";
2829
+ event: string;
2830
+ } | {
2831
+ type: "email_opened" | "email_clicked";
2832
+ newsletter_id: string | null;
2833
+ } | {
2834
+ type: "filter";
2835
+ filter_id: string;
2836
+ include_existing: boolean;
2837
+ } | {
2838
+ type: "manual";
2135
2839
  };
2136
2840
  reentry: {
2137
- mode: string;
2138
- days: unknown;
2841
+ mode: "once" | "always" | "after_days";
2842
+ days: number | null;
2139
2843
  };
2140
2844
  exit: {
2141
2845
  events: string[];
2142
- filter_id: unknown;
2846
+ filter_id: string | null;
2143
2847
  };
2144
- steps: {
2848
+ steps: ({
2145
2849
  id: string;
2146
- type: string;
2147
- subject?: string;
2148
- preheader?: unknown;
2149
- doc?: {
2150
- type: string;
2151
- content: unknown[];
2850
+ type: "email";
2851
+ subject: string;
2852
+ preheader: string | null;
2853
+ doc: {
2854
+ [k: string]: unknown;
2152
2855
  };
2153
- amount?: number;
2154
- unit?: string;
2155
- }[];
2856
+ } | {
2857
+ id: string;
2858
+ type: "email";
2859
+ subject: string;
2860
+ preheader: string | null;
2861
+ template_id: string;
2862
+ } | {
2863
+ id: string;
2864
+ type: "delay";
2865
+ amount: number;
2866
+ unit: "minutes" | "hours" | "days";
2867
+ } | {
2868
+ id: string;
2869
+ type: "delay";
2870
+ until: {
2871
+ time: string;
2872
+ weekdays?: number[];
2873
+ timezone: "contact" | "newsletter";
2874
+ };
2875
+ } | {
2876
+ id: string;
2877
+ type: "wait_event";
2878
+ event: string;
2879
+ timeout_hours: number;
2880
+ on_timeout: "continue" | "exit";
2881
+ } | {
2882
+ id: string;
2883
+ type: "condition";
2884
+ filter_id: string;
2885
+ yes: {
2886
+ [k: string]: unknown;
2887
+ }[];
2888
+ no: {
2889
+ [k: string]: unknown;
2890
+ }[];
2891
+ } | {
2892
+ id: string;
2893
+ type: "condition";
2894
+ rule: {
2895
+ [k: string]: unknown;
2896
+ };
2897
+ yes: {
2898
+ [k: string]: unknown;
2899
+ }[];
2900
+ no: {
2901
+ [k: string]: unknown;
2902
+ }[];
2903
+ } | {
2904
+ id: string;
2905
+ type: "update_contact";
2906
+ action: "set_field";
2907
+ key: string;
2908
+ value: string | number | boolean | null;
2909
+ } | {
2910
+ id: string;
2911
+ type: "update_contact";
2912
+ action: "subscribe_topic" | "unsubscribe_topic";
2913
+ topic_id: string;
2914
+ } | {
2915
+ id: string;
2916
+ type: "webhook";
2917
+ webhook_id: string;
2918
+ } | {
2919
+ id: string;
2920
+ type: "exit";
2921
+ })[];
2156
2922
  published_version: {
2157
2923
  id: string;
2158
- number: number;
2159
- };
2924
+ number: number | null;
2925
+ } | null;
2160
2926
  has_unpublished_changes: boolean;
2161
- activated_at: string;
2162
- archived_at: unknown;
2927
+ activated_at: string | null;
2928
+ archived_at: string | null;
2163
2929
  created_at: string;
2164
2930
  updated_at: string;
2165
2931
  }[];
2166
- };
2932
+ }
2167
2933
  interface SequencesCreateParams {
2168
2934
  name: string;
2169
2935
  description?: string | null;
@@ -2323,7 +3089,7 @@ interface SequencesCreateParams {
2323
3089
  /**
2324
3090
  * update_contact set_field: `null` clears it.
2325
3091
  */
2326
- value?: (string | number | boolean) | null;
3092
+ value?: string | number | boolean | null;
2327
3093
  /**
2328
3094
  * update_contact (un)subscribe_topic.
2329
3095
  */
@@ -2335,90 +3101,253 @@ interface SequencesCreateParams {
2335
3101
  [k: string]: unknown;
2336
3102
  }[];
2337
3103
  }
2338
- type SequencesCreateResponse = {
2339
- object: string;
3104
+ interface SequencesCreateResponse {
3105
+ object: "sequence";
2340
3106
  id: string;
2341
3107
  name: string;
2342
- description: unknown;
2343
- status: string;
3108
+ description: string | null;
3109
+ status: "draft" | "active" | "paused" | "archived";
2344
3110
  segment_id: string;
2345
- topic_id: unknown;
3111
+ topic_id: string | null;
2346
3112
  trigger: {
2347
- type: string;
2348
- lead_magnet_id: unknown;
3113
+ type: "subscribed";
3114
+ include_imports: boolean;
3115
+ } | {
3116
+ type: "topic_subscribed";
3117
+ topic_id: string;
3118
+ } | {
3119
+ type: "lead_magnet";
3120
+ lead_magnet_id: string | null;
3121
+ } | {
3122
+ type: "event";
3123
+ event: string;
3124
+ } | {
3125
+ type: "email_opened" | "email_clicked";
3126
+ newsletter_id: string | null;
3127
+ } | {
3128
+ type: "filter";
3129
+ filter_id: string;
3130
+ include_existing: boolean;
3131
+ } | {
3132
+ type: "manual";
2349
3133
  };
2350
3134
  reentry: {
2351
- mode: string;
2352
- days: unknown;
3135
+ mode: "once" | "always" | "after_days";
3136
+ days: number | null;
2353
3137
  };
2354
3138
  exit: {
2355
3139
  events: string[];
2356
- filter_id: unknown;
3140
+ filter_id: string | null;
2357
3141
  };
2358
- steps: {
3142
+ steps: ({
2359
3143
  id: string;
2360
- type: string;
2361
- subject?: string;
2362
- preheader?: unknown;
2363
- doc?: {
2364
- type: string;
2365
- content: unknown[];
3144
+ type: "email";
3145
+ subject: string;
3146
+ preheader: string | null;
3147
+ doc: {
3148
+ [k: string]: unknown;
2366
3149
  };
2367
- amount?: number;
2368
- unit?: string;
2369
- }[];
2370
- published_version: unknown;
3150
+ } | {
3151
+ id: string;
3152
+ type: "email";
3153
+ subject: string;
3154
+ preheader: string | null;
3155
+ template_id: string;
3156
+ } | {
3157
+ id: string;
3158
+ type: "delay";
3159
+ amount: number;
3160
+ unit: "minutes" | "hours" | "days";
3161
+ } | {
3162
+ id: string;
3163
+ type: "delay";
3164
+ until: {
3165
+ time: string;
3166
+ weekdays?: number[];
3167
+ timezone: "contact" | "newsletter";
3168
+ };
3169
+ } | {
3170
+ id: string;
3171
+ type: "wait_event";
3172
+ event: string;
3173
+ timeout_hours: number;
3174
+ on_timeout: "continue" | "exit";
3175
+ } | {
3176
+ id: string;
3177
+ type: "condition";
3178
+ filter_id: string;
3179
+ yes: {
3180
+ [k: string]: unknown;
3181
+ }[];
3182
+ no: {
3183
+ [k: string]: unknown;
3184
+ }[];
3185
+ } | {
3186
+ id: string;
3187
+ type: "condition";
3188
+ rule: {
3189
+ [k: string]: unknown;
3190
+ };
3191
+ yes: {
3192
+ [k: string]: unknown;
3193
+ }[];
3194
+ no: {
3195
+ [k: string]: unknown;
3196
+ }[];
3197
+ } | {
3198
+ id: string;
3199
+ type: "update_contact";
3200
+ action: "set_field";
3201
+ key: string;
3202
+ value: string | number | boolean | null;
3203
+ } | {
3204
+ id: string;
3205
+ type: "update_contact";
3206
+ action: "subscribe_topic" | "unsubscribe_topic";
3207
+ topic_id: string;
3208
+ } | {
3209
+ id: string;
3210
+ type: "webhook";
3211
+ webhook_id: string;
3212
+ } | {
3213
+ id: string;
3214
+ type: "exit";
3215
+ })[];
3216
+ published_version: {
3217
+ id: string;
3218
+ number: number | null;
3219
+ } | null;
2371
3220
  has_unpublished_changes: boolean;
2372
- activated_at: string;
2373
- archived_at: unknown;
3221
+ activated_at: string | null;
3222
+ archived_at: string | null;
2374
3223
  created_at: string;
2375
3224
  updated_at: string;
2376
- };
3225
+ }
2377
3226
  interface SequencesGetParams {
2378
3227
  id: string;
2379
3228
  }
2380
- type SequencesGetResponse = {
2381
- object: string;
3229
+ interface SequencesGetResponse {
3230
+ object: "sequence";
2382
3231
  id: string;
2383
3232
  name: string;
2384
- description: unknown;
2385
- status: string;
3233
+ description: string | null;
3234
+ status: "draft" | "active" | "paused" | "archived";
2386
3235
  segment_id: string;
2387
- topic_id: unknown;
3236
+ topic_id: string | null;
2388
3237
  trigger: {
2389
- type: string;
2390
- lead_magnet_id: unknown;
3238
+ type: "subscribed";
3239
+ include_imports: boolean;
3240
+ } | {
3241
+ type: "topic_subscribed";
3242
+ topic_id: string;
3243
+ } | {
3244
+ type: "lead_magnet";
3245
+ lead_magnet_id: string | null;
3246
+ } | {
3247
+ type: "event";
3248
+ event: string;
3249
+ } | {
3250
+ type: "email_opened" | "email_clicked";
3251
+ newsletter_id: string | null;
3252
+ } | {
3253
+ type: "filter";
3254
+ filter_id: string;
3255
+ include_existing: boolean;
3256
+ } | {
3257
+ type: "manual";
2391
3258
  };
2392
3259
  reentry: {
2393
- mode: string;
2394
- days: unknown;
3260
+ mode: "once" | "always" | "after_days";
3261
+ days: number | null;
2395
3262
  };
2396
3263
  exit: {
2397
3264
  events: string[];
2398
- filter_id: unknown;
3265
+ filter_id: string | null;
2399
3266
  };
2400
- steps: {
3267
+ steps: ({
3268
+ id: string;
3269
+ type: "email";
3270
+ subject: string;
3271
+ preheader: string | null;
3272
+ doc: {
3273
+ [k: string]: unknown;
3274
+ };
3275
+ } | {
3276
+ id: string;
3277
+ type: "email";
3278
+ subject: string;
3279
+ preheader: string | null;
3280
+ template_id: string;
3281
+ } | {
3282
+ id: string;
3283
+ type: "delay";
3284
+ amount: number;
3285
+ unit: "minutes" | "hours" | "days";
3286
+ } | {
3287
+ id: string;
3288
+ type: "delay";
3289
+ until: {
3290
+ time: string;
3291
+ weekdays?: number[];
3292
+ timezone: "contact" | "newsletter";
3293
+ };
3294
+ } | {
3295
+ id: string;
3296
+ type: "wait_event";
3297
+ event: string;
3298
+ timeout_hours: number;
3299
+ on_timeout: "continue" | "exit";
3300
+ } | {
2401
3301
  id: string;
2402
- type: string;
2403
- subject?: string;
2404
- preheader?: unknown;
2405
- doc?: {
2406
- type: string;
2407
- content: unknown[];
3302
+ type: "condition";
3303
+ filter_id: string;
3304
+ yes: {
3305
+ [k: string]: unknown;
3306
+ }[];
3307
+ no: {
3308
+ [k: string]: unknown;
3309
+ }[];
3310
+ } | {
3311
+ id: string;
3312
+ type: "condition";
3313
+ rule: {
3314
+ [k: string]: unknown;
2408
3315
  };
2409
- amount?: number;
2410
- unit?: string;
2411
- }[];
3316
+ yes: {
3317
+ [k: string]: unknown;
3318
+ }[];
3319
+ no: {
3320
+ [k: string]: unknown;
3321
+ }[];
3322
+ } | {
3323
+ id: string;
3324
+ type: "update_contact";
3325
+ action: "set_field";
3326
+ key: string;
3327
+ value: string | number | boolean | null;
3328
+ } | {
3329
+ id: string;
3330
+ type: "update_contact";
3331
+ action: "subscribe_topic" | "unsubscribe_topic";
3332
+ topic_id: string;
3333
+ } | {
3334
+ id: string;
3335
+ type: "webhook";
3336
+ webhook_id: string;
3337
+ } | {
3338
+ id: string;
3339
+ type: "exit";
3340
+ })[];
2412
3341
  published_version: {
2413
3342
  id: string;
2414
- number: number;
2415
- };
3343
+ number: number | null;
3344
+ } | null;
2416
3345
  has_unpublished_changes: boolean;
2417
- activated_at: string;
2418
- archived_at: unknown;
3346
+ activated_at: string | null;
3347
+ archived_at: string | null;
2419
3348
  created_at: string;
2420
3349
  updated_at: string;
2421
- };
3350
+ }
2422
3351
  type SequencesUpdateParams = {
2423
3352
  id: string;
2424
3353
  } & {
@@ -2580,7 +3509,7 @@ type SequencesUpdateParams = {
2580
3509
  /**
2581
3510
  * update_contact set_field: `null` clears it.
2582
3511
  */
2583
- value?: (string | number | boolean) | null;
3512
+ value?: string | number | boolean | null;
2584
3513
  /**
2585
3514
  * update_contact (un)subscribe_topic.
2586
3515
  */
@@ -2592,219 +3521,552 @@ type SequencesUpdateParams = {
2592
3521
  [k: string]: unknown;
2593
3522
  }[];
2594
3523
  };
2595
- type SequencesUpdateResponse = {
2596
- object: string;
3524
+ interface SequencesUpdateResponse {
3525
+ object: "sequence";
2597
3526
  id: string;
2598
3527
  name: string;
2599
- description: unknown;
2600
- status: string;
3528
+ description: string | null;
3529
+ status: "draft" | "active" | "paused" | "archived";
2601
3530
  segment_id: string;
2602
- topic_id: unknown;
3531
+ topic_id: string | null;
2603
3532
  trigger: {
2604
- type: string;
2605
- lead_magnet_id: unknown;
3533
+ type: "subscribed";
3534
+ include_imports: boolean;
3535
+ } | {
3536
+ type: "topic_subscribed";
3537
+ topic_id: string;
3538
+ } | {
3539
+ type: "lead_magnet";
3540
+ lead_magnet_id: string | null;
3541
+ } | {
3542
+ type: "event";
3543
+ event: string;
3544
+ } | {
3545
+ type: "email_opened" | "email_clicked";
3546
+ newsletter_id: string | null;
3547
+ } | {
3548
+ type: "filter";
3549
+ filter_id: string;
3550
+ include_existing: boolean;
3551
+ } | {
3552
+ type: "manual";
2606
3553
  };
2607
3554
  reentry: {
2608
- mode: string;
2609
- days: unknown;
3555
+ mode: "once" | "always" | "after_days";
3556
+ days: number | null;
2610
3557
  };
2611
3558
  exit: {
2612
3559
  events: string[];
2613
- filter_id: unknown;
3560
+ filter_id: string | null;
2614
3561
  };
2615
- steps: {
3562
+ steps: ({
2616
3563
  id: string;
2617
- type: string;
2618
- subject?: string;
2619
- preheader?: unknown;
2620
- doc?: {
2621
- type: string;
2622
- content: unknown[];
3564
+ type: "email";
3565
+ subject: string;
3566
+ preheader: string | null;
3567
+ doc: {
3568
+ [k: string]: unknown;
2623
3569
  };
2624
- amount?: number;
2625
- unit?: string;
2626
- }[];
3570
+ } | {
3571
+ id: string;
3572
+ type: "email";
3573
+ subject: string;
3574
+ preheader: string | null;
3575
+ template_id: string;
3576
+ } | {
3577
+ id: string;
3578
+ type: "delay";
3579
+ amount: number;
3580
+ unit: "minutes" | "hours" | "days";
3581
+ } | {
3582
+ id: string;
3583
+ type: "delay";
3584
+ until: {
3585
+ time: string;
3586
+ weekdays?: number[];
3587
+ timezone: "contact" | "newsletter";
3588
+ };
3589
+ } | {
3590
+ id: string;
3591
+ type: "wait_event";
3592
+ event: string;
3593
+ timeout_hours: number;
3594
+ on_timeout: "continue" | "exit";
3595
+ } | {
3596
+ id: string;
3597
+ type: "condition";
3598
+ filter_id: string;
3599
+ yes: {
3600
+ [k: string]: unknown;
3601
+ }[];
3602
+ no: {
3603
+ [k: string]: unknown;
3604
+ }[];
3605
+ } | {
3606
+ id: string;
3607
+ type: "condition";
3608
+ rule: {
3609
+ [k: string]: unknown;
3610
+ };
3611
+ yes: {
3612
+ [k: string]: unknown;
3613
+ }[];
3614
+ no: {
3615
+ [k: string]: unknown;
3616
+ }[];
3617
+ } | {
3618
+ id: string;
3619
+ type: "update_contact";
3620
+ action: "set_field";
3621
+ key: string;
3622
+ value: string | number | boolean | null;
3623
+ } | {
3624
+ id: string;
3625
+ type: "update_contact";
3626
+ action: "subscribe_topic" | "unsubscribe_topic";
3627
+ topic_id: string;
3628
+ } | {
3629
+ id: string;
3630
+ type: "webhook";
3631
+ webhook_id: string;
3632
+ } | {
3633
+ id: string;
3634
+ type: "exit";
3635
+ })[];
2627
3636
  published_version: {
2628
3637
  id: string;
2629
- number: number;
2630
- };
3638
+ number: number | null;
3639
+ } | null;
2631
3640
  has_unpublished_changes: boolean;
2632
- activated_at: string;
2633
- archived_at: unknown;
3641
+ activated_at: string | null;
3642
+ archived_at: string | null;
2634
3643
  created_at: string;
2635
3644
  updated_at: string;
2636
- };
3645
+ }
2637
3646
  interface SequencesRemoveParams {
2638
3647
  id: string;
2639
3648
  }
2640
3649
  type SequencesRemoveResponse = {
2641
- object: string;
3650
+ object: "sequence";
2642
3651
  id: string;
2643
- deleted: boolean;
3652
+ deleted: true;
3653
+ } | {
3654
+ object: "sequence";
3655
+ id: string;
3656
+ deleted: false;
3657
+ archived: true;
2644
3658
  };
2645
3659
  interface SequencesActivateParams {
2646
3660
  id: string;
2647
3661
  }
2648
- type SequencesActivateResponse = {
2649
- object: string;
3662
+ interface SequencesActivateResponse {
3663
+ object: "sequence";
2650
3664
  id: string;
2651
3665
  name: string;
2652
- description: unknown;
2653
- status: string;
3666
+ description: string | null;
3667
+ status: "draft" | "active" | "paused" | "archived";
2654
3668
  segment_id: string;
2655
- topic_id: unknown;
3669
+ topic_id: string | null;
2656
3670
  trigger: {
2657
- type: string;
2658
- lead_magnet_id: unknown;
3671
+ type: "subscribed";
3672
+ include_imports: boolean;
3673
+ } | {
3674
+ type: "topic_subscribed";
3675
+ topic_id: string;
3676
+ } | {
3677
+ type: "lead_magnet";
3678
+ lead_magnet_id: string | null;
3679
+ } | {
3680
+ type: "event";
3681
+ event: string;
3682
+ } | {
3683
+ type: "email_opened" | "email_clicked";
3684
+ newsletter_id: string | null;
3685
+ } | {
3686
+ type: "filter";
3687
+ filter_id: string;
3688
+ include_existing: boolean;
3689
+ } | {
3690
+ type: "manual";
2659
3691
  };
2660
3692
  reentry: {
2661
- mode: string;
2662
- days: unknown;
3693
+ mode: "once" | "always" | "after_days";
3694
+ days: number | null;
2663
3695
  };
2664
3696
  exit: {
2665
3697
  events: string[];
2666
- filter_id: unknown;
3698
+ filter_id: string | null;
2667
3699
  };
2668
- steps: {
3700
+ steps: ({
2669
3701
  id: string;
2670
- type: string;
2671
- subject?: string;
2672
- preheader?: unknown;
2673
- doc?: {
2674
- type: string;
2675
- content: unknown[];
3702
+ type: "email";
3703
+ subject: string;
3704
+ preheader: string | null;
3705
+ doc: {
3706
+ [k: string]: unknown;
2676
3707
  };
2677
- amount?: number;
2678
- unit?: string;
2679
- }[];
3708
+ } | {
3709
+ id: string;
3710
+ type: "email";
3711
+ subject: string;
3712
+ preheader: string | null;
3713
+ template_id: string;
3714
+ } | {
3715
+ id: string;
3716
+ type: "delay";
3717
+ amount: number;
3718
+ unit: "minutes" | "hours" | "days";
3719
+ } | {
3720
+ id: string;
3721
+ type: "delay";
3722
+ until: {
3723
+ time: string;
3724
+ weekdays?: number[];
3725
+ timezone: "contact" | "newsletter";
3726
+ };
3727
+ } | {
3728
+ id: string;
3729
+ type: "wait_event";
3730
+ event: string;
3731
+ timeout_hours: number;
3732
+ on_timeout: "continue" | "exit";
3733
+ } | {
3734
+ id: string;
3735
+ type: "condition";
3736
+ filter_id: string;
3737
+ yes: {
3738
+ [k: string]: unknown;
3739
+ }[];
3740
+ no: {
3741
+ [k: string]: unknown;
3742
+ }[];
3743
+ } | {
3744
+ id: string;
3745
+ type: "condition";
3746
+ rule: {
3747
+ [k: string]: unknown;
3748
+ };
3749
+ yes: {
3750
+ [k: string]: unknown;
3751
+ }[];
3752
+ no: {
3753
+ [k: string]: unknown;
3754
+ }[];
3755
+ } | {
3756
+ id: string;
3757
+ type: "update_contact";
3758
+ action: "set_field";
3759
+ key: string;
3760
+ value: string | number | boolean | null;
3761
+ } | {
3762
+ id: string;
3763
+ type: "update_contact";
3764
+ action: "subscribe_topic" | "unsubscribe_topic";
3765
+ topic_id: string;
3766
+ } | {
3767
+ id: string;
3768
+ type: "webhook";
3769
+ webhook_id: string;
3770
+ } | {
3771
+ id: string;
3772
+ type: "exit";
3773
+ })[];
2680
3774
  published_version: {
2681
3775
  id: string;
2682
- number: number;
2683
- };
3776
+ number: number | null;
3777
+ } | null;
2684
3778
  has_unpublished_changes: boolean;
2685
- activated_at: string;
2686
- archived_at: unknown;
3779
+ activated_at: string | null;
3780
+ archived_at: string | null;
2687
3781
  created_at: string;
2688
3782
  updated_at: string;
2689
- };
3783
+ }
2690
3784
  interface SequencesPauseParams {
2691
3785
  id: string;
2692
3786
  }
2693
- type SequencesPauseResponse = {
2694
- object: string;
3787
+ interface SequencesPauseResponse {
3788
+ object: "sequence";
2695
3789
  id: string;
2696
3790
  name: string;
2697
- description: unknown;
2698
- status: string;
3791
+ description: string | null;
3792
+ status: "draft" | "active" | "paused" | "archived";
2699
3793
  segment_id: string;
2700
- topic_id: unknown;
3794
+ topic_id: string | null;
2701
3795
  trigger: {
2702
- type: string;
2703
- lead_magnet_id: unknown;
3796
+ type: "subscribed";
3797
+ include_imports: boolean;
3798
+ } | {
3799
+ type: "topic_subscribed";
3800
+ topic_id: string;
3801
+ } | {
3802
+ type: "lead_magnet";
3803
+ lead_magnet_id: string | null;
3804
+ } | {
3805
+ type: "event";
3806
+ event: string;
3807
+ } | {
3808
+ type: "email_opened" | "email_clicked";
3809
+ newsletter_id: string | null;
3810
+ } | {
3811
+ type: "filter";
3812
+ filter_id: string;
3813
+ include_existing: boolean;
3814
+ } | {
3815
+ type: "manual";
2704
3816
  };
2705
3817
  reentry: {
2706
- mode: string;
2707
- days: unknown;
3818
+ mode: "once" | "always" | "after_days";
3819
+ days: number | null;
2708
3820
  };
2709
3821
  exit: {
2710
3822
  events: string[];
2711
- filter_id: unknown;
3823
+ filter_id: string | null;
2712
3824
  };
2713
- steps: {
3825
+ steps: ({
2714
3826
  id: string;
2715
- type: string;
2716
- subject?: string;
2717
- preheader?: unknown;
2718
- doc?: {
2719
- type: string;
2720
- content: unknown[];
3827
+ type: "email";
3828
+ subject: string;
3829
+ preheader: string | null;
3830
+ doc: {
3831
+ [k: string]: unknown;
2721
3832
  };
2722
- amount?: number;
2723
- unit?: string;
2724
- }[];
3833
+ } | {
3834
+ id: string;
3835
+ type: "email";
3836
+ subject: string;
3837
+ preheader: string | null;
3838
+ template_id: string;
3839
+ } | {
3840
+ id: string;
3841
+ type: "delay";
3842
+ amount: number;
3843
+ unit: "minutes" | "hours" | "days";
3844
+ } | {
3845
+ id: string;
3846
+ type: "delay";
3847
+ until: {
3848
+ time: string;
3849
+ weekdays?: number[];
3850
+ timezone: "contact" | "newsletter";
3851
+ };
3852
+ } | {
3853
+ id: string;
3854
+ type: "wait_event";
3855
+ event: string;
3856
+ timeout_hours: number;
3857
+ on_timeout: "continue" | "exit";
3858
+ } | {
3859
+ id: string;
3860
+ type: "condition";
3861
+ filter_id: string;
3862
+ yes: {
3863
+ [k: string]: unknown;
3864
+ }[];
3865
+ no: {
3866
+ [k: string]: unknown;
3867
+ }[];
3868
+ } | {
3869
+ id: string;
3870
+ type: "condition";
3871
+ rule: {
3872
+ [k: string]: unknown;
3873
+ };
3874
+ yes: {
3875
+ [k: string]: unknown;
3876
+ }[];
3877
+ no: {
3878
+ [k: string]: unknown;
3879
+ }[];
3880
+ } | {
3881
+ id: string;
3882
+ type: "update_contact";
3883
+ action: "set_field";
3884
+ key: string;
3885
+ value: string | number | boolean | null;
3886
+ } | {
3887
+ id: string;
3888
+ type: "update_contact";
3889
+ action: "subscribe_topic" | "unsubscribe_topic";
3890
+ topic_id: string;
3891
+ } | {
3892
+ id: string;
3893
+ type: "webhook";
3894
+ webhook_id: string;
3895
+ } | {
3896
+ id: string;
3897
+ type: "exit";
3898
+ })[];
2725
3899
  published_version: {
2726
3900
  id: string;
2727
- number: number;
2728
- };
3901
+ number: number | null;
3902
+ } | null;
2729
3903
  has_unpublished_changes: boolean;
2730
- activated_at: string;
2731
- archived_at: unknown;
3904
+ activated_at: string | null;
3905
+ archived_at: string | null;
2732
3906
  created_at: string;
2733
3907
  updated_at: string;
2734
- };
3908
+ }
2735
3909
  interface SequencesArchiveParams {
2736
3910
  id: string;
2737
3911
  }
2738
- type SequencesArchiveResponse = {
2739
- object: string;
3912
+ interface SequencesArchiveResponse {
3913
+ object: "sequence";
2740
3914
  id: string;
2741
3915
  name: string;
2742
- description: unknown;
2743
- status: string;
3916
+ description: string | null;
3917
+ status: "draft" | "active" | "paused" | "archived";
2744
3918
  segment_id: string;
2745
- topic_id: unknown;
3919
+ topic_id: string | null;
2746
3920
  trigger: {
2747
- type: string;
2748
- lead_magnet_id: unknown;
3921
+ type: "subscribed";
3922
+ include_imports: boolean;
3923
+ } | {
3924
+ type: "topic_subscribed";
3925
+ topic_id: string;
3926
+ } | {
3927
+ type: "lead_magnet";
3928
+ lead_magnet_id: string | null;
3929
+ } | {
3930
+ type: "event";
3931
+ event: string;
3932
+ } | {
3933
+ type: "email_opened" | "email_clicked";
3934
+ newsletter_id: string | null;
3935
+ } | {
3936
+ type: "filter";
3937
+ filter_id: string;
3938
+ include_existing: boolean;
3939
+ } | {
3940
+ type: "manual";
2749
3941
  };
2750
3942
  reentry: {
2751
- mode: string;
2752
- days: unknown;
3943
+ mode: "once" | "always" | "after_days";
3944
+ days: number | null;
2753
3945
  };
2754
3946
  exit: {
2755
3947
  events: string[];
2756
- filter_id: unknown;
3948
+ filter_id: string | null;
2757
3949
  };
2758
- steps: {
3950
+ steps: ({
3951
+ id: string;
3952
+ type: "email";
3953
+ subject: string;
3954
+ preheader: string | null;
3955
+ doc: {
3956
+ [k: string]: unknown;
3957
+ };
3958
+ } | {
3959
+ id: string;
3960
+ type: "email";
3961
+ subject: string;
3962
+ preheader: string | null;
3963
+ template_id: string;
3964
+ } | {
3965
+ id: string;
3966
+ type: "delay";
3967
+ amount: number;
3968
+ unit: "minutes" | "hours" | "days";
3969
+ } | {
3970
+ id: string;
3971
+ type: "delay";
3972
+ until: {
3973
+ time: string;
3974
+ weekdays?: number[];
3975
+ timezone: "contact" | "newsletter";
3976
+ };
3977
+ } | {
3978
+ id: string;
3979
+ type: "wait_event";
3980
+ event: string;
3981
+ timeout_hours: number;
3982
+ on_timeout: "continue" | "exit";
3983
+ } | {
3984
+ id: string;
3985
+ type: "condition";
3986
+ filter_id: string;
3987
+ yes: {
3988
+ [k: string]: unknown;
3989
+ }[];
3990
+ no: {
3991
+ [k: string]: unknown;
3992
+ }[];
3993
+ } | {
2759
3994
  id: string;
2760
- type: string;
2761
- subject?: string;
2762
- preheader?: unknown;
2763
- doc?: {
2764
- type: string;
2765
- content: unknown[];
3995
+ type: "condition";
3996
+ rule: {
3997
+ [k: string]: unknown;
2766
3998
  };
2767
- amount?: number;
2768
- unit?: string;
2769
- }[];
3999
+ yes: {
4000
+ [k: string]: unknown;
4001
+ }[];
4002
+ no: {
4003
+ [k: string]: unknown;
4004
+ }[];
4005
+ } | {
4006
+ id: string;
4007
+ type: "update_contact";
4008
+ action: "set_field";
4009
+ key: string;
4010
+ value: string | number | boolean | null;
4011
+ } | {
4012
+ id: string;
4013
+ type: "update_contact";
4014
+ action: "subscribe_topic" | "unsubscribe_topic";
4015
+ topic_id: string;
4016
+ } | {
4017
+ id: string;
4018
+ type: "webhook";
4019
+ webhook_id: string;
4020
+ } | {
4021
+ id: string;
4022
+ type: "exit";
4023
+ })[];
2770
4024
  published_version: {
2771
4025
  id: string;
2772
- number: number;
2773
- };
4026
+ number: number | null;
4027
+ } | null;
2774
4028
  has_unpublished_changes: boolean;
2775
- activated_at: string;
2776
- archived_at: string;
4029
+ activated_at: string | null;
4030
+ archived_at: string | null;
2777
4031
  created_at: string;
2778
4032
  updated_at: string;
2779
- };
4033
+ }
2780
4034
  type SequencesEnrollmentsParams = {
2781
4035
  id: string;
2782
4036
  } & {
2783
- status?: "active" | "completed" | "exited";
2784
4037
  /**
2785
- * Newest first, 1–100 (default 100).
4038
+ * 1–100, default 100.
2786
4039
  */
2787
4040
  limit?: number;
4041
+ /**
4042
+ * Id of the last item of the previous page (older items).
4043
+ */
4044
+ after?: string;
4045
+ /**
4046
+ * Id of the first item of the previous page (newer items).
4047
+ */
4048
+ before?: string;
4049
+ status?: "active" | "completed" | "exited";
2788
4050
  };
2789
- type SequencesEnrollmentsResponse = {
2790
- object: string;
4051
+ interface SequencesEnrollmentsResponse {
4052
+ object: "list";
2791
4053
  has_more: boolean;
2792
4054
  data: {
2793
- object: string;
4055
+ object: "sequence_enrollment";
2794
4056
  id: string;
2795
4057
  sequence_id: string;
2796
- contact_id: string;
4058
+ contact_id: string | null;
2797
4059
  email: string;
2798
- status: string;
2799
- exit_reason: unknown;
2800
- current_step_id: string;
2801
- next_run_at: string;
2802
- source: string;
4060
+ status: "active" | "completed" | "exited";
4061
+ exit_reason: string | null;
4062
+ current_step_id: string | null;
4063
+ next_run_at: string | null;
4064
+ source: "trigger" | "filter" | "manual" | "api" | "mcp";
2803
4065
  entered_at: string;
2804
- completed_at: unknown;
2805
- exited_at: unknown;
4066
+ completed_at: string | null;
4067
+ exited_at: string | null;
2806
4068
  }[];
2807
- };
4069
+ }
2808
4070
  type SequencesEnrollParams = {
2809
4071
  id: string;
2810
4072
  } & {
@@ -2814,28 +4076,28 @@ type SequencesEnrollParams = {
2814
4076
  email?: string;
2815
4077
  contactId?: string;
2816
4078
  };
2817
- type SequencesEnrollResponse = {
2818
- object: string;
4079
+ interface SequencesEnrollResponse {
4080
+ object: "sequence_enrollment";
2819
4081
  id: string;
2820
4082
  sequence_id: string;
2821
4083
  contact_id: string;
2822
- status: string;
2823
- };
4084
+ status: "active";
4085
+ }
2824
4086
  interface SequencesUnenrollParams {
2825
4087
  id: string;
2826
4088
  enrollmentId: string;
2827
4089
  }
2828
- type SequencesUnenrollResponse = {
2829
- object: string;
4090
+ interface SequencesUnenrollResponse {
4091
+ object: "sequence_enrollment";
2830
4092
  id: string;
2831
4093
  sequence_id: string;
2832
- status: string;
2833
- };
4094
+ status: "completed" | "exited";
4095
+ }
2834
4096
  interface SequencesStatsParams {
2835
4097
  id: string;
2836
4098
  }
2837
- type SequencesStatsResponse = {
2838
- object: string;
4099
+ interface SequencesStatsResponse {
4100
+ object: "sequence_stats";
2839
4101
  sequence_id: string;
2840
4102
  entered: number;
2841
4103
  active: number;
@@ -2851,7 +4113,7 @@ type SequencesStatsResponse = {
2851
4113
  bounced: number;
2852
4114
  unsubscribed: number;
2853
4115
  }[];
2854
- };
4116
+ }
2855
4117
  interface WebhooksCreateParams {
2856
4118
  /**
2857
4119
  * Public `https://` URL that receives the events.
@@ -2875,11 +4137,11 @@ interface WebhooksCreateParams {
2875
4137
  */
2876
4138
  domains?: string[];
2877
4139
  }
2878
- type WebhooksCreateResponse = {
2879
- object: string;
4140
+ interface WebhooksCreateResponse {
4141
+ object: "webhook";
2880
4142
  id: string;
2881
4143
  signing_secret: string;
2882
- };
4144
+ }
2883
4145
  interface WebhooksListParams {
2884
4146
  /**
2885
4147
  * 1–100, default 20.
@@ -2894,45 +4156,45 @@ interface WebhooksListParams {
2894
4156
  */
2895
4157
  before?: string;
2896
4158
  }
2897
- type WebhooksListResponse = {
2898
- object: string;
4159
+ interface WebhooksListResponse {
4160
+ object: "list";
2899
4161
  has_more: boolean;
2900
4162
  data: {
2901
- object: string;
4163
+ object: "webhook";
2902
4164
  id: string;
2903
4165
  endpoint: string;
2904
- description: string;
2905
- events: string[];
4166
+ description: string | null;
4167
+ 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
4168
  include_newsletters: boolean;
2907
- segment_ids: unknown[];
2908
- domains: unknown[];
2909
- status: string;
2910
- disabled_reason: unknown;
4169
+ segment_ids: string[];
4170
+ domains: string[];
4171
+ status: "enabled" | "disabled";
4172
+ disabled_reason: ("manual" | "failing") | null;
2911
4173
  consecutive_failures: number;
2912
- last_success_at: string;
2913
- last_failure_at: unknown;
4174
+ last_success_at: string | null;
4175
+ last_failure_at: string | null;
2914
4176
  created_at: string;
2915
4177
  }[];
2916
- };
4178
+ }
2917
4179
  interface WebhooksGetParams {
2918
4180
  id: string;
2919
4181
  }
2920
- type WebhooksGetResponse = {
2921
- object: string;
4182
+ interface WebhooksGetResponse {
4183
+ object: "webhook";
2922
4184
  id: string;
2923
4185
  endpoint: string;
2924
- description: string;
2925
- events: string[];
4186
+ description: string | null;
4187
+ 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
4188
  include_newsletters: boolean;
2927
- segment_ids: unknown[];
2928
- domains: unknown[];
2929
- status: string;
2930
- disabled_reason: unknown;
4189
+ segment_ids: string[];
4190
+ domains: string[];
4191
+ status: "enabled" | "disabled";
4192
+ disabled_reason: ("manual" | "failing") | null;
2931
4193
  consecutive_failures: number;
2932
- last_success_at: string;
2933
- last_failure_at: unknown;
4194
+ last_success_at: string | null;
4195
+ last_failure_at: string | null;
2934
4196
  created_at: string;
2935
- };
4197
+ }
2936
4198
  type WebhooksUpdateParams = {
2937
4199
  id: string;
2938
4200
  } & {
@@ -2959,27 +4221,27 @@ type WebhooksUpdateParams = {
2959
4221
  */
2960
4222
  domains?: string[];
2961
4223
  };
2962
- type WebhooksUpdateResponse = {
2963
- object: string;
4224
+ interface WebhooksUpdateResponse {
4225
+ object: "webhook";
2964
4226
  id: string;
2965
- };
4227
+ }
2966
4228
  interface WebhooksRemoveParams {
2967
4229
  id: string;
2968
4230
  }
2969
- type WebhooksRemoveResponse = {
2970
- object: string;
4231
+ interface WebhooksRemoveResponse {
4232
+ object: "webhook";
2971
4233
  id: string;
2972
- deleted: boolean;
2973
- };
4234
+ deleted: true;
4235
+ }
2974
4236
  interface WebhooksRotateSigningSecretParams {
2975
4237
  id: string;
2976
4238
  }
2977
- type WebhooksRotateSigningSecretResponse = {
2978
- object: string;
4239
+ interface WebhooksRotateSigningSecretResponse {
4240
+ object: "webhook";
2979
4241
  id: string;
2980
4242
  signing_secret: string;
2981
4243
  previous_secret_expires_at: string;
2982
- };
4244
+ }
2983
4245
  type WebhooksTestParams = {
2984
4246
  id: string;
2985
4247
  } & {
@@ -2988,29 +4250,29 @@ type WebhooksTestParams = {
2988
4250
  */
2989
4251
  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
4252
  };
2991
- type WebhooksTestResponse = {
2992
- object: string;
4253
+ interface WebhooksTestResponse {
4254
+ object: "webhook_delivery";
2993
4255
  id: string;
2994
4256
  msg_id: string;
2995
4257
  webhook_id: string;
2996
4258
  event_type: string;
2997
- status: string;
4259
+ status: "pending" | "processing" | "delivered" | "failed";
2998
4260
  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;
4261
+ next_attempt_at: string | null;
4262
+ last_status_code: number | null;
4263
+ last_response: string | null;
4264
+ last_error: string | null;
4265
+ last_duration_ms: number | null;
3004
4266
  payload: {
3005
4267
  type: string;
3006
4268
  created_at: string;
3007
4269
  data: {
3008
- email_id: string;
4270
+ [k: string]: unknown;
3009
4271
  };
3010
4272
  };
3011
- delivered_at: string;
4273
+ delivered_at: string | null;
3012
4274
  created_at: string;
3013
- };
4275
+ }
3014
4276
  type WebhooksDeliveriesParams = {
3015
4277
  id: string;
3016
4278
  } & {
@@ -3028,81 +4290,81 @@ type WebhooksDeliveriesParams = {
3028
4290
  before?: string;
3029
4291
  status?: "pending" | "processing" | "delivered" | "failed";
3030
4292
  };
3031
- type WebhooksDeliveriesResponse = {
3032
- object: string;
4293
+ interface WebhooksDeliveriesResponse {
4294
+ object: "list";
3033
4295
  has_more: boolean;
3034
4296
  data: {
3035
- object: string;
4297
+ object: "webhook_delivery";
3036
4298
  id: string;
3037
4299
  msg_id: string;
3038
4300
  webhook_id: string;
3039
4301
  event_type: string;
3040
- status: string;
4302
+ status: "pending" | "processing" | "delivered" | "failed";
3041
4303
  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;
4304
+ next_attempt_at: string | null;
4305
+ last_status_code: number | null;
4306
+ last_response: string | null;
4307
+ last_error: string | null;
4308
+ last_duration_ms: number | null;
3047
4309
  payload: {
3048
4310
  type: string;
3049
4311
  created_at: string;
3050
4312
  data: {
3051
- email_id: string;
4313
+ [k: string]: unknown;
3052
4314
  };
3053
4315
  };
3054
- delivered_at: string;
4316
+ delivered_at: string | null;
3055
4317
  created_at: string;
3056
4318
  }[];
3057
- };
4319
+ }
3058
4320
  interface WebhooksRetryDeliveryParams {
3059
4321
  id: string;
3060
4322
  deliveryId: string;
3061
4323
  }
3062
- type WebhooksRetryDeliveryResponse = {
3063
- object: string;
4324
+ interface WebhooksRetryDeliveryResponse {
4325
+ object: "webhook_delivery";
3064
4326
  id: string;
3065
4327
  msg_id: string;
3066
4328
  webhook_id: string;
3067
4329
  event_type: string;
3068
- status: string;
4330
+ status: "pending" | "processing" | "delivered" | "failed";
3069
4331
  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;
4332
+ next_attempt_at: string | null;
4333
+ last_status_code: number | null;
4334
+ last_response: string | null;
4335
+ last_error: string | null;
4336
+ last_duration_ms: number | null;
3075
4337
  payload: {
3076
4338
  type: string;
3077
4339
  created_at: string;
3078
4340
  data: {
3079
- email_id: string;
4341
+ [k: string]: unknown;
3080
4342
  };
3081
4343
  };
3082
- delivered_at: string;
4344
+ delivered_at: string | null;
3083
4345
  created_at: string;
3084
- };
4346
+ }
3085
4347
  type InboxesListParams = Record<string, never>;
3086
- type InboxesListResponse = {
3087
- object: string;
4348
+ interface InboxesListResponse {
4349
+ object: "list";
3088
4350
  has_more: boolean;
3089
4351
  data: {
3090
- object: string;
4352
+ object: "inbox";
3091
4353
  id: string;
3092
4354
  address: string;
3093
4355
  name: string;
3094
- display_name: string;
3095
- description: string;
3096
- reply_from: unknown;
3097
- status: string;
4356
+ display_name: string | null;
4357
+ description: string | null;
4358
+ reply_from: string | null;
4359
+ status: "active" | "disabled";
3098
4360
  custom_domain: boolean;
3099
- domain_id: unknown;
4361
+ domain_id: string | null;
3100
4362
  dropped_count: number;
3101
- last_dropped_at: unknown;
4363
+ last_dropped_at: string | null;
3102
4364
  created_at: string;
3103
4365
  updated_at: string;
3104
4366
  }[];
3105
- };
4367
+ }
3106
4368
  interface InboxesCreateParams {
3107
4369
  /**
3108
4370
  * Local part: `support` gives `support-<workspace>@in.smartletter.ai` (or `support@<your receiving domain>` with `domain_id`).
@@ -3125,41 +4387,41 @@ interface InboxesCreateParams {
3125
4387
  */
3126
4388
  replyFrom?: string | null;
3127
4389
  }
3128
- type InboxesCreateResponse = {
3129
- object: string;
4390
+ interface InboxesCreateResponse {
4391
+ object: "inbox";
3130
4392
  id: string;
3131
4393
  address: string;
3132
4394
  name: string;
3133
- display_name: string;
3134
- description: string;
3135
- reply_from: unknown;
3136
- status: string;
4395
+ display_name: string | null;
4396
+ description: string | null;
4397
+ reply_from: string | null;
4398
+ status: "active" | "disabled";
3137
4399
  custom_domain: boolean;
3138
- domain_id: unknown;
4400
+ domain_id: string | null;
3139
4401
  dropped_count: number;
3140
- last_dropped_at: unknown;
4402
+ last_dropped_at: string | null;
3141
4403
  created_at: string;
3142
4404
  updated_at: string;
3143
- };
4405
+ }
3144
4406
  interface InboxesGetParams {
3145
4407
  id: string;
3146
4408
  }
3147
- type InboxesGetResponse = {
3148
- object: string;
4409
+ interface InboxesGetResponse {
4410
+ object: "inbox";
3149
4411
  id: string;
3150
4412
  address: string;
3151
4413
  name: string;
3152
- display_name: string;
3153
- description: string;
3154
- reply_from: unknown;
3155
- status: string;
4414
+ display_name: string | null;
4415
+ description: string | null;
4416
+ reply_from: string | null;
4417
+ status: "active" | "disabled";
3156
4418
  custom_domain: boolean;
3157
- domain_id: unknown;
4419
+ domain_id: string | null;
3158
4420
  dropped_count: number;
3159
- last_dropped_at: unknown;
4421
+ last_dropped_at: string | null;
3160
4422
  created_at: string;
3161
4423
  updated_at: string;
3162
- };
4424
+ }
3163
4425
  type InboxesUpdateParams = {
3164
4426
  id: string;
3165
4427
  } & {
@@ -3180,31 +4442,43 @@ type InboxesUpdateParams = {
3180
4442
  */
3181
4443
  status?: "active" | "disabled";
3182
4444
  };
3183
- type InboxesUpdateResponse = {
3184
- object: string;
4445
+ interface InboxesUpdateResponse {
4446
+ object: "inbox";
3185
4447
  id: string;
3186
4448
  address: string;
3187
4449
  name: string;
3188
- display_name: string;
3189
- description: string;
3190
- reply_from: unknown;
3191
- status: string;
4450
+ display_name: string | null;
4451
+ description: string | null;
4452
+ reply_from: string | null;
4453
+ status: "active" | "disabled";
3192
4454
  custom_domain: boolean;
3193
- domain_id: unknown;
4455
+ domain_id: string | null;
3194
4456
  dropped_count: number;
3195
- last_dropped_at: unknown;
4457
+ last_dropped_at: string | null;
3196
4458
  created_at: string;
3197
4459
  updated_at: string;
3198
- };
4460
+ }
3199
4461
  interface InboxesRemoveParams {
3200
4462
  id: string;
3201
4463
  }
3202
- type InboxesRemoveResponse = {
3203
- object: string;
4464
+ interface InboxesRemoveResponse {
4465
+ object: "inbox";
3204
4466
  id: string;
3205
- deleted: boolean;
3206
- };
4467
+ deleted: true;
4468
+ }
3207
4469
  interface ThreadsListParams {
4470
+ /**
4471
+ * 1–100, default 20.
4472
+ */
4473
+ limit?: number;
4474
+ /**
4475
+ * Id of the last item of the previous page (older items).
4476
+ */
4477
+ after?: string;
4478
+ /**
4479
+ * Id of the first item of the previous page (newer items).
4480
+ */
4481
+ before?: string;
3208
4482
  inboxId?: string;
3209
4483
  /**
3210
4484
  * Default: every status but `archived`.
@@ -3217,111 +4491,139 @@ interface ThreadsListParams {
3217
4491
  spam?: "exclude" | "only" | "include";
3218
4492
  assigneeAgent?: string;
3219
4493
  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
4494
  }
3229
- type ThreadsListResponse = {
3230
- object: string;
4495
+ interface ThreadsListResponse {
4496
+ object: "list";
3231
4497
  has_more: boolean;
3232
4498
  data: {
3233
- object: string;
4499
+ object: "inbox_thread";
3234
4500
  id: string;
3235
4501
  inbox_id: string;
3236
- subject: string;
3237
- status: string;
4502
+ subject: string | null;
4503
+ status: "open" | "pending" | "done" | "archived";
3238
4504
  spam: boolean;
3239
- labels: unknown[];
3240
- assignee_user_id: unknown;
3241
- assignee_agent: unknown;
4505
+ labels: string[];
4506
+ assignee_user_id: string | null;
4507
+ assignee_agent: string | null;
3242
4508
  message_count: number;
3243
4509
  unread: boolean;
3244
4510
  participants: string[];
3245
4511
  last_message_at: string;
3246
- last_inbound_at: string;
4512
+ last_inbound_at: string | null;
3247
4513
  created_at: string;
3248
4514
  updated_at: string;
3249
4515
  last_message: {
3250
4516
  id: string;
3251
- direction: string;
4517
+ direction: "inbound" | "outbound";
3252
4518
  from: string;
3253
- snippet: string;
4519
+ snippet: string | null;
3254
4520
  received_at: string;
3255
- };
4521
+ } | null;
3256
4522
  }[];
3257
- };
4523
+ }
3258
4524
  interface ThreadsGetParams {
3259
4525
  id: string;
3260
4526
  }
3261
- type ThreadsGetResponse = {
3262
- object: string;
4527
+ interface ThreadsGetResponse {
4528
+ object: "inbox_thread";
3263
4529
  id: string;
3264
4530
  inbox_id: string;
3265
- subject: string;
3266
- status: string;
4531
+ subject: string | null;
4532
+ status: "open" | "pending" | "done" | "archived";
3267
4533
  spam: boolean;
3268
- labels: unknown[];
3269
- assignee_user_id: unknown;
3270
- assignee_agent: unknown;
4534
+ labels: string[];
4535
+ assignee_user_id: string | null;
4536
+ assignee_agent: string | null;
3271
4537
  message_count: number;
3272
4538
  unread: boolean;
3273
4539
  participants: string[];
3274
4540
  last_message_at: string;
3275
- last_inbound_at: string;
4541
+ last_inbound_at: string | null;
3276
4542
  created_at: string;
3277
4543
  updated_at: string;
3278
- messages: {
3279
- object: string;
4544
+ messages: ({
4545
+ object: "inbox_message";
3280
4546
  id: string;
3281
- thread_id: string;
4547
+ thread_id: string | null;
3282
4548
  inbox_id: string;
3283
- direction: string;
3284
- status: string;
3285
4549
  from: string;
3286
4550
  from_address: string;
3287
- from_name: string;
4551
+ from_name: string | null;
3288
4552
  to: string[];
3289
- cc: unknown[];
3290
- reply_to: unknown[];
3291
- subject: string;
3292
- text: string;
3293
- html: string;
3294
- snippet: string;
4553
+ cc: string[];
4554
+ reply_to: string[];
4555
+ subject: string | null;
4556
+ text: string | null;
4557
+ html: string | null;
4558
+ snippet: string | null;
3295
4559
  remote_images: number;
3296
4560
  body_truncated: boolean;
3297
- message_id: string;
3298
- in_reply_to: unknown;
3299
- references: unknown[];
4561
+ message_id: string | null;
4562
+ in_reply_to: string | null;
4563
+ references: string[];
4564
+ attachments: {
4565
+ id: string;
4566
+ filename: string;
4567
+ content_type: string;
4568
+ size: number;
4569
+ inline: boolean;
4570
+ content_id: string | null;
4571
+ available: boolean;
4572
+ expires_at: string;
4573
+ }[];
4574
+ received_at: string;
4575
+ created_at: string;
4576
+ direction: "inbound";
4577
+ status: "inbox" | "spam";
3300
4578
  spam: {
3301
- score: number;
3302
- verdict: string;
3303
- virus: string;
3304
- spf: string;
3305
- dkim: string;
3306
- dmarc: string;
3307
- reasons: unknown[];
4579
+ score: number | null;
4580
+ verdict: string | null;
4581
+ virus: string | null;
4582
+ spf: string | null;
4583
+ dkim: string | null;
4584
+ dmarc: string | null;
4585
+ reasons: string[];
3308
4586
  };
3309
4587
  auto_submitted: boolean;
3310
- automation_reason: unknown;
4588
+ automation_reason: string | null;
4589
+ } | {
4590
+ object: "inbox_message";
4591
+ id: string;
4592
+ thread_id: string | null;
4593
+ inbox_id: string;
4594
+ from: string;
4595
+ from_address: string;
4596
+ from_name: string | null;
4597
+ to: string[];
4598
+ cc: string[];
4599
+ reply_to: string[];
4600
+ subject: string | null;
4601
+ text: string | null;
4602
+ html: string | null;
4603
+ snippet: string | null;
4604
+ remote_images: number;
4605
+ body_truncated: boolean;
4606
+ message_id: string | null;
4607
+ in_reply_to: string | null;
4608
+ references: string[];
3311
4609
  attachments: {
3312
4610
  id: string;
3313
4611
  filename: string;
3314
4612
  content_type: string;
3315
4613
  size: number;
3316
4614
  inline: boolean;
3317
- content_id: unknown;
4615
+ content_id: string | null;
3318
4616
  available: boolean;
3319
4617
  expires_at: string;
3320
4618
  }[];
3321
4619
  received_at: string;
3322
4620
  created_at: string;
3323
- }[];
3324
- };
4621
+ direction: "outbound";
4622
+ status: "draft" | "sent";
4623
+ email_id: string | null;
4624
+ delivery: string | null;
4625
+ })[];
4626
+ }
3325
4627
  type ThreadsUpdateParams = {
3326
4628
  id: string;
3327
4629
  } & {
@@ -3346,24 +4648,24 @@ type ThreadsUpdateParams = {
3346
4648
  spam?: boolean;
3347
4649
  unread?: boolean;
3348
4650
  };
3349
- type ThreadsUpdateResponse = {
3350
- object: string;
4651
+ interface ThreadsUpdateResponse {
4652
+ object: "inbox_thread";
3351
4653
  id: string;
3352
4654
  inbox_id: string;
3353
- subject: string;
3354
- status: string;
4655
+ subject: string | null;
4656
+ status: "open" | "pending" | "done" | "archived";
3355
4657
  spam: boolean;
3356
4658
  labels: string[];
3357
- assignee_user_id: unknown;
3358
- assignee_agent: string;
4659
+ assignee_user_id: string | null;
4660
+ assignee_agent: string | null;
3359
4661
  message_count: number;
3360
4662
  unread: boolean;
3361
4663
  participants: string[];
3362
4664
  last_message_at: string;
3363
- last_inbound_at: string;
4665
+ last_inbound_at: string | null;
3364
4666
  created_at: string;
3365
4667
  updated_at: string;
3366
- };
4668
+ }
3367
4669
  type ThreadsReplyParams = {
3368
4670
  id: string;
3369
4671
  } & {
@@ -3395,101 +4697,167 @@ type ThreadsReplyParams = {
3395
4697
  status?: "open" | "pending" | "done" | "archived";
3396
4698
  };
3397
4699
  type ThreadsReplyResponse = {
3398
- object: string;
4700
+ object: "inbox_message";
3399
4701
  id: string;
3400
- thread_id: string;
4702
+ thread_id: string | null;
3401
4703
  inbox_id: string;
3402
- direction: string;
3403
- status: string;
3404
4704
  from: string;
3405
4705
  from_address: string;
3406
- from_name: string;
4706
+ from_name: string | null;
3407
4707
  to: string[];
3408
- cc: unknown[];
3409
- reply_to: unknown[];
3410
- subject: string;
3411
- text: string;
3412
- html: string;
3413
- snippet: string;
4708
+ cc: string[];
4709
+ reply_to: string[];
4710
+ subject: string | null;
4711
+ text: string | null;
4712
+ html: string | null;
4713
+ snippet: string | null;
3414
4714
  remote_images: number;
3415
4715
  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;
4716
+ message_id: string | null;
4717
+ in_reply_to: string | null;
4718
+ references: string[];
3430
4719
  attachments: {
3431
4720
  id: string;
3432
4721
  filename: string;
3433
4722
  content_type: string;
3434
4723
  size: number;
3435
4724
  inline: boolean;
3436
- content_id: unknown;
4725
+ content_id: string | null;
3437
4726
  available: boolean;
3438
4727
  expires_at: string;
3439
4728
  }[];
3440
4729
  received_at: string;
3441
4730
  created_at: string;
4731
+ direction: "outbound";
4732
+ status: "sent";
3442
4733
  email_id: string;
3443
4734
  delivery: string;
4735
+ } | {
4736
+ object: "inbox_message";
4737
+ id: string;
4738
+ thread_id: string | null;
4739
+ inbox_id: string;
4740
+ from: string;
4741
+ from_address: string;
4742
+ from_name: string | null;
4743
+ to: string[];
4744
+ cc: string[];
4745
+ reply_to: string[];
4746
+ subject: string | null;
4747
+ text: string | null;
4748
+ html: string | null;
4749
+ snippet: string | null;
4750
+ remote_images: number;
4751
+ body_truncated: boolean;
4752
+ message_id: string | null;
4753
+ in_reply_to: string | null;
4754
+ references: string[];
4755
+ attachments: {
4756
+ id: string;
4757
+ filename: string;
4758
+ content_type: string;
4759
+ size: number;
4760
+ inline: boolean;
4761
+ content_id: string | null;
4762
+ available: boolean;
4763
+ expires_at: string;
4764
+ }[];
4765
+ received_at: string;
4766
+ created_at: string;
4767
+ direction: "outbound";
4768
+ status: "draft";
4769
+ email_id: string | null;
4770
+ delivery: string | null;
4771
+ } | {
4772
+ object: "inbox_message";
4773
+ id: string;
4774
+ email_id: string;
4775
+ status: "sent";
3444
4776
  };
3445
4777
  interface MessagesGetParams {
3446
4778
  id: string;
3447
4779
  }
3448
4780
  type MessagesGetResponse = {
3449
- object: string;
4781
+ object: "inbox_message";
3450
4782
  id: string;
3451
- thread_id: string;
4783
+ thread_id: string | null;
3452
4784
  inbox_id: string;
3453
- direction: string;
3454
- status: string;
3455
4785
  from: string;
3456
4786
  from_address: string;
3457
- from_name: string;
4787
+ from_name: string | null;
3458
4788
  to: string[];
3459
- cc: unknown[];
3460
- reply_to: unknown[];
3461
- subject: string;
3462
- text: string;
3463
- html: string;
3464
- snippet: string;
4789
+ cc: string[];
4790
+ reply_to: string[];
4791
+ subject: string | null;
4792
+ text: string | null;
4793
+ html: string | null;
4794
+ snippet: string | null;
3465
4795
  remote_images: number;
3466
4796
  body_truncated: boolean;
3467
- message_id: string;
3468
- in_reply_to: unknown;
3469
- references: unknown[];
4797
+ message_id: string | null;
4798
+ in_reply_to: string | null;
4799
+ references: string[];
4800
+ attachments: {
4801
+ id: string;
4802
+ filename: string;
4803
+ content_type: string;
4804
+ size: number;
4805
+ inline: boolean;
4806
+ content_id: string | null;
4807
+ available: boolean;
4808
+ expires_at: string;
4809
+ }[];
4810
+ received_at: string;
4811
+ created_at: string;
4812
+ direction: "inbound";
4813
+ status: "inbox" | "spam";
3470
4814
  spam: {
3471
- score: number;
3472
- verdict: string;
3473
- virus: string;
3474
- spf: string;
3475
- dkim: string;
3476
- dmarc: string;
3477
- reasons: unknown[];
4815
+ score: number | null;
4816
+ verdict: string | null;
4817
+ virus: string | null;
4818
+ spf: string | null;
4819
+ dkim: string | null;
4820
+ dmarc: string | null;
4821
+ reasons: string[];
3478
4822
  };
3479
4823
  auto_submitted: boolean;
3480
- automation_reason: unknown;
4824
+ automation_reason: string | null;
4825
+ } | {
4826
+ object: "inbox_message";
4827
+ id: string;
4828
+ thread_id: string | null;
4829
+ inbox_id: string;
4830
+ from: string;
4831
+ from_address: string;
4832
+ from_name: string | null;
4833
+ to: string[];
4834
+ cc: string[];
4835
+ reply_to: string[];
4836
+ subject: string | null;
4837
+ text: string | null;
4838
+ html: string | null;
4839
+ snippet: string | null;
4840
+ remote_images: number;
4841
+ body_truncated: boolean;
4842
+ message_id: string | null;
4843
+ in_reply_to: string | null;
4844
+ references: string[];
3481
4845
  attachments: {
3482
4846
  id: string;
3483
4847
  filename: string;
3484
4848
  content_type: string;
3485
4849
  size: number;
3486
4850
  inline: boolean;
3487
- content_id: unknown;
4851
+ content_id: string | null;
3488
4852
  available: boolean;
3489
4853
  expires_at: string;
3490
4854
  }[];
3491
4855
  received_at: string;
3492
4856
  created_at: string;
4857
+ direction: "outbound";
4858
+ status: "draft" | "sent";
4859
+ email_id: string | null;
4860
+ delivery: string | null;
3493
4861
  };
3494
4862
  type MessagesUpdateParams = {
3495
4863
  id: string;
@@ -3498,124 +4866,111 @@ type MessagesUpdateParams = {
3498
4866
  html?: string | null;
3499
4867
  cc?: string[];
3500
4868
  };
3501
- type MessagesUpdateResponse = {
3502
- object: string;
4869
+ interface MessagesUpdateResponse {
4870
+ object: "inbox_message";
3503
4871
  id: string;
3504
- thread_id: string;
4872
+ thread_id: string | null;
3505
4873
  inbox_id: string;
3506
- direction: string;
3507
- status: string;
3508
4874
  from: string;
3509
4875
  from_address: string;
3510
- from_name: string;
4876
+ from_name: string | null;
3511
4877
  to: string[];
3512
- cc: unknown[];
3513
- reply_to: unknown[];
3514
- subject: string;
3515
- text: string;
3516
- html: string;
3517
- snippet: string;
4878
+ cc: string[];
4879
+ reply_to: string[];
4880
+ subject: string | null;
4881
+ text: string | null;
4882
+ html: string | null;
4883
+ snippet: string | null;
3518
4884
  remote_images: number;
3519
4885
  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;
4886
+ message_id: string | null;
4887
+ in_reply_to: string | null;
4888
+ references: string[];
3534
4889
  attachments: {
3535
4890
  id: string;
3536
4891
  filename: string;
3537
4892
  content_type: string;
3538
4893
  size: number;
3539
4894
  inline: boolean;
3540
- content_id: unknown;
4895
+ content_id: string | null;
3541
4896
  available: boolean;
3542
4897
  expires_at: string;
3543
4898
  }[];
3544
4899
  received_at: string;
3545
4900
  created_at: string;
3546
- };
4901
+ direction: "outbound";
4902
+ status: "draft" | "sent";
4903
+ email_id: string | null;
4904
+ delivery: string | null;
4905
+ }
3547
4906
  type MessagesSendParams = {
3548
4907
  id: string;
3549
4908
  } & {
3550
4909
  status?: "open" | "pending" | "done" | "archived";
3551
4910
  };
3552
4911
  type MessagesSendResponse = {
3553
- object: string;
4912
+ object: "inbox_message";
3554
4913
  id: string;
3555
- thread_id: string;
4914
+ thread_id: string | null;
3556
4915
  inbox_id: string;
3557
- direction: string;
3558
- status: string;
3559
4916
  from: string;
3560
4917
  from_address: string;
3561
- from_name: string;
4918
+ from_name: string | null;
3562
4919
  to: string[];
3563
- cc: unknown[];
3564
- reply_to: unknown[];
3565
- subject: string;
3566
- text: string;
3567
- html: string;
3568
- snippet: string;
4920
+ cc: string[];
4921
+ reply_to: string[];
4922
+ subject: string | null;
4923
+ text: string | null;
4924
+ html: string | null;
4925
+ snippet: string | null;
3569
4926
  remote_images: number;
3570
4927
  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;
4928
+ message_id: string | null;
4929
+ in_reply_to: string | null;
4930
+ references: string[];
3585
4931
  attachments: {
3586
4932
  id: string;
3587
4933
  filename: string;
3588
4934
  content_type: string;
3589
4935
  size: number;
3590
4936
  inline: boolean;
3591
- content_id: unknown;
4937
+ content_id: string | null;
3592
4938
  available: boolean;
3593
4939
  expires_at: string;
3594
4940
  }[];
3595
4941
  received_at: string;
3596
4942
  created_at: string;
4943
+ direction: "outbound";
4944
+ status: "sent";
4945
+ email_id: string;
4946
+ delivery: string;
4947
+ } | {
4948
+ object: "inbox_message";
4949
+ id: string;
4950
+ email_id: string;
4951
+ status: "sent";
3597
4952
  };
3598
4953
  interface MessagesRemoveParams {
3599
4954
  id: string;
3600
4955
  }
3601
- type MessagesRemoveResponse = {
3602
- object: string;
4956
+ interface MessagesRemoveResponse {
4957
+ object: "inbox_message";
3603
4958
  id: string;
3604
- deleted: boolean;
3605
- };
4959
+ deleted: true;
4960
+ }
3606
4961
  interface MessagesAttachmentParams {
3607
4962
  id: string;
3608
4963
  attachmentId: string;
3609
4964
  }
3610
- type MessagesAttachmentResponse = {
3611
- object: string;
4965
+ interface MessagesAttachmentResponse {
4966
+ object: "attachment_url";
3612
4967
  id: string;
3613
4968
  filename: string;
3614
4969
  content_type: string;
3615
4970
  size: number;
3616
4971
  url: string;
3617
4972
  expires_at: string;
3618
- };
4973
+ }
3619
4974
 
3620
4975
  interface SmartletterResources {
3621
4976
  emails: {