mailchannels-sdk 0.4.0 → 0.4.1

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.
@@ -11,279 +11,279 @@ declare class MailChannelsClient {
11
11
  put<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
12
12
  }
13
13
 
14
- interface EmailsSendRecipient {
15
- /**
16
- * The email address of the recipient.
17
- */
18
- email: string;
19
- /**
20
- * The name of the recipient.
21
- */
22
- name?: string;
23
- }
24
-
25
- interface EmailsSendAttachment {
26
- /**
27
- * The attachment data, encoded in base64.
28
- */
29
- content: string;
30
- /**
31
- * The name of the attachment file.
32
- */
33
- filename: string;
34
- /**
35
- * The MIME type of the attachment.
36
- */
37
- type: string;
38
- }
39
-
40
- interface EmailsSendTracking {
41
- /**
42
- * Track when a recipient clicks a link in your email.
43
- * @default false
44
- */
45
- click?: boolean;
46
- /**
47
- * Track when a recipient opens your email. Please note that some email clients may not support open tracking.
48
- * @default false
49
- */
50
- open?: boolean;
51
- }
52
-
53
- interface EmailsSendOptionsBase {
54
- /**
55
- * An array of attachments to be sent with the email.
56
- */
57
- attachments?: EmailsSendAttachment[];
58
- /**
59
- * The campaign identifier. If specified, this ID will be included in all relevant webhooks. It can be up to 48 UTF-8 characters long and must not contain spaces.
60
- */
61
- campaignId?: string;
62
- /**
63
- * The BCC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
64
- * @example
65
- * [
66
- * { email: 'email1@example.com', name: 'Example1' },
67
- * { email: 'email2@example.com', name: 'Example2' }
68
- * ]
69
- * @example
70
- * { email: 'email@example.com', name: 'Example' }
71
- * @example
72
- * ['email1@example.com', 'email2@example.com']
73
- * @example
74
- * 'email@example.com'
75
- * @example
76
- * 'Name <email@example.com>'
77
- */
78
- bcc?: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
79
- /**
80
- * The CC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
81
- * @example
82
- * [
83
- * { email: 'email1@example.com', name: 'Example1' },
84
- * { email: 'email2@example.com', name: 'Example2' }
85
- * ]
86
- * @example
87
- * { email: 'email@example.com', name: 'Example' }
88
- * @example
89
- * ['email1@example.com', 'email2@example.com']
90
- * @example
91
- * 'email@example.com'
92
- * @example
93
- * 'Name <email@example.com>'
94
- */
95
- cc?: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
96
- /**
97
- * The DKIM settings for the email.
98
- */
99
- dkim?: {
100
- /**
101
- * Domain used for DKIM signing.
102
- */
103
- domain: string;
104
- /**
105
- * DKIM private key encoded in Base64.
106
- */
107
- privateKey: string;
108
- /**
109
- * DKIM selector in the domain DNS records.
110
- */
111
- selector: string;
112
- };
113
- /**
114
- * The sender of the email. Can be a string or an object with email and name properties.
115
- * @example
116
- * { email: 'email@example.com', name: 'Example' }
117
- * @example
118
- * 'email@example.com'
119
- * @example
120
- * 'Name <email@example.com>'
121
- */
122
- from: EmailsSendRecipient | string;
123
- /**
124
- * The recipient of the email. Can be an array of email addresses or an array of objects with `email` and `name` properties or a single email address string or an object with `email` and `name` properties.
125
- * @example
126
- * [
127
- * { email: 'email1@example.com', name: 'Example1' },
128
- * { email: 'email2@example.com', name: 'Example2' },
129
- * ]
130
- * @example
131
- * { email: 'email@example.com', name: 'Example' }
132
- * @example
133
- * ['email1@example.com', 'email2@example.com']
134
- * @example
135
- * 'email@example.com'
136
- * @example
137
- * 'Name <email@example.com>'
138
- */
139
- to: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
140
- /**
141
- * Adjust open and click tracking for the message. Please note that enabling tracking for your messages requires a subscription that supports open and click tracking.
142
- */
143
- tracking?: EmailsSendTracking;
144
- /**
145
- * A single `replyTo` recipient object, or a single email address.
146
- * @example
147
- * { email: 'email@example.com', name: 'Example' }
148
- * @example
149
- * 'email@example.com'
150
- * @example
151
- * 'Name <email@example.com>'
152
- */
153
- replyTo?: EmailsSendRecipient | string;
154
- /**
155
- * The subject of the email.
156
- */
157
- subject: string;
158
- /**
159
- * Data to be used if the email is a mustache template, key-value pairs of variables to set for template rendering. Keys must be strings.
160
- *
161
- * the values can be one of the following types:
162
- * - string
163
- * - number
164
- * - boolean
165
- * - list, whose values are all of permitted types
166
- * - map, whose keys must be strings, and whose values are all of permitted types
167
- */
168
- mustaches?: Record<string, unknown>;
169
- /**
170
- * Mark these messages as transactional or non-transactional. In order for a message to be marked as non-transactional, it must have exactly one recipient per personalization, and it must be DKIM signed. 400 Bad Request will be returned if there are more than one recipient in any personalization for non-transactional messages. If a message is marked as non-transactional, it changes the sending process as follows:
171
- *
172
- * List-Unsubscribe headers will be added.
173
- * @default true
174
- */
175
- transactional?: boolean;
176
- }
177
-
178
- type EmailsSendOptions = EmailsSendOptionsBase & (
179
- | {
180
- /**
181
- * The HTML content of the email
182
- * @example
183
- * '<p>Hello World</p>'
184
- */
185
- html: string;
186
- /**
187
- * The plain text content of the email (optional when html is provided)
188
- * @example
189
- * 'Hello World'
190
- */
191
- text?: string;
192
- }
193
- | {
194
- /**
195
- * The HTML content of the email (optional when text is provided)
196
- * @example
197
- * '<p>Hello World</p>'
198
- */
199
- html?: string;
200
- /**
201
- * The plain text content of the email
202
- * @example
203
- * 'Hello World'
204
- */
205
- text: string;
206
- }
207
- );
208
-
209
- interface EmailsSendResponse {
210
- /**
211
- * Indicates if the email was successfully sent
212
- */
213
- success: boolean;
214
- /**
215
- * Fully rendered message if `dryRun` was set to `true`
216
- */
217
- data?: string[];
218
- error: string | null;
219
- }
220
-
221
- interface EmailsCheckDomainDkim {
222
- /**
223
- * Domain used for DKIM signing.
224
- */
225
- domain: string;
226
- /**
227
- * DKIM private key encoded in Base64.
228
- */
229
- privateKey: string;
230
- /**
231
- * DKIM selector in the domain DNS records.
232
- */
233
- selector: string;
234
- }
235
-
236
- interface EmailsCheckDomainOptions {
237
- /**
238
- * Up to 10 DKIM checks are allowed.
239
- */
240
- dkim: EmailsCheckDomainDkim[] | EmailsCheckDomainDkim;
241
- /**
242
- * Domain used for sending emails.
243
- */
244
- domain: string;
245
- /**
246
- * `X-MailChannels-Sender-Id` header value in emails via MailChannels.
247
- */
248
- senderId: string;
249
- }
250
-
251
- type EmailsCheckDomainVerdict = "passed" | "failed" | "soft failed" | "temporary error" | "permanent error" | "neutral" | "none" | "unknown";
252
-
253
- interface EmailsCheckDomainResponse {
254
- /**
255
- * The results of the domain checks.
256
- */
257
- results: {
258
- dkim: {
259
- domain: string;
260
- selector: string;
261
- /**
262
- * A human-readable explanation of DKIM check.
263
- */
264
- reason?: string;
265
- verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
266
- }[];
267
- domainLockdown: {
268
- /**
269
- * A human-readable explanation of Domain Lockdown check.
270
- */
271
- reason?: string;
272
- verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
273
- };
274
- spf: {
275
- /**
276
- * A human-readable explanation of SPF check.
277
- */
278
- reason?: string;
279
- verdict: EmailsCheckDomainVerdict;
280
- };
281
- references?: string[];
282
- } | null;
283
- /**
284
- * Link to SPF, Domain Lockdown or DKIM references, displayed if any verdict is not passed.
285
- */
286
- error: string | null;
14
+ interface EmailsSendRecipient {
15
+ /**
16
+ * The email address of the recipient.
17
+ */
18
+ email: string;
19
+ /**
20
+ * The name of the recipient.
21
+ */
22
+ name?: string;
23
+ }
24
+
25
+ interface EmailsSendAttachment {
26
+ /**
27
+ * The attachment data, encoded in base64.
28
+ */
29
+ content: string;
30
+ /**
31
+ * The name of the attachment file.
32
+ */
33
+ filename: string;
34
+ /**
35
+ * The MIME type of the attachment.
36
+ */
37
+ type: string;
38
+ }
39
+
40
+ interface EmailsSendTracking {
41
+ /**
42
+ * Track when a recipient clicks a link in your email.
43
+ * @default false
44
+ */
45
+ click?: boolean;
46
+ /**
47
+ * Track when a recipient opens your email. Please note that some email clients may not support open tracking.
48
+ * @default false
49
+ */
50
+ open?: boolean;
51
+ }
52
+
53
+ interface EmailsSendOptionsBase {
54
+ /**
55
+ * An array of attachments to be sent with the email.
56
+ */
57
+ attachments?: EmailsSendAttachment[];
58
+ /**
59
+ * The campaign identifier. If specified, this ID will be included in all relevant webhooks. It can be up to 48 UTF-8 characters long and must not contain spaces.
60
+ */
61
+ campaignId?: string;
62
+ /**
63
+ * The BCC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
64
+ * @example
65
+ * [
66
+ * { email: 'email1@example.com', name: 'Example1' },
67
+ * { email: 'email2@example.com', name: 'Example2' }
68
+ * ]
69
+ * @example
70
+ * { email: 'email@example.com', name: 'Example' }
71
+ * @example
72
+ * ['email1@example.com', 'email2@example.com']
73
+ * @example
74
+ * 'email@example.com'
75
+ * @example
76
+ * 'Name <email@example.com>'
77
+ */
78
+ bcc?: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
79
+ /**
80
+ * The CC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
81
+ * @example
82
+ * [
83
+ * { email: 'email1@example.com', name: 'Example1' },
84
+ * { email: 'email2@example.com', name: 'Example2' }
85
+ * ]
86
+ * @example
87
+ * { email: 'email@example.com', name: 'Example' }
88
+ * @example
89
+ * ['email1@example.com', 'email2@example.com']
90
+ * @example
91
+ * 'email@example.com'
92
+ * @example
93
+ * 'Name <email@example.com>'
94
+ */
95
+ cc?: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
96
+ /**
97
+ * The DKIM settings for the email.
98
+ */
99
+ dkim?: {
100
+ /**
101
+ * Domain used for DKIM signing.
102
+ */
103
+ domain: string;
104
+ /**
105
+ * DKIM private key encoded in Base64.
106
+ */
107
+ privateKey: string;
108
+ /**
109
+ * DKIM selector in the domain DNS records.
110
+ */
111
+ selector: string;
112
+ };
113
+ /**
114
+ * The sender of the email. Can be a string or an object with email and name properties.
115
+ * @example
116
+ * { email: 'email@example.com', name: 'Example' }
117
+ * @example
118
+ * 'email@example.com'
119
+ * @example
120
+ * 'Name <email@example.com>'
121
+ */
122
+ from: EmailsSendRecipient | string;
123
+ /**
124
+ * The recipient of the email. Can be an array of email addresses or an array of objects with `email` and `name` properties or a single email address string or an object with `email` and `name` properties.
125
+ * @example
126
+ * [
127
+ * { email: 'email1@example.com', name: 'Example1' },
128
+ * { email: 'email2@example.com', name: 'Example2' },
129
+ * ]
130
+ * @example
131
+ * { email: 'email@example.com', name: 'Example' }
132
+ * @example
133
+ * ['email1@example.com', 'email2@example.com']
134
+ * @example
135
+ * 'email@example.com'
136
+ * @example
137
+ * 'Name <email@example.com>'
138
+ */
139
+ to: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
140
+ /**
141
+ * Adjust open and click tracking for the message. Please note that enabling tracking for your messages requires a subscription that supports open and click tracking.
142
+ */
143
+ tracking?: EmailsSendTracking;
144
+ /**
145
+ * A single `replyTo` recipient object, or a single email address.
146
+ * @example
147
+ * { email: 'email@example.com', name: 'Example' }
148
+ * @example
149
+ * 'email@example.com'
150
+ * @example
151
+ * 'Name <email@example.com>'
152
+ */
153
+ replyTo?: EmailsSendRecipient | string;
154
+ /**
155
+ * The subject of the email.
156
+ */
157
+ subject: string;
158
+ /**
159
+ * Data to be used if the email is a mustache template, key-value pairs of variables to set for template rendering. Keys must be strings.
160
+ *
161
+ * the values can be one of the following types:
162
+ * - string
163
+ * - number
164
+ * - boolean
165
+ * - list, whose values are all of permitted types
166
+ * - map, whose keys must be strings, and whose values are all of permitted types
167
+ */
168
+ mustaches?: Record<string, unknown>;
169
+ /**
170
+ * Mark these messages as transactional or non-transactional. In order for a message to be marked as non-transactional, it must have exactly one recipient per personalization, and it must be DKIM signed. 400 Bad Request will be returned if there are more than one recipient in any personalization for non-transactional messages. If a message is marked as non-transactional, it changes the sending process as follows:
171
+ *
172
+ * List-Unsubscribe headers will be added.
173
+ * @default true
174
+ */
175
+ transactional?: boolean;
176
+ }
177
+
178
+ type EmailsSendOptions = EmailsSendOptionsBase & (
179
+ | {
180
+ /**
181
+ * The HTML content of the email
182
+ * @example
183
+ * '<p>Hello World</p>'
184
+ */
185
+ html: string;
186
+ /**
187
+ * The plain text content of the email (optional when html is provided)
188
+ * @example
189
+ * 'Hello World'
190
+ */
191
+ text?: string;
192
+ }
193
+ | {
194
+ /**
195
+ * The HTML content of the email (optional when text is provided)
196
+ * @example
197
+ * '<p>Hello World</p>'
198
+ */
199
+ html?: string;
200
+ /**
201
+ * The plain text content of the email
202
+ * @example
203
+ * 'Hello World'
204
+ */
205
+ text: string;
206
+ }
207
+ );
208
+
209
+ interface EmailsSendResponse {
210
+ /**
211
+ * Indicates if the email was successfully sent
212
+ */
213
+ success: boolean;
214
+ /**
215
+ * Fully rendered message if `dryRun` was set to `true`
216
+ */
217
+ data?: string[];
218
+ error: string | null;
219
+ }
220
+
221
+ interface EmailsCheckDomainDkim {
222
+ /**
223
+ * Domain used for DKIM signing.
224
+ */
225
+ domain: string;
226
+ /**
227
+ * DKIM private key encoded in Base64.
228
+ */
229
+ privateKey: string;
230
+ /**
231
+ * DKIM selector in the domain DNS records.
232
+ */
233
+ selector: string;
234
+ }
235
+
236
+ interface EmailsCheckDomainOptions {
237
+ /**
238
+ * Up to 10 DKIM checks are allowed.
239
+ */
240
+ dkim: EmailsCheckDomainDkim[] | EmailsCheckDomainDkim;
241
+ /**
242
+ * Domain used for sending emails.
243
+ */
244
+ domain: string;
245
+ /**
246
+ * `X-MailChannels-Sender-Id` header value in emails via MailChannels.
247
+ */
248
+ senderId: string;
249
+ }
250
+
251
+ type EmailsCheckDomainVerdict = "passed" | "failed" | "soft failed" | "temporary error" | "permanent error" | "neutral" | "none" | "unknown";
252
+
253
+ interface EmailsCheckDomainResponse {
254
+ /**
255
+ * The results of the domain checks.
256
+ */
257
+ results: {
258
+ dkim: {
259
+ domain: string;
260
+ selector: string;
261
+ /**
262
+ * A human-readable explanation of DKIM check.
263
+ */
264
+ reason?: string;
265
+ verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
266
+ }[];
267
+ domainLockdown: {
268
+ /**
269
+ * A human-readable explanation of Domain Lockdown check.
270
+ */
271
+ reason?: string;
272
+ verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
273
+ };
274
+ spf: {
275
+ /**
276
+ * A human-readable explanation of SPF check.
277
+ */
278
+ reason?: string;
279
+ verdict: EmailsCheckDomainVerdict;
280
+ };
281
+ references?: string[];
282
+ } | null;
283
+ /**
284
+ * Link to SPF, Domain Lockdown or DKIM references, displayed if any verdict is not passed.
285
+ */
286
+ error: string | null;
287
287
  }
288
288
 
289
289
  declare class Emails {
@@ -325,56 +325,56 @@ declare class Emails {
325
325
  checkDomain(options: EmailsCheckDomainOptions): Promise<EmailsCheckDomainResponse>;
326
326
  }
327
327
 
328
- interface SuccessResponse {
329
- /**
330
- * Whether the operation was successful.
331
- */
332
- success: boolean;
333
- error: string | null;
334
- }
335
-
336
- interface WebhooksListResponse {
337
- webhooks: string[];
338
- error: string | null;
339
- }
340
-
341
- interface WebhooksSigningKeyResponse {
342
- key: string | null;
343
- error: string | null;
344
- }
345
-
346
- interface WebhooksValidateResponse {
347
- /**
348
- * Indicates whether all webhook validations passed
349
- */
350
- allPassed: boolean;
351
- /**
352
- * Detailed results for each tested webhook, including whether it returned a 2xx status code, along with its response status code and body.
353
- */
354
- results: {
355
- /**
356
- * Indicates whether the webhook responded with a 2xx HTTP status code
357
- */
358
- result: "passed" | "failed";
359
- /**
360
- * The webhook that was validated
361
- */
362
- webhook: string;
363
- /**
364
- * The HTTP response returned by the webhook, including status code and response body. A null value indicates no response was received. Possible reasons include timeouts, connection failures, or other network-related issues.
365
- */
366
- response: {
367
- /**
368
- * Response body from webhook. Returns an error if unprocessable or too large.
369
- */
370
- body?: string;
371
- /**
372
- * HTTP status code returned by the webhook
373
- */
374
- status: number;
375
- } | null;
376
- }[];
377
- error: string | null;
328
+ interface SuccessResponse {
329
+ /**
330
+ * Whether the operation was successful.
331
+ */
332
+ success: boolean;
333
+ error: string | null;
334
+ }
335
+
336
+ interface WebhooksListResponse {
337
+ webhooks: string[];
338
+ error: string | null;
339
+ }
340
+
341
+ interface WebhooksSigningKeyResponse {
342
+ key: string | null;
343
+ error: string | null;
344
+ }
345
+
346
+ interface WebhooksValidateResponse {
347
+ /**
348
+ * Indicates whether all webhook validations passed
349
+ */
350
+ allPassed: boolean;
351
+ /**
352
+ * Detailed results for each tested webhook, including whether it returned a 2xx status code, along with its response status code and body.
353
+ */
354
+ results: {
355
+ /**
356
+ * Indicates whether the webhook responded with a 2xx HTTP status code
357
+ */
358
+ result: "passed" | "failed";
359
+ /**
360
+ * The webhook that was validated
361
+ */
362
+ webhook: string;
363
+ /**
364
+ * The HTTP response returned by the webhook, including status code and response body. A null value indicates no response was received. Possible reasons include timeouts, connection failures, or other network-related issues.
365
+ */
366
+ response: {
367
+ /**
368
+ * Response body from webhook. Returns an error if unprocessable or too large.
369
+ */
370
+ body?: string;
371
+ /**
372
+ * HTTP status code returned by the webhook
373
+ */
374
+ status: number;
375
+ } | null;
376
+ }[];
377
+ error: string | null;
378
378
  }
379
379
 
380
380
  declare class Webhooks {
@@ -430,119 +430,119 @@ declare class Webhooks {
430
430
  validate(requestId?: string): Promise<WebhooksValidateResponse>;
431
431
  }
432
432
 
433
- interface SubAccountsAccount {
434
- /**
435
- * The name of the company associated with the sub-account.
436
- */
437
- companyName: string;
438
- /**
439
- * If the sub-account is enabled.
440
- */
441
- enabled: boolean;
442
- /**
443
- * The handle for the sub-account.
444
- */
445
- handle: string;
446
- }
447
-
448
- interface SubAccountsCreateResponse {
449
- account: SubAccountsAccount | null;
450
- error: string | null;
451
- }
452
-
453
- interface SubAccountsListOptions {
454
- /**
455
- * Possible values are `1` to `1000`.
456
- * @default 1000
457
- */
458
- limit?: number;
459
- /**
460
- * The offset for pagination.
461
- * @default 0
462
- */
463
- offset?: number;
464
- }
465
-
466
- interface SubAccountsListResponse {
467
- accounts: SubAccountsAccount[];
468
- error: string | null;
469
- }
470
-
471
- interface SubAccountsApiKey {
472
- /**
473
- * The API key ID for the sub-account.
474
- */
475
- id: number;
476
- /**
477
- * API key for the sub-account.
478
- */
479
- value: string;
480
- }
481
-
482
- interface SubAccountsCreateApiKeyResponse {
483
- key: SubAccountsApiKey | null;
484
- error: string | null;
485
- }
486
-
487
- interface SubAccountsListApiKeyResponse {
488
- keys: SubAccountsApiKey[];
489
- error: string | null;
490
- }
491
-
492
- interface SubAccountsSmtpPassword {
493
- /**
494
- * Whether the SMTP password is enabled.
495
- */
496
- enabled: boolean;
497
- /**
498
- * The SMTP password ID for the sub-account.
499
- */
500
- id: number;
501
- /**
502
- * SMTP password for the sub-account.
503
- */
504
- value: string;
505
- }
506
-
507
- interface SubAccountsCreateSmtpPasswordResponse {
508
- password: SubAccountsSmtpPassword | null;
509
- error: string | null;
510
- }
511
-
512
- interface SubAccountsListSmtpPasswordResponse {
513
- passwords: SubAccountsSmtpPassword[];
514
- error: string | null;
515
- }
516
-
517
- interface SubAccountsLimit {
518
- sends: number;
519
- }
520
-
521
- interface SubAccountsLimitResponse {
522
- limit: SubAccountsLimit | null;
523
- error: string | null;
524
- }
525
-
526
- interface SubAccountsUsage {
527
- /**
528
- * The end date of the current billing period (ISO 8601 format).
529
- * @example "2025-04-11"
530
- */
531
- endDate?: string;
532
- /**
533
- * The start date of the current billing period (ISO 8601 format).
534
- * @example "2025-03-12"
535
- */
536
- startDate?: string;
537
- /**
538
- * The total usage for the current billing period.
539
- */
540
- total: number;
541
- }
542
-
543
- interface SubAccountsUsageResponse {
544
- usage: SubAccountsUsage | null;
545
- error: string | null;
433
+ interface SubAccountsAccount {
434
+ /**
435
+ * The name of the company associated with the sub-account.
436
+ */
437
+ companyName: string;
438
+ /**
439
+ * If the sub-account is enabled.
440
+ */
441
+ enabled: boolean;
442
+ /**
443
+ * The handle for the sub-account.
444
+ */
445
+ handle: string;
446
+ }
447
+
448
+ interface SubAccountsCreateResponse {
449
+ account: SubAccountsAccount | null;
450
+ error: string | null;
451
+ }
452
+
453
+ interface SubAccountsListOptions {
454
+ /**
455
+ * Possible values are `1` to `1000`.
456
+ * @default 1000
457
+ */
458
+ limit?: number;
459
+ /**
460
+ * The offset for pagination.
461
+ * @default 0
462
+ */
463
+ offset?: number;
464
+ }
465
+
466
+ interface SubAccountsListResponse {
467
+ accounts: SubAccountsAccount[];
468
+ error: string | null;
469
+ }
470
+
471
+ interface SubAccountsApiKey {
472
+ /**
473
+ * The API key ID for the sub-account.
474
+ */
475
+ id: number;
476
+ /**
477
+ * API key for the sub-account.
478
+ */
479
+ value: string;
480
+ }
481
+
482
+ interface SubAccountsCreateApiKeyResponse {
483
+ key: SubAccountsApiKey | null;
484
+ error: string | null;
485
+ }
486
+
487
+ interface SubAccountsListApiKeyResponse {
488
+ keys: SubAccountsApiKey[];
489
+ error: string | null;
490
+ }
491
+
492
+ interface SubAccountsSmtpPassword {
493
+ /**
494
+ * Whether the SMTP password is enabled.
495
+ */
496
+ enabled: boolean;
497
+ /**
498
+ * The SMTP password ID for the sub-account.
499
+ */
500
+ id: number;
501
+ /**
502
+ * SMTP password for the sub-account.
503
+ */
504
+ value: string;
505
+ }
506
+
507
+ interface SubAccountsCreateSmtpPasswordResponse {
508
+ password: SubAccountsSmtpPassword | null;
509
+ error: string | null;
510
+ }
511
+
512
+ interface SubAccountsListSmtpPasswordResponse {
513
+ passwords: SubAccountsSmtpPassword[];
514
+ error: string | null;
515
+ }
516
+
517
+ interface SubAccountsLimit {
518
+ sends: number;
519
+ }
520
+
521
+ interface SubAccountsLimitResponse {
522
+ limit: SubAccountsLimit | null;
523
+ error: string | null;
524
+ }
525
+
526
+ interface SubAccountsUsage {
527
+ /**
528
+ * The end date of the current billing period (ISO 8601 format).
529
+ * @example "2025-04-11"
530
+ */
531
+ endDate?: string;
532
+ /**
533
+ * The start date of the current billing period (ISO 8601 format).
534
+ * @example "2025-03-12"
535
+ */
536
+ startDate?: string;
537
+ /**
538
+ * The total usage for the current billing period.
539
+ */
540
+ total: number;
541
+ }
542
+
543
+ interface SubAccountsUsageResponse {
544
+ usage: SubAccountsUsage | null;
545
+ error: string | null;
546
546
  }
547
547
 
548
548
  declare class SubAccounts {
@@ -705,171 +705,171 @@ declare class SubAccounts {
705
705
  getUsage(handle: string): Promise<SubAccountsUsageResponse>;
706
706
  }
707
707
 
708
- interface MetricsEngagement {
709
- buckets: {
710
- click: MetricsBucket[];
711
- clickTrackingDelivered: MetricsBucket[];
712
- open: MetricsBucket[];
713
- openTrackingDelivered: MetricsBucket[];
714
- };
715
- click: number;
716
- clickTrackingDelivered: number;
717
- endTime: string;
718
- open: number;
719
- openTrackingDelivered: number;
720
- startTime: string;
721
- }
722
-
723
- interface MetricsEngagementResponse {
724
- engagement: MetricsEngagement | null;
725
- error: string | null;
726
- }
727
-
728
- interface MetricsPerformance {
729
- /**
730
- * Count of messages bounced during the specified time range.
731
- */
732
- bounced: number;
733
- buckets: {
734
- bounced: MetricsBucket[];
735
- delivered: MetricsBucket[];
736
- processed: MetricsBucket[];
737
- };
738
- /**
739
- * Count of messages delivered during the specified time range.
740
- */
741
- delivered: number;
742
- /**
743
- * The end of the time range for retrieving message performance metrics (exclusive).
744
- */
745
- endTime: string;
746
- /**
747
- * Count of messages processed during the specified time range.
748
- */
749
- processed: number;
750
- /**
751
- * The beginning of the time range for retrieving message performance metrics (inclusive).
752
- */
753
- startTime: string;
754
- }
755
-
756
- interface MetricsPerformanceResponse {
757
- performance: MetricsPerformance | null;
758
- error: string | null;
759
- }
760
-
761
- interface MetricsRecipientBehaviour {
762
- buckets: {
763
- unsubscribeDelivered: MetricsBucket[];
764
- unsubscribed: MetricsBucket[];
765
- };
766
- /**
767
- * The end of the time range for retrieving recipient behaviour metrics (exclusive).
768
- */
769
- endTime: string;
770
- /**
771
- * The beginning of the time range for retrieving recipient behaviour metrics (inclusive).
772
- */
773
- startTime: string;
774
- /**
775
- * Count of recipients of delivered messages that include at least one of the unsubscribe link or unsubscribe headers. Since the unsubscribe feature requires exactly one recipient per message, this count also represents the total number of delivered messages.
776
- */
777
- unsubscribeDelivered: number;
778
- /**
779
- * Count of unsubscribed events by recipients.
780
- */
781
- unsubscribed: number;
782
- }
783
-
784
- interface MetricsRecipientBehaviourResponse {
785
- behaviour: MetricsRecipientBehaviour | null;
786
- error: string | null;
787
- }
788
-
789
- interface MetricsVolume {
790
- buckets: {
791
- delivered: MetricsBucket[];
792
- dropped: MetricsBucket[];
793
- processed: MetricsBucket[];
794
- };
795
- /**
796
- * Count of messages delivered during the specified time range.
797
- */
798
- delivered: number;
799
- /**
800
- * Count of messages dropped during the specified time range.
801
- */
802
- dropped: number;
803
- /**
804
- * The end of the time range for retrieving message volume metrics (exclusive).
805
- */
806
- endTime: string;
807
- /**
808
- * Count of messages processed during the specified time range.
809
- */
810
- processed: number;
811
- /**
812
- * The beginning of the time range for retrieving message volume metrics (inclusive).
813
- */
814
- startTime: string;
815
- }
816
-
817
- interface MetricsVolumeResponse {
818
- volume: MetricsVolume | null;
819
- error: string | null;
820
- }
821
-
822
- interface MetricsUsageResponse {
823
- usage: {
824
- /**
825
- * The end date of the current billing period (ISO 8601 format).
826
- * @example "2025-04-11"
827
- */
828
- endDate: string;
829
- /**
830
- * The start date of the current billing period (ISO 8601 format).
831
- * @example "2025-03-12"
832
- */
833
- startDate: string;
834
- /**
835
- * The total usage for the current billing period.
836
- */
837
- total: number;
838
- } | null;
839
- error: string | null;
840
- }
841
-
842
- interface MetricsBucket {
843
- /**
844
- * The number of events or occurrences aggregated within this time period.
845
- */
846
- count: number;
847
- /**
848
- * The starting date and time of the time period this bucket represents.
849
- */
850
- periodStart: string;
851
- }
852
-
853
- interface MetricsOptions {
854
- /**
855
- * The beginning of the time range for retrieving message metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to one month ago if not provided.
856
- * @example "2025-05-26"
857
- */
858
- startTime?: string;
859
- /**
860
- * The end of the time range for retrieving message metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to the current time if not provided.
861
- * @example "2025-05-31T15:16:17Z"
862
- */
863
- endTime?: string;
864
- /**
865
- * The ID of the campaign to filter metrics by. If not provided, metrics for all campaigns will be returned.
866
- */
867
- campaignId?: string;
868
- /**
869
- * The interval for aggregating metrics data.
870
- * @default "day"
871
- */
872
- interval?: "hour" | "day" | "week" | "month";
708
+ interface MetricsEngagement {
709
+ buckets: {
710
+ click: MetricsBucket[];
711
+ clickTrackingDelivered: MetricsBucket[];
712
+ open: MetricsBucket[];
713
+ openTrackingDelivered: MetricsBucket[];
714
+ };
715
+ click: number;
716
+ clickTrackingDelivered: number;
717
+ endTime: string;
718
+ open: number;
719
+ openTrackingDelivered: number;
720
+ startTime: string;
721
+ }
722
+
723
+ interface MetricsEngagementResponse {
724
+ engagement: MetricsEngagement | null;
725
+ error: string | null;
726
+ }
727
+
728
+ interface MetricsPerformance {
729
+ /**
730
+ * Count of messages bounced during the specified time range.
731
+ */
732
+ bounced: number;
733
+ buckets: {
734
+ bounced: MetricsBucket[];
735
+ delivered: MetricsBucket[];
736
+ processed: MetricsBucket[];
737
+ };
738
+ /**
739
+ * Count of messages delivered during the specified time range.
740
+ */
741
+ delivered: number;
742
+ /**
743
+ * The end of the time range for retrieving message performance metrics (exclusive).
744
+ */
745
+ endTime: string;
746
+ /**
747
+ * Count of messages processed during the specified time range.
748
+ */
749
+ processed: number;
750
+ /**
751
+ * The beginning of the time range for retrieving message performance metrics (inclusive).
752
+ */
753
+ startTime: string;
754
+ }
755
+
756
+ interface MetricsPerformanceResponse {
757
+ performance: MetricsPerformance | null;
758
+ error: string | null;
759
+ }
760
+
761
+ interface MetricsRecipientBehaviour {
762
+ buckets: {
763
+ unsubscribeDelivered: MetricsBucket[];
764
+ unsubscribed: MetricsBucket[];
765
+ };
766
+ /**
767
+ * The end of the time range for retrieving recipient behaviour metrics (exclusive).
768
+ */
769
+ endTime: string;
770
+ /**
771
+ * The beginning of the time range for retrieving recipient behaviour metrics (inclusive).
772
+ */
773
+ startTime: string;
774
+ /**
775
+ * Count of recipients of delivered messages that include at least one of the unsubscribe link or unsubscribe headers. Since the unsubscribe feature requires exactly one recipient per message, this count also represents the total number of delivered messages.
776
+ */
777
+ unsubscribeDelivered: number;
778
+ /**
779
+ * Count of unsubscribed events by recipients.
780
+ */
781
+ unsubscribed: number;
782
+ }
783
+
784
+ interface MetricsRecipientBehaviourResponse {
785
+ behaviour: MetricsRecipientBehaviour | null;
786
+ error: string | null;
787
+ }
788
+
789
+ interface MetricsVolume {
790
+ buckets: {
791
+ delivered: MetricsBucket[];
792
+ dropped: MetricsBucket[];
793
+ processed: MetricsBucket[];
794
+ };
795
+ /**
796
+ * Count of messages delivered during the specified time range.
797
+ */
798
+ delivered: number;
799
+ /**
800
+ * Count of messages dropped during the specified time range.
801
+ */
802
+ dropped: number;
803
+ /**
804
+ * The end of the time range for retrieving message volume metrics (exclusive).
805
+ */
806
+ endTime: string;
807
+ /**
808
+ * Count of messages processed during the specified time range.
809
+ */
810
+ processed: number;
811
+ /**
812
+ * The beginning of the time range for retrieving message volume metrics (inclusive).
813
+ */
814
+ startTime: string;
815
+ }
816
+
817
+ interface MetricsVolumeResponse {
818
+ volume: MetricsVolume | null;
819
+ error: string | null;
820
+ }
821
+
822
+ interface MetricsUsageResponse {
823
+ usage: {
824
+ /**
825
+ * The end date of the current billing period (ISO 8601 format).
826
+ * @example "2025-04-11"
827
+ */
828
+ endDate: string;
829
+ /**
830
+ * The start date of the current billing period (ISO 8601 format).
831
+ * @example "2025-03-12"
832
+ */
833
+ startDate: string;
834
+ /**
835
+ * The total usage for the current billing period.
836
+ */
837
+ total: number;
838
+ } | null;
839
+ error: string | null;
840
+ }
841
+
842
+ interface MetricsBucket {
843
+ /**
844
+ * The number of events or occurrences aggregated within this time period.
845
+ */
846
+ count: number;
847
+ /**
848
+ * The starting date and time of the time period this bucket represents.
849
+ */
850
+ periodStart: string;
851
+ }
852
+
853
+ interface MetricsOptions {
854
+ /**
855
+ * The beginning of the time range for retrieving message metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to one month ago if not provided.
856
+ * @example "2025-05-26"
857
+ */
858
+ startTime?: string;
859
+ /**
860
+ * The end of the time range for retrieving message metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to the current time if not provided.
861
+ * @example "2025-05-31T15:16:17Z"
862
+ */
863
+ endTime?: string;
864
+ /**
865
+ * The ID of the campaign to filter metrics by. If not provided, metrics for all campaigns will be returned.
866
+ */
867
+ campaignId?: string;
868
+ /**
869
+ * The interval for aggregating metrics data.
870
+ * @default "day"
871
+ */
872
+ interval?: "hour" | "day" | "week" | "month";
873
873
  }
874
874
 
875
875
  declare class Metrics {
@@ -926,366 +926,80 @@ declare class Metrics {
926
926
  usage(): Promise<MetricsUsageResponse>;
927
927
  }
928
928
 
929
- type SuppressionsTypes = "transactional" | "non-transactional";
930
-
931
- interface SuppressionsCreateOptions {
932
- /**
933
- * If true, the parent account creates suppression entries for all associated sub-accounts. This field is only applicable to parent accounts. Sub-accounts cannot create entries for other sub-accounts.
934
- * @default false
935
- */
936
- addToSubAccounts?: boolean;
937
- /**
938
- * The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
939
- */
940
- entries: {
941
- /**
942
- * Must be less than `1024` characters.
943
- */
944
- notes?: string;
945
- /**
946
- * The email address to suppress. Must be a valid email address format and less than `255` characters.
947
- */
948
- recipient: string;
949
- /**
950
- * An array of types of suppression to apply to the recipient.
951
- * @default ["non-transactional"]
952
- */
953
- types?: SuppressionsTypes[];
954
- }[];
955
- }
956
-
957
- type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
958
-
959
- interface SuppressionsListOptions {
960
- /**
961
- * The email address of the suppression entry to search for. If provided, the search will return the suppression entry associated with this recipient. If not provided, the search will return all suppression entries for the account.
962
- */
963
- recipient?: string;
964
- /**
965
- * The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.
966
- */
967
- source?: Exclude<SuppressionsSource, "all">;
968
- /**
969
- * The date and/or time before which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`
970
- */
971
- createdBefore?: string;
972
- /**
973
- * The date and/or time after which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`
974
- */
975
- createdAfter?: string;
976
- /**
977
- * The maximum number of suppression entries to return. Must be between `1` and `1000`.
978
- * @default 1000
979
- */
980
- limit?: number;
981
- /**
982
- * The number of suppression entries to skip before returning results.
983
- * @default 0
984
- */
985
- offset?: number;
986
- }
987
-
988
- interface SuppressionsListEntry {
989
- createdAt: string;
990
- notes?: string;
991
- /**
992
- * The email address that is suppressed.
993
- */
994
- recipient: string;
995
- sender?: string;
996
- source: SuppressionsSource;
997
- types: SuppressionsTypes[];
998
- }
999
-
1000
- interface SuppressionsListResponse {
1001
- list: SuppressionsListEntry[];
1002
- error: string | null;
1003
- }
1004
-
1005
- interface DomainsData {
1006
- /**
1007
- * The domain name.
1008
- */
1009
- domain: string;
1010
- /**
1011
- * The abuse policy settings for the domain. These settings determine how spam messages are handled.
1012
- */
1013
- settings?: Partial<{
1014
- /**
1015
- * The abuse policy.
1016
- */
1017
- abusePolicy: "block" | "flag" | "quarantine";
1018
- /**
1019
- * If `true`, this abuse policy overrides the recipient abuse policy.
1020
- */
1021
- abusePolicyOverride: boolean;
1022
- /**
1023
- * The spam header name to use if the abuse policy is set to `flag`.
1024
- */
1025
- spamHeaderName: string;
1026
- /**
1027
- * The spam header value to use if the abuse policy is set to `flag`.
1028
- */
1029
- spamHeaderValue: string;
1030
- }>;
1031
- /**
1032
- * A list of email addresses that are the domain admins for the domain.
1033
- */
1034
- admins?: string[] | null;
1035
- /**
1036
- * The locations of mail servers to which messages will be delivered after filtering.
1037
- */
1038
- downstreamAddresses?: {
1039
- /**
1040
- * The priority of the downstream address. Only addresses with the highest priority (the lowest numerical value) are selected.
1041
- */
1042
- priority: number;
1043
- /**
1044
- * Downstream addresses are selected in proportion to their weights. For example, if there are two downstream addresses, A with weight 40, and B with weight 10, then A is selected 80% of the time and B is selected 20% of the time.
1045
- */
1046
- weight: number;
1047
- /**
1048
- * TCP port on which the downstream mail server is listening.
1049
- */
1050
- port: number;
1051
- /**
1052
- * The canonical hostname of the host providing the service, ending in a dot.
1053
- */
1054
- target: string;
1055
- }[] | null;
1056
- /**
1057
- * A list of aliases for the domain. Mail is accepted for these domains and routed to the `downstreamAddresses` defined for the domain. Must be <= 255 characters
1058
- */
1059
- aliases?: string[] | null;
1060
- /**
1061
- * The subscription `handle` that identifies the subscription that this domain should be provisioned against. Subscription handles can be retrieved from the `subscriptions` service method.
1062
- */
1063
- subscriptionHandle: string;
1064
- }
1065
-
1066
- interface DomainsProvisionOptions {
1067
- /**
1068
- * If present and set to true, the domain will be associated with the api-key that created it. This means that this api-key must be used for inbound-api actions involving this domain (for example adding safe/block list entries, etc).
1069
- */
1070
- associateKey?: boolean;
1071
- /**
1072
- * If present and set to true, the settings (domain settings, downstream addresses, aliases and admins) for the domain will be overwritten with the ones in the request if the domain already exists, unless a section is not included in the request or there is problem updating a setting in which case the previous settings are carried forward.
1073
- */
1074
- overwrite?: boolean;
1075
- }
1076
-
1077
- type DomainsBulkProvisionOptions = DomainsProvisionOptions & Pick<DomainsData, "subscriptionHandle">;
1078
-
1079
- interface DomainsProvisionResponse {
1080
- data: DomainsData | null;
1081
- error: string | null;
1082
- }
1083
-
1084
- interface DomainsBulkProvisionResponse {
1085
- /**
1086
- * If the request was processed successfully, this does not necessarily mean all the domains in the request were successfully provisioned.
1087
- */
1088
- results: {
1089
- /**
1090
- * Domains that were successfully provisioned or updated.
1091
- */
1092
- successes: {
1093
- domain: DomainsData;
1094
- code: number;
1095
- comment?: string;
1096
- }[];
1097
- /**
1098
- * Domains that were not successfully provisioned.
1099
- */
1100
- errors: {
1101
- domain: DomainsData;
1102
- code: number;
1103
- comment?: string;
1104
- }[];
1105
- } | null;
1106
- error: string | null;
1107
- }
1108
-
1109
- interface DomainsListOptions {
1110
- /**
1111
- * A list of domains to fetch. If this parameter is present, only domains whose name matches an item in this list are returned.
1112
- */
1113
- domains?: string[];
1114
- /**
1115
- * The maximum number of domains included in the response. Possible values are 1 to 5000
1116
- * @default 10
1117
- */
1118
- limit?: number;
1119
- /**
1120
- * Offset into the list of domains to return.
1121
- * @default 0
1122
- */
1123
- offset?: number;
1124
- }
1125
-
1126
- interface DomainsListResponse {
1127
- /**
1128
- * A list of domains
1129
- */
1130
- domains: DomainsData[];
1131
- /**
1132
- * The total number of domains that are accessible with the given API key that match the list of domains in the 'domains' parameter. If there is no 'domains' parameter, this field is the total number of domains that are accessible with with this API key. A domain is accessible with a given API key if it is associated with that API key, or if it is not associated with any API key.
1133
- */
1134
- total: number;
1135
- error: string | null;
1136
- }
1137
-
1138
- interface DomainsCreateLoginLinkResponse {
1139
- /**
1140
- * If a user browses to this URL, they will be automatically logged in as a domain admin.
1141
- */
1142
- link: string | null;
1143
- error: string | null;
1144
- }
1145
-
1146
- interface DomainsListDownstreamAddressesOptions {
1147
- /**
1148
- * The number of records to return.
1149
- * @default 10
1150
- */
1151
- limit?: number;
1152
- /**
1153
- * The offset into the records to return.
1154
- * @default 0
1155
- */
1156
- offset?: number;
1157
- }
1158
-
1159
- interface DomainsDownstreamAddress {
1160
- /**
1161
- * TCP port on which the downstream mail server is listening.
1162
- */
1163
- port: number;
1164
- /**
1165
- * The priority of the downstream address. Only addresses with the highest priority (the lowest numerical value) are selected.
1166
- */
1167
- priority: number;
1168
- /**
1169
- * The canonical hostname of the host providing the service, ending in a dot.
1170
- */
1171
- target: string;
1172
- /**
1173
- * Downstream addresses are selected in proportion to their weights. For example, if there are two downstream addresses, A with weight 40, and B with weight 10, then A is selected 80% of the time and B is selected 20% of the time.
1174
- */
1175
- weight: number;
1176
- }
1177
-
1178
- interface DomainsListDownstreamAddressesResponse {
1179
- records: DomainsDownstreamAddress[];
1180
- error: string | null;
1181
- }
1182
-
1183
- type ListNames = "blocklist" | "safelist" | "blacklist" | "whitelist";
1184
-
1185
- interface ListEntryOptions {
1186
- /**
1187
- * This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
1188
- */
1189
- listName: ListNames;
1190
- /**
1191
- * This can be a domain, email address, or IP address. The type of the entry is automatically determined based on the value.
1192
- */
1193
- item: string;
1194
- }
1195
-
1196
- interface ListEntry {
1197
- action: Extract<ListNames, "blocklist" | "safelist">;
1198
- item: string;
1199
- type: "domain" | "email_address" | "ip_address";
1200
- }
1201
-
1202
- interface ListEntryResponse {
1203
- entry: ListEntry | null;
1204
- error: string | null;
1205
- }
1206
-
1207
- interface ListEntriesResponse {
1208
- entries: ListEntry[];
1209
- error: string | null;
1210
- }
1211
-
1212
- interface UsersCreateOptions {
1213
- /**
1214
- * Flag to indicate if the user is a domain admin or a regular user
1215
- * @default false
1216
- */
1217
- admin?: boolean;
1218
- /**
1219
- * Whether or not to filter mail for this recipient. There are three valid values.
1220
- * - `false` - Filtering policy will be applied to messages intended for this recipient. If this would exceed the protected-addresses limit, return an error.
1221
- * - `true` - Filtering policy will not be applied to messages intended for this recipient.
1222
- * - `compute` - Filtering policy will be applied to messages intended for this recipient. If this would exceed the protected-addresses limit, filtering policy will not be applied, and no error will be returned.
1223
- * @default 'compute'
1224
- */
1225
- filter?: boolean | "compute";
1226
- /**
1227
- * safelist and blocklist entries to be added
1228
- */
1229
- listEntries?: {
1230
- blocklist?: string[];
1231
- safelist?: string[];
1232
- };
1233
- }
1234
-
1235
- interface UsersCreateResponse {
1236
- user: {
1237
- email: string;
1238
- roles: string[];
1239
- filter?: boolean;
1240
- listEntries: {
1241
- item: string;
1242
- type: "domain" | "email_address" | "ip_address";
1243
- action: "safelist" | "blocklist";
1244
- }[];
1245
- } | null;
1246
- error: string | null;
1247
- }
1248
-
1249
- interface ServiceSubscriptionsResponse {
1250
- subscriptions: {
1251
- active: boolean;
1252
- activeAccountsCount: number;
1253
- handle: string;
1254
- limits: {
1255
- featureHandle: string;
1256
- value: string;
1257
- }[];
1258
- plan: {
1259
- handle: string;
1260
- name: string;
1261
- };
1262
- }[];
1263
- error: string | null;
1264
- }
1265
-
1266
- interface ServiceReportOptions {
1267
- /**
1268
- * The report type. It can be either `false_negative` or `false_positive`.
1269
- */
1270
- type: "false_negative" | "false_positive";
1271
- /**
1272
- * The full, unaltered message content in accordance with the RFC 2822 specifications without dot stuffing.
1273
- */
1274
- messageContent: string;
1275
- /**
1276
- * The SMTP envelope information
1277
- */
1278
- smtpEnvelopeInformation?: {
1279
- ehlo: string;
1280
- mailFrom: string;
1281
- rcptTo: string;
1282
- };
1283
- /**
1284
- * The sending host information.
1285
- */
1286
- sendingHostInformation?: {
1287
- name: string;
1288
- };
929
+ type SuppressionsTypes = "transactional" | "non-transactional";
930
+
931
+ interface SuppressionsCreateOptions {
932
+ /**
933
+ * If true, the parent account creates suppression entries for all associated sub-accounts. This field is only applicable to parent accounts. Sub-accounts cannot create entries for other sub-accounts.
934
+ * @default false
935
+ */
936
+ addToSubAccounts?: boolean;
937
+ /**
938
+ * The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
939
+ */
940
+ entries: {
941
+ /**
942
+ * Must be less than `1024` characters.
943
+ */
944
+ notes?: string;
945
+ /**
946
+ * The email address to suppress. Must be a valid email address format and less than `255` characters.
947
+ */
948
+ recipient: string;
949
+ /**
950
+ * An array of types of suppression to apply to the recipient.
951
+ * @default ["non-transactional"]
952
+ */
953
+ types?: SuppressionsTypes[];
954
+ }[];
955
+ }
956
+
957
+ type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
958
+
959
+ interface SuppressionsListOptions {
960
+ /**
961
+ * The email address of the suppression entry to search for. If provided, the search will return the suppression entry associated with this recipient. If not provided, the search will return all suppression entries for the account.
962
+ */
963
+ recipient?: string;
964
+ /**
965
+ * The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.
966
+ */
967
+ source?: Exclude<SuppressionsSource, "all">;
968
+ /**
969
+ * The date and/or time before which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`
970
+ */
971
+ createdBefore?: string;
972
+ /**
973
+ * The date and/or time after which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`
974
+ */
975
+ createdAfter?: string;
976
+ /**
977
+ * The maximum number of suppression entries to return. Must be between `1` and `1000`.
978
+ * @default 1000
979
+ */
980
+ limit?: number;
981
+ /**
982
+ * The number of suppression entries to skip before returning results.
983
+ * @default 0
984
+ */
985
+ offset?: number;
986
+ }
987
+
988
+ interface SuppressionsListEntry {
989
+ createdAt: string;
990
+ notes?: string;
991
+ /**
992
+ * The email address that is suppressed.
993
+ */
994
+ recipient: string;
995
+ sender?: string;
996
+ source: SuppressionsSource;
997
+ types: SuppressionsTypes[];
998
+ }
999
+
1000
+ interface SuppressionsListResponse {
1001
+ list: SuppressionsListEntry[];
1002
+ error: string | null;
1289
1003
  }
1290
1004
 
1291
1005
  declare class Suppressions {
@@ -1297,7 +1011,7 @@ declare class Suppressions {
1297
1011
  * @example
1298
1012
  * ```ts
1299
1013
  * const mailchannels = new MailChannels('your-api-key')
1300
- * const response = await mailchannels.suppressions.create({
1014
+ * const { success } = await mailchannels.suppressions.create({
1301
1015
  * // ...
1302
1016
  * });
1303
1017
  */
@@ -1309,7 +1023,7 @@ declare class Suppressions {
1309
1023
  * @example
1310
1024
  * ```ts
1311
1025
  * const mailchannels = new MailChannels('your-api-key')
1312
- * const response = await mailchannels.suppressions.delete('name@example.com', 'api');
1026
+ * const { success } = await mailchannels.suppressions.delete('name@example.com', 'api');
1313
1027
  * ```
1314
1028
  */
1315
1029
  delete(recipient: string, source?: SuppressionsSource): Promise<SuccessResponse>;
@@ -1318,13 +1032,247 @@ declare class Suppressions {
1318
1032
  * @example
1319
1033
  * ```ts
1320
1034
  * const mailchannels = new MailChannels('your-api-key')
1321
- * const response = await mailchannels.suppressions.list();
1035
+ * const { list }= await mailchannels.suppressions.list();
1322
1036
  * ```
1323
1037
  * @param options - Options to filter and customize the suppression entries retrieval.
1324
1038
  */
1325
1039
  list(options?: SuppressionsListOptions): Promise<SuppressionsListResponse>;
1326
1040
  }
1327
1041
 
1042
+ type ListNames = "blocklist" | "safelist" | "blacklist" | "whitelist";
1043
+
1044
+ interface ListEntryOptions {
1045
+ /**
1046
+ * This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
1047
+ */
1048
+ listName: ListNames;
1049
+ /**
1050
+ * This can be a domain, email address, or IP address. The type of the entry is automatically determined based on the value.
1051
+ */
1052
+ item: string;
1053
+ }
1054
+
1055
+ interface ListEntry {
1056
+ action: Extract<ListNames, "blocklist" | "safelist">;
1057
+ item: string;
1058
+ type: "domain" | "email_address" | "ip_address";
1059
+ }
1060
+
1061
+ interface ListEntryResponse {
1062
+ entry: ListEntry | null;
1063
+ error: string | null;
1064
+ }
1065
+
1066
+ interface ListEntriesResponse {
1067
+ entries: ListEntry[];
1068
+ error: string | null;
1069
+ }
1070
+
1071
+ interface DomainsData {
1072
+ /**
1073
+ * The domain name.
1074
+ */
1075
+ domain: string;
1076
+ /**
1077
+ * The abuse policy settings for the domain. These settings determine how spam messages are handled.
1078
+ */
1079
+ settings?: Partial<{
1080
+ /**
1081
+ * The abuse policy.
1082
+ */
1083
+ abusePolicy: "block" | "flag" | "quarantine";
1084
+ /**
1085
+ * If `true`, this abuse policy overrides the recipient abuse policy.
1086
+ */
1087
+ abusePolicyOverride: boolean;
1088
+ /**
1089
+ * The spam header name to use if the abuse policy is set to `flag`.
1090
+ */
1091
+ spamHeaderName: string;
1092
+ /**
1093
+ * The spam header value to use if the abuse policy is set to `flag`.
1094
+ */
1095
+ spamHeaderValue: string;
1096
+ }>;
1097
+ /**
1098
+ * A list of email addresses that are the domain admins for the domain.
1099
+ */
1100
+ admins?: string[] | null;
1101
+ /**
1102
+ * The locations of mail servers to which messages will be delivered after filtering.
1103
+ */
1104
+ downstreamAddresses?: {
1105
+ /**
1106
+ * The priority of the downstream address. Only addresses with the highest priority (the lowest numerical value) are selected.
1107
+ */
1108
+ priority: number;
1109
+ /**
1110
+ * Downstream addresses are selected in proportion to their weights. For example, if there are two downstream addresses, A with weight 40, and B with weight 10, then A is selected 80% of the time and B is selected 20% of the time.
1111
+ */
1112
+ weight: number;
1113
+ /**
1114
+ * TCP port on which the downstream mail server is listening.
1115
+ */
1116
+ port: number;
1117
+ /**
1118
+ * The canonical hostname of the host providing the service, ending in a dot.
1119
+ */
1120
+ target: string;
1121
+ }[] | null;
1122
+ /**
1123
+ * A list of aliases for the domain. Mail is accepted for these domains and routed to the `downstreamAddresses` defined for the domain. Must be <= 255 characters
1124
+ */
1125
+ aliases?: string[] | null;
1126
+ /**
1127
+ * The subscription `handle` that identifies the subscription that this domain should be provisioned against. Subscription handles can be retrieved from the `subscriptions` service method.
1128
+ */
1129
+ subscriptionHandle: string;
1130
+ }
1131
+
1132
+ interface DomainsProvisionOptions {
1133
+ /**
1134
+ * If present and set to true, the domain will be associated with the api-key that created it. This means that this api-key must be used for inbound-api actions involving this domain (for example adding safe/block list entries, etc).
1135
+ */
1136
+ associateKey?: boolean;
1137
+ /**
1138
+ * If present and set to true, the settings (domain settings, downstream addresses, aliases and admins) for the domain will be overwritten with the ones in the request if the domain already exists, unless a section is not included in the request or there is problem updating a setting in which case the previous settings are carried forward.
1139
+ */
1140
+ overwrite?: boolean;
1141
+ }
1142
+
1143
+ type DomainsBulkProvisionOptions = DomainsProvisionOptions & Pick<DomainsData, "subscriptionHandle">;
1144
+
1145
+ interface DomainsProvisionResponse {
1146
+ data: DomainsData | null;
1147
+ error: string | null;
1148
+ }
1149
+
1150
+ interface DomainsBulkProvisionResponse {
1151
+ /**
1152
+ * If the request was processed successfully, this does not necessarily mean all the domains in the request were successfully provisioned.
1153
+ */
1154
+ results: {
1155
+ /**
1156
+ * Domains that were successfully provisioned or updated.
1157
+ */
1158
+ successes: {
1159
+ domain: DomainsData;
1160
+ code: number;
1161
+ comment?: string;
1162
+ }[];
1163
+ /**
1164
+ * Domains that were not successfully provisioned.
1165
+ */
1166
+ errors: {
1167
+ domain: DomainsData;
1168
+ code: number;
1169
+ comment?: string;
1170
+ }[];
1171
+ } | null;
1172
+ error: string | null;
1173
+ }
1174
+
1175
+ interface DomainsListOptions {
1176
+ /**
1177
+ * A list of domains to fetch. If this parameter is present, only domains whose name matches an item in this list are returned.
1178
+ */
1179
+ domains?: string[];
1180
+ /**
1181
+ * The maximum number of domains included in the response. Possible values are 1 to 5000
1182
+ * @default 10
1183
+ */
1184
+ limit?: number;
1185
+ /**
1186
+ * Offset into the list of domains to return.
1187
+ * @default 0
1188
+ */
1189
+ offset?: number;
1190
+ }
1191
+
1192
+ interface DomainsListResponse {
1193
+ /**
1194
+ * A list of domains
1195
+ */
1196
+ domains: DomainsData[];
1197
+ /**
1198
+ * The total number of domains that are accessible with the given API key that match the list of domains in the 'domains' parameter. If there is no 'domains' parameter, this field is the total number of domains that are accessible with with this API key. A domain is accessible with a given API key if it is associated with that API key, or if it is not associated with any API key.
1199
+ */
1200
+ total: number;
1201
+ error: string | null;
1202
+ }
1203
+
1204
+ interface DomainsCreateLoginLinkResponse {
1205
+ /**
1206
+ * If a user browses to this URL, they will be automatically logged in as a domain admin.
1207
+ */
1208
+ link: string | null;
1209
+ error: string | null;
1210
+ }
1211
+
1212
+ interface DomainsListDownstreamAddressesOptions {
1213
+ /**
1214
+ * The number of records to return.
1215
+ * @default 10
1216
+ */
1217
+ limit?: number;
1218
+ /**
1219
+ * The offset into the records to return.
1220
+ * @default 0
1221
+ */
1222
+ offset?: number;
1223
+ }
1224
+
1225
+ interface DomainsDownstreamAddress {
1226
+ /**
1227
+ * TCP port on which the downstream mail server is listening.
1228
+ */
1229
+ port: number;
1230
+ /**
1231
+ * The priority of the downstream address. Only addresses with the highest priority (the lowest numerical value) are selected.
1232
+ */
1233
+ priority: number;
1234
+ /**
1235
+ * The canonical hostname of the host providing the service, ending in a dot.
1236
+ */
1237
+ target: string;
1238
+ /**
1239
+ * Downstream addresses are selected in proportion to their weights. For example, if there are two downstream addresses, A with weight 40, and B with weight 10, then A is selected 80% of the time and B is selected 20% of the time.
1240
+ */
1241
+ weight: number;
1242
+ }
1243
+
1244
+ interface DomainsListDownstreamAddressesResponse {
1245
+ records: DomainsDownstreamAddress[];
1246
+ error: string | null;
1247
+ }
1248
+
1249
+ interface DomainsBulkCreateLoginLinkResult {
1250
+ /**
1251
+ * The domain the request was for.
1252
+ */
1253
+ domain: string;
1254
+ code: 200 | 400 | 401 | 403 | 404 | 500;
1255
+ /**
1256
+ * More information about the result of creating the login link.
1257
+ */
1258
+ comment?: string;
1259
+ }
1260
+
1261
+ interface DomainsBulkCreateLoginLink {
1262
+ successes: DomainsBulkCreateLoginLinkResult & {
1263
+ /**
1264
+ * If a user browses to this URL, they will be automatically logged in as a domain admin.
1265
+ */
1266
+ loginLink: string;
1267
+ }[];
1268
+ errors: DomainsBulkCreateLoginLinkResult[];
1269
+ }
1270
+
1271
+ interface DomainsBulkCreateLoginLinksResponse {
1272
+ results: DomainsCreateLoginLink[];
1273
+ error: string | null;
1274
+ }
1275
+
1328
1276
  declare class Domains {
1329
1277
  protected mailchannels: MailChannelsClient;
1330
1278
  constructor(mailchannels: MailChannelsClient);
@@ -1432,7 +1380,7 @@ declare class Domains {
1432
1380
  */
1433
1381
  createLoginLink(domain: string): Promise<DomainsCreateLoginLinkResponse>;
1434
1382
  /**
1435
- * Sets the list of downstream addreses for the domain. This action deletes any existing downstream address for the domain before creating new ones. If the `records` parameter is an empty array, all downstream address records will be deleted.
1383
+ * Sets the list of downstream addresses for the domain. This action deletes any existing downstream address for the domain before creating new ones. If the `records` parameter is an empty array, all downstream address records will be deleted.
1436
1384
  * @param domain - The domain name.
1437
1385
  * @param records - The list of records to set for the domain. A maximum of 10 records can be set.
1438
1386
  * @example
@@ -1471,6 +1419,16 @@ declare class Domains {
1471
1419
  * ```
1472
1420
  */
1473
1421
  updateApiKey(domain: string, key: string): Promise<SuccessResponse>;
1422
+ /**
1423
+ * Generate a batch of links that allow a user to log in as a domain administrator to their different domains.
1424
+ * @param domains - The list of domain names. Maximum of `1000` links per request.
1425
+ * @example
1426
+ * ```ts
1427
+ * const mailchannels = new MailChannels('your-api-key')
1428
+ * const { results } = await mailchannels.domains.bulkCreateLoginLinks(['example.com', 'example2.com'])
1429
+ * ```
1430
+ */
1431
+ bulkCreateLoginLinks(domains: string[]): Promise<DomainsBulkCreateLoginLinksResponse>;
1474
1432
  }
1475
1433
 
1476
1434
  declare class Lists {
@@ -1514,6 +1472,43 @@ declare class Lists {
1514
1472
  deleteListEntry(options: ListEntryOptions): Promise<SuccessResponse>;
1515
1473
  }
1516
1474
 
1475
+ interface UsersCreateOptions {
1476
+ /**
1477
+ * Flag to indicate if the user is a domain admin or a regular user
1478
+ * @default false
1479
+ */
1480
+ admin?: boolean;
1481
+ /**
1482
+ * Whether or not to filter mail for this recipient. There are three valid values.
1483
+ * - `false` - Filtering policy will be applied to messages intended for this recipient. If this would exceed the protected-addresses limit, return an error.
1484
+ * - `true` - Filtering policy will not be applied to messages intended for this recipient.
1485
+ * - `compute` - Filtering policy will be applied to messages intended for this recipient. If this would exceed the protected-addresses limit, filtering policy will not be applied, and no error will be returned.
1486
+ * @default 'compute'
1487
+ */
1488
+ filter?: boolean | "compute";
1489
+ /**
1490
+ * safelist and blocklist entries to be added
1491
+ */
1492
+ listEntries?: {
1493
+ blocklist?: string[];
1494
+ safelist?: string[];
1495
+ };
1496
+ }
1497
+
1498
+ interface UsersCreateResponse {
1499
+ user: {
1500
+ email: string;
1501
+ roles: string[];
1502
+ filter?: boolean;
1503
+ listEntries: {
1504
+ item: string;
1505
+ type: "domain" | "email_address" | "ip_address";
1506
+ action: "safelist" | "blocklist";
1507
+ }[];
1508
+ } | null;
1509
+ error: string | null;
1510
+ }
1511
+
1517
1512
  declare class Users {
1518
1513
  protected mailchannels: MailChannelsClient;
1519
1514
  constructor(mailchannels: MailChannelsClient);
@@ -1571,6 +1566,48 @@ declare class Users {
1571
1566
  deleteListEntry(email: string, options: ListEntryOptions): Promise<SuccessResponse>;
1572
1567
  }
1573
1568
 
1569
+ interface ServiceSubscriptionsResponse {
1570
+ subscriptions: {
1571
+ active: boolean;
1572
+ activeAccountsCount: number;
1573
+ handle: string;
1574
+ limits: {
1575
+ featureHandle: string;
1576
+ value: string;
1577
+ }[];
1578
+ plan: {
1579
+ handle: string;
1580
+ name: string;
1581
+ };
1582
+ }[];
1583
+ error: string | null;
1584
+ }
1585
+
1586
+ interface ServiceReportOptions {
1587
+ /**
1588
+ * The report type. It can be either `false_negative` or `false_positive`.
1589
+ */
1590
+ type: "false_negative" | "false_positive";
1591
+ /**
1592
+ * The full, unaltered message content in accordance with the RFC 2822 specifications without dot stuffing.
1593
+ */
1594
+ messageContent: string;
1595
+ /**
1596
+ * The SMTP envelope information
1597
+ */
1598
+ smtpEnvelopeInformation?: {
1599
+ ehlo: string;
1600
+ mailFrom: string;
1601
+ rcptTo: string;
1602
+ };
1603
+ /**
1604
+ * The sending host information.
1605
+ */
1606
+ sendingHostInformation?: {
1607
+ name: string;
1608
+ };
1609
+ }
1610
+
1574
1611
  declare class Service {
1575
1612
  protected mailchannels: MailChannelsClient;
1576
1613
  constructor(mailchannels: MailChannelsClient);
@@ -1607,4 +1644,4 @@ declare class Service {
1607
1644
  }
1608
1645
 
1609
1646
  export { Domains as D, Emails as E, Lists as L, MailChannelsClient as M, SubAccounts as S, Users as U, Webhooks as W, Metrics as a, Suppressions as b, Service as c };
1610
- export type { SuppressionsListResponse as $, SubAccountsLimit as A, SubAccountsLimitResponse as B, SubAccountsUsage as C, SubAccountsUsageResponse as F, MetricsBucket as G, MetricsOptions as H, MetricsEngagement as I, MetricsEngagementResponse as J, MetricsPerformance as K, MetricsPerformanceResponse as N, MetricsRecipientBehaviour as O, MetricsRecipientBehaviourResponse as P, MetricsVolume as Q, MetricsVolumeResponse as R, MetricsUsageResponse as T, SuppressionsTypes as V, SuppressionsCreateOptions as X, SuppressionsSource as Y, SuppressionsListOptions as Z, SuppressionsListEntry as _, DomainsData as a0, DomainsProvisionOptions as a1, DomainsBulkProvisionOptions as a2, DomainsProvisionResponse as a3, DomainsBulkProvisionResponse as a4, DomainsListOptions as a5, DomainsListResponse as a6, DomainsCreateLoginLinkResponse as a7, DomainsListDownstreamAddressesOptions as a8, DomainsDownstreamAddress as a9, DomainsListDownstreamAddressesResponse as aa, ListNames as ab, ListEntryOptions as ac, ListEntry as ad, ListEntryResponse as ae, ListEntriesResponse as af, UsersCreateOptions as ag, UsersCreateResponse as ah, ServiceSubscriptionsResponse as ai, ServiceReportOptions as aj, SuccessResponse as ak, EmailsSendRecipient as d, EmailsSendAttachment as e, EmailsSendTracking as f, EmailsSendOptionsBase as g, EmailsSendOptions as h, EmailsSendResponse as i, EmailsCheckDomainDkim as j, EmailsCheckDomainOptions as k, EmailsCheckDomainVerdict as l, EmailsCheckDomainResponse as m, WebhooksListResponse as n, WebhooksSigningKeyResponse as o, WebhooksValidateResponse as p, SubAccountsAccount as q, SubAccountsCreateResponse as r, SubAccountsListOptions as s, SubAccountsListResponse as t, SubAccountsApiKey as u, SubAccountsCreateApiKeyResponse as v, SubAccountsListApiKeyResponse as w, SubAccountsSmtpPassword as x, SubAccountsCreateSmtpPasswordResponse as y, SubAccountsListSmtpPasswordResponse as z };
1647
+ export type { SuppressionsListResponse as $, SubAccountsLimit as A, SubAccountsLimitResponse as B, SubAccountsUsage as C, SubAccountsUsageResponse as F, MetricsBucket as G, MetricsOptions as H, MetricsEngagement as I, MetricsEngagementResponse as J, MetricsPerformance as K, MetricsPerformanceResponse as N, MetricsRecipientBehaviour as O, MetricsRecipientBehaviourResponse as P, MetricsVolume as Q, MetricsVolumeResponse as R, MetricsUsageResponse as T, SuppressionsTypes as V, SuppressionsCreateOptions as X, SuppressionsSource as Y, SuppressionsListOptions as Z, SuppressionsListEntry as _, DomainsData as a0, DomainsProvisionOptions as a1, DomainsBulkProvisionOptions as a2, DomainsProvisionResponse as a3, DomainsBulkProvisionResponse as a4, DomainsListOptions as a5, DomainsListResponse as a6, DomainsCreateLoginLinkResponse as a7, DomainsListDownstreamAddressesOptions as a8, DomainsDownstreamAddress as a9, DomainsListDownstreamAddressesResponse as aa, DomainsBulkCreateLoginLinkResult as ab, DomainsBulkCreateLoginLink as ac, DomainsBulkCreateLoginLinksResponse as ad, ListNames as ae, ListEntryOptions as af, ListEntry as ag, ListEntryResponse as ah, ListEntriesResponse as ai, UsersCreateOptions as aj, UsersCreateResponse as ak, ServiceSubscriptionsResponse as al, ServiceReportOptions as am, SuccessResponse as an, EmailsSendRecipient as d, EmailsSendAttachment as e, EmailsSendTracking as f, EmailsSendOptionsBase as g, EmailsSendOptions as h, EmailsSendResponse as i, EmailsCheckDomainDkim as j, EmailsCheckDomainOptions as k, EmailsCheckDomainVerdict as l, EmailsCheckDomainResponse as m, WebhooksListResponse as n, WebhooksSigningKeyResponse as o, WebhooksValidateResponse as p, SubAccountsAccount as q, SubAccountsCreateResponse as r, SubAccountsListOptions as s, SubAccountsListResponse as t, SubAccountsApiKey as u, SubAccountsCreateApiKeyResponse as v, SubAccountsListApiKeyResponse as w, SubAccountsSmtpPassword as x, SubAccountsCreateSmtpPasswordResponse as y, SubAccountsListSmtpPasswordResponse as z };