@agentisend/sdk-node 0.2.0 → 0.4.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/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ApiKey, AutomationRun, ReceivedAttachment, ReceivedEmail, ReceivedThread, SentAttachment, RequestLogEntry, EventDefinition, EventFieldType, ApiKeyPermission, BatchItemResult, CreatedApiKey, CreatedWebhookEndpoint, DeadLetter, Deleted, Domain, DomainRegion, LegacyDomainRegion, Email, EventType, Limit, LimitPeriod, ListEmailsQuery, ListQuery, MetricsQuery, ExplainReport, Page, PreflightReport, ReplayResult, ContactTopic, SendEmailPayload, ServiceStatus, SuppressionBatchItem, AuditEntry, TeamInvite, TeamMember, Topic, BillingPlan, TrustStanding, WebhookEndpoint } from './types.js';
1
+ import type { ApiKey, AutomationRun, ReceivedAttachment, ReceivedEmail, ReceivedThread, SentAttachment, RequestLogEntry, EventDefinition, EventFieldType, ApiKeyPermission, BatchItemResult, CreatedApiKey, CreatedWebhookEndpoint, DeadLetter, Deleted, Domain, DomainRegion, DomainSetup, LegacyDomainRegion, Email, EventType, Limit, LimitPeriod, ListEmailsQuery, ListQuery, MetricsQuery, ExplainReport, Page, PreflightReport, ReplayResult, ContactTopic, SendEmailPayload, ServiceStatus, SuppressionBatchItem, AuditEntry, TeamInvite, TeamMember, Topic, BillingPlan, TrustStanding, WebhookEndpoint } from './types.js';
2
2
  export declare const DEFAULT_BASE_URL = "https://api.agentisend.com";
3
3
  export interface FetchResponse {
4
4
  status: number;
@@ -6,6 +6,8 @@ export interface FetchResponse {
6
6
  get(name: string): string | null;
7
7
  };
8
8
  text(): Promise<string>;
9
+ /** Read for downloads (an attachment, an .eml). Falls back to text() when absent. */
10
+ arrayBuffer?(): Promise<ArrayBuffer>;
9
11
  }
10
12
  export type FetchLike = (url: string, init: {
11
13
  method: string;
@@ -19,6 +21,7 @@ export interface ClientOptions {
19
21
  /** Injected for tests and for runtimes without a global fetch. */
20
22
  fetch?: FetchLike;
21
23
  timeoutMs?: number;
24
+ /** Defaults to `agentisend-node/<SDK version> node/<Node version>`. */
22
25
  userAgent?: string;
23
26
  }
24
27
  export interface RequestOptions {
@@ -29,6 +32,12 @@ export interface RequestOptions {
29
32
  */
30
33
  idempotencyKey?: string;
31
34
  signal?: AbortSignal;
35
+ /**
36
+ * Extra request headers, merged in after idempotency-key. Used for
37
+ * `x-batch-validation` on `emails.batch` (RESENDCOMPAT-5/-6) — never for
38
+ * `authorization`, `accept` or `content-type`, which this client owns.
39
+ */
40
+ headers?: Record<string, string>;
32
41
  }
33
42
  /**
34
43
  * Build an idempotency key in the shape that debugs well: `<what>/<which>`,
@@ -55,7 +64,17 @@ export declare class AgentiSend {
55
64
  private readonly timeoutMs;
56
65
  private readonly userAgent;
57
66
  constructor(apiKey?: string, options?: ClientOptions);
67
+ private send;
58
68
  request<T>(raw: RawRequest): Promise<T>;
69
+ /**
70
+ * A response that is not JSON: an attachment, an .eml, the CSV export. A
71
+ * refusal still arrives as the JSON error envelope and throws the same
72
+ * AgentiSendError that request() throws.
73
+ */
74
+ requestBytes(raw: Omit<RawRequest, 'body'>): Promise<Uint8Array>;
75
+ /** The same download, decoded as UTF-8: an .eml, raw MIME, a CSV. */
76
+ requestText(raw: Omit<RawRequest, 'body'>): Promise<string>;
77
+ private fail;
59
78
  readonly emails: {
60
79
  send: (payload: SendEmailPayload, options?: RequestOptions) => Promise<{
61
80
  id: string;
@@ -75,8 +94,15 @@ export declare class AgentiSend {
75
94
  id: string;
76
95
  status: string;
77
96
  }>;
97
+ /** Delete a sent email and its events for good. A scheduled one must be cancelled first. */
98
+ remove: (id: string, options?: RequestOptions) => Promise<{
99
+ id: string;
100
+ status: string;
101
+ }>;
78
102
  /** Move an email to a new time. Works from scheduled AND canceled. */
79
- reschedule: (id: string, scheduledAt: string, options?: RequestOptions) => Promise<{
103
+ reschedule: (id: string, scheduledAt: string, options?: RequestOptions & {
104
+ timezone?: string;
105
+ }) => Promise<{
80
106
  id: string;
81
107
  status: string;
82
108
  scheduled_at: string;
@@ -89,6 +115,41 @@ export declare class AgentiSend {
89
115
  explain: (id: string) => Promise<ExplainReport>;
90
116
  /** Run every gate without sending or spending. Free, always. */
91
117
  preflight: (payload: SendEmailPayload) => Promise<PreflightReport>;
118
+ /** Deliverability lint without sending: a 0-100 placement score and every finding with its fix. */
119
+ lint: (payload: {
120
+ from: string;
121
+ to: string[];
122
+ subject?: string;
123
+ html?: string;
124
+ text?: string;
125
+ headers?: Record<string, string>;
126
+ }) => Promise<Record<string, unknown>>;
127
+ /** Every event recorded for one message, oldest first. */
128
+ events: (id: string, query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
129
+ /** The exact RFC 5322 source of this message, as text. */
130
+ mime: (id: string) => Promise<string>;
131
+ /** The same message as a .eml file. */
132
+ eml: (id: string) => Promise<string>;
133
+ /** One attachment's bytes, as they were sent. */
134
+ attachment: (id: string, attachmentId: string) => Promise<Uint8Array>;
135
+ /** Cancel scheduled or queued messages by id, or everything scheduled before a time. */
136
+ bulkCancel: (payload: {
137
+ ids?: string[];
138
+ before?: string;
139
+ }, options?: RequestOptions) => Promise<Record<string, unknown>>;
140
+ /** The message log as CSV, with the same filters as list. */
141
+ export: (query?: {
142
+ status?: string;
143
+ q?: string;
144
+ from?: string;
145
+ to?: string;
146
+ domain?: string;
147
+ bounce_class?: string;
148
+ api_key_id?: string;
149
+ template_id?: string;
150
+ since?: string;
151
+ until?: string;
152
+ }) => Promise<string>;
92
153
  /**
93
154
  * Move a scheduled email. The same act as `reschedule`, under the verb a
94
155
  * Resend integration already calls (M5.5).
@@ -115,6 +176,16 @@ export declare class AgentiSend {
115
176
  scopes?: string[];
116
177
  }, options?: RequestOptions) => Promise<ApiKey>;
117
178
  delete: (id: string, options?: RequestOptions) => Promise<Deleted>;
179
+ /**
180
+ * Issue a new token for this key. The old one keeps working for
181
+ * `grace_hours` (0, 1 or 24) so a deploy can pick up the new one.
182
+ */
183
+ rotate: (id: string, payload: {
184
+ grace_hours: 0 | 1 | 24;
185
+ }, options?: RequestOptions) => Promise<CreatedApiKey & {
186
+ rotated_at: string;
187
+ previous_key_expires_at: string | null;
188
+ }>;
118
189
  };
119
190
  readonly domains: {
120
191
  create: (payload: {
@@ -122,23 +193,52 @@ export declare class AgentiSend {
122
193
  region?: DomainRegion | LegacyDomainRegion;
123
194
  tracking?: boolean;
124
195
  tracking_subdomain?: string;
196
+ return_path_subdomain?: string;
197
+ open_tracking?: boolean;
198
+ click_tracking?: boolean;
199
+ tls_mode?: "opportunistic" | "enforced";
125
200
  }, options?: RequestOptions) => Promise<Domain>;
126
201
  list: (query?: ListQuery) => Promise<Page<Domain>>;
127
202
  get: (id: string) => Promise<Domain>;
203
+ /** One-shot DNS sheet: zone file, copy-paste commands, provider. */
204
+ setup: (id: string) => Promise<DomainSetup>;
128
205
  verify: (id: string, options?: RequestOptions) => Promise<Domain>;
129
- /** A8 + P3b: click/open tracking, or a new tracking_subdomain. Never removed. */
206
+ /** A8 + P3b: click/open tracking, TLS mode, or a new tracking_subdomain. Never removed. */
130
207
  update: (id: string, payload: {
131
208
  click_tracking?: boolean;
132
209
  open_tracking?: boolean;
133
210
  tracking_subdomain?: string;
211
+ tls_mode?: "opportunistic" | "enforced";
134
212
  }, options?: RequestOptions) => Promise<Domain>;
135
213
  delete: (id: string, options?: RequestOptions) => Promise<Deleted>;
214
+ /**
215
+ * Long-poll until the domain is verified or failed, or `timeout` seconds
216
+ * (0-25) pass; 0 is a snapshot. It does not re-check DNS: the server checks
217
+ * on its own, and `next_poll_seconds` says when to ask again.
218
+ */
219
+ wait: (id: string, query?: {
220
+ timeout?: number;
221
+ }) => Promise<{
222
+ id: string;
223
+ name: string;
224
+ status: string;
225
+ progress: unknown;
226
+ reason: string | null;
227
+ deadline: string;
228
+ next_poll_seconds: number | null;
229
+ }>;
230
+ /** Newest-first timeline: each DNS check, each record found or lost, verified, deleted. */
231
+ events: (id: string, query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
232
+ /** Alias of setup: detects the DNS provider and returns the exact records to add. */
233
+ connect: (id: string) => Promise<DomainSetup>;
136
234
  };
137
235
  readonly webhooks: {
138
236
  create: (payload: {
139
237
  url: string;
140
238
  events?: EventType[];
141
239
  svix_compat?: boolean;
240
+ /** `resend` stores Resend's envelope (`created_at`, `data.to`, `data.bounce`). */
241
+ payload_format?: "native" | "resend";
142
242
  }, options?: RequestOptions) => Promise<CreatedWebhookEndpoint>;
143
243
  list: (query?: ListQuery) => Promise<Page<WebhookEndpoint>>;
144
244
  get: (id: string) => Promise<WebhookEndpoint>;
@@ -158,6 +258,21 @@ export declare class AgentiSend {
158
258
  limit?: number;
159
259
  cursor?: string;
160
260
  }) => Promise<Page<DeadLetter>>;
261
+ /** Every delivery to this endpoint, with each attempt and what the receiver answered. */
262
+ deliveries: (id: string, query?: ListQuery & {
263
+ id?: string;
264
+ event_type?: EventType;
265
+ status?: "pending" | "retrying" | "delivered" | "dead_lettered";
266
+ since?: string;
267
+ until?: string;
268
+ }) => Promise<Page<Record<string, unknown>>>;
269
+ /** A new signing secret, returned once. The previous one keeps verifying for 24 hours. */
270
+ rotateSecret: (id: string, options?: RequestOptions) => Promise<{
271
+ id: string;
272
+ secret: string;
273
+ rotated_at: string;
274
+ previous_secret_expires_at: string;
275
+ }>;
161
276
  };
162
277
  readonly limits: {
163
278
  list: (query?: ListQuery) => Promise<Page<Limit>>;
@@ -170,6 +285,16 @@ export declare class AgentiSend {
170
285
  /** Stops the key sending, immediately. Takes effect on its next request. */
171
286
  kill: (apiKeyId: string, reason?: string, options?: RequestOptions) => Promise<Limit>;
172
287
  resume: (apiKeyId: string, options?: RequestOptions) => Promise<Limit>;
288
+ /**
289
+ * Stop every key on the account sending, in one call. Undoing it is a
290
+ * person's decision, made in the console; no key can resume it.
291
+ */
292
+ killAll: (reason?: string, options?: RequestOptions) => Promise<{
293
+ paused: boolean;
294
+ affected_key_ids: string[];
295
+ reason: string | null;
296
+ at: string;
297
+ }>;
173
298
  };
174
299
  /** M5.5 — the rest of the verb surface a Resend integration calls. */
175
300
  /**
@@ -186,6 +311,8 @@ export declare class AgentiSend {
186
311
  route?: string;
187
312
  error_code?: string;
188
313
  api_key_id?: string;
314
+ q?: string;
315
+ source?: "api" | "console" | "all";
189
316
  }) => Promise<Page<RequestLogEntry>>;
190
317
  get: (id: string) => Promise<RequestLogEntry>;
191
318
  };
@@ -201,6 +328,11 @@ export declare class AgentiSend {
201
328
  until?: string;
202
329
  }) => Promise<Page<ReceivedEmail>>;
203
330
  get: (id: string) => Promise<ReceivedEmail>;
331
+ /** Delete one received email for good. */
332
+ remove: (id: string, options?: RequestOptions) => Promise<{
333
+ id: string;
334
+ status: string;
335
+ }>;
204
336
  threads: (query?: ListQuery) => Promise<Page<ReceivedThread>>;
205
337
  reply: (id: string, body: {
206
338
  html?: string;
@@ -219,6 +351,10 @@ export declare class AgentiSend {
219
351
  }[];
220
352
  }>;
221
353
  attachments: (id: string) => Promise<Page<ReceivedAttachment>>;
354
+ /** One received attachment's bytes, served as an inert download. */
355
+ attachment: (id: string, attachmentId: string) => Promise<Uint8Array>;
356
+ /** The message exactly as it arrived, headers and all. */
357
+ raw: (id: string) => Promise<string>;
222
358
  };
223
359
  /**
224
360
  * M5.7 — the custom-event registry. Declaring an event's fields turns a
@@ -284,17 +420,76 @@ export declare class AgentiSend {
284
420
  status?: "active" | "unsubscribed";
285
421
  properties?: Record<string, unknown>;
286
422
  }, options?: RequestOptions) => Promise<Record<string, unknown>>;
423
+ /** Up to 1,000 contacts. Each item succeeds or fails on its own. */
424
+ batch: (payload: {
425
+ contacts: Record<string, unknown>[];
426
+ }, options?: RequestOptions) => Promise<{
427
+ data: Record<string, unknown>[];
428
+ }>;
429
+ /** CSV in `csv`. Finishes in this response. `on_conflict` defaults to skip. */
430
+ importCsv: (payload: {
431
+ csv: string;
432
+ column_map?: Record<string, string>;
433
+ on_conflict?: "skip" | "upsert";
434
+ }, options?: RequestOptions) => Promise<Record<string, unknown>>;
435
+ /** Segments whose rules include this contact. The id may be an email. */
436
+ segments: (id: string) => Promise<Page<Record<string, unknown>>>;
437
+ /** Refused: membership is the segment's rules. Names PATCH /segments/:id. */
438
+ addSegment: (id: string, segmentId: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
439
+ /** Refused: membership is the segment's rules. Names PATCH /segments/:id. */
440
+ removeSegment: (id: string, segmentId: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
441
+ /** Lift a marketing unsubscribe after the person opts back in. */
442
+ resubscribe: (id: string, payload: {
443
+ consent_source: string;
444
+ consent_at: string;
445
+ }, options?: RequestOptions) => Promise<Record<string, unknown>>;
446
+ };
447
+ /** Property names and types already stored on the account. */
448
+ readonly contactProperties: {
449
+ list: () => Promise<Page<Record<string, unknown>>>;
450
+ get: (id: string) => Promise<Record<string, unknown>>;
451
+ };
452
+ /**
453
+ * The same contact list, at the paths the official SDK uses when a call
454
+ * names an audience. This account has one contact list.
455
+ */
456
+ readonly audiences: {
457
+ createContact: (audienceId: string, payload: {
458
+ email: string;
459
+ properties?: Record<string, unknown>;
460
+ }, options?: RequestOptions) => Promise<Record<string, unknown>>;
461
+ listContacts: (audienceId: string, query?: ListQuery & {
462
+ email?: string;
463
+ }) => Promise<Page<Record<string, unknown>>>;
464
+ getContact: (audienceId: string, id: string) => Promise<Record<string, unknown>>;
465
+ updateContact: (audienceId: string, id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
466
+ deleteContact: (audienceId: string, id: string, options?: RequestOptions) => Promise<Deleted>;
287
467
  };
288
468
  readonly broadcasts: {
289
469
  create: (payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
290
470
  list: (query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
291
471
  get: (id: string) => Promise<Record<string, unknown>>;
472
+ /** Sent, delivered, opened, clicked, bounced, complained and unsubscribed. A test send is not included. */
473
+ stats: (id: string) => Promise<Record<string, unknown>>;
474
+ /** The rendered message. Nothing is sent. */
475
+ preview: (id: string) => Promise<{
476
+ subject: string;
477
+ html: string;
478
+ }>;
292
479
  update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
293
- send: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
480
+ /**
481
+ * Send now, or pass `scheduledAt` to schedule it instead (the same time
482
+ * grammar PATCH /broadcasts/:id accepts). Returns 200 when the broadcast
483
+ * has finished sending or was scheduled, and 202 while it is still
484
+ * sending. A 202 has status sending.
485
+ */
486
+ send: (id: string, payload?: {
487
+ scheduledAt?: string;
488
+ }, options?: RequestOptions) => Promise<Record<string, unknown>>;
294
489
  /** Archive, not delete: a sent broadcast is history worth keeping (F14). */
295
490
  archive: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
296
491
  messages: (id: string, query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
297
- /** Cancel a scheduled broadcast: it returns to draft, editable again. */
492
+ /** Cancel a scheduled broadcast, or stop one that is still sending. Mail already handed off is not pulled back. A scheduled broadcast returns to draft. */
298
493
  cancel: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
299
494
  };
300
495
  readonly templates: {
@@ -309,10 +504,34 @@ export declare class AgentiSend {
309
504
  update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
310
505
  /** Snapshot the draft as an immutable version. Nothing already sent changes. */
311
506
  publish: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
312
- render: (id: string, values?: Record<string, unknown>, versionNumber?: number) => Promise<{
507
+ /**
508
+ * `rendered` is the HTML; `text` is the plain-text part a markdown
509
+ * template yields. `preview: true` shows a missing required variable as
510
+ * `{{name}}` and lists it in `missing_variables` instead of failing.
511
+ */
512
+ render: (id: string, values?: Record<string, unknown>, versionNumber?: number | "draft", options?: {
513
+ preview?: boolean;
514
+ }) => Promise<{
313
515
  rendered: string;
516
+ subject: string;
517
+ text: string | null;
518
+ missing_variables: string[];
314
519
  }>;
520
+ /**
521
+ * Delete a template and its versions. Sent mail keeps its body and its
522
+ * template reference. Refused while a broadcast that has not been sent
523
+ * still uses it.
524
+ */
525
+ delete: (id: string, options?: RequestOptions) => Promise<Deleted>;
315
526
  versions: (id: string) => Promise<Page<Record<string, unknown>>>;
527
+ version: (id: string, versionNumber: number) => Promise<Record<string, unknown>>;
528
+ /** Structured diff between two versions, or between a version and the draft. */
529
+ diff: (id: string, from: number | "draft", to: number | "draft") => Promise<Record<string, unknown>>;
530
+ /**
531
+ * Start a new draft from an older version. History is never rewritten; the
532
+ * live version stays until that draft is published.
533
+ */
534
+ rollback: (id: string, toVersion: number, options?: RequestOptions) => Promise<Record<string, unknown>>;
316
535
  /** Copy a template into a fresh editable draft, history not included. */
317
536
  duplicate: (id: string, payload?: {
318
537
  name?: string;
@@ -323,7 +542,10 @@ export declare class AgentiSend {
323
542
  add: (payload: {
324
543
  email: string;
325
544
  level?: "address" | "domain";
545
+ origin?: "bounce" | "complaint" | "manual";
326
546
  }, options?: RequestOptions) => Promise<Record<string, unknown>>;
547
+ /** The id or the address. */
548
+ get: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
327
549
  remove: (id: string, options?: RequestOptions) => Promise<Deleted>;
328
550
  /** Up to 500 at a time. Each item succeeds or fails on its own. */
329
551
  batchAdd: (emails: string[], level?: "address" | "domain", options?: RequestOptions) => Promise<{
@@ -346,6 +568,10 @@ export declare class AgentiSend {
346
568
  get: (id: string) => Promise<Record<string, unknown>>;
347
569
  update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
348
570
  delete: (id: string, options?: RequestOptions) => Promise<Deleted>;
571
+ /** The account contact list. An audience id on this path does not select a second list. */
572
+ contacts: (id: string, query?: ListQuery & {
573
+ email?: string;
574
+ }) => Promise<Page<Record<string, unknown>>>;
349
575
  members: (id: string) => Promise<Page<Record<string, unknown>>>;
350
576
  };
351
577
  /**
@@ -429,9 +655,102 @@ export declare class AgentiSend {
429
655
  };
430
656
  /** Public per-component health — the same document the status page renders. */
431
657
  readonly status: () => Promise<ServiceStatus>;
658
+ /** Daily uptime per component over the last 90 days, or `days`. A day nobody measured has no samples. */
659
+ readonly statusHistory: (query?: {
660
+ days?: number;
661
+ }) => Promise<Record<string, unknown>>;
662
+ /**
663
+ * Sending-domain DNS check. No API key. Ten checks a minute from one
664
+ * network. Returns the records to publish; stores nothing.
665
+ */
666
+ readonly dnsCheck: (domain: string) => Promise<Record<string, unknown>>;
667
+ /** Send, delivery and engagement figures with a daily series, over a window. */
668
+ readonly metrics: (query?: MetricsQuery & {
669
+ group_by?: string;
670
+ event?: "sent" | "delivered" | "bounced" | "complained" | "opened" | "clicked";
671
+ domain?: string;
672
+ api_key_id?: string;
673
+ }) => Promise<Record<string, unknown>>;
674
+ /** This period's usage per key: budget, consumed, remaining, rate window, last used. */
675
+ readonly usage: () => Promise<Record<string, unknown>>;
676
+ readonly account: {
677
+ /** Lifecycle status, the reason for it, and when the account was created. */
678
+ get: () => Promise<Record<string, unknown>>;
679
+ /**
680
+ * Set the postal address printed in every broadcast footer. `null` clears
681
+ * it. A broadcast is not sent until the account has one.
682
+ */
683
+ update: (payload: {
684
+ postal_address: string | null;
685
+ }, options?: RequestOptions) => Promise<Record<string, unknown>>;
686
+ };
432
687
  readonly trust: {
433
688
  /** What the platform currently thinks of this account, in a shape an agent can branch on. */
434
689
  standing: () => Promise<TrustStanding>;
690
+ /** The published enforcement thresholds, as numbers. */
691
+ thresholds: () => Promise<Record<string, unknown>>;
692
+ /** Appeal the current standing. The reason is recorded verbatim; a person answers by `sla_deadline_at`. */
693
+ appeal: (reason: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
694
+ /** The remediation checklist, with what has been ticked. */
695
+ remediation: () => Promise<Record<string, unknown>>;
696
+ /** Tick or untick one checklist item. Returns the whole checklist. */
697
+ setRemediation: (payload: {
698
+ key: string;
699
+ done: boolean;
700
+ }, options?: RequestOptions) => Promise<Record<string, unknown>>;
701
+ };
702
+ /**
703
+ * Sends held for a person to approve, and what they decided. Approving or
704
+ * rejecting is done in the console; a key can list, never decide.
705
+ */
706
+ readonly agentActions: {
707
+ list: (query?: ListQuery & {
708
+ before?: string;
709
+ state?: "pending" | "approved" | "rejected" | "killed";
710
+ }) => Promise<Page<Record<string, unknown>>>;
711
+ };
712
+ /** Conditions this account should know about: a spent budget, a kill switch, a lost domain. */
713
+ readonly notifications: {
714
+ list: (query?: ListQuery & {
715
+ before?: string;
716
+ state?: "open" | "resolved";
717
+ unread?: "true" | "false";
718
+ }) => Promise<Page<Record<string, unknown>>>;
719
+ read: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
720
+ readAll: (options?: RequestOptions) => Promise<Record<string, unknown>>;
721
+ preferences: () => Promise<Record<string, unknown>>;
722
+ setPreferences: (preferences: {
723
+ type: string;
724
+ email?: boolean;
725
+ in_app?: boolean;
726
+ }[], options?: RequestOptions) => Promise<Record<string, unknown>>;
727
+ };
728
+ readonly dedicatedIps: {
729
+ list: (query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
730
+ /** Provision a dedicated IP. It starts warming on the published curve. */
731
+ provision: (payload: {
732
+ ip: string;
733
+ region: string;
734
+ }, options?: RequestOptions) => Promise<Record<string, unknown>>;
735
+ release: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
736
+ /** The published warmup curve: how volume moves, and when. */
737
+ ramp: () => Promise<Record<string, unknown>>;
738
+ /** Which route this message would take right now, by the same math the send path uses. */
739
+ routeDecision: (messageId: string) => Promise<Record<string, unknown>>;
740
+ };
741
+ readonly deliverability: {
742
+ /** Every sending domain with its standing over the window, worst first. */
743
+ domains: (query?: {
744
+ window_days?: number;
745
+ }) => Promise<Record<string, unknown>>;
746
+ domain: (id: string) => Promise<Record<string, unknown>>;
747
+ /** Persist today's rates as a snapshot. Idempotent per domain per day. */
748
+ snapshot: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
749
+ /** Aggregate authentication reports: aligned and failing volume per day, and every address sending as you. */
750
+ dmarc: (query?: {
751
+ domain?: string;
752
+ window_days?: number;
753
+ }) => Promise<Record<string, unknown>>;
435
754
  };
436
755
  readonly billing: {
437
756
  /**
@@ -440,6 +759,8 @@ export declare class AgentiSend {
440
759
  * budget comes from Starter; only a signed-in human in the console can buy.
441
760
  */
442
761
  plan: () => Promise<BillingPlan>;
762
+ /** Plan, usage against each published limit, and what the next tier changes. Buying stays in the console. */
763
+ get: () => Promise<Record<string, unknown>>;
443
764
  };
444
765
  }
445
766
  export {};