@agentisend/sdk-node 0.1.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, SentAttachment, RequestLogEntry, EventDefinition, EventFieldType, ApiKeyPermission, BatchItemResult, CreatedApiKey, CreatedWebhookEndpoint, DeadLetter, Deleted, Domain, DomainRegion, LegacyDomainRegion, Email, EventType, Limit, LimitPeriod, ListEmailsQuery, ListQuery, 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;
@@ -66,6 +85,8 @@ export declare class AgentiSend {
66
85
  }>;
67
86
  get: (id: string) => Promise<Email>;
68
87
  list: (query?: ListEmailsQuery) => Promise<Page<Email>>;
88
+ /** Alias of GET /metrics. start_date and end_date name since and until. */
89
+ metrics: (query?: MetricsQuery) => Promise<Record<string, unknown>>;
69
90
  /** M5.10 — what this email carried, after it was sent. */
70
91
  attachments: (id: string) => Promise<Page<SentAttachment>>;
71
92
  /** Stop a scheduled or queued email. Sent mail is history, not cancellable. */
@@ -73,8 +94,15 @@ export declare class AgentiSend {
73
94
  id: string;
74
95
  status: string;
75
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
+ }>;
76
102
  /** Move an email to a new time. Works from scheduled AND canceled. */
77
- reschedule: (id: string, scheduledAt: string, options?: RequestOptions) => Promise<{
103
+ reschedule: (id: string, scheduledAt: string, options?: RequestOptions & {
104
+ timezone?: string;
105
+ }) => Promise<{
78
106
  id: string;
79
107
  status: string;
80
108
  scheduled_at: string;
@@ -87,6 +115,41 @@ export declare class AgentiSend {
87
115
  explain: (id: string) => Promise<ExplainReport>;
88
116
  /** Run every gate without sending or spending. Free, always. */
89
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>;
90
153
  /**
91
154
  * Move a scheduled email. The same act as `reschedule`, under the verb a
92
155
  * Resend integration already calls (M5.5).
@@ -113,6 +176,16 @@ export declare class AgentiSend {
113
176
  scopes?: string[];
114
177
  }, options?: RequestOptions) => Promise<ApiKey>;
115
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
+ }>;
116
189
  };
117
190
  readonly domains: {
118
191
  create: (payload: {
@@ -120,23 +193,52 @@ export declare class AgentiSend {
120
193
  region?: DomainRegion | LegacyDomainRegion;
121
194
  tracking?: boolean;
122
195
  tracking_subdomain?: string;
196
+ return_path_subdomain?: string;
197
+ open_tracking?: boolean;
198
+ click_tracking?: boolean;
199
+ tls_mode?: "opportunistic" | "enforced";
123
200
  }, options?: RequestOptions) => Promise<Domain>;
124
201
  list: (query?: ListQuery) => Promise<Page<Domain>>;
125
202
  get: (id: string) => Promise<Domain>;
203
+ /** One-shot DNS sheet: zone file, copy-paste commands, provider. */
204
+ setup: (id: string) => Promise<DomainSetup>;
126
205
  verify: (id: string, options?: RequestOptions) => Promise<Domain>;
127
- /** 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. */
128
207
  update: (id: string, payload: {
129
208
  click_tracking?: boolean;
130
209
  open_tracking?: boolean;
131
210
  tracking_subdomain?: string;
211
+ tls_mode?: "opportunistic" | "enforced";
132
212
  }, options?: RequestOptions) => Promise<Domain>;
133
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>;
134
234
  };
135
235
  readonly webhooks: {
136
236
  create: (payload: {
137
237
  url: string;
138
238
  events?: EventType[];
139
239
  svix_compat?: boolean;
240
+ /** `resend` stores Resend's envelope (`created_at`, `data.to`, `data.bounce`). */
241
+ payload_format?: "native" | "resend";
140
242
  }, options?: RequestOptions) => Promise<CreatedWebhookEndpoint>;
141
243
  list: (query?: ListQuery) => Promise<Page<WebhookEndpoint>>;
142
244
  get: (id: string) => Promise<WebhookEndpoint>;
@@ -156,6 +258,21 @@ export declare class AgentiSend {
156
258
  limit?: number;
157
259
  cursor?: string;
158
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
+ }>;
159
276
  };
160
277
  readonly limits: {
161
278
  list: (query?: ListQuery) => Promise<Page<Limit>>;
@@ -168,6 +285,16 @@ export declare class AgentiSend {
168
285
  /** Stops the key sending, immediately. Takes effect on its next request. */
169
286
  kill: (apiKeyId: string, reason?: string, options?: RequestOptions) => Promise<Limit>;
170
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
+ }>;
171
298
  };
172
299
  /** M5.5 — the rest of the verb surface a Resend integration calls. */
173
300
  /**
@@ -184,6 +311,8 @@ export declare class AgentiSend {
184
311
  route?: string;
185
312
  error_code?: string;
186
313
  api_key_id?: string;
314
+ q?: string;
315
+ source?: "api" | "console" | "all";
187
316
  }) => Promise<Page<RequestLogEntry>>;
188
317
  get: (id: string) => Promise<RequestLogEntry>;
189
318
  };
@@ -199,7 +328,33 @@ export declare class AgentiSend {
199
328
  until?: string;
200
329
  }) => Promise<Page<ReceivedEmail>>;
201
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
+ }>;
336
+ threads: (query?: ListQuery) => Promise<Page<ReceivedThread>>;
337
+ reply: (id: string, body: {
338
+ html?: string;
339
+ text?: string;
340
+ from?: string;
341
+ subject?: string;
342
+ cc?: string | string[];
343
+ bcc?: string | string[];
344
+ }, options?: RequestOptions) => Promise<{
345
+ id: string;
346
+ simulated: boolean;
347
+ warnings: {
348
+ code: string;
349
+ message: string;
350
+ fix: string;
351
+ }[];
352
+ }>;
202
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>;
203
358
  };
204
359
  /**
205
360
  * M5.7 — the custom-event registry. Declaring an event's fields turns a
@@ -265,17 +420,76 @@ export declare class AgentiSend {
265
420
  status?: "active" | "unsubscribed";
266
421
  properties?: Record<string, unknown>;
267
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>;
268
467
  };
269
468
  readonly broadcasts: {
270
469
  create: (payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
271
470
  list: (query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
272
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
+ }>;
273
479
  update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
274
- 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>>;
275
489
  /** Archive, not delete: a sent broadcast is history worth keeping (F14). */
276
490
  archive: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
277
491
  messages: (id: string, query?: ListQuery) => Promise<Page<Record<string, unknown>>>;
278
- /** 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. */
279
493
  cancel: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
280
494
  };
281
495
  readonly templates: {
@@ -290,10 +504,34 @@ export declare class AgentiSend {
290
504
  update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
291
505
  /** Snapshot the draft as an immutable version. Nothing already sent changes. */
292
506
  publish: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
293
- 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<{
294
515
  rendered: string;
516
+ subject: string;
517
+ text: string | null;
518
+ missing_variables: string[];
295
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>;
296
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>>;
297
535
  /** Copy a template into a fresh editable draft, history not included. */
298
536
  duplicate: (id: string, payload?: {
299
537
  name?: string;
@@ -304,7 +542,10 @@ export declare class AgentiSend {
304
542
  add: (payload: {
305
543
  email: string;
306
544
  level?: "address" | "domain";
545
+ origin?: "bounce" | "complaint" | "manual";
307
546
  }, options?: RequestOptions) => Promise<Record<string, unknown>>;
547
+ /** The id or the address. */
548
+ get: (id: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
308
549
  remove: (id: string, options?: RequestOptions) => Promise<Deleted>;
309
550
  /** Up to 500 at a time. Each item succeeds or fails on its own. */
310
551
  batchAdd: (emails: string[], level?: "address" | "domain", options?: RequestOptions) => Promise<{
@@ -327,6 +568,10 @@ export declare class AgentiSend {
327
568
  get: (id: string) => Promise<Record<string, unknown>>;
328
569
  update: (id: string, payload: Record<string, unknown>, options?: RequestOptions) => Promise<Record<string, unknown>>;
329
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>>>;
330
575
  members: (id: string) => Promise<Page<Record<string, unknown>>>;
331
576
  };
332
577
  /**
@@ -410,9 +655,102 @@ export declare class AgentiSend {
410
655
  };
411
656
  /** Public per-component health — the same document the status page renders. */
412
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
+ };
413
687
  readonly trust: {
414
688
  /** What the platform currently thinks of this account, in a shape an agent can branch on. */
415
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>>;
416
754
  };
417
755
  readonly billing: {
418
756
  /**
@@ -421,6 +759,8 @@ export declare class AgentiSend {
421
759
  * budget comes from Starter; only a signed-in human in the console can buy.
422
760
  */
423
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>>;
424
764
  };
425
765
  }
426
766
  export {};