@messagebird/sdk 0.12.2 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -80,7 +80,7 @@ interface ErrorDetail {
80
80
  /** What is wrong with this field. */
81
81
  message: string;
82
82
  }
83
- /** One recovery step: an operation to call to resolve the error (ADR-0073). */
83
+ /** One recovery step: an operation to call to resolve the error. */
84
84
  interface ErrorNextAction {
85
85
  /** operationId of the follow-up operation that resolves this error. */
86
86
  operation: string;
@@ -118,9 +118,9 @@ interface BirdAPIErrorFields {
118
118
  param?: string;
119
119
  /** Verbatim code from a downstream system (SMTP reply, payment decline). */
120
120
  vendorCode?: string;
121
- /** Human recovery line for this error, when a recovery is known (ADR-0073). */
121
+ /** Human recovery line for this error, when a recovery is known. */
122
122
  remediation?: string;
123
- /** Operations that resolve this error, in the order to try them (ADR-0073). */
123
+ /** Operations that resolve this error, in the order to try them. */
124
124
  next?: ErrorNextAction[];
125
125
  /** Verification requirements blocking this action, when it is blocked pending verification. */
126
126
  unmetGates?: UnmetGate[];
@@ -180,7 +180,7 @@ declare class BirdInternalError extends BirdAPIError {
180
180
  declare class BirdNotImplementedError extends BirdAPIError {
181
181
  constructor(fields: BirdAPIErrorFields);
182
182
  }
183
- /** 421 — request reached the wrong region (ADR-0036). */
183
+ /** 421 — request reached the wrong region. */
184
184
  declare class BirdMisdirectedError extends BirdAPIError {
185
185
  constructor(fields: BirdAPIErrorFields);
186
186
  }
@@ -223,7 +223,7 @@ interface RequestOptions {
223
223
  * failure `error` is a `BirdError` you can `instanceof`-narrow, and `data`/
224
224
  * `response` are `null` — the metadata you need (status, request id) is on the
225
225
  * error itself. A caller-initiated abort is not a Bird failure and still throws
226
- * (the native `AbortError`, ADR-0042 §1).
226
+ * (the native `AbortError`).
227
227
  */
228
228
  type SafeResult<T> = {
229
229
  data: T;
@@ -531,7 +531,11 @@ type EventVoiceCallInitiated = {
531
531
  data: EventVoiceCallInitiatedData;
532
532
  };
533
533
  /**
534
- * Call status. v1 records are always terminal and carry one of answered, no_answer, failed, rejected, or unknown. The remaining values are declared ahead of planned features so their arrival is not a breaking contract change: busy and canceled arrive with inbound (DID) termination — today both outcomes are folded into failed — and ringing and in_progress with a live-calls surface.
534
+ * Call status.
535
+ *
536
+ * A call that has ended carries answered, no_answer, failed, rejected, or unknown. A call that is still up carries ringing before it is picked up and in_progress once it is; both are what the `status` filter on the call list selects on to show calls happening right now.
537
+ *
538
+ * busy and canceled are declared ahead of the feature that produces them, so their arrival is not a breaking contract change: they come with inbound termination, and today both outcomes are folded into failed.
535
539
  *
536
540
  */
537
541
  type VoiceCallStatus = "answered" | "no_answer" | "busy" | "canceled" | "failed" | "rejected" | "unknown" | "ringing" | "in_progress";
@@ -691,7 +695,7 @@ type EventVerifyVerificationCreated = {
691
695
  data: EventVerifyVerificationCreatedData;
692
696
  };
693
697
  /**
694
- * Why a passcode send did not deliver. Open enum — new reasons may be added over time, so treat any unrecognized value as a future reason rather than an error. v1 emits `carrier_rejected` (SMS), `hard_bounce` (email), `undelivered` (a generic terminal delivery failure), and `channel_unavailable` (the channel could not be used and the verification failed over).
698
+ * Why a passcode send did not deliver. Open enum — new reasons may be added over time, so treat any unrecognized value as a future reason rather than an error. Emitted reasons are `carrier_rejected` (SMS), `hard_bounce` (email, permanent bounce), `soft_bounce` (email, transient bounce such as a full mailbox), `undelivered` (a generic delivery failure), and `channel_unavailable` (the channel could not be used and the verification failed over).
695
699
  */
696
700
  type VerificationAttemptFailureReason = string;
697
701
  /**
@@ -2072,20 +2076,6 @@ type Timestamps = {
2072
2076
  readonly created_at: string;
2073
2077
  readonly updated_at: string;
2074
2078
  };
2075
- type ListEnvelope = {
2076
- /**
2077
- * Cursor for the next page. Pass back as `starting_after` to advance forward. Null when no next page exists.
2078
- */
2079
- next_cursor: string | null;
2080
- /**
2081
- * Cursor for the previous page. Pass back as `ending_before` to step backward. Null when no previous page exists.
2082
- */
2083
- prev_cursor: string | null;
2084
- /**
2085
- * Refresh anchor. Pass back as `ending_before` later to fetch items that have appeared since this response. Non-null whenever `data` is non-empty; null only on an empty page. Distinct from `prev_cursor`.
2086
- */
2087
- refresh_cursor: string | null;
2088
- };
2089
2079
  /**
2090
2080
  * The labels available in a mailbox.
2091
2081
  */
@@ -2156,12 +2146,13 @@ type EmailMailboxComposeRequest = {
2156
2146
  metadata?: {
2157
2147
  [key: string]: unknown;
2158
2148
  };
2159
- /**
2160
- * Content classification — controls suppression policy. `marketing` blocks on all suppression reasons; `transactional` allows delivery through complaint and unsubscribe suppressions. Default: transactional.
2161
- *
2162
- */
2163
- category?: "marketing" | "transactional";
2149
+ category?: EmailMessageCategory;
2164
2150
  };
2151
+ /**
2152
+ * Content classification. Controls suppression policy: `marketing` blocks on all suppression reasons; `transactional` allows delivery through complaint and unsubscribe suppressions, for receipts, password resets, and similar operational mail.
2153
+ *
2154
+ */
2155
+ type EmailMessageCategory = "marketing" | "transactional";
2165
2156
  /**
2166
2157
  * File attached to an email send. The attachment bytes are passed as base64-encoded `content` directly in the request body (required). The `path` field (provide a URL and Bird fetches the attachment for you) is a preview feature and currently unavailable. Requests are rejected with 422 if `content` is missing — `path` alone does not satisfy the schema. When `path` becomes generally available, the schema will be relaxed so that exactly one of `content` or `path` is required.
2167
2158
  * Inline images for `<img src="cid:..."/>` references in the HTML body use the `content_id` field together with `content`.
@@ -2243,11 +2234,12 @@ type EmailThreadMessageReplyRequest = {
2243
2234
  metadata?: {
2244
2235
  [key: string]: unknown;
2245
2236
  };
2237
+ category?: EmailMessageCategory;
2246
2238
  /**
2247
- * Content classification controls suppression policy. `marketing` blocks on all suppression reasons; `transactional` allows delivery through complaint and unsubscribe suppressions. Default: transactional.
2239
+ * File attachments to include with the reply. The send is rejected when the estimated generated message size exceeds 20 MB (bodies plus all attachments after base64 encoding). Keep total raw attachment content at or below 15 MB for reliable headroom. Attachment metadata endures on the message's `attachment_manifest`; the bytes are downloadable for 30 days.
2248
2240
  *
2249
2241
  */
2250
- category?: "marketing" | "transactional";
2242
+ attachments?: Array<EmailAttachment>;
2251
2243
  };
2252
2244
  /**
2253
2245
  * The attachments on a conversation message.
@@ -2306,9 +2298,6 @@ type EmailLabelsUpdate = {
2306
2298
  */
2307
2299
  remove?: Array<string>;
2308
2300
  };
2309
- type EmailThreadMessageList = {
2310
- data: Array<EmailThreadMessage>;
2311
- } & ListEnvelope;
2312
2301
  /**
2313
2302
  * Link to the message's entry in the received-message or sent-message log, which carries delivery analytics such as per-recipient events. Log entries expire 30 days after the message occurred.
2314
2303
  *
@@ -2462,9 +2451,6 @@ type EmailThreadUpdateRequest = {
2462
2451
  */
2463
2452
  contact_id?: ContactId | null;
2464
2453
  };
2465
- type EmailThreadList = {
2466
- data: Array<EmailThread>;
2467
- } & ListEnvelope;
2468
2454
  /**
2469
2455
  * Matched search fragments for a thread, one array per field the query matched, with the matched terms wrapped in `**`. A field is present only when the query matched it, so the keys that are present tell you which fields produced the hit. Returned only on thread search results.
2470
2456
  *
@@ -2560,9 +2546,6 @@ type ReceiveRuleCreate = {
2560
2546
  */
2561
2547
  note?: string;
2562
2548
  };
2563
- type ReceiveRuleList = {
2564
- data: Array<ReceiveRule>;
2565
- } & ListEnvelope;
2566
2549
  type ReceiveRuleId = string;
2567
2550
  /**
2568
2551
  * An allow or block entry on a mailbox, evaluated when inbound mail arrives. Matching is against the message's envelope sender; domain entries also match subdomains. A given entry can be allow or block, never both.
@@ -2941,9 +2924,6 @@ type MailboxCreate = {
2941
2924
  [key: string]: unknown;
2942
2925
  };
2943
2926
  };
2944
- type MailboxList = {
2945
- data: Array<Mailbox>;
2946
- } & ListEnvelope;
2947
2927
  type InboundAddressId = string;
2948
2928
  /**
2949
2929
  * The principal that owns the mailbox. Always the workspace.
@@ -3042,14 +3022,26 @@ type Mailbox = {
3042
3022
  */
3043
3023
  type DomainUpdate = {
3044
3024
  settings?: DomainSettings;
3045
- return_path?: DomainReturnPathConfig & unknown;
3025
+ /**
3026
+ * Change the return-path name part. Cannot be removed — the return-path is required for sending.
3027
+ *
3028
+ */
3029
+ return_path?: DomainReturnPathConfig;
3046
3030
  /**
3047
3031
  * Set or change the tracking name part, or remove tracking by passing null. Removal requires `click_tracking` and `open_tracking` to be disabled first, and returns `409` otherwise. After removal, links in previously sent email keep resolving while the tracking records are reported as `deprecated`.
3048
3032
  *
3049
3033
  */
3050
3034
  tracking?: DomainTrackingConfig | null;
3051
- dkim?: DomainDkimConfig & unknown;
3052
- inbound?: DomainInboundConfig & unknown;
3035
+ /**
3036
+ * Change how the DKIM key is published. The current key keeps signing until the new configuration verifies, so mail is never sent unsigned during the transition.
3037
+ *
3038
+ */
3039
+ dkim?: DomainDkimConfig;
3040
+ /**
3041
+ * Enable or disable receiving on this domain. Enabling claims the domain for inbound and moves `capabilities.inbound.status` from `not_configured` to `pending`, then `verified` once the MX records resolve to Bird. The MX records to publish are always present under `dns_records` (`purpose: inbound_mx`) as a regional reference, so their presence does not mean receiving is on — a domain still needs enabling whenever `capabilities.inbound.status` is `not_configured`. Enabling requires the domain's DKIM to be verified first (ownership proof): a fresh enable on a domain whose DKIM is not verified returns `422` `E05019` and claims nothing. A domain already receiving inbound for another organization returns `422` `E05018`.
3042
+ *
3043
+ */
3044
+ inbound?: DomainInboundConfig;
3053
3045
  };
3054
3046
  /**
3055
3047
  * Inbound (receiving) configuration. Enable inbound to receive email addressed to this domain: Bird returns MX records to publish, and once they verify, mail to any local-part at this domain is delivered as an inbound message and the `email.received` webhook fires. The capability is enabled on the domain's own registration, so use a dedicated subdomain (e.g. `inbound.acme.com`), never your apex — apex MX would capture your corporate mail.
@@ -3239,11 +3231,31 @@ type DomainCapability = {
3239
3231
  readonly reason?: string | null;
3240
3232
  };
3241
3233
  type DomainCapabilities = {
3242
- sending: DomainCapability & unknown;
3243
- return_path: DomainCapability & unknown;
3244
- dmarc: DomainCapability & unknown;
3245
- tracking: DomainCapability & unknown;
3246
- inbound?: DomainCapability & unknown;
3234
+ /**
3235
+ * Overall authorization to send from this domain. Verified when the DKIM record, the return-path CNAME, and a DMARC policy are all in place. Required for live sends.
3236
+ *
3237
+ */
3238
+ sending: DomainCapability;
3239
+ /**
3240
+ * Return-path (bounce) CNAME verification. The return-path domain receives bounce and complaint notifications and is what mailbox providers check for SPF — no separate SPF record is needed.
3241
+ *
3242
+ */
3243
+ return_path: DomainCapability;
3244
+ /**
3245
+ * DMARC policy check. Satisfied by any valid DMARC record covering the sending domain — on the domain itself or on its registered (organizational) domain; `domain` reports where the policy was found. A minimal policy of `p=none` is sufficient.
3246
+ *
3247
+ */
3248
+ dmarc: DomainCapability;
3249
+ /**
3250
+ * Branded open/click tracking domain. `not_configured` until a tracking domain is set. Tracked links are served over HTTPS once the CNAME verifies.
3251
+ *
3252
+ */
3253
+ tracking: DomainCapability;
3254
+ /**
3255
+ * Inbound mail receiving. `not_configured` until receiving is enabled on this domain (see `DomainUpdate.inbound`), then `pending` while the published MX records are checked, and `verified` once they resolve to Bird. The MX records to publish are always listed under `dns_records` (`purpose: inbound_mx`) as a regional reference, even while this is `not_configured` — enabling is what actually starts delivery.
3256
+ *
3257
+ */
3258
+ inbound?: DomainCapability;
3247
3259
  };
3248
3260
  /**
3249
3261
  * Active DKIM signing configuration for the domain.
@@ -3321,7 +3333,10 @@ type Domain = {
3321
3333
  * Per-broadcast breakdown for the requested period, ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, max 200).
3322
3334
  */
3323
3335
  type EmailStatsByBroadcastResponse = {
3324
- period: EmailStatsPeriod & unknown;
3336
+ /**
3337
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3338
+ */
3339
+ period: EmailStatsPeriod;
3325
3340
  /**
3326
3341
  * Broadcast breakdown rows, ranked by the `sort` metric (default `processed`) descending. Empty when no broadcast messages were active in the period.
3327
3342
  */
@@ -3409,7 +3424,10 @@ type EmailStatsPeriod = {
3409
3424
  * Per-complaint-type breakdown for the requested period, ranked by `complained` descending and capped at the requested `limit` (default 50, max 200).
3410
3425
  */
3411
3426
  type EmailStatsByComplaintTypeResponse = {
3412
- period: EmailStatsPeriod & unknown;
3427
+ /**
3428
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3429
+ */
3430
+ period: EmailStatsPeriod;
3413
3431
  /**
3414
3432
  * Complaint-type breakdown rows, ranked by `complained` descending. Empty when no complaints occurred in the period.
3415
3433
  */
@@ -3438,7 +3456,10 @@ type EmailComplaintTypeStatsPoint = {
3438
3456
  * Per-SMTP-code bounce breakdown for the requested period, ranked by the `sort` metric (default `bounced`) descending and capped at the requested `limit` (default 50, max 200).
3439
3457
  */
3440
3458
  type EmailStatsByBounceCodeResponse = {
3441
- period: EmailStatsPeriod & unknown;
3459
+ /**
3460
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3461
+ */
3462
+ period: EmailStatsPeriod;
3442
3463
  /**
3443
3464
  * Bounce-code breakdown rows, ranked by the `sort` metric (default `bounced`) descending. Empty when no bounces occurred in the period.
3444
3465
  */
@@ -3499,7 +3520,10 @@ type EmailBounceCodeStatsPoint = {
3499
3520
  * Per-client engagement breakdown for the requested period, grouped by the requested `group_by` facet, ranked by the `sort` metric (default `unique_opens`) descending and capped at the requested `limit` (default 50, max 200).
3500
3521
  */
3501
3522
  type EmailStatsByClientResponse = {
3502
- period: EmailStatsPeriod & unknown;
3523
+ /**
3524
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3525
+ */
3526
+ period: EmailStatsPeriod;
3503
3527
  /**
3504
3528
  * Client breakdown rows, ranked by the `sort` metric (default `unique_opens`) descending. Empty when no opens or clicks with a detected client occurred in the period.
3505
3529
  */
@@ -3565,7 +3589,10 @@ type EmailClientStatsPoint = {
3565
3589
  * Per-location engagement breakdown for the requested period, grouped at the requested `group_by` granularity, ranked by the `sort` metric (default `unique_opens`) descending and capped at the requested `limit` (default 50, max 200).
3566
3590
  */
3567
3591
  type EmailStatsByLocationResponse = {
3568
- period: EmailStatsPeriod & unknown;
3592
+ /**
3593
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3594
+ */
3595
+ period: EmailStatsPeriod;
3569
3596
  /**
3570
3597
  * Location breakdown rows, ranked by the `sort` metric (default `unique_opens`) descending. Empty when no opens or clicks with a resolved location occurred in the period.
3571
3598
  */
@@ -3604,7 +3631,10 @@ type EmailEngagementSortMetric = "opens" | "opens_non_prefetched" | "unique_open
3604
3631
  * Per-template breakdown for the requested period, ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, max 200).
3605
3632
  */
3606
3633
  type EmailStatsByTemplateResponse = {
3607
- period: EmailStatsPeriod & unknown;
3634
+ /**
3635
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3636
+ */
3637
+ period: EmailStatsPeriod;
3608
3638
  /**
3609
3639
  * Template breakdown rows, ranked by the `sort` metric (default `processed`) descending. Empty when no templated messages were active in the period.
3610
3640
  */
@@ -3636,7 +3666,10 @@ type EmailTemplateStatsPoint = {
3636
3666
  * Per-recipient-domain breakdown for the requested period, ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, max 200).
3637
3667
  */
3638
3668
  type EmailStatsByRecipientDomainResponse = {
3639
- period: EmailStatsPeriod & unknown;
3669
+ /**
3670
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3671
+ */
3672
+ period: EmailStatsPeriod;
3640
3673
  /**
3641
3674
  * Recipient-domain breakdown rows, ranked by the `sort` metric (default `processed`) descending. Empty when no eligible activity occurred in the period.
3642
3675
  */
@@ -3667,7 +3700,10 @@ type EmailRecipientDomainStatsPoint = {
3667
3700
  * Per-(mailbox provider, provider region) breakdown for the requested period, ranked by the `sort` metric (default `delivered`) descending and capped at the requested `limit` (default 50, max 200).
3668
3701
  */
3669
3702
  type EmailStatsByMailboxProviderRegionResponse = {
3670
- period: EmailStatsPeriod & unknown;
3703
+ /**
3704
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3705
+ */
3706
+ period: EmailStatsPeriod;
3671
3707
  /**
3672
3708
  * Provider-region breakdown rows, ranked by the `sort` metric (default `delivered`) descending. Empty when no deliveries occurred in the period.
3673
3709
  */
@@ -3754,7 +3790,10 @@ type EmailMailboxProviderRegionStatsPoint = {
3754
3790
  * Per-mailbox-provider breakdown for the requested period, ranked by the `sort` metric (default `delivered`) descending and capped at the requested `limit` (default 50, max 200).
3755
3791
  */
3756
3792
  type EmailStatsByMailboxProviderResponse = {
3757
- period: EmailStatsPeriod & unknown;
3793
+ /**
3794
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3795
+ */
3796
+ period: EmailStatsPeriod;
3758
3797
  /**
3759
3798
  * Mailbox-provider breakdown rows, ranked by the `sort` metric (default `delivered`) descending. Empty when no eligible activity occurred in the period.
3760
3799
  */
@@ -3791,7 +3830,10 @@ type EmailMailboxProviderSortMetric = "delivered" | "bounced" | "complained" | "
3791
3830
  * Per-category breakdown for the requested period, ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, max 200).
3792
3831
  */
3793
3832
  type EmailStatsByCategoryResponse = {
3794
- period: EmailStatsPeriod & unknown;
3833
+ /**
3834
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3835
+ */
3836
+ period: EmailStatsPeriod;
3795
3837
  /**
3796
3838
  * Category breakdown rows, ranked by the `sort` metric (default `processed`) descending. Empty when no sends occurred in the period.
3797
3839
  */
@@ -3822,7 +3864,10 @@ type EmailCategoryStatsPoint = {
3822
3864
  * Per-sending-domain breakdown for the requested period, ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, max 200).
3823
3865
  */
3824
3866
  type EmailStatsBySendingDomainResponse = {
3825
- period: EmailStatsPeriod & unknown;
3867
+ /**
3868
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3869
+ */
3870
+ period: EmailStatsPeriod;
3826
3871
  /**
3827
3872
  * Sending-domain breakdown rows, ranked by the `sort` metric (default `processed`) descending. Empty when no eligible activity occurred in the period.
3828
3873
  */
@@ -3853,7 +3898,10 @@ type EmailSendingDomainStatsPoint = {
3853
3898
  * Per-sending-IP breakdown for the requested period, ranked by the `sort` metric (default `delivered`) descending and capped at the requested `limit` (default 50, max 200).
3854
3899
  */
3855
3900
  type EmailStatsBySendingIpResponse = {
3856
- period: EmailStatsPeriod & unknown;
3901
+ /**
3902
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
3903
+ */
3904
+ period: EmailStatsPeriod;
3857
3905
  /**
3858
3906
  * Sending-IP breakdown rows, ranked by the `sort` metric (default `delivered`) descending. Empty when no per-IP-attributable activity (delivery, bounce, deferral, or late bounce) occurred in the period.
3859
3907
  */
@@ -3948,7 +3996,10 @@ type EmailSendingIpStatsPoint = {
3948
3996
  *
3949
3997
  */
3950
3998
  type EmailStatsSummary = {
3951
- period: EmailStatsSummaryPeriod & unknown;
3999
+ /**
4000
+ * The window the response covers (echoed back from the request, day or hour grain), plus `data_as_of`, the freshness boundary the data is current to.
4001
+ */
4002
+ period: EmailStatsSummaryPeriod;
3952
4003
  /**
3953
4004
  * Distinct email messages accepted, counted at the message level (one per accepted send regardless of recipient count) and summed per bucket across the period. This counts messages, not recipients, so it is not comparable to `delivery.accepted`, which counts recipients (a single message to 500 recipients is 1 here and up to 500 there).
3954
4005
  */
@@ -4013,7 +4064,10 @@ type EmailStatsComparisonDelta = {
4013
4064
  *
4014
4065
  */
4015
4066
  type EmailStatsComparison = {
4016
- period: EmailStatsSummaryPeriod & unknown;
4067
+ /**
4068
+ * The preceding window these comparison figures cover, the equal-length window ending immediately before the requested start (the prior day for day windows, the prior hour for hour windows). For a request covering 2026-05-01 to 2026-05-31, this is 2026-03-31 to 2026-04-30, both inclusive.
4069
+ */
4070
+ period: EmailStatsSummaryPeriod;
4017
4071
  /**
4018
4072
  * Distinct email messages accepted in the preceding period, counted at the message level.
4019
4073
  */
@@ -4046,7 +4100,10 @@ type EmailStatsSummaryPeriod = {
4046
4100
  * Per-tag breakdown for the requested period, ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, max 200).
4047
4101
  */
4048
4102
  type EmailStatsTagsResponse = {
4049
- period: EmailStatsPeriod & unknown;
4103
+ /**
4104
+ * The date range the response covers (echoed back from the request), plus `data_as_of`, the freshness boundary the data is current to.
4105
+ */
4106
+ period: EmailStatsPeriod;
4050
4107
  /**
4051
4108
  * Tag breakdown rows, ranked by the `sort` metric (default `processed`) descending. Empty when no tagged sends occurred in the period.
4052
4109
  */
@@ -4108,123 +4165,6 @@ type EmailStatsPoint = {
4108
4165
  readonly engagement: EmailEngagementStats;
4109
4166
  readonly latency: EmailLatencyStats;
4110
4167
  };
4111
- type WhatsAppTemplateList = {
4112
- /**
4113
- * The templates available to your workspace.
4114
- */
4115
- data: Array<WhatsAppTemplate>;
4116
- };
4117
- type WhatsAppTemplateButton = {
4118
- /**
4119
- * The button's behavior type.
4120
- */
4121
- readonly type: string;
4122
- /**
4123
- * How the recipient receives the one-time passcode. Present on authentication-template OTP buttons.
4124
- */
4125
- readonly otp_type?: string;
4126
- /**
4127
- * The button's label text.
4128
- */
4129
- readonly text: string;
4130
- /**
4131
- * The URL the button opens, with any variable placeholder shown inline. Present on link buttons.
4132
- */
4133
- readonly url?: string;
4134
- /**
4135
- * Example values for this button's variables, in placeholder order. Present when the button URL has variables.
4136
- */
4137
- readonly example_parameters?: Array<WhatsAppTemplateExampleParameter>;
4138
- };
4139
- /**
4140
- * The kind of value a template parameter accepts. `text` (the only kind today) is a plain string substituted into the placeholder. Open enum: more kinds may be added over time.
4141
- *
4142
- */
4143
- type WhatsAppTemplateParameterType = string;
4144
- type WhatsAppTemplateExampleParameter = {
4145
- /**
4146
- * The kind of value this parameter accepts.
4147
- */
4148
- readonly type: WhatsAppTemplateParameterType;
4149
- /**
4150
- * An example value for a text parameter. Present when `type` is `text`.
4151
- */
4152
- readonly text?: string;
4153
- /**
4154
- * The named placeholder this example fills, for templates that use named parameters. Absent for system templates, which use positional parameters.
4155
- */
4156
- readonly name?: string;
4157
- };
4158
- type WhatsAppTemplateComponent = {
4159
- /**
4160
- * The content block's type within the template.
4161
- */
4162
- readonly type: string;
4163
- /**
4164
- * The block's text content, with any variable placeholders shown inline. Present when the block carries text.
4165
- */
4166
- readonly text?: string;
4167
- /**
4168
- * Example values for this block's variables, in placeholder order (one per `{{n}}`). Use them to see what a filled message looks like. Present when the block has variables.
4169
- */
4170
- readonly example_parameters?: Array<WhatsAppTemplateExampleParameter>;
4171
- /**
4172
- * The buttons attached to this block. Present when the block carries buttons.
4173
- */
4174
- readonly buttons?: Array<WhatsAppTemplateButton>;
4175
- };
4176
- /**
4177
- * A message template's review and health status. `approved` (passed review and sendable), `pending` (review in progress), and `rejected` (failed review) are review outcomes. The rest reflect a template's ongoing health after approval: `paused` and `disabled` mean sending from it is suspended, `in_appeal` means a review decision is under appeal, `pending_deletion` means the template is queued for removal, and `limit_exceeded` means it has exceeded a usage limit. Every template in Bird's catalogue is currently `approved`. Open enum: new statuses may be added over time, so treat any unrecognized value as a future status rather than an error.
4178
- *
4179
- */
4180
- type WhatsAppTemplateStatus = string;
4181
- /**
4182
- * Meta's content classification for a template. `authentication` templates deliver one-time passcodes, `utility` templates deliver transaction-triggered updates (receipts, order status), and `marketing` templates carry promotional content. The category drives which sender number Bird selects and how the send is priced. Open enum: Meta may add new categories over time, so treat any unrecognized value as a future category rather than an error.
4183
- *
4184
- */
4185
- type WhatsAppTemplateCategory = string;
4186
- /**
4187
- * Language code of the template variant (for example `en` or `pt_BR`).
4188
- */
4189
- type WhatsAppLanguage = string;
4190
- /**
4191
- * Whether the template is a built-in Bird template (`system`) or one your workspace authored (`workspace`).
4192
- */
4193
- type TemplateScope = "system" | "workspace";
4194
- /**
4195
- * A WhatsApp template's name — the stable handle used to reference the template when sending. Lowercase letters, numbers, and underscores.
4196
- *
4197
- */
4198
- type WhatsAppTemplateName = string;
4199
- type WhatsAppTemplateId = string;
4200
- type WhatsAppTemplate = {
4201
- /**
4202
- * Stable Bird identifier for the template.
4203
- */
4204
- readonly id: WhatsAppTemplateId;
4205
- /**
4206
- * The template's stable handle. Pass it as the template reference when sending.
4207
- */
4208
- readonly name: WhatsAppTemplateName;
4209
- /**
4210
- * Optional description of the template's purpose. Null when unset.
4211
- */
4212
- readonly description?: string | null;
4213
- scope: TemplateScope;
4214
- readonly language: WhatsAppLanguage;
4215
- /**
4216
- * Content classification applied to messages sent from this template.
4217
- */
4218
- readonly category: WhatsAppTemplateCategory;
4219
- /**
4220
- * The template's review and health status.
4221
- */
4222
- readonly status: WhatsAppTemplateStatus;
4223
- /**
4224
- * The content blocks that make up the template, in display order.
4225
- */
4226
- readonly components: Array<WhatsAppTemplateComponent>;
4227
- };
4228
4168
  type WhatsAppEventList = {
4229
4169
  /**
4230
4170
  * Timeline events for this WhatsApp message, in chronological order. The timeline is bounded and returned in full; this list is not paginated.
@@ -4275,6 +4215,11 @@ type WhatsAppMessageSendRequest = {
4275
4215
  [key: string]: unknown;
4276
4216
  };
4277
4217
  };
4218
+ /**
4219
+ * The kind of value a template parameter accepts. `text` (the only kind today) is a plain string substituted into the placeholder. Open enum: more kinds may be added over time.
4220
+ *
4221
+ */
4222
+ type WhatsAppTemplateParameterType = string;
4278
4223
  type WhatsAppMessageTemplateComponentParameter = {
4279
4224
  /**
4280
4225
  * The kind of value this parameter carries. `text` is the only kind today.
@@ -4301,6 +4246,15 @@ type WhatsAppMessageTemplateComponent = {
4301
4246
  */
4302
4247
  parameters?: Array<WhatsAppMessageTemplateComponentParameter>;
4303
4248
  };
4249
+ /**
4250
+ * Language code of the template variant (for example `en` or `pt_BR`).
4251
+ */
4252
+ type WhatsAppLanguage = string;
4253
+ /**
4254
+ * A WhatsApp template's name — the stable handle used to reference the template when sending. Lowercase letters, numbers, and underscores.
4255
+ *
4256
+ */
4257
+ type WhatsAppTemplateName = string;
4304
4258
  type WhatsAppTemplateSend = {
4305
4259
  /**
4306
4260
  * The template to send, by its name (for example `bird_otp`).
@@ -4317,11 +4271,30 @@ type WhatsAppTemplateSend = {
4317
4271
  */
4318
4272
  components?: Array<WhatsAppMessageTemplateComponent>;
4319
4273
  };
4274
+ /**
4275
+ * ISO 4217 three-letter currency code.
4276
+ */
4277
+ type CurrencyCode = string;
4278
+ type Money = {
4279
+ /**
4280
+ * Decimal amount as a string, in major currency units.
4281
+ */
4282
+ amount: string;
4283
+ /**
4284
+ * ISO 4217 currency code.
4285
+ */
4286
+ currency_code: CurrencyCode;
4287
+ };
4320
4288
  /**
4321
4289
  * Delivery status. `accepted` (the initial status of an outbound send) means Bird accepted the request and it is queued for sending. `sent` means it was handed to the WhatsApp network. `delivered` is confirmed delivery to the recipient's device. `failed` is a terminal permanent failure. `rejected` means the recipient is on the workspace's suppression list; the message was not sent and not charged. There is no `read` status: a read receipt is reported as `read_at` and a `whatsapp.read` event, not a status value. The remaining values are reserved and not returned today: `scheduled` (queued to send at a future time), `canceled` (a scheduled message canceled before sending), and `received` (an inbound message, `direction: inbound`, sent to you by a contact).
4322
4290
  *
4323
4291
  */
4324
4292
  type WhatsAppMessageStatus = "scheduled" | "accepted" | "sent" | "delivered" | "failed" | "rejected" | "canceled" | "received";
4293
+ /**
4294
+ * Meta's content classification for a template. `authentication` templates deliver one-time passcodes, `utility` templates deliver transaction-triggered updates (receipts, order status), and `marketing` templates carry promotional content. The category drives which sender number Bird selects and how the send is priced. Open enum: Meta may add new categories over time, so treat any unrecognized value as a future category rather than an error.
4295
+ *
4296
+ */
4297
+ type WhatsAppTemplateCategory = string;
4325
4298
  /**
4326
4299
  * The template a message was sent from. On reads `name`, `language`, `category`, and `components` are always present; `components` is an empty array for an authentication template (the filled-in values, for example a verification code, are never returned).
4327
4300
  *
@@ -4388,6 +4361,7 @@ type WhatsAppMessage = {
4388
4361
  * When the message was read by the recipient. Null until then.
4389
4362
  */
4390
4363
  readonly read_at?: string | null;
4364
+ cost?: Money | null;
4391
4365
  /**
4392
4366
  * Structured `{name, value}` filter labels applied to this message.
4393
4367
  */
@@ -4485,6 +4459,10 @@ type VerificationOptions = {
4485
4459
  */
4486
4460
  channels?: Array<VerificationChannel>;
4487
4461
  };
4462
+ /**
4463
+ * Bucket grain for a stats trend series.
4464
+ */
4465
+ type StatsTrendGrain = "daily" | "hourly";
4488
4466
  type SmsTemplateList = {
4489
4467
  /**
4490
4468
  * The templates available to your workspace. The catalogue is small and returned in full; this list is not paginated.
@@ -4520,6 +4498,10 @@ type TemplateVariable = {
4520
4498
  * Content classification. Tells Bird and carriers why you're sending; per-country compliance rules (opt-out policy, quiet hours) key on it as they roll out.
4521
4499
  */
4522
4500
  type SmsMessageCategory = "transactional" | "marketing" | "authentication" | "service";
4501
+ /**
4502
+ * Whether the template is a built-in Bird template (`system`) or one your workspace authored (`workspace`).
4503
+ */
4504
+ type TemplateScope = "system" | "workspace";
4523
4505
  /**
4524
4506
  * A template's send-by handle — the stable reference used in place of the template id when sending. Lowercase letters, numbers, hyphens, and underscores; starts and ends with a letter or number.
4525
4507
  *
@@ -4624,10 +4606,6 @@ type SmsCostBreakdown = {
4624
4606
  */
4625
4607
  carrier_surcharge: string;
4626
4608
  };
4627
- /**
4628
- * ISO 4217 three-letter currency code.
4629
- */
4630
- type CurrencyCode = string;
4631
4609
  /**
4632
4610
  * Cost of the message. Null until the message has been priced; the cost is populated as the message is processed, not at the moment it is accepted.
4633
4611
  */
@@ -4776,7 +4754,7 @@ type SmsMessageSendRequest = unknown & {
4776
4754
  */
4777
4755
  to: string;
4778
4756
  /**
4779
- * Sender to send from: an E.164 number (`+15557654321`), an alphanumeric sender ID (1-11 letters, digits, or spaces, for example `MyBrand`), or a short code (5-6 digits). A numeric sender must be a number your workspace owns; an alphanumeric sender is accepted where the destination country permits one. Required on a free-text send: omitting it returns a `422` `SMSNoEligibleSender`. Not accepted alongside `template`, which selects its sender automatically.
4757
+ * Sender to send from: an E.164 number (`+15557654321`), an alphanumeric sender ID (1-11 letters, digits, spaces, dashes, or underscores, at least one of them a letter, for example `MyBrand`), or a short code (5-6 digits). A numeric sender must be a number your workspace owns; an alphanumeric sender is accepted where the destination country permits one. Required on a free-text send: omitting it returns a `422` `SMSNoEligibleSender`. Not accepted alongside `template`, which selects its sender automatically.
4780
4758
  *
4781
4759
  */
4782
4760
  from?: string;
@@ -4859,6 +4837,10 @@ type SmsMessageSendRequest = unknown & {
4859
4837
  */
4860
4838
  track_clicks?: boolean;
4861
4839
  };
4840
+ /**
4841
+ * Whether a message was sent from the workspace (`outbound`) or received by it (`inbound`).
4842
+ */
4843
+ type MessageDirection = "outbound" | "inbound";
4862
4844
  type AudienceContactsRemoveRequest = {
4863
4845
  /**
4864
4846
  * Contacts to remove from the audience. Removing a contact that is not a member has no effect; duplicate IDs in the list are collapsed. If any ID does not exist in the workspace, the whole request fails with a validation error and no memberships are removed.
@@ -4971,15 +4953,16 @@ type ContactPropertyCreateRequest = {
4971
4953
  * The property key, used as the key in contact data and as the template variable name in broadcasts. Lowercase letters, digits, and underscores, starting with a letter. Cannot be changed after creation.
4972
4954
  */
4973
4955
  key: string;
4974
- /**
4975
- * The value type every contact must use for this property. Cannot be changed after creation.
4976
- */
4977
- type: "string" | "number" | "boolean";
4956
+ type: ContactPropertyType;
4978
4957
  /**
4979
4958
  * Default used when a contact has no value for this property and the template does not supply an inline fallback. A string, number, or boolean matching the declared type (strings up to 500 characters), or null for no fallback; a value of another type returns a validation error.
4980
4959
  */
4981
4960
  fallback_value?: unknown;
4982
4961
  };
4962
+ /**
4963
+ * The value type every contact must use for a property. Cannot be changed after creation.
4964
+ */
4965
+ type ContactPropertyType = "string" | "number" | "boolean";
4983
4966
  type ContactPropertyId = string;
4984
4967
  type ContactProperty = {
4985
4968
  /**
@@ -4990,10 +4973,7 @@ type ContactProperty = {
4990
4973
  * The property key, used as the key in contact data and as the template variable name in broadcasts. Lowercase letters, digits, and underscores, starting with a letter. Cannot be changed after creation.
4991
4974
  */
4992
4975
  key: string;
4993
- /**
4994
- * The value type every contact must use for this property. Cannot be changed after creation.
4995
- */
4996
- type: "string" | "number" | "boolean";
4976
+ type: ContactPropertyType;
4997
4977
  /**
4998
4978
  * Default used when a contact has no value for this property and the template does not supply an inline fallback. A string, number, or boolean matching the declared type (strings up to 500 characters), or null when no fallback is set.
4999
4979
  */
@@ -5146,17 +5126,31 @@ type EmailMessageBatchItem = {
5146
5126
  *
5147
5127
  */
5148
5128
  type EmailMessageBatchRequest = Array<EmailMessageSendRequest>;
5129
+ /**
5130
+ * A language tag in BCP-47 form, for example `en` or `pt-BR`.
5131
+ */
5132
+ type LanguageTag = string;
5133
+ /**
5134
+ * A template's slug: its permanent, workspace-unique handle and API address. Lowercase letters, numbers, hyphens, and underscores. Fixed at creation, so anything that references it never breaks; the display name is the label to change freely.
5135
+ *
5136
+ */
5137
+ type TemplateSlug = string;
5149
5138
  type EmailTemplateSend = unknown & {
5150
5139
  /**
5151
5140
  * The template to send, by its id.
5152
5141
  */
5153
5142
  id?: EmailTemplateId;
5154
5143
  /**
5155
- * The template to send, by its name handle a workspace template (for example `welcome-email`) or a built-in `system` template (for example `bird_welcome`).
5144
+ * The template to send, by its slug handle. A workspace template (for example `welcome-email`) or a built-in `system` template (for example `bird_welcome`).
5156
5145
  */
5157
- name?: TemplateName;
5146
+ slug?: TemplateSlug;
5147
+ /**
5148
+ * Which of the template's languages to send. Omit it to send the template's default language. When the template does not carry the language you ask for, its own `on_missing_language` setting decides whether the closest available language is sent instead or the send is rejected.
5149
+ *
5150
+ */
5151
+ language?: LanguageTag;
5158
5152
  /**
5159
- * Values for the template's variables, keyed by variable name. A token with no matching value renders empty. Cap: 16 KB serialized.
5153
+ * Values for the template's variables, keyed by variable name. A token with no matching value renders empty. Send everything the template's `variables` lists rather than only what you expect the chosen language to use: languages need not reference the same variables, and a value no language uses is ignored. Cap: 16 KB serialized.
5160
5154
  *
5161
5155
  */
5162
5156
  parameters?: {
@@ -5241,11 +5235,7 @@ type EmailMessageSendRequest = {
5241
5235
  *
5242
5236
  */
5243
5237
  ip_pool_id?: string;
5244
- /**
5245
- * Content classification — independent of which endpoint you use. Controls suppression policy: `marketing` blocks on all suppression reasons (use for marketing content); `transactional` allows delivery through complaint and unsubscribe suppressions (use for receipts, password resets, and similar operational messages). Default: marketing.
5246
- *
5247
- */
5248
- category?: "marketing" | "transactional";
5238
+ category?: EmailMessageCategory;
5249
5239
  /**
5250
5240
  * Preview feature — threaded replies. Currently unavailable; supplying this field returns `422 UnsupportedEmailFeature`. When generally available, sets In-Reply-To and References headers automatically.
5251
5241
  */
@@ -5349,11 +5339,7 @@ type EmailMessage = {
5349
5339
  * Message subject line.
5350
5340
  */
5351
5341
  subject: string;
5352
- /**
5353
- * Content classification. Controls suppression policy — `marketing` blocks on all suppression reasons; `transactional` allows delivery through complaint and unsubscribe suppressions.
5354
- *
5355
- */
5356
- category: "marketing" | "transactional";
5342
+ category: EmailMessageCategory;
5357
5343
  /**
5358
5344
  * Reply-To addresses, if set on the send. Empty/null when no Reply-To was provided.
5359
5345
  */
@@ -5458,52 +5444,255 @@ type EmailMessage = {
5458
5444
  */
5459
5445
  readonly scheduled_at?: string | null;
5460
5446
  };
5461
- type ListEmailMessagesData = {
5462
- body?: never;
5463
- path?: never;
5464
- query?: {
5465
- /**
5466
- * Maximum number of items to return per page.
5467
- */
5468
- limit?: number;
5469
- /**
5470
- * Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.
5471
- */
5472
- starting_after?: string;
5473
- /**
5474
- * Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
5475
- */
5476
- ending_before?: string;
5477
- /**
5478
- * Return only resources created at or after this timestamp (inclusive lower bound). Combine with `created_before` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
5479
- */
5480
- created_after?: string;
5481
- /**
5482
- * Return only resources created strictly before this timestamp (exclusive upper bound). Combine with `created_after` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
5483
- */
5484
- created_before?: string;
5485
- /**
5486
- * Filter by aggregate delivery status.
5487
- */
5488
- status?: "scheduled" | "accepted" | "processed" | "deferred" | "delivered" | "partial_failure" | "bounced" | "complained" | "rejected" | "canceled";
5489
- /**
5490
- * Filter by tag. Accepts `name` to match any message carrying that tag name, or `name:value` to match a specific tag pair (e.g. `category:welcome`). Repeat the parameter to AND-combine several tag filters.
5491
- *
5492
- */
5493
- tag?: Array<string>;
5494
- /**
5495
- * Filter by category.
5496
- */
5497
- category?: "marketing" | "transactional";
5498
- /**
5499
- * Filter by recipient address. Exact match against any `to`/`cc`/`bcc` recipient on the message; normalised to lowercase before comparison.
5500
- *
5501
- */
5502
- to?: string;
5503
- /**
5504
- * Filter by sender address. Exact match against the message `from` field; normalised to lowercase before comparison.
5505
- *
5506
- */
5447
+ /**
5448
+ * The members present on a presence channel.
5449
+ */
5450
+ type RealtimeChannelMembers = {
5451
+ members: Array<RealtimeChannelMember>;
5452
+ };
5453
+ /**
5454
+ * An app-defined member id — the identity of your application's end user ("member"), assigned when your auth server authorizes them. Never a Bird user. Max 128 characters, restricted to URL-safe characters because member ids appear directly in API request paths. Broader than a channel name — allows `+ : @ . _ -` etc. for real identifiers (phone numbers, emails, `member:42`), but excludes `/ ? # %` and whitespace.
5455
+ */
5456
+ type RealtimeMemberId = string;
5457
+ /**
5458
+ * A member present on a presence channel.
5459
+ */
5460
+ type RealtimeChannelMember = {
5461
+ member_id: RealtimeMemberId;
5462
+ };
5463
+ type RealtimeChannelInfo = RealtimeChannelCounts & {
5464
+ /**
5465
+ * Whether at least one client is subscribed.
5466
+ */
5467
+ occupied: boolean;
5468
+ };
5469
+ /**
5470
+ * Per-channel counts, present only when requested via `include` and applicable.
5471
+ */
5472
+ type RealtimeChannelCounts = {
5473
+ /**
5474
+ * Distinct members (presence channels only; requires include=member_count).
5475
+ */
5476
+ member_count?: number;
5477
+ /**
5478
+ * Connections currently subscribed to this channel (requires include=connection_count and the app's connection-counting flag). Channel-scoped — distinct from the app-wide peak connections metric.
5479
+ */
5480
+ connection_count?: number;
5481
+ };
5482
+ /**
5483
+ * The app's occupied channels. The Realtime service does not paginate this listing, so all occupied channels are returned in one response.
5484
+ */
5485
+ type RealtimeChannelsList = {
5486
+ /**
5487
+ * The occupied channels, sorted by name.
5488
+ */
5489
+ data: Array<RealtimeChannelListItem>;
5490
+ };
5491
+ /**
5492
+ * A Realtime channel name. Only letters, digits, and _ - = @ , . ; Prefix with `private-` or `presence-` for authenticated channels.
5493
+ */
5494
+ type RealtimeChannelName = string;
5495
+ type RealtimeChannelListItem = RealtimeChannelCounts & {
5496
+ name: RealtimeChannelName;
5497
+ };
5498
+ /**
5499
+ * The result of a Realtime batch publish. The events were accepted for delivery; delivery to connected clients is asynchronous.
5500
+ *
5501
+ */
5502
+ type RealtimeBatchPublishResult = {
5503
+ /**
5504
+ * Per-event channel attributes at publish time, present only when at least one event asked for them via `include`. Positional: one item per event, in request order.
5505
+ */
5506
+ readonly data?: Array<RealtimeBatchPublishResultItem>;
5507
+ };
5508
+ type RealtimeBatchPublishResultItem = RealtimeChannelCounts & {
5509
+ channel: RealtimeChannelName;
5510
+ };
5511
+ /**
5512
+ * A batch of events, each delivered to a single channel, in one request.
5513
+ */
5514
+ type RealtimeBatchPublish = {
5515
+ /**
5516
+ * Up to 10 events per batch.
5517
+ */
5518
+ events: Array<RealtimeBatchEvent>;
5519
+ };
5520
+ /**
5521
+ * A per-channel attribute to include in the response. `member_count` is presence-channels only; `connection_count` requires the app's connection-counting flag.
5522
+ */
5523
+ type RealtimeChannelInclude = "member_count" | "connection_count";
5524
+ /**
5525
+ * Exclude this connection from delivery, to avoid echoing a change back to the client that triggered it. The value is the client's connection id, assigned when its connection is established.
5526
+ */
5527
+ type RealtimeExcludeConnectionId = string;
5528
+ /**
5529
+ * Arbitrary JSON payload delivered as the event data — an object, array, or scalar. Cap: 10 KB serialized.
5530
+ */
5531
+ type RealtimeEventData = unknown;
5532
+ /**
5533
+ * The event name clients bind to. Application event names are free-form; the `bird:` and `bird_internal:` prefixes are reserved for the protocol and rejected.
5534
+ */
5535
+ type RealtimeEventName = string;
5536
+ /**
5537
+ * One item of a batch publish — a single event to a single channel.
5538
+ */
5539
+ type RealtimeBatchEvent = {
5540
+ event: RealtimeEventName;
5541
+ channel: RealtimeChannelName;
5542
+ data?: RealtimeEventData;
5543
+ exclude_connection_id?: RealtimeExcludeConnectionId;
5544
+ /**
5545
+ * Attributes of this event's channel to return alongside the publish (same semantics and validation errors as on the channel endpoints). Requesting attributes counts as one additional message toward usage.
5546
+ */
5547
+ include?: Array<RealtimeChannelInclude>;
5548
+ };
5549
+ /**
5550
+ * The result of a Realtime publish. The event was accepted and fanned out to the requested channels; delivery to connected clients is asynchronous.
5551
+ *
5552
+ */
5553
+ type RealtimePublishResult = {
5554
+ /**
5555
+ * Per-channel attributes at publish time, present only when the request asked for them via `include`; one item per distinct target channel, sorted by name.
5556
+ */
5557
+ readonly data?: Array<RealtimeChannelListItem>;
5558
+ };
5559
+ /**
5560
+ * A Realtime publish: delivers one event to one or more channels of the app. Listing several channels fans the event out to all of them (broadcast) in a single call.
5561
+ *
5562
+ */
5563
+ type RealtimePublish = {
5564
+ event: RealtimeEventName;
5565
+ /**
5566
+ * The channels to deliver the event to (up to 100 per call). Prefix with `private-` or `presence-` for authenticated channels.
5567
+ *
5568
+ */
5569
+ channels: Array<RealtimeChannelName>;
5570
+ data?: RealtimeEventData;
5571
+ exclude_connection_id?: RealtimeExcludeConnectionId;
5572
+ /**
5573
+ * Per-channel attributes to return alongside the publish, reflecting each channel's state at publish time (same semantics and validation errors as on the channel endpoints: `member_count` is presence-channels only, `connection_count` requires the app's connection-counting flag). Requesting attributes counts as one additional message toward usage.
5574
+ */
5575
+ include?: Array<RealtimeChannelInclude>;
5576
+ };
5577
+ type RealtimeAppId = string;
5578
+ type ListRealtimeAppChannelsData = {
5579
+ body?: never;
5580
+ headers: {
5581
+ /**
5582
+ * Workspace context. Required for session auth; derived from API key otherwise.
5583
+ */
5584
+ "X-Workspace-Id"?: string;
5585
+ /**
5586
+ * The Realtime app key. With X-Realtime-Secret it authenticates the request to the Realtime edge. Both come from the app's credentials (shown once at creation) and must belong to the calling workspace.
5587
+ *
5588
+ */
5589
+ "X-Realtime-Key": string;
5590
+ /**
5591
+ * The Realtime app secret, paired with X-Realtime-Key. Sent over TLS and used only to sign the request to the edge — never stored. Rotate it by rotating the app key.
5592
+ *
5593
+ */
5594
+ "X-Realtime-Secret": string;
5595
+ };
5596
+ path: {
5597
+ /**
5598
+ * Realtime app ID
5599
+ */
5600
+ realtime_app_id: RealtimeAppId;
5601
+ };
5602
+ query?: {
5603
+ /**
5604
+ * Only channels whose name starts with this prefix (e.g. "presence-").
5605
+ */
5606
+ prefix?: string;
5607
+ /**
5608
+ * Per-channel attributes to include. Repeatable. Requesting `member_count` without a presence-channel `prefix`, or `connection_count` when the app's connection-counting flag is off, returns a validation error (400).
5609
+ */
5610
+ include?: Array<RealtimeChannelInclude>;
5611
+ };
5612
+ url: "/v1/realtime/apps/{realtime_app_id}/channels";
5613
+ };
5614
+ type GetRealtimeAppChannelData = {
5615
+ body?: never;
5616
+ headers: {
5617
+ /**
5618
+ * Workspace context. Required for session auth; derived from API key otherwise.
5619
+ */
5620
+ "X-Workspace-Id"?: string;
5621
+ /**
5622
+ * The Realtime app key. With X-Realtime-Secret it authenticates the request to the Realtime edge. Both come from the app's credentials (shown once at creation) and must belong to the calling workspace.
5623
+ *
5624
+ */
5625
+ "X-Realtime-Key": string;
5626
+ /**
5627
+ * The Realtime app secret, paired with X-Realtime-Key. Sent over TLS and used only to sign the request to the edge — never stored. Rotate it by rotating the app key.
5628
+ *
5629
+ */
5630
+ "X-Realtime-Secret": string;
5631
+ };
5632
+ path: {
5633
+ /**
5634
+ * Realtime app ID
5635
+ */
5636
+ realtime_app_id: RealtimeAppId;
5637
+ /**
5638
+ * Channel name
5639
+ */
5640
+ channel_name: RealtimeChannelName;
5641
+ };
5642
+ query?: {
5643
+ /**
5644
+ * Attributes to include. Repeatable. Requesting `member_count` for a non-presence channel, or `connection_count` when the app's connection-counting flag is off, returns a validation error (400).
5645
+ */
5646
+ include?: Array<RealtimeChannelInclude>;
5647
+ };
5648
+ url: "/v1/realtime/apps/{realtime_app_id}/channels/{channel_name}";
5649
+ };
5650
+ type ListEmailMessagesData = {
5651
+ body?: never;
5652
+ path?: never;
5653
+ query?: {
5654
+ /**
5655
+ * Maximum number of items to return per page.
5656
+ */
5657
+ limit?: number;
5658
+ /**
5659
+ * Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.
5660
+ */
5661
+ starting_after?: string;
5662
+ /**
5663
+ * Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
5664
+ */
5665
+ ending_before?: string;
5666
+ /**
5667
+ * Return only resources created at or after this timestamp (inclusive lower bound). Combine with `created_before` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
5668
+ */
5669
+ created_after?: string;
5670
+ /**
5671
+ * Return only resources created strictly before this timestamp (exclusive upper bound). Combine with `created_after` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
5672
+ */
5673
+ created_before?: string;
5674
+ /**
5675
+ * Filter by aggregate delivery status.
5676
+ */
5677
+ status?: EmailMessageStatus;
5678
+ /**
5679
+ * Filter by tag. Accepts `name` to match any message carrying that tag name, or `name:value` to match a specific tag pair (e.g. `category:welcome`). Repeat the parameter to AND-combine several tag filters.
5680
+ *
5681
+ */
5682
+ tag?: Array<string>;
5683
+ /**
5684
+ * Filter by category.
5685
+ */
5686
+ category?: EmailMessageCategory;
5687
+ /**
5688
+ * Filter by recipient address. Exact match against any `to`/`cc`/`bcc` recipient on the message; normalised to lowercase before comparison.
5689
+ *
5690
+ */
5691
+ to?: string;
5692
+ /**
5693
+ * Filter by sender address. Exact match against the message `from` field; normalised to lowercase before comparison.
5694
+ *
5695
+ */
5507
5696
  from?: string;
5508
5697
  };
5509
5698
  url: "/v1/email/messages";
@@ -5560,6 +5749,53 @@ type CreateContactData = {
5560
5749
  query?: never;
5561
5750
  url: "/v1/contacts";
5562
5751
  };
5752
+ type CreateContactBatchData = {
5753
+ body: ContactUpsertRequest;
5754
+ headers?: {
5755
+ /**
5756
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
5757
+ * Two distinct 409 errors signal misuse:
5758
+ * - `request_in_progress` (E01004) — the same key is currently being
5759
+ * processed by a concurrent request. Wait briefly and retry; the lock
5760
+ * expires within 30 seconds.
5761
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
5762
+ * against a different request body or method. Generate a new key.
5763
+ *
5764
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
5765
+ *
5766
+ */
5767
+ "Idempotency-Key"?: string;
5768
+ };
5769
+ path?: never;
5770
+ query?: never;
5771
+ url: "/v1/contacts/batch";
5772
+ };
5773
+ type UpdateContactData = {
5774
+ body: ContactUpdateRequest;
5775
+ headers?: {
5776
+ /**
5777
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
5778
+ * Two distinct 409 errors signal misuse:
5779
+ * - `request_in_progress` (E01004) — the same key is currently being
5780
+ * processed by a concurrent request. Wait briefly and retry; the lock
5781
+ * expires within 30 seconds.
5782
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
5783
+ * against a different request body or method. Generate a new key.
5784
+ *
5785
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
5786
+ *
5787
+ */
5788
+ "Idempotency-Key"?: string;
5789
+ };
5790
+ path: {
5791
+ /**
5792
+ * ID of the contact to update (`con_`-prefixed).
5793
+ */
5794
+ contact_id: ContactId;
5795
+ };
5796
+ query?: never;
5797
+ url: "/v1/contacts/{contact_id}";
5798
+ };
5563
5799
  type ListContactPropertiesData = {
5564
5800
  body?: never;
5565
5801
  path?: never;
@@ -5579,6 +5815,53 @@ type ListContactPropertiesData = {
5579
5815
  };
5580
5816
  url: "/v1/contact-properties";
5581
5817
  };
5818
+ type CreateContactPropertyData = {
5819
+ body: ContactPropertyCreateRequest;
5820
+ headers?: {
5821
+ /**
5822
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
5823
+ * Two distinct 409 errors signal misuse:
5824
+ * - `request_in_progress` (E01004) — the same key is currently being
5825
+ * processed by a concurrent request. Wait briefly and retry; the lock
5826
+ * expires within 30 seconds.
5827
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
5828
+ * against a different request body or method. Generate a new key.
5829
+ *
5830
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
5831
+ *
5832
+ */
5833
+ "Idempotency-Key"?: string;
5834
+ };
5835
+ path?: never;
5836
+ query?: never;
5837
+ url: "/v1/contact-properties";
5838
+ };
5839
+ type UpdateContactPropertyData = {
5840
+ body: ContactPropertyUpdateRequest;
5841
+ headers?: {
5842
+ /**
5843
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
5844
+ * Two distinct 409 errors signal misuse:
5845
+ * - `request_in_progress` (E01004) — the same key is currently being
5846
+ * processed by a concurrent request. Wait briefly and retry; the lock
5847
+ * expires within 30 seconds.
5848
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
5849
+ * against a different request body or method. Generate a new key.
5850
+ *
5851
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
5852
+ *
5853
+ */
5854
+ "Idempotency-Key"?: string;
5855
+ };
5856
+ path: {
5857
+ /**
5858
+ * ID of the contact property to update (`prp_`-prefixed).
5859
+ */
5860
+ property_id: ContactPropertyId;
5861
+ };
5862
+ query?: never;
5863
+ url: "/v1/contact-properties/{property_id}";
5864
+ };
5582
5865
  type ListAudiencesData = {
5583
5866
  body?: never;
5584
5867
  path?: never;
@@ -5602,6 +5885,53 @@ type ListAudiencesData = {
5602
5885
  };
5603
5886
  url: "/v1/audiences";
5604
5887
  };
5888
+ type CreateAudienceData = {
5889
+ body: AudienceCreateRequest;
5890
+ headers?: {
5891
+ /**
5892
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
5893
+ * Two distinct 409 errors signal misuse:
5894
+ * - `request_in_progress` (E01004) — the same key is currently being
5895
+ * processed by a concurrent request. Wait briefly and retry; the lock
5896
+ * expires within 30 seconds.
5897
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
5898
+ * against a different request body or method. Generate a new key.
5899
+ *
5900
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
5901
+ *
5902
+ */
5903
+ "Idempotency-Key"?: string;
5904
+ };
5905
+ path?: never;
5906
+ query?: never;
5907
+ url: "/v1/audiences";
5908
+ };
5909
+ type UpdateAudienceData = {
5910
+ body: AudienceUpdateRequest;
5911
+ headers?: {
5912
+ /**
5913
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
5914
+ * Two distinct 409 errors signal misuse:
5915
+ * - `request_in_progress` (E01004) — the same key is currently being
5916
+ * processed by a concurrent request. Wait briefly and retry; the lock
5917
+ * expires within 30 seconds.
5918
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
5919
+ * against a different request body or method. Generate a new key.
5920
+ *
5921
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
5922
+ *
5923
+ */
5924
+ "Idempotency-Key"?: string;
5925
+ };
5926
+ path: {
5927
+ /**
5928
+ * ID of the audience to update (`adn_`-prefixed).
5929
+ */
5930
+ audience_id: AudienceId;
5931
+ };
5932
+ query?: never;
5933
+ url: "/v1/audiences/{audience_id}";
5934
+ };
5605
5935
  type ListAudienceContactsData = {
5606
5936
  body?: never;
5607
5937
  path: {
@@ -5630,6 +5960,58 @@ type ListAudienceContactsData = {
5630
5960
  };
5631
5961
  url: "/v1/audiences/{audience_id}/contacts";
5632
5962
  };
5963
+ type AssignAudienceContactsData = {
5964
+ body: AudienceContactsAddRequest;
5965
+ headers?: {
5966
+ /**
5967
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
5968
+ * Two distinct 409 errors signal misuse:
5969
+ * - `request_in_progress` (E01004) — the same key is currently being
5970
+ * processed by a concurrent request. Wait briefly and retry; the lock
5971
+ * expires within 30 seconds.
5972
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
5973
+ * against a different request body or method. Generate a new key.
5974
+ *
5975
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
5976
+ *
5977
+ */
5978
+ "Idempotency-Key"?: string;
5979
+ };
5980
+ path: {
5981
+ /**
5982
+ * ID of the audience to add contacts to (`adn_`-prefixed).
5983
+ */
5984
+ audience_id: AudienceId;
5985
+ };
5986
+ query?: never;
5987
+ url: "/v1/audiences/{audience_id}/contacts";
5988
+ };
5989
+ type UnassignAudienceContactsData = {
5990
+ body: AudienceContactsRemoveRequest;
5991
+ headers?: {
5992
+ /**
5993
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
5994
+ * Two distinct 409 errors signal misuse:
5995
+ * - `request_in_progress` (E01004) — the same key is currently being
5996
+ * processed by a concurrent request. Wait briefly and retry; the lock
5997
+ * expires within 30 seconds.
5998
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
5999
+ * against a different request body or method. Generate a new key.
6000
+ *
6001
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
6002
+ *
6003
+ */
6004
+ "Idempotency-Key"?: string;
6005
+ };
6006
+ path: {
6007
+ /**
6008
+ * ID of the audience to remove contacts from (`adn_`-prefixed).
6009
+ */
6010
+ audience_id: AudienceId;
6011
+ };
6012
+ query?: never;
6013
+ url: "/v1/audiences/{audience_id}/contacts/remove";
6014
+ };
5633
6015
  type ListSmsMessagesData = {
5634
6016
  body?: never;
5635
6017
  path?: never;
@@ -5657,7 +6039,7 @@ type ListSmsMessagesData = {
5657
6039
  /**
5658
6040
  * Filter by direction. Omit for both.
5659
6041
  */
5660
- direction?: "outbound" | "inbound";
6042
+ direction?: MessageDirection;
5661
6043
  /**
5662
6044
  * Keep only messages whose current `status` matches; repeat the parameter to match any of several. One of `scheduled`, `accepted`, `sent`, `delivered`, `undelivered`, `failed`, `rejected`, `canceled`, `expired`, or `received`.
5663
6045
  *
@@ -5671,7 +6053,7 @@ type ListSmsMessagesData = {
5671
6053
  /**
5672
6054
  * Filter by category.
5673
6055
  */
5674
- category?: "transactional" | "marketing" | "authentication" | "service";
6056
+ category?: SmsMessageCategory;
5675
6057
  /**
5676
6058
  * Filter by recipient phone number (E.164 exact match).
5677
6059
  */
@@ -5696,11 +6078,11 @@ type ListSmsTemplatesData = {
5696
6078
  * Keep only templates of this scope: `system` for Bird's built-in templates, `workspace` for templates authored in your workspace. Omit for all. Workspace-authored SMS templates are not available yet, so `workspace` currently matches nothing.
5697
6079
  *
5698
6080
  */
5699
- scope?: "system" | "workspace";
6081
+ scope?: TemplateScope;
5700
6082
  /**
5701
6083
  * Keep only templates whose `category` matches. Omit for all categories.
5702
6084
  */
5703
- category?: "transactional" | "marketing" | "authentication" | "service";
6085
+ category?: SmsMessageCategory;
5704
6086
  /**
5705
6087
  * Keep only templates available in this language, as a BCP-47 tag. Matches the template's `available_languages` entries exactly, with no fallback.
5706
6088
  *
@@ -5709,6 +6091,56 @@ type ListSmsTemplatesData = {
5709
6091
  };
5710
6092
  url: "/v1/sms/templates";
5711
6093
  };
6094
+ type CreateVerificationData = {
6095
+ body: VerificationCreateRequest;
6096
+ headers?: {
6097
+ /**
6098
+ * Workspace context. Required for session auth; derived from API key otherwise.
6099
+ */
6100
+ "X-Workspace-Id"?: string;
6101
+ /**
6102
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
6103
+ * Two distinct 409 errors signal misuse:
6104
+ * - `request_in_progress` (E01004) — the same key is currently being
6105
+ * processed by a concurrent request. Wait briefly and retry; the lock
6106
+ * expires within 30 seconds.
6107
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
6108
+ * against a different request body or method. Generate a new key.
6109
+ *
6110
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
6111
+ *
6112
+ */
6113
+ "Idempotency-Key"?: string;
6114
+ };
6115
+ path?: never;
6116
+ query?: never;
6117
+ url: "/v1/verify/verifications";
6118
+ };
6119
+ type CreateVerificationCheckData = {
6120
+ body: VerificationCheckRequest;
6121
+ headers?: {
6122
+ /**
6123
+ * Workspace context. Required for session auth; derived from API key otherwise.
6124
+ */
6125
+ "X-Workspace-Id"?: string;
6126
+ /**
6127
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
6128
+ * Two distinct 409 errors signal misuse:
6129
+ * - `request_in_progress` (E01004) — the same key is currently being
6130
+ * processed by a concurrent request. Wait briefly and retry; the lock
6131
+ * expires within 30 seconds.
6132
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
6133
+ * against a different request body or method. Generate a new key.
6134
+ *
6135
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
6136
+ *
6137
+ */
6138
+ "Idempotency-Key"?: string;
6139
+ };
6140
+ path?: never;
6141
+ query?: never;
6142
+ url: "/v1/verify/verifications/check";
6143
+ };
5712
6144
  type ListWhatsAppMessagesData = {
5713
6145
  body?: never;
5714
6146
  path?: never;
@@ -5906,7 +6338,7 @@ type GetEmailStatsByTagData = {
5906
6338
  /**
5907
6339
  * Bucket grain for the `trend` series. Has no effect unless `include_trend=true`.
5908
6340
  */
5909
- trend_grain?: "daily" | "hourly";
6341
+ trend_grain?: StatsTrendGrain;
5910
6342
  };
5911
6343
  url: "/v1/email/stats/tags";
5912
6344
  };
@@ -6004,7 +6436,7 @@ type GetEmailStatsBySendingIpData = {
6004
6436
  /**
6005
6437
  * Bucket grain for the `trend` series. Has no effect unless `include_trend=true`.
6006
6438
  */
6007
- trend_grain?: "daily" | "hourly";
6439
+ trend_grain?: StatsTrendGrain;
6008
6440
  };
6009
6441
  url: "/v1/email/stats/sending-ips";
6010
6442
  };
@@ -6046,7 +6478,7 @@ type GetEmailStatsBySendingDomainData = {
6046
6478
  /**
6047
6479
  * Bucket grain for the `trend` series. Has no effect unless `include_trend=true`.
6048
6480
  */
6049
- trend_grain?: "daily" | "hourly";
6481
+ trend_grain?: StatsTrendGrain;
6050
6482
  };
6051
6483
  url: "/v1/email/stats/sending-domains";
6052
6484
  };
@@ -6084,7 +6516,7 @@ type GetEmailStatsByCategoryData = {
6084
6516
  /**
6085
6517
  * Bucket grain for the `trend` series. Has no effect unless `include_trend=true`.
6086
6518
  */
6087
- trend_grain?: "daily" | "hourly";
6519
+ trend_grain?: StatsTrendGrain;
6088
6520
  };
6089
6521
  url: "/v1/email/stats/categories";
6090
6522
  };
@@ -6126,7 +6558,7 @@ type GetEmailStatsByMailboxProviderData = {
6126
6558
  /**
6127
6559
  * Bucket grain for the `trend` series. Has no effect unless `include_trend=true`.
6128
6560
  */
6129
- trend_grain?: "daily" | "hourly";
6561
+ trend_grain?: StatsTrendGrain;
6130
6562
  };
6131
6563
  url: "/v1/email/stats/mailbox-providers";
6132
6564
  };
@@ -6168,7 +6600,7 @@ type GetEmailStatsByMailboxProviderRegionData = {
6168
6600
  /**
6169
6601
  * Bucket grain for the `trend` series. Has no effect unless `include_trend=true`.
6170
6602
  */
6171
- trend_grain?: "daily" | "hourly";
6603
+ trend_grain?: StatsTrendGrain;
6172
6604
  };
6173
6605
  url: "/v1/email/stats/mailbox-provider-regions";
6174
6606
  };
@@ -6210,7 +6642,7 @@ type GetEmailStatsByRecipientDomainData = {
6210
6642
  /**
6211
6643
  * Bucket grain for the `trend` series. Has no effect unless `include_trend=true`.
6212
6644
  */
6213
- trend_grain?: "daily" | "hourly";
6645
+ trend_grain?: StatsTrendGrain;
6214
6646
  };
6215
6647
  url: "/v1/email/stats/recipient-domains";
6216
6648
  };
@@ -6252,7 +6684,7 @@ type GetEmailStatsByTemplateData = {
6252
6684
  /**
6253
6685
  * Bucket grain for the `trend` series. Has no effect unless `include_trend=true`.
6254
6686
  */
6255
- trend_grain?: "daily" | "hourly";
6687
+ trend_grain?: StatsTrendGrain;
6256
6688
  };
6257
6689
  url: "/v1/email/stats/templates";
6258
6690
  };
@@ -6431,7 +6863,7 @@ type GetEmailStatsByBroadcastData = {
6431
6863
  /**
6432
6864
  * Bucket grain for the `trend` series. Has no effect on this breakdown, where `include_trend` is not available.
6433
6865
  */
6434
- trend_grain?: "daily" | "hourly";
6866
+ trend_grain?: StatsTrendGrain;
6435
6867
  };
6436
6868
  url: "/v1/email/stats/broadcasts";
6437
6869
  };
@@ -6459,17 +6891,64 @@ type ListDomainsData = {
6459
6891
  /**
6460
6892
  * Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.
6461
6893
  */
6462
- starting_after?: string;
6894
+ starting_after?: string;
6895
+ /**
6896
+ * Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
6897
+ */
6898
+ ending_before?: string;
6899
+ /**
6900
+ * When true, the response includes a `total` field with the total number of items matching the request's filters across all pages.
6901
+ */
6902
+ include_total?: boolean;
6903
+ };
6904
+ url: "/v1/email/domains";
6905
+ };
6906
+ type CreateDomainData = {
6907
+ body: DomainCreate;
6908
+ headers?: {
6909
+ /**
6910
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
6911
+ * Two distinct 409 errors signal misuse:
6912
+ * - `request_in_progress` (E01004) — the same key is currently being
6913
+ * processed by a concurrent request. Wait briefly and retry; the lock
6914
+ * expires within 30 seconds.
6915
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
6916
+ * against a different request body or method. Generate a new key.
6917
+ *
6918
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
6919
+ *
6920
+ */
6921
+ "Idempotency-Key"?: string;
6922
+ };
6923
+ path?: never;
6924
+ query?: never;
6925
+ url: "/v1/email/domains";
6926
+ };
6927
+ type UpdateDomainData = {
6928
+ body: DomainUpdate;
6929
+ headers?: {
6463
6930
  /**
6464
- * Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
6931
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
6932
+ * Two distinct 409 errors signal misuse:
6933
+ * - `request_in_progress` (E01004) — the same key is currently being
6934
+ * processed by a concurrent request. Wait briefly and retry; the lock
6935
+ * expires within 30 seconds.
6936
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
6937
+ * against a different request body or method. Generate a new key.
6938
+ *
6939
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
6940
+ *
6465
6941
  */
6466
- ending_before?: string;
6942
+ "Idempotency-Key"?: string;
6943
+ };
6944
+ path: {
6467
6945
  /**
6468
- * When true, the response includes a `total` field with the total number of items matching the request's filters across all pages.
6946
+ * Domain ID.
6469
6947
  */
6470
- include_total?: boolean;
6948
+ domain_id: DomainId;
6471
6949
  };
6472
- url: "/v1/email/domains";
6950
+ query?: never;
6951
+ url: "/v1/email/domains/{domain_id}";
6473
6952
  };
6474
6953
  type ListMailboxesData = {
6475
6954
  body?: never;
@@ -6510,6 +6989,58 @@ type ListMailboxesData = {
6510
6989
  };
6511
6990
  url: "/v1/email/mailboxes";
6512
6991
  };
6992
+ type CreateMailboxData = {
6993
+ body: MailboxCreate;
6994
+ headers?: {
6995
+ /**
6996
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
6997
+ * Two distinct 409 errors signal misuse:
6998
+ * - `request_in_progress` (E01004) — the same key is currently being
6999
+ * processed by a concurrent request. Wait briefly and retry; the lock
7000
+ * expires within 30 seconds.
7001
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
7002
+ * against a different request body or method. Generate a new key.
7003
+ *
7004
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
7005
+ *
7006
+ */
7007
+ "Idempotency-Key"?: string;
7008
+ };
7009
+ path?: never;
7010
+ query?: never;
7011
+ url: "/v1/email/mailboxes";
7012
+ };
7013
+ type UpdateMailboxData = {
7014
+ body: MailboxUpdate;
7015
+ headers?: {
7016
+ /**
7017
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
7018
+ * Two distinct 409 errors signal misuse:
7019
+ * - `request_in_progress` (E01004) — the same key is currently being
7020
+ * processed by a concurrent request. Wait briefly and retry; the lock
7021
+ * expires within 30 seconds.
7022
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
7023
+ * against a different request body or method. Generate a new key.
7024
+ *
7025
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
7026
+ *
7027
+ */
7028
+ "Idempotency-Key"?: string;
7029
+ };
7030
+ path: {
7031
+ /**
7032
+ * Mailbox ID.
7033
+ */
7034
+ mailbox_id: MailboxId;
7035
+ };
7036
+ query?: {
7037
+ /**
7038
+ * Required as `true` when lowering `retention_tier`, acknowledging that remembered messages older than the new horizon are deleted.
7039
+ */
7040
+ confirm?: boolean;
7041
+ };
7042
+ url: "/v1/email/mailboxes/{mailbox_id}";
7043
+ };
6513
7044
  type GetMailboxStatsData = {
6514
7045
  body?: never;
6515
7046
  path: {
@@ -6570,6 +7101,32 @@ type ListMailboxReceiveRulesData = {
6570
7101
  };
6571
7102
  url: "/v1/email/mailboxes/{mailbox_id}/receive-rules";
6572
7103
  };
7104
+ type CreateMailboxReceiveRuleData = {
7105
+ body: ReceiveRuleCreate;
7106
+ headers?: {
7107
+ /**
7108
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
7109
+ * Two distinct 409 errors signal misuse:
7110
+ * - `request_in_progress` (E01004) — the same key is currently being
7111
+ * processed by a concurrent request. Wait briefly and retry; the lock
7112
+ * expires within 30 seconds.
7113
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
7114
+ * against a different request body or method. Generate a new key.
7115
+ *
7116
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
7117
+ *
7118
+ */
7119
+ "Idempotency-Key"?: string;
7120
+ };
7121
+ path: {
7122
+ /**
7123
+ * Mailbox ID.
7124
+ */
7125
+ mailbox_id: MailboxId;
7126
+ };
7127
+ query?: never;
7128
+ url: "/v1/email/mailboxes/{mailbox_id}/receive-rules";
7129
+ };
6573
7130
  type ListEmailThreadsData = {
6574
7131
  body?: never;
6575
7132
  path?: never;
@@ -6621,6 +7178,63 @@ type ListEmailThreadsData = {
6621
7178
  };
6622
7179
  url: "/v1/email/threads";
6623
7180
  };
7181
+ type DeleteEmailThreadData = {
7182
+ body?: never;
7183
+ headers?: {
7184
+ /**
7185
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
7186
+ * Two distinct 409 errors signal misuse:
7187
+ * - `request_in_progress` (E01004) — the same key is currently being
7188
+ * processed by a concurrent request. Wait briefly and retry; the lock
7189
+ * expires within 30 seconds.
7190
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
7191
+ * against a different request body or method. Generate a new key.
7192
+ *
7193
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
7194
+ *
7195
+ */
7196
+ "Idempotency-Key"?: string;
7197
+ };
7198
+ path: {
7199
+ /**
7200
+ * Thread ID.
7201
+ */
7202
+ thread_id: ThreadId;
7203
+ };
7204
+ query?: {
7205
+ /**
7206
+ * Permanently delete the conversation and its messages immediately instead of moving them to the trash.
7207
+ */
7208
+ permanent?: boolean;
7209
+ };
7210
+ url: "/v1/email/threads/{thread_id}";
7211
+ };
7212
+ type UpdateEmailThreadData = {
7213
+ body: EmailThreadUpdateRequest;
7214
+ headers?: {
7215
+ /**
7216
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
7217
+ * Two distinct 409 errors signal misuse:
7218
+ * - `request_in_progress` (E01004) — the same key is currently being
7219
+ * processed by a concurrent request. Wait briefly and retry; the lock
7220
+ * expires within 30 seconds.
7221
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
7222
+ * against a different request body or method. Generate a new key.
7223
+ *
7224
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
7225
+ *
7226
+ */
7227
+ "Idempotency-Key"?: string;
7228
+ };
7229
+ path: {
7230
+ /**
7231
+ * Thread ID.
7232
+ */
7233
+ thread_id: ThreadId;
7234
+ };
7235
+ query?: never;
7236
+ url: "/v1/email/threads/{thread_id}";
7237
+ };
6624
7238
  type ListEmailThreadMessagesData = {
6625
7239
  body?: never;
6626
7240
  path: {
@@ -6633,7 +7247,7 @@ type ListEmailThreadMessagesData = {
6633
7247
  /**
6634
7248
  * Filter to received (`inbound`) or sent (`outbound`) messages.
6635
7249
  */
6636
- direction?: "inbound" | "outbound";
7250
+ direction?: MessageDirection;
6637
7251
  /**
6638
7252
  * Filter to messages carrying this label. `trash` lists trashed messages; any other label — `archive`, `spam`, `blocked`, `unread`, or a custom label — lists its non-trashed carriers. When omitted, received messages in the inbox and all sent messages are returned.
6639
7253
  *
@@ -6658,6 +7272,36 @@ type ListEmailThreadMessagesData = {
6658
7272
  };
6659
7273
  url: "/v1/email/threads/{thread_id}/messages";
6660
7274
  };
7275
+ type ReplyEmailThreadMessageData = {
7276
+ body: EmailThreadMessageReplyRequest;
7277
+ headers?: {
7278
+ /**
7279
+ * Client-supplied deduplication key. When present, the server replays the original response for any duplicate request with the same key within the idempotency TTL window (3 hours by default).
7280
+ * Two distinct 409 errors signal misuse:
7281
+ * - `request_in_progress` (E01004) — the same key is currently being
7282
+ * processed by a concurrent request. Wait briefly and retry; the lock
7283
+ * expires within 30 seconds.
7284
+ * - `idempotency_key_reuse` (E01005) — the same key has already completed
7285
+ * against a different request body or method. Generate a new key.
7286
+ *
7287
+ * Recommended key format is `<event-type>/<entity-id>` (e.g. `welcome-user/usr_abc123`).
7288
+ *
7289
+ */
7290
+ "Idempotency-Key"?: string;
7291
+ };
7292
+ path: {
7293
+ /**
7294
+ * Thread ID.
7295
+ */
7296
+ thread_id: ThreadId;
7297
+ /**
7298
+ * Message ID (`rem_` for a received message, `em_` for a sent one).
7299
+ */
7300
+ message_id: string;
7301
+ };
7302
+ query?: never;
7303
+ url: "/v1/email/threads/{thread_id}/messages/{message_id}/reply";
7304
+ };
6661
7305
  //#endregion
6662
7306
  //#region src/generated/core/auth.gen.d.ts
6663
7307
  type AuthToken = string | undefined;
@@ -6991,6 +7635,37 @@ declare abstract class Resource {
6991
7635
  protected paginated<T>(method: string, options: RequestOptions | undefined, invoke: (ctx: CallContext, cursor: string | undefined) => Promise<FetchOutcome<CursorPage<T>>>): PaginatedPromise<T>;
6992
7636
  }
6993
7637
  //#endregion
7638
+ //#region src/resources/email.gen.d.ts
7639
+ type EmailListQuery$1 = NonNullable<ListEmailMessagesData["query"]>;
7640
+ declare class EmailResourceBase extends Resource {
7641
+ /**
7642
+ * Fetch one email message by id — aggregate delivery status and per-state recipient counts. The message body (html, text) is not returned. Per-recipient delivery statuses and the event log are separate sub-resources: GET /v1/email/messages/{message_id}/recipients and GET /v1/email/messages/{message_id}/events.
7643
+ *
7644
+ * @example
7645
+ * const msg = await bird.email.get("em_abc123");
7646
+ * msg.status; // "accepted" | "processed" | "delivered" | "bounced" | …
7647
+ * msg.delivered_count;
7648
+ * msg.bounced_count;
7649
+ */
7650
+ get(messageId: string, options?: RequestOptions): APIPromise<EmailMessage>;
7651
+ /**
7652
+ * List sent email messages, newest first, as a cursor page ({data, next_cursor, …}). Pass next_cursor back as starting_after to fetch the next page. Filter by creation time with the half-open range created_after (inclusive) / created_before (exclusive) — e.g. for a single UTC day set created_after to that day at 00:00:00Z and created_before to the next day at 00:00:00Z.
7653
+ *
7654
+ * @example
7655
+ * for await (const message of bird.email.list({ status: "bounced" })) {
7656
+ * console.log(message.id);
7657
+ * }
7658
+ */
7659
+ list(query?: EmailListQuery$1, options?: RequestOptions): PaginatedPromise<EmailMessage>;
7660
+ /**
7661
+ * Cancel a scheduled email before it sends. Only works while the message is still scheduled (status `scheduled`); once it starts sending — or was already canceled — the call returns a conflict error. Canceling does not return consumed scheduled-send quota.
7662
+ *
7663
+ * @example
7664
+ * await bird.email.cancel("em_abc123");
7665
+ */
7666
+ cancel(messageId: string, options?: RequestOptions): APIPromise<void>;
7667
+ }
7668
+ //#endregion
6994
7669
  //#region src/resources/emailStats.gen.d.ts
6995
7670
  type EmailStatsSummaryQuery = NonNullable<GetEmailStatsSummaryData["query"]>;
6996
7671
  type EmailStatsDailyQuery = NonNullable<GetEmailStatsDailyData["query"]>;
@@ -7210,7 +7885,7 @@ type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
7210
7885
  type DefaultedKeys<D> = D extends object ? Extract<keyof D, keyof EmailSendParams> : never;
7211
7886
  /** `send` params with defaulted fields made optional. */
7212
7887
  type EmailSend<D> = PartialBy<EmailSendParams, DefaultedKeys<D>>;
7213
- declare class EmailResource<D extends EmailChannelDefaults | undefined = undefined> extends Resource {
7888
+ declare class EmailResource<D extends EmailChannelDefaults | undefined = undefined> extends EmailResourceBase {
7214
7889
  #private;
7215
7890
  /** Email statistics — `bird.email.stats.summary(...)`, `.daily(...)`, `.byTag(...)`, … */
7216
7891
  readonly stats: EmailStatsResource;
@@ -7302,202 +7977,156 @@ declare class EmailResource<D extends EmailChannelDefaults | undefined = undefin
7302
7977
  * for (const item of batch.data) console.log(item.id, item.status);
7303
7978
  */
7304
7979
  sendBatch(params: EmailSendBatchParams, options?: RequestOptions): APIPromise<EmailSendBatchResult>;
7305
- /**
7306
- * Fetch a message with aggregate delivery status.
7307
- *
7308
- * @example
7309
- * const msg = await bird.email.get("em_abc123");
7310
- * msg.status; // "accepted" | "processed" | "delivered" | "bounced" | …
7311
- * msg.delivered_count;
7312
- * msg.bounced_count;
7313
- */
7314
- get(messageId: string, options?: RequestOptions): APIPromise<EmailMessage>;
7315
- /**
7316
- * Cancel a message scheduled with `scheduled_at` before it sends. Only a
7317
- * message that is still scheduled can be canceled; one that already started
7318
- * sending — or was previously canceled — rejects with a conflict error.
7319
- * Canceling does not return consumed scheduled-send quota.
7320
- *
7321
- * @example
7322
- * await bird.email.cancel("em_abc123");
7323
- */
7324
- cancel(messageId: string, options?: RequestOptions): APIPromise<void>;
7325
- /**
7326
- * List messages, newest first. `await` resolves the first page; `for await`
7327
- * walks every message across all pages.
7328
- *
7329
- * @example Iterate every message, or take one page
7330
- * for await (const message of bird.email.list({ status: "bounced" })) {
7331
- * console.log(message.id);
7332
- * }
7333
- * const page = await bird.email.list({ limit: 50 }); // page.data, page.next_cursor
7334
- */
7335
- list(query?: EmailListQuery, options?: RequestOptions): PaginatedPromise<EmailMessage>;
7336
7980
  }
7337
7981
  //#endregion
7338
- //#region src/resources/audiences.d.ts
7339
- /** Body for `bird.audiences.create`. */
7340
- type AudienceCreateParams = AudienceCreateRequest;
7341
- /** Body for `bird.audiences.update` — a partial patch. */
7342
- type AudienceUpdateParams = AudienceUpdateRequest;
7343
- /** Body for `bird.audiences.addContacts`. */
7344
- type AudienceAddContactsParams = AudienceContactsAddRequest;
7345
- /** Body for `bird.audiences.removeContacts`. */
7346
- type AudienceRemoveContactsParams = AudienceContactsRemoveRequest;
7347
- /** Filters and cursor params for `bird.audiences.list`. */
7982
+ //#region src/resources/audiences.gen.d.ts
7348
7983
  type AudienceListQuery = NonNullable<ListAudiencesData["query"]>;
7349
- /** Cursor params for `bird.audiences.listContacts`. */
7350
- type AudienceContactsQuery = NonNullable<ListAudienceContactsData["query"]>;
7984
+ type AudienceCreateParams = NonNullable<CreateAudienceData["body"]>;
7985
+ type AudienceUpdateParams = NonNullable<UpdateAudienceData["body"]>;
7986
+ type AudienceListContactsQuery = NonNullable<ListAudienceContactsData["query"]>;
7987
+ type AudienceAddContactsParams = NonNullable<AssignAudienceContactsData["body"]>;
7988
+ type AudienceRemoveContactsParams = NonNullable<UnassignAudienceContactsData["body"]>;
7351
7989
  declare class AudiencesResource extends Resource {
7352
7990
  /**
7353
- * Create an audience.
7354
- *
7355
- * @example Create an audience
7356
- * const audience = await bird.audiences.create({ name: "Newsletter subscribers" });
7357
- * console.log(audience.id); // "aud_…"
7358
- */
7359
- create(params: AudienceCreateParams, options?: RequestOptions): APIPromise<Audience>;
7360
- /**
7361
- * List the workspace's audiences, newest first. `await` resolves the first
7362
- * page; `for await` walks every audience across pages.
7991
+ * List the workspace's audiences as a cursor page, newest first. Filter by name substring with `q`.
7363
7992
  *
7364
- * @example
7993
+ * @example Iterate every audience, or take one page
7365
7994
  * for await (const audience of bird.audiences.list()) {
7366
7995
  * console.log(audience.id, audience.name);
7367
7996
  * }
7368
7997
  */
7369
7998
  list(query?: AudienceListQuery, options?: RequestOptions): PaginatedPromise<Audience>;
7370
7999
  /**
7371
- * Fetch a single audience by id.
8000
+ * Get a single audience by ID: name, description, and type. Members are listed separately with `audiences.list_contacts`.
7372
8001
  *
7373
- * @example
7374
- * const audience = await bird.audiences.get("aud_01krdgeqcxet5s7t44vh8rt9mg");
8002
+ * @example Fetch an audience by id
8003
+ * const audience = await bird.audiences.get("adn_01krdgeqcxet5s7t44vh8rt9mg");
8004
+ * console.log(audience.name);
7375
8005
  */
7376
8006
  get(audienceId: string, options?: RequestOptions): APIPromise<Audience>;
7377
8007
  /**
7378
- * Update an audience. Only the fields you send change.
8008
+ * Create an audience in the workspace. New audiences start empty; add contacts with `audiences.add_contacts` or `contacts.batch`. Only static audiences can be created today.
7379
8009
  *
7380
- * @example
7381
- * await bird.audiences.update("aud_01krdgeqcxet5s7t44vh8rt9mg", { name: "Renamed" });
8010
+ * @example Create an audience
8011
+ * const audience = await bird.audiences.create({ name: "Newsletter subscribers" });
8012
+ * console.log(audience.id); // "adn_…"
7382
8013
  */
7383
- update(audienceId: string, params: AudienceUpdateParams, options?: RequestOptions): APIPromise<Audience>;
8014
+ create(params: AudienceCreateParams, options?: RequestOptions): APIPromise<Audience>;
7384
8015
  /**
7385
- * Delete an audience. Its contacts are unaffected.
8016
+ * Update an audience's name or description. Omitted fields are unchanged; a null description clears it.
7386
8017
  *
7387
- * @example
7388
- * await bird.audiences.delete("aud_01krdgeqcxet5s7t44vh8rt9mg");
8018
+ * @example Rename an audience
8019
+ * await bird.audiences.update("adn_01krdgeqcxet5s7t44vh8rt9mg", { name: "Renamed" });
8020
+ */
8021
+ update(audienceId: string, params?: AudienceUpdateParams, options?: RequestOptions): APIPromise<Audience>;
8022
+ /**
8023
+ * Delete an audience and its memberships; contacts themselves are not deleted. Fails while a broadcast targeting the audience is scheduled, accepted, sending, or canceling.
8024
+ *
8025
+ * @example Delete an audience by id
8026
+ * await bird.audiences.delete("adn_01krdgeqcxet5s7t44vh8rt9mg");
7389
8027
  */
7390
8028
  delete(audienceId: string, options?: RequestOptions): APIPromise<void>;
7391
8029
  /**
7392
- * List the contacts in an audience, newest first. `await` resolves the first
7393
- * page; `for await` walks every member across pages.
8030
+ * List the contacts in a static audience by ID, as a cursor page ordered by when each contact joined (most recent first). Each entry pairs the contact with its join time.
7394
8031
  *
7395
- * @example
7396
- * for await (const member of bird.audiences.listContacts("aud_01krdgeqcxet5s7t44vh8rt9mg")) {
8032
+ * @example Iterate an audience's members
8033
+ * for await (const member of bird.audiences.listContacts("adn_01krdgeqcxet5s7t44vh8rt9mg")) {
7397
8034
  * console.log(member.contact.id, member.joined_at);
7398
8035
  * }
7399
8036
  */
7400
- listContacts(audienceId: string, query?: AudienceContactsQuery, options?: RequestOptions): PaginatedPromise<AudienceMember>;
8037
+ listContacts(audienceId: string, query?: AudienceListContactsQuery, options?: RequestOptions): PaginatedPromise<AudienceMember>;
7401
8038
  /**
7402
- * Add contacts to an audience by id.
8039
+ * Add up to 1,000 existing contacts to a static audience by ID. Fails entirely if any contact ID does not exist.
7403
8040
  *
7404
- * @example
7405
- * await bird.audiences.addContacts("aud_01krdgeqcxet5s7t44vh8rt9mg", {
7406
- * contact_ids: ["con_1", "con_2"],
8041
+ * @example Add contacts to an audience
8042
+ * await bird.audiences.addContacts("adn_01krdgeqcxet5s7t44vh8rt9mg", {
8043
+ * contact_ids: ["con_01krdgeqcxet5s7t44vh8rt9mg"],
7407
8044
  * });
7408
8045
  */
7409
8046
  addContacts(audienceId: string, params: AudienceAddContactsParams, options?: RequestOptions): APIPromise<void>;
7410
8047
  /**
7411
- * Remove a set of contacts from an audience.
8048
+ * Remove up to 1,000 contacts from a static audience by ID. Fails entirely if any contact ID does not exist; contacts are not deleted.
7412
8049
  *
7413
- * @example
7414
- * await bird.audiences.removeContacts("aud_01krdgeqcxet5s7t44vh8rt9mg", {
7415
- * contact_ids: ["con_1", "con_2"],
8050
+ * @example Remove contacts from an audience
8051
+ * await bird.audiences.removeContacts("adn_01krdgeqcxet5s7t44vh8rt9mg", {
8052
+ * contact_ids: ["con_01krdgeqcxet5s7t44vh8rt9mg"],
7416
8053
  * });
7417
8054
  */
7418
8055
  removeContacts(audienceId: string, params: AudienceRemoveContactsParams, options?: RequestOptions): APIPromise<void>;
7419
8056
  /**
7420
- * Remove a single contact from an audience.
8057
+ * Remove one contact's membership from an audience. The contact itself is not deleted and stays a member of any other audiences.
7421
8058
  *
7422
- * @example
7423
- * await bird.audiences.removeContact("aud_01krdgeqcxet5s7t44vh8rt9mg", "con_1");
7424
- */
7425
- removeContact(audienceId: string, contactId: string, options?: RequestOptions): APIPromise<void>;
7426
- }
7427
- //#endregion
7428
- //#region src/resources/domains.d.ts
7429
- /** Body for `bird.domains.create`. */
7430
- type DomainCreateParams = DomainCreate;
7431
- /**
7432
- * Body for `bird.domains.update` — a partial patch. Omit a field to leave it
7433
- * unchanged; send `tracking: null` to remove the tracking domain (both tracking
7434
- * toggles must be off first, else the API returns 409).
7435
- */
7436
- type DomainUpdateParams = DomainUpdate;
7437
- /** Filters and cursor params for `bird.domains.list`. */
7438
- type DomainListQuery = NonNullable<ListDomainsData["query"]>;
7439
- declare class DomainsResource extends Resource {
7440
- /**
7441
- * Register a sending domain. Returns it in `pending` with the `dns_records`
7442
- * to publish at your DNS provider; call `verify` once they are in place.
7443
- *
7444
- * @example Register a sending domain
7445
- * const domain = await bird.domains.create({ domain: "mail.acme.com" });
7446
- * console.log(domain.id, domain.status); // "dom_…", "pending"
8059
+ * @example Remove one contact's membership
8060
+ * await bird.audiences.removeContact(
8061
+ * "adn_01krdgeqcxet5s7t44vh8rt9mg",
8062
+ * "con_01krdgeqcxet5s7t44vh8rt9mg",
8063
+ * );
7447
8064
  */
7448
- create(params: DomainCreateParams, options?: RequestOptions): APIPromise<Domain>;
8065
+ removeContact(audienceId: string, contactId: string, options?: RequestOptions): APIPromise<void>;
8066
+ }
8067
+ //#endregion
8068
+ //#region src/resources/domains.gen.d.ts
8069
+ type DomainListQuery = NonNullable<ListDomainsData["query"]>;
8070
+ type DomainCreateParams = NonNullable<CreateDomainData["body"]>;
8071
+ type DomainUpdateParams = NonNullable<UpdateDomainData["body"]>;
8072
+ declare class DomainsResource extends Resource {
7449
8073
  /**
7450
- * List the workspace's sending domains, newest first. `await` resolves the
7451
- * first page; `for await` walks every domain across pages.
8074
+ * List the workspace's sending domains with their verification status, as a cursor page.
7452
8075
  *
7453
- * @example
8076
+ * @example Iterate every sending domain
7454
8077
  * for await (const domain of bird.domains.list()) {
7455
8078
  * console.log(domain.id, domain.status);
7456
8079
  * }
7457
8080
  */
7458
8081
  list(query?: DomainListQuery, options?: RequestOptions): PaginatedPromise<Domain>;
7459
8082
  /**
7460
- * Fetch a single sending domain by id, with its DNS records and their
7461
- * per-record verification state.
8083
+ * Fetch one sending domain: verification status and the DNS records with their individual verification states.
7462
8084
  *
7463
- * @example
8085
+ * @example Fetch a sending domain by id
7464
8086
  * const domain = await bird.domains.get("dom_01krdgeqcxet5s7t44vh8rt9mg");
8087
+ * console.log(domain.domain);
7465
8088
  */
7466
8089
  get(domainId: string, options?: RequestOptions): APIPromise<Domain>;
7467
8090
  /**
7468
- * Update a sending domain. Only the fields you send change; `settings` apply
7469
- * immediately, while `return_path`/`tracking`/`dkim` changes are staged until
7470
- * their new DNS records verify.
8091
+ * Register a new sending domain and get the DNS records to publish. Flow: call this, publish the returned DNS records at your DNS provider, then call email_domains_verify (repeat until status is verified — DNS propagation can take minutes to hours).
7471
8092
  *
7472
- * @example
8093
+ * @example Register a sending domain
8094
+ * const domain = await bird.domains.create({ domain: "mail.acme.com" });
8095
+ * console.log(domain.id, domain.status); // "dom_…", "pending"
8096
+ */
8097
+ create(params: DomainCreateParams, options?: RequestOptions): APIPromise<Domain>;
8098
+ /**
8099
+ * Trigger a DNS verification check for a sending domain and return the refreshed domain with per-record results. Safe to repeat while waiting for DNS propagation.
8100
+ *
8101
+ * @example Re-run the DNS verification check
8102
+ * const domain = await bird.domains.verify("dom_01krdgeqcxet5s7t44vh8rt9mg");
8103
+ * console.log(domain.status); // "verified" once DNS is in place
8104
+ */
8105
+ verify(domainId: string, options?: RequestOptions): APIPromise<Domain>;
8106
+ /**
8107
+ * Update a sending domain's tracking and inbound configuration. Tracking: toggle click_tracking and open_tracking (applied immediately to new sends), and set, change, or remove the tracking domain (the name part only — Bird appends the sending domain). Enabling either toggle with no tracking domain configured returns 409; removing the tracking domain while either toggle is still on also returns 409. Tracking-domain changes on a verified domain are staged behind DNS verification, so the current config keeps serving until the new records verify. Inbound receiving: set inbound.enabled to start or stop receiving mail for the domain. Enabling requires the domain's DKIM to be verified first (a fresh enable on an unverified domain returns 422), and a domain already receiving inbound for another organization returns 422. The MX records to publish are always listed in dns_records regardless, so enabling — not merely publishing them — is what turns receiving on.
8108
+ *
8109
+ * @example Enable tracking on a domain
7473
8110
  * await bird.domains.update("dom_01krdgeqcxet5s7t44vh8rt9mg", {
7474
8111
  * settings: { click_tracking: true, open_tracking: true },
7475
8112
  * tracking: { name: "links" },
7476
8113
  * });
7477
8114
  */
7478
- update(domainId: string, params: DomainUpdateParams, options?: RequestOptions): APIPromise<Domain>;
8115
+ update(domainId: string, params?: DomainUpdateParams, options?: RequestOptions): APIPromise<Domain>;
7479
8116
  /**
7480
- * Delete a sending domain. Mail already accepted still sends; you can no
7481
- * longer send new mail from it.
8117
+ * Delete a sending domain by id. Revokes its sender authorization: new sends from the domain are rejected afterward, while historical statistics and events for past sends are preserved. Destructive.
7482
8118
  *
7483
- * @example
8119
+ * @example Delete a sending domain by id
7484
8120
  * await bird.domains.delete("dom_01krdgeqcxet5s7t44vh8rt9mg");
7485
8121
  */
7486
8122
  delete(domainId: string, options?: RequestOptions): APIPromise<void>;
7487
- /**
7488
- * Trigger a fresh DNS check and return the refreshed domain with per-record
7489
- * results. Safe to repeat while waiting for DNS to propagate.
7490
- *
7491
- * @example
7492
- * const domain = await bird.domains.verify("dom_01krdgeqcxet5s7t44vh8rt9mg");
7493
- * console.log(domain.status); // "verified" once DNS is in place
7494
- */
7495
- verify(domainId: string, options?: RequestOptions): APIPromise<Domain>;
7496
8123
  }
7497
8124
  //#endregion
7498
8125
  //#region src/resources/contactProperties.gen.d.ts
7499
8126
  type ContactPropertyListQuery = NonNullable<ListContactPropertiesData["query"]>;
7500
- declare class ContactPropertiesResourceBase extends Resource {
8127
+ type ContactPropertyCreateParams = NonNullable<CreateContactPropertyData["body"]>;
8128
+ type ContactPropertyUpdateParams = NonNullable<UpdateContactPropertyData["body"]>;
8129
+ declare class ContactPropertiesResource extends Resource {
7501
8130
  /**
7502
8131
  * List the workspace's contact properties as a cursor page, newest first. Archived properties are included, marked by their archived flag.
7503
8132
  *
@@ -7516,6 +8145,21 @@ declare class ContactPropertiesResourceBase extends Resource {
7516
8145
  * console.log(prop.key, prop.type);
7517
8146
  */
7518
8147
  get(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty>;
8148
+ /**
8149
+ * Define a custom contact property (key + value type) that becomes available in contact data and as a broadcast template variable. The key and type cannot change after creation; a workspace holds at most 200 properties, archived included.
8150
+ *
8151
+ * @example Define a custom property
8152
+ * const prop = await bird.contactProperties.create({ key: "plan", type: "string" });
8153
+ * console.log(prop.id); // "cp_…"
8154
+ */
8155
+ create(params: ContactPropertyCreateParams, options?: RequestOptions): APIPromise<ContactProperty>;
8156
+ /**
8157
+ * Update a contact property's fallback value. The key and type are immutable; create a new property instead.
8158
+ *
8159
+ * @example Change a property's fallback value
8160
+ * await bird.contactProperties.update("cp_01krdgeqcxet5s7t44vh8rt9mg", { fallback_value: "free" });
8161
+ */
8162
+ update(propertyId: string, params?: ContactPropertyUpdateParams, options?: RequestOptions): APIPromise<ContactProperty>;
7519
8163
  /**
7520
8164
  * Archive a contact property: the key is rejected in new contact writes and stops rendering in templates, while stored values remain readable. The key stays reserved and counts toward the 200-property limit; reverse with `contact_properties.unarchive`.
7521
8165
  *
@@ -7533,34 +8177,12 @@ declare class ContactPropertiesResourceBase extends Resource {
7533
8177
  unarchive(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty>;
7534
8178
  }
7535
8179
  //#endregion
7536
- //#region src/resources/contactProperties.d.ts
7537
- /** Body for `bird.contactProperties.create`. */
7538
- type ContactPropertyCreateParams = ContactPropertyCreateRequest;
7539
- /** Body for `bird.contactProperties.update` — a partial patch. */
7540
- type ContactPropertyUpdateParams = ContactPropertyUpdateRequest;
7541
- declare class ContactPropertiesResource extends ContactPropertiesResourceBase {
7542
- /**
7543
- * Define a contact property. The `key` must be unique in the workspace and is
7544
- * how contacts reference the field in their `data`.
7545
- *
7546
- * @example
7547
- * const prop = await bird.contactProperties.create({ key: "plan", type: "string" });
7548
- * console.log(prop.id); // "cp_…"
7549
- */
7550
- create(params: ContactPropertyCreateParams, options?: RequestOptions): APIPromise<ContactProperty>;
7551
- /**
7552
- * Update a contact property. Only the fields you send change.
7553
- *
7554
- * @example
7555
- * await bird.contactProperties.update("cp_01krdgeqcxet5s7t44vh8rt9mg", { fallback_value: "free" });
7556
- */
7557
- update(propertyId: string, params: ContactPropertyUpdateParams, options?: RequestOptions): APIPromise<ContactProperty>;
7558
- }
7559
- //#endregion
7560
8180
  //#region src/resources/contacts.gen.d.ts
7561
8181
  type ContactListQuery = NonNullable<ListContactsData["query"]>;
7562
8182
  type ContactCreateParams = NonNullable<CreateContactData["body"]>;
7563
- declare class ContactsResourceBase extends Resource {
8183
+ type ContactUpdateParams = NonNullable<UpdateContactData["body"]>;
8184
+ type ContactBatchParams = NonNullable<CreateContactBatchData["body"]>;
8185
+ declare class ContactsResource extends Resource {
7564
8186
  /**
7565
8187
  * List the workspace's contacts as a cursor page, newest first. Look one up by exact email or external_id, or search by email substring.
7566
8188
  *
@@ -7590,6 +8212,16 @@ declare class ContactsResourceBase extends Resource {
7590
8212
  * console.log(contact.id); // "con_…"
7591
8213
  */
7592
8214
  create(params: ContactCreateParams, options?: RequestOptions): APIPromise<Contact>;
8215
+ /**
8216
+ * Update a contact's name, external_id, email, or custom data. Only supplied fields change; custom data keys are merged, with null removing a key.
8217
+ *
8218
+ * @example Change a contact's fields
8219
+ * const contact = await bird.contacts.update("con_01krdgeqcxet5s7t44vh8rt9mg", {
8220
+ * first_name: "Jane",
8221
+ * });
8222
+ * console.log(contact.first_name);
8223
+ */
8224
+ update(contactId: string, params?: ContactUpdateParams, options?: RequestOptions): APIPromise<Contact>;
7593
8225
  /**
7594
8226
  * Delete a contact and remove it from every audience it belongs to. Suppression records for the address are unaffected.
7595
8227
  *
@@ -7597,33 +8229,40 @@ declare class ContactsResourceBase extends Resource {
7597
8229
  * await bird.contacts.delete("con_01krdgeqcxet5s7t44vh8rt9mg");
7598
8230
  */
7599
8231
  delete(contactId: string, options?: RequestOptions): APIPromise<void>;
8232
+ /**
8233
+ * Create or update up to 1,000 contacts in one request, matched by email address, and optionally add them all to one or more audiences. Per-contact results are returned in submission order.
8234
+ *
8235
+ * @example Create or update many contacts at once, matched by email
8236
+ * const result = await bird.contacts.batch({
8237
+ * contacts: [{ email: "jane@acme.com", first_name: "Jane" }],
8238
+ * });
8239
+ * for (const item of result.data) {
8240
+ * console.log(item.email, item.status);
8241
+ * }
8242
+ */
8243
+ batch(params: ContactBatchParams, options?: RequestOptions): APIPromise<ContactUpsertResult>;
7600
8244
  }
7601
8245
  //#endregion
7602
- //#region src/resources/contacts.d.ts
7603
- /** Body for `bird.contacts.update` — a partial patch. */
7604
- type ContactUpdateParams = ContactUpdateRequest;
7605
- /** Body for `bird.contacts.batch` — create-or-update many contacts in one call. */
7606
- type ContactBatchParams = ContactUpsertRequest;
7607
- declare class ContactsResource extends ContactsResourceBase {
8246
+ //#region src/resources/sms.gen.d.ts
8247
+ type SmsListQuery = NonNullable<ListSmsMessagesData["query"]>;
8248
+ declare class SmsResourceBase extends Resource {
7608
8249
  /**
7609
- * Update a contact. Only the fields you send change.
8250
+ * Get one SMS message by id: its current delivery status, segment breakdown, cost, and failure detail if it failed.
7610
8251
  *
7611
- * @example
7612
- * const contact = await bird.contacts.update("con_01krdgeqcxet5s7t44vh8rt9mg", {
7613
- * first_name: "Jane",
7614
- * });
8252
+ * @example Read a message back
8253
+ * const msg = await bird.sms.get("sms_abc123");
8254
+ * msg.status; // "accepted" | "delivered" | …
7615
8255
  */
7616
- update(contactId: string, params: ContactUpdateParams, options?: RequestOptions): APIPromise<Contact>;
8256
+ get(messageId: string, options?: RequestOptions): APIPromise<SmsMessage>;
7617
8257
  /**
7618
- * Create or update many contacts in one call, matched by email. Returns a
7619
- * per-contact result.
8258
+ * List SMS messages, newest first, as a cursor page ({data, next_cursor, …}). Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, category, recipient, sender, or tag.
7620
8259
  *
7621
- * @example
7622
- * const result = await bird.contacts.batch({
7623
- * contacts: [{ email: "jane@acme.com", first_name: "Jane" }],
7624
- * });
8260
+ * @example Iterate outbound messages
8261
+ * for await (const msg of bird.sms.list({ direction: "outbound" })) {
8262
+ * console.log(msg.id, msg.status);
8263
+ * }
7625
8264
  */
7626
- batch(params: ContactBatchParams, options?: RequestOptions): APIPromise<ContactUpsertResult>;
8265
+ list(query?: SmsListQuery, options?: RequestOptions): PaginatedPromise<SmsMessage>;
7627
8266
  }
7628
8267
  //#endregion
7629
8268
  //#region src/resources/sms.d.ts
@@ -7634,8 +8273,7 @@ type SmsSendBatchParams = SmsMessageBatchRequest;
7634
8273
  /** Result of `bird.sms.sendBatch`. */
7635
8274
  type SmsSendBatchResult = SmsMessageBatchResponse;
7636
8275
  /** Filters and cursor params for `bird.sms.list`. */
7637
- type SmsListQuery = NonNullable<ListSmsMessagesData["query"]>;
7638
- declare class SmsResource extends Resource {
8276
+ declare class SmsResource extends SmsResourceBase {
7639
8277
  /**
7640
8278
  * Send one SMS to a single recipient. Supply either `text` (with a `category`)
7641
8279
  * or a stored `template` (by `id` or `name`, with its `parameters`). The
@@ -7668,37 +8306,13 @@ declare class SmsResource extends Resource {
7668
8306
  * ]);
7669
8307
  */
7670
8308
  sendBatch(params: SmsSendBatchParams, options?: RequestOptions): APIPromise<SmsSendBatchResult>;
7671
- /**
7672
- * Fetch a single SMS message: its current delivery status, segment breakdown,
7673
- * cost, and failure detail if it failed.
7674
- *
7675
- * @example
7676
- * const msg = await bird.sms.get("sms_abc123");
7677
- * msg.status; // "accepted" | "delivered" | …
7678
- */
7679
- get(messageId: string, options?: RequestOptions): APIPromise<SmsMessage>;
7680
- /**
7681
- * List SMS messages, newest first. `await` resolves the first page; `for await`
7682
- * walks every message across all pages. Filter by direction, status, category,
7683
- * recipient, sender, or tag.
7684
- *
7685
- * @example
7686
- * for await (const msg of bird.sms.list({ direction: "outbound" })) {
7687
- * console.log(msg.id, msg.status);
7688
- * }
7689
- */
7690
- list(query?: SmsListQuery, options?: RequestOptions): PaginatedPromise<SmsMessage>;
7691
8309
  }
7692
8310
  //#endregion
7693
- //#region src/resources/smsTemplates.d.ts
7694
- /** Filters for `bird.smsTemplates.list`. */
8311
+ //#region src/resources/smsTemplates.gen.d.ts
7695
8312
  type SmsTemplateListQuery = NonNullable<ListSmsTemplatesData["query"]>;
7696
8313
  declare class SmsTemplatesResource extends Resource {
7697
8314
  /**
7698
- * List the SMS templates available to the workspace Bird's built-in
7699
- * templates plus any the workspace authored. The catalogue is small and
7700
- * returned in full (`.data`); this list is not paginated. Filter by `scope`,
7701
- * `category`, or `language` (a BCP-47 language tag).
8315
+ * List the SMS templates available to your workspace, including Bird's built-in templates. Filter by scope, category, or language. The catalogue is small and returned in full; this list is not paginated. Use sms_templates_get to read one template's variables before sending with it.
7702
8316
  *
7703
8317
  * @example List the built-in templates
7704
8318
  * const { data } = await bird.smsTemplates.list({ scope: "system" });
@@ -7706,127 +8320,102 @@ declare class SmsTemplatesResource extends Resource {
7706
8320
  */
7707
8321
  list(query?: SmsTemplateListQuery, options?: RequestOptions): APIPromise<SmsTemplateList>;
7708
8322
  /**
7709
- * Fetch a single SMS template by its name or id, including its body and the
7710
- * variables it expects.
8323
+ * Get one SMS template by its name or id, including its body and the variables it expects. Fetch it before sms_send to see which parameter keys a template send requires.
7711
8324
  *
7712
- * @example
8325
+ * @example Read one template by name or id
7713
8326
  * const tpl = await bird.smsTemplates.get("bird_otp_verification");
7714
8327
  * console.log(tpl.body, tpl.variables);
7715
8328
  */
7716
8329
  get(templateRef: string, options?: RequestOptions): APIPromise<SmsTemplate>;
7717
8330
  }
7718
8331
  //#endregion
7719
- //#region src/resources/whatsapp.d.ts
7720
- /** Body for `bird.whatsapp.send` — a template send; Bird picks the sender from the template's category. */
7721
- type WhatsappSendParams = WhatsAppMessageSendRequest;
7722
- /** Filters and cursor params for `bird.whatsapp.list`. */
8332
+ //#region src/resources/whatsapp.gen.d.ts
7723
8333
  type WhatsappListQuery = NonNullable<ListWhatsAppMessagesData["query"]>;
7724
- /** Filter for `bird.whatsapp.listEvents`. */
7725
8334
  type WhatsappListEventsQuery = NonNullable<ListWhatsAppMessageEventsData["query"]>;
7726
- declare class WhatsappResource extends Resource {
7727
- /**
7728
- * Send a template message. Bird selects the sender number from the
7729
- * template's category, so there is no sender field on the request. The
7730
- * result is `accepted`, not yet delivered — read it back with `get` to
7731
- * confirm.
7732
- *
7733
- * @example
7734
- * const msg = await bird.whatsapp.send({
7735
- * to: "+15551234567",
7736
- * template: {
7737
- * name: "bird_otp",
7738
- * components: [
7739
- * { type: "body", parameters: [{ type: "text", text: "123456" }] },
7740
- * ],
7741
- * },
7742
- * });
7743
- * console.log(msg.id, msg.status);
7744
- */
7745
- send(params: WhatsappSendParams, options?: RequestOptions): APIPromise<WhatsAppMessage>;
8335
+ declare class WhatsappResourceBase extends Resource {
7746
8336
  /**
7747
- * Fetch a single WhatsApp message: its current delivery status and failure
7748
- * detail if it failed.
8337
+ * Get one WhatsApp message by id: current delivery status, sent/delivered/read timestamps, the template it was sent from, and failure detail if it failed. For the per-event timeline use whatsapp_list_events.
7749
8338
  *
7750
- * @example
8339
+ * @example Read a message back
7751
8340
  * const msg = await bird.whatsapp.get("wa_abc123");
7752
8341
  * msg.status; // "accepted" | "delivered" | …
7753
8342
  */
7754
8343
  get(messageId: string, options?: RequestOptions): APIPromise<WhatsAppMessage>;
7755
8344
  /**
7756
- * List WhatsApp messages, newest first. `await` resolves the first page;
7757
- * `for await` walks every message across all pages. Filter by status,
7758
- * recipient phone number, or business-scoped user ID.
8345
+ * List WhatsApp messages, newest first, as a cursor page ({data, next_cursor, …}). Pass next_cursor back as starting_after to fetch the next page. Filter by status, contact phone number, bsuid, or tag. Use whatsapp_get for one message's current state.
7759
8346
  *
7760
- * @example
8347
+ * @example Iterate delivered messages
7761
8348
  * for await (const msg of bird.whatsapp.list({ status: ["delivered"] })) {
7762
8349
  * console.log(msg.id, msg.status);
7763
8350
  * }
7764
8351
  */
7765
8352
  list(query?: WhatsappListQuery, options?: RequestOptions): PaginatedPromise<WhatsAppMessage>;
7766
8353
  /**
7767
- * List a WhatsApp message's lifecycle event timeline, in chronological
7768
- * order. The timeline is bounded and returned in full — this list is not
7769
- * paginated.
8354
+ * Get one WhatsApp message's delivery timeline, oldest first: whatsapp.accepted, whatsapp.sent, whatsapp.delivered, whatsapp.read, and whatsapp.failed events, with failure detail on failed events. Not paginated; an unknown message id is a 404. Use whatsapp_get for the condensed current status.
7770
8355
  *
7771
- * @example
8356
+ * @example Read one message's delivery timeline
7772
8357
  * const { data } = await bird.whatsapp.listEvents("wa_abc123");
7773
8358
  * for (const event of data) console.log(event.type, event.occurred_at);
7774
8359
  */
7775
8360
  listEvents(messageId: string, query?: WhatsappListEventsQuery, options?: RequestOptions): APIPromise<WhatsAppEventList>;
7776
8361
  }
7777
8362
  //#endregion
7778
- //#region src/resources/whatsappTemplates.d.ts
7779
- declare class WhatsappTemplatesResource extends Resource {
8363
+ //#region src/resources/whatsapp.d.ts
8364
+ /** Body for `bird.whatsapp.send` a template send; Bird picks the sender from the template's category. */
8365
+ type WhatsappSendParams = WhatsAppMessageSendRequest;
8366
+ declare class WhatsappResource extends WhatsappResourceBase {
7780
8367
  /**
7781
- * List the WhatsApp message templates available to the workspace Meta's
7782
- * approved templates for this business account. The catalogue is small and
7783
- * returned in full (`.data`); this list is not paginated.
8368
+ * Send a template message. Bird selects the sender number from the
8369
+ * template's category, so there is no sender field on the request. The
8370
+ * result is `accepted`, not yet delivered read it back with `get` to
8371
+ * confirm.
7784
8372
  *
7785
8373
  * @example
7786
- * const { data } = await bird.whatsappTemplates.list();
7787
- * for (const tpl of data) console.log(tpl.name, tpl.status);
8374
+ * const msg = await bird.whatsapp.send({
8375
+ * to: "+15551234567",
8376
+ * template: {
8377
+ * name: "bird_otp",
8378
+ * components: [
8379
+ * { type: "body", parameters: [{ type: "text", text: "123456" }] },
8380
+ * ],
8381
+ * },
8382
+ * });
8383
+ * console.log(msg.id, msg.status);
7788
8384
  */
7789
- list(options?: RequestOptions): APIPromise<WhatsAppTemplateList>;
8385
+ send(params: WhatsappSendParams, options?: RequestOptions): APIPromise<WhatsAppMessage>;
7790
8386
  }
7791
8387
  //#endregion
7792
- //#region src/resources/verify.d.ts
7793
- /** Body for `bird.verify.verifications.create` — a recipient in `to`, plus optional `options`/`metadata`. */
7794
- type VerificationCreateParams = VerificationCreateRequest;
7795
- /** Body for `bird.verify.verifications.check` the recipient in `to` and the submitted `code`. */
7796
- type VerificationCheckParams = VerificationCheckRequest;
7797
- declare class VerificationsResource extends Resource {
7798
- /**
7799
- * Start a verification and send a one-time passcode to the recipient in `to`
7800
- * (a `phone_number` over SMS, an `email_address` over email, or both). Calling
7801
- * again for the same recipient re-sends the code after the cooldown rather than
7802
- * starting a second verification. The passcode is never returned — submit the
7803
- * recipient's entry with `check`.
7804
- *
7805
- * @example Start over SMS
8388
+ //#region src/resources/verifyVerifications.gen.d.ts
8389
+ type VerifyVerificationsCreateParams = NonNullable<CreateVerificationData["body"]>;
8390
+ type VerifyVerificationsCheckParams = NonNullable<CreateVerificationCheckData["body"]>;
8391
+ declare class VerifyVerificationsResource extends Resource {
8392
+ /**
8393
+ * Start a verification: generate a one-time passcode and send it to the recipient in `to` (a phone number over SMS, an email address over email, or both; with both, it is sent over one channel and fails over to the other, not to both at once). Calling again for the same recipient reuses the in-progress verification and sends a fresh code after the resend cooldown; it does not start a second one, so use this both to send and to resend. The passcode is never returned; submit what the recipient enters with verify_verifications_check. SMS delivery draws on the workspace's SMS balance.
8394
+ *
8395
+ * @example Start a verification over SMS
7806
8396
  * const verification = await bird.verify.verifications.create({
7807
8397
  * to: { phone_number: "+15551234567" },
7808
8398
  * });
7809
8399
  * console.log(verification.id, verification.status);
7810
8400
  */
7811
- create(params: VerificationCreateParams, options?: RequestOptions): APIPromise<Verification>;
8401
+ create(params: VerifyVerificationsCreateParams, options?: RequestOptions): APIPromise<Verification>;
7812
8402
  /**
7813
- * Check a passcode the recipient submitted. Identify the verification by the same
7814
- * `to` recipient used to start it — no id needed. A wrong or expired code resolves
7815
- * with `success: false` and a `reason`, not an error; a verification already
7816
- * resolved is no longer checkable and returns a 404 error.
8403
+ * Check a passcode a recipient submitted. Identify the verification by the same `to` recipient used to start it; no verification id needed. A wrong or expired code returns HTTP 200 with `success: false` and a `reason` (for example `incorrect_code` or `expired`), not an error. A verification that has already reached a final state is no longer checkable and returns 404, as does a missing verification; malformed input or rate limiting is also an error status.
7817
8404
  *
7818
- * @example
8405
+ * @example Check a submitted passcode
7819
8406
  * const result = await bird.verify.verifications.check({
7820
8407
  * to: { phone_number: "+15551234567" },
7821
8408
  * code: "123456",
7822
8409
  * });
7823
8410
  * console.log(result.success);
7824
8411
  */
7825
- check(params: VerificationCheckParams, options?: RequestOptions): APIPromise<VerificationCheckResult>;
8412
+ check(params: VerifyVerificationsCheckParams, options?: RequestOptions): APIPromise<VerificationCheckResult>;
7826
8413
  }
8414
+ //#endregion
8415
+ //#region src/resources/verify.d.ts
7827
8416
  /** The Verify product namespace — holds the `verifications` collection. */
7828
8417
  declare class VerifyResource {
7829
- readonly verifications: VerificationsResource;
8418
+ readonly verifications: VerifyVerificationsResource;
7830
8419
  constructor(...args: ConstructorParameters<typeof Resource>);
7831
8420
  }
7832
8421
  //#endregion
@@ -7884,24 +8473,24 @@ declare class WebhooksResource {
7884
8473
  unwrap(payload: string, headers: WebhookHeaders, options?: WebhookOptions): BirdWebhookEvent;
7885
8474
  }
7886
8475
  //#endregion
7887
- //#region src/resources/mailbox.d.ts
7888
- /** Parameters for creating a mailbox. */
7889
- type MailboxCreateParams = MailboxCreate;
7890
- /** Partial update for a mailbox; omitted fields are unchanged. */
7891
- type MailboxUpdateParams = MailboxUpdate;
7892
- /** Filters for `bird.mailbox.list`. */
8476
+ //#region src/resources/mailbox.gen.d.ts
7893
8477
  type MailboxListQuery = NonNullable<ListMailboxesData["query"]>;
7894
- /** Stats query parameters. */
8478
+ type MailboxCreateParams = NonNullable<CreateMailboxData["body"]>;
8479
+ type MailboxUpdateParams = NonNullable<UpdateMailboxData["body"]>;
8480
+ type MailboxUpdateQuery = NonNullable<UpdateMailboxData["query"]>;
7895
8481
  type MailboxStatsQuery = NonNullable<GetMailboxStatsData["query"]>;
7896
- /** Parameters for composing a new message from a mailbox. */
7897
- type MailboxComposeParams = EmailMailboxComposeRequest;
7898
- /** Parameters for creating a receive rule. */
7899
- type MailboxReceiveRuleCreateParams = ReceiveRuleCreate;
7900
- /** Filters for `bird.mailboxReceiveRule.list`. */
7901
- type MailboxReceiveRuleListQuery = NonNullable<ListMailboxReceiveRulesData["query"]>;
7902
- declare class MailboxResource extends Resource {
8482
+ declare class MailboxResourceBase extends Resource {
8483
+ /**
8484
+ * List the workspace's mailboxes as a cursor page, newest first. Search addresses and display names with q, or filter by exact address, state, or domain.
8485
+ *
8486
+ * @example List mailboxes
8487
+ * for await (const mailbox of bird.mailbox.list()) {
8488
+ * console.log(mailbox.address);
8489
+ * }
8490
+ */
8491
+ list(query?: MailboxListQuery, options?: RequestOptions): PaginatedPromise<Mailbox>;
7903
8492
  /**
7904
- * Create a mailbox. Omit `local_part` to auto-generate a handle on inbox.ai.
8493
+ * Create a mailbox a durable agent identity that owns an email address, groups mail into threads, and remembers conversations for its retention tier.
7905
8494
  *
7906
8495
  * @example Create a mailbox
7907
8496
  * const mailbox = await bird.mailbox.create({ display_name: "Support" });
@@ -7909,49 +8498,64 @@ declare class MailboxResource extends Resource {
7909
8498
  */
7910
8499
  create(params?: MailboxCreateParams, options?: RequestOptions): APIPromise<Mailbox>;
7911
8500
  /**
7912
- * Get a mailbox by id.
7913
- *
7914
8501
  * @example Get a mailbox
7915
8502
  * const mailbox = await bird.mailbox.get("mbx_01abc");
7916
8503
  * console.log(mailbox.state); // "active"
7917
8504
  */
7918
8505
  get(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7919
8506
  /**
7920
- * Update a mailbox. Only the fields you provide change.
8507
+ * Update a mailbox's display name, reply-to, receive policy, retention tier, contact, or metadata. Lowering the retention tier onto remembered messages older than the new horizon requires confirm=true.
7921
8508
  *
7922
- * @example Update receive policy
7923
- * const mailbox = await bird.mailbox.update("mbx_01abc", { receive_policy: "open" });
8509
+ * @example Change a mailbox's receive policy
8510
+ * const mailbox = await bird.mailbox.update("mbx_01abc", {
8511
+ * receive_policy: "open",
8512
+ * });
8513
+ * console.log(mailbox.id, mailbox.receive_policy);
7924
8514
  */
7925
- update(mailboxId: string, params: MailboxUpdateParams, options?: RequestOptions): APIPromise<Mailbox>;
8515
+ update(mailboxId: string, params?: MailboxUpdateParams, query?: MailboxUpdateQuery, options?: RequestOptions): APIPromise<Mailbox>;
7926
8516
  /**
7927
- * Soft-delete a mailbox. It can be restored within 30 days.
8517
+ * Delete a mailbox. The address stops receiving immediately and is quarantined; the mailbox and its remembered messages stay restorable for 30 days via the restore endpoint, then are permanently deleted.
7928
8518
  *
7929
8519
  * @example Delete a mailbox
7930
8520
  * await bird.mailbox.delete("mbx_01abc");
7931
8521
  */
7932
8522
  delete(mailboxId: string, options?: RequestOptions): APIPromise<void>;
7933
8523
  /**
7934
- * Restore a deleted mailbox within its 30-day window.
8524
+ * Restore a mailbox deleted less than 30 days ago: the address starts receiving again and the remembered messages are back. Past the window the mailbox is permanently deleted and returns 404; a mailbox that is not deleted returns 409.
7935
8525
  *
7936
- * @example Restore a mailbox
8526
+ * @example Restore a deleted mailbox
7937
8527
  * const mailbox = await bird.mailbox.restore("mbx_01abc");
8528
+ * console.log(mailbox.deleted_at); // null
7938
8529
  */
7939
8530
  restore(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7940
8531
  /**
7941
- * Reactivate a suspended mailbox.
8532
+ * Reactivate a suspended mailbox so it can send and receive again and its threads become visible. Fails if your plan does not have room for another active mailbox (or another custom inbox.ai handle); delete an active mailbox or upgrade first. A mailbox that is not suspended returns 409.
7942
8533
  *
7943
- * @example Resume a mailbox
8534
+ * @example Resume a suspended mailbox
7944
8535
  * const mailbox = await bird.mailbox.resume("mbx_01abc");
8536
+ * console.log(mailbox.state); // "active"
7945
8537
  */
7946
8538
  resume(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox>;
7947
8539
  /**
7948
- * Get email activity statistics for a mailbox.
7949
- *
7950
8540
  * @example Get mailbox stats
7951
8541
  * const stats = await bird.mailbox.stats("mbx_01abc");
7952
8542
  * console.log(stats.summary?.sends_accepted);
7953
8543
  */
7954
8544
  stats(mailboxId: string, query?: MailboxStatsQuery, options?: RequestOptions): APIPromise<MailboxStatsResponse>;
8545
+ /**
8546
+ * List the labels available in a mailbox: the built-in system labels (inbox, archive, spam, blocked, sent, trash, unread) plus every custom label in use.
8547
+ *
8548
+ * @example List a mailbox's labels
8549
+ * const labels = await bird.mailbox.labels("mbx_01abc");
8550
+ * console.log(labels.data.map((label) => label.name));
8551
+ */
8552
+ labels(mailboxId: string, options?: RequestOptions): APIPromise<EmailMailboxLabelList>;
8553
+ }
8554
+ //#endregion
8555
+ //#region src/resources/mailbox.d.ts
8556
+ /** Parameters for composing a new message from a mailbox. */
8557
+ type MailboxComposeParams = EmailMailboxComposeRequest;
8558
+ declare class MailboxResource extends MailboxResourceBase {
7955
8559
  /**
7956
8560
  * Send a new email from this mailbox, starting a new conversation.
7957
8561
  *
@@ -7963,104 +8567,97 @@ declare class MailboxResource extends Resource {
7963
8567
  * });
7964
8568
  */
7965
8569
  compose(mailboxId: string, params: MailboxComposeParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8570
+ }
8571
+ //#endregion
8572
+ //#region src/resources/mailboxReceiveRule.gen.d.ts
8573
+ type MailboxReceiveRuleListQuery = NonNullable<ListMailboxReceiveRulesData["query"]>;
8574
+ type MailboxReceiveRuleCreateParams = NonNullable<CreateMailboxReceiveRuleData["body"]>;
8575
+ declare class MailboxReceiveRuleResource extends Resource {
7966
8576
  /**
7967
- * List labels available in a mailbox.
7968
- *
7969
- * @example List labels
7970
- * const labels = await bird.mailbox.labels("mbx_01abc");
7971
- * console.log(labels.data.map(l => l.name));
7972
- */
7973
- labels(mailboxId: string, options?: RequestOptions): APIPromise<EmailMailboxLabelList>;
7974
- /**
7975
- * List mailboxes in the workspace. `await` resolves the first page;
7976
- * `for await` walks every mailbox.
8577
+ * List a mailbox's allow/block receive rules as a cursor page, oldest first. Filter by action.
7977
8578
  *
7978
- * @example List mailboxes
7979
- * for await (const mailbox of bird.mailbox.list()) {
7980
- * console.log(mailbox.address);
8579
+ * @example List a mailbox's receive rules
8580
+ * for await (const rule of bird.mailboxReceiveRule.list("mbx_01abc")) {
8581
+ * console.log(rule.action, rule.entry);
7981
8582
  * }
7982
8583
  */
7983
- list(query?: MailboxListQuery, options?: RequestOptions): PaginatedPromise<Mailbox>;
7984
- }
7985
- declare class MailboxReceiveRuleResource extends Resource {
8584
+ list(mailboxId: string, query?: MailboxReceiveRuleListQuery, options?: RequestOptions): PaginatedPromise<ReceiveRule>;
7986
8585
  /**
7987
- * Add an allow or block rule to a mailbox. Block rules always win.
8586
+ * Add an allow or block rule for a sender address or domain to a mailbox. Block always wins; up to 200 rules per mailbox.
7988
8587
  *
7989
8588
  * @example Block a domain
7990
8589
  * const rule = await bird.mailboxReceiveRule.create("mbx_01abc", {
7991
8590
  * action: "block",
7992
8591
  * entry: "spam.example.com",
7993
8592
  * });
8593
+ * console.log(rule.id);
7994
8594
  */
7995
8595
  create(mailboxId: string, params: MailboxReceiveRuleCreateParams, options?: RequestOptions): APIPromise<ReceiveRule>;
7996
8596
  /**
7997
- * Remove a receive rule.
8597
+ * Remove a receive rule from a mailbox. Delete-and-recreate is how an entry's action is flipped.
7998
8598
  *
7999
8599
  * @example Delete a rule
8000
8600
  * await bird.mailboxReceiveRule.delete("mbx_01abc", "erl_01xyz");
8001
8601
  */
8002
8602
  delete(mailboxId: string, ruleId: string, options?: RequestOptions): APIPromise<void>;
8003
- /**
8004
- * List receive rules for a mailbox.
8005
- *
8006
- * @example List rules
8007
- * for await (const rule of bird.mailboxReceiveRule.list("mbx_01abc")) {
8008
- * console.log(rule.action, rule.entry);
8009
- * }
8010
- */
8011
- list(mailboxId: string, query?: MailboxReceiveRuleListQuery, options?: RequestOptions): PaginatedPromise<ReceiveRule>;
8012
8603
  }
8013
8604
  //#endregion
8014
- //#region src/resources/mailboxThread.d.ts
8015
- /** Partial update for a thread — add/remove labels, link/unlink a contact. */
8016
- type MailboxThreadUpdateParams = EmailThreadUpdateRequest;
8017
- /** Filters for `bird.mailboxThread.list`. */
8605
+ //#region src/resources/mailboxThread.gen.d.ts
8018
8606
  type MailboxThreadListQuery = NonNullable<ListEmailThreadsData["query"]>;
8019
- /** Parameters for `bird.mailboxThreadMessage.reply`. */
8020
- type MailboxThreadMessageReplyParams = EmailThreadMessageReplyRequest;
8021
- /** Filters for `bird.mailboxThreadMessage.list`. */
8022
- type MailboxThreadMessageListQuery = NonNullable<ListEmailThreadMessagesData["query"]>;
8607
+ type MailboxThreadUpdateParams = NonNullable<UpdateEmailThreadData["body"]>;
8608
+ type MailboxThreadDeleteQuery = NonNullable<DeleteEmailThreadData["query"]>;
8023
8609
  declare class MailboxThreadResource extends Resource {
8024
8610
  /**
8025
- * Get a conversation thread.
8611
+ * List mailbox conversations as a cursor page, most recently active first. `label` selects the view — inbox (default), archive, spam, blocked, or a custom label. Filter by mailbox, contact, participant address, or subject substring.
8612
+ *
8613
+ * @example List conversation threads
8614
+ * for await (const thread of bird.mailboxThread.list({ mailbox_id: "mbx_01abc" })) {
8615
+ * console.log(thread.id, thread.subject);
8616
+ * }
8617
+ */
8618
+ list(query?: MailboxThreadListQuery, options?: RequestOptions): PaginatedPromise<EmailThread>;
8619
+ /**
8620
+ * Get one conversation: participants, counts, labels, read state. Fetch its messages with the thread messages endpoint.
8026
8621
  *
8027
8622
  * @example Get a thread
8028
8623
  * const thread = await bird.mailboxThread.get("thr_01abc");
8029
- * console.log(thread.message_count);
8624
+ * console.log(thread.subject);
8030
8625
  */
8031
8626
  get(threadId: string, options?: RequestOptions): APIPromise<EmailThread>;
8032
8627
  /**
8033
- * Apply label changes or contact link changes to a thread.
8628
+ * Add or remove labels on a conversation adding `spam` files it as spam, adding `archive` clears it out of the inbox, adding `inbox` brings it back — or link/unlink a contact.
8034
8629
  *
8035
- * @example Archive a thread
8630
+ * @example Apply label changes to a thread
8036
8631
  * const thread = await bird.mailboxThread.update("thr_01abc", {
8037
8632
  * labels: { add: ["archive"] },
8038
8633
  * });
8634
+ * console.log(thread.id);
8039
8635
  */
8040
- update(threadId: string, params: MailboxThreadUpdateParams, options?: RequestOptions): APIPromise<EmailThread>;
8636
+ update(threadId: string, params?: MailboxThreadUpdateParams, options?: RequestOptions): APIPromise<EmailThread>;
8041
8637
  /**
8042
- * Move a thread to trash. Pass `query.permanent = true` to delete immediately.
8638
+ * Move a conversation and all its messages to trash (purged after 30 days), or delete permanently with ?permanent=true.
8043
8639
  *
8044
8640
  * @example Delete a thread
8045
- * await bird.mailboxThread.delete("thr_01abc");
8641
+ * await bird.mailboxThread.delete("thr_01abc", { permanent: true });
8046
8642
  */
8047
- delete(threadId: string, query?: {
8048
- permanent?: boolean;
8049
- }, options?: RequestOptions): APIPromise<void>;
8643
+ delete(threadId: string, query?: MailboxThreadDeleteQuery, options?: RequestOptions): APIPromise<void>;
8644
+ }
8645
+ //#endregion
8646
+ //#region src/resources/mailboxThreadMessage.gen.d.ts
8647
+ type MailboxThreadMessageListQuery = NonNullable<ListEmailThreadMessagesData["query"]>;
8648
+ type MailboxThreadMessageReplyParams = NonNullable<ReplyEmailThreadMessageData["body"]>;
8649
+ declare class MailboxThreadMessageResource extends Resource {
8050
8650
  /**
8051
- * List threads across the workspace's mailboxes. `await` resolves the first
8052
- * page; `for await` walks every thread.
8651
+ * List the messages in a conversation newest first, both directions. Page older messages with starting_after, and pass include=extracted_text to inline each message's durable plain text.
8053
8652
  *
8054
- * @example List threads in the inbox
8055
- * for await (const thread of bird.mailboxThread.list()) {
8056
- * console.log(thread.id, thread.message_count);
8653
+ * @example List a thread's messages
8654
+ * for await (const msg of bird.mailboxThreadMessage.list("thr_01abc")) {
8655
+ * console.log(msg.id, msg.direction);
8057
8656
  * }
8058
8657
  */
8059
- list(query?: MailboxThreadListQuery, options?: RequestOptions): PaginatedPromise<EmailThread>;
8060
- }
8061
- declare class MailboxThreadMessageResource extends Resource {
8658
+ list(threadId: string, query?: MailboxThreadMessageListQuery, options?: RequestOptions): PaginatedPromise<EmailThreadMessage>;
8062
8659
  /**
8063
- * Get metadata for a message (not the body; use `body` for that).
8660
+ * Get one conversation message with its extracted plain text — readable for the mailbox's full retention period, no MIME parsing needed.
8064
8661
  *
8065
8662
  * @example Get a message
8066
8663
  * const msg = await bird.mailboxThreadMessage.get("thr_01abc", "rem_01xyz");
@@ -8068,40 +8665,173 @@ declare class MailboxThreadMessageResource extends Resource {
8068
8665
  */
8069
8666
  get(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8070
8667
  /**
8071
- * Get the parsed HTML and plain-text body of a message.
8668
+ * Get the original rendered HTML and plain-text body of a conversation message. Available 30 days; after that use the message's extracted_text.
8072
8669
  *
8073
- * @example Get message body
8670
+ * @example Get a message body
8074
8671
  * const body = await bird.mailboxThreadMessage.body("thr_01abc", "rem_01xyz");
8075
8672
  * console.log(body.text);
8076
8673
  */
8077
8674
  body(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageBody>;
8078
8675
  /**
8079
- * Reply to a message from the mailbox's own address.
8676
+ * Reply to a specific conversation message from the mailbox's own address. To reply to a conversation, target its newest received message. Recipients, subject, and threading headers are derived automatically.
8080
8677
  *
8081
8678
  * @example Reply to a message
8082
8679
  * const reply = await bird.mailboxThreadMessage.reply("thr_01abc", "rem_01xyz", {
8083
8680
  * text: "Thanks for reaching out!",
8084
8681
  * });
8682
+ * console.log(reply.id);
8085
8683
  */
8086
- reply(threadId: string, messageId: string, params: MailboxThreadMessageReplyParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8684
+ reply(threadId: string, messageId: string, params?: MailboxThreadMessageReplyParams, options?: RequestOptions): APIPromise<EmailThreadMessage>;
8087
8685
  /**
8088
- * List the attachment manifest for a message.
8686
+ * List the attachments on a conversation message. Bytes are downloadable for 30 days; the metadata also rides the message's attachment_manifest durably.
8089
8687
  *
8090
- * @example List attachments
8688
+ * @example List a message's attachments
8091
8689
  * const atts = await bird.mailboxThreadMessage.attachments("thr_01abc", "rem_01xyz");
8092
- * console.log(atts.data.map(a => a.filename));
8690
+ * console.log(atts.data.map((a) => a.filename));
8093
8691
  */
8094
8692
  attachments(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageAttachmentList>;
8693
+ }
8694
+ //#endregion
8695
+ //#region src/resources/realtime.d.ts
8696
+ /** Body for `bird.realtime.publish` — one event to one or more channels. */
8697
+ type RealtimePublishParams = RealtimePublish;
8698
+ /** Body for `bird.realtime.publishBatch` — up to 10 events, one channel each. */
8699
+ type RealtimeBatchPublishParams = RealtimeBatchPublish;
8700
+ /** Query params for `bird.realtime.channels.list`. */
8701
+ type RealtimeChannelsListQuery = NonNullable<ListRealtimeAppChannelsData["query"]>;
8702
+ /** Query params for `bird.realtime.channels.get`. */
8703
+ type RealtimeChannelGetQuery = NonNullable<GetRealtimeAppChannelData["query"]>;
8704
+ /**
8705
+ * Realtime app credentials — `new BirdClient({ realtime: { key, secret } })`.
8706
+ * They come from the app's credentials (shown once at creation) and must belong
8707
+ * to the calling workspace. Any Realtime method takes the same pair in its
8708
+ * trailing options to override the configured one for a single call — the way
8709
+ * to talk to a second app without a second client.
8710
+ */
8711
+ interface RealtimeOptions {
8712
+ /** The Realtime app key, sent as `X-Realtime-Key`. */
8713
+ key?: string;
8714
+ /** The Realtime app secret, sent as `X-Realtime-Secret`. */
8715
+ secret?: string;
8716
+ }
8717
+ /** Per-call options for a Realtime method: the usual request options plus a credential override. */
8718
+ interface RealtimeRequestOptions extends RequestOptions, RealtimeOptions {}
8719
+ /** The resolved credential headers, in wire form. */
8720
+ interface RealtimeAuthHeaders {
8721
+ "X-Realtime-Key": string;
8722
+ "X-Realtime-Secret": string;
8723
+ }
8724
+ declare abstract class RealtimeBase extends Resource {
8725
+ #private;
8726
+ constructor(core: ConstructorParameters<typeof Resource>[0], client: ConstructorParameters<typeof Resource>[1], config?: RealtimeOptions);
8095
8727
  /**
8096
- * List messages in a thread. `await` resolves the first page; `for await`
8097
- * walks every message.
8728
+ * Resolve the app credentials for one call. Called eagerly at the top of each
8729
+ * method so a missing credential throws before the lifecycle starts — never
8730
+ * as a rejected promise after a request is already in flight.
8731
+ */
8732
+ protected auth(options?: RealtimeOptions): RealtimeAuthHeaders;
8733
+ }
8734
+ /**
8735
+ * `bird.realtime.channels` — reads the app's live channel state. Channels exist
8736
+ * implicitly: one appears when the first connection subscribes and vanishes when
8737
+ * the last one leaves, so these report occupancy, never existence.
8738
+ */
8739
+ declare class RealtimeChannelsResource extends RealtimeBase {
8740
+ /**
8741
+ * List the app's currently occupied channels, optionally filtered by name
8742
+ * prefix. The Realtime service returns them all in one response — this is a
8743
+ * point read, not a cursor list, so there is nothing to iterate.
8098
8744
  *
8099
- * @example List messages
8100
- * for await (const msg of bird.mailboxThreadMessage.list("thr_01abc")) {
8101
- * console.log(msg.id, msg.direction);
8102
- * }
8745
+ * @example List the occupied presence channels with their member counts
8746
+ * const { data } = await bird.realtime.channels.list("rap_01krdgeqcxet5s7t44vh8rt9mg", {
8747
+ * prefix: "presence-",
8748
+ * include: ["member_count"],
8749
+ * });
8750
+ * for (const channel of data) console.log(channel.name, channel.member_count);
8103
8751
  */
8104
- list(threadId: string, query?: MailboxThreadMessageListQuery, options?: RequestOptions): PaginatedPromise<EmailThreadMessage>;
8752
+ list(appId: string, query?: RealtimeChannelsListQuery, options?: RealtimeRequestOptions): APIPromise<RealtimeChannelsList>;
8753
+ /**
8754
+ * Read one channel's state. An unknown or never-used name is not an error —
8755
+ * it resolves with `occupied: false`.
8756
+ *
8757
+ * @example Check whether anyone is in a channel
8758
+ * const channel = await bird.realtime.channels.get(
8759
+ * "rap_01krdgeqcxet5s7t44vh8rt9mg",
8760
+ * "presence-lobby",
8761
+ * { include: ["member_count"] },
8762
+ * );
8763
+ * console.log(channel.occupied, channel.member_count);
8764
+ */
8765
+ get(appId: string, channelName: string, query?: RealtimeChannelGetQuery, options?: RealtimeRequestOptions): APIPromise<RealtimeChannelInfo>;
8766
+ /**
8767
+ * List the member ids subscribed to a presence channel. Ids only — the
8768
+ * `member_info` your authorization endpoint attaches is delivered to subscribed
8769
+ * clients over the realtime connection and is not available over REST.
8770
+ *
8771
+ * @example Who is in the lobby
8772
+ * const { members } = await bird.realtime.channels.members(
8773
+ * "rap_01krdgeqcxet5s7t44vh8rt9mg",
8774
+ * "presence-lobby",
8775
+ * );
8776
+ * for (const member of members) console.log(member.member_id);
8777
+ */
8778
+ members(appId: string, channelName: string, options?: RealtimeRequestOptions): APIPromise<RealtimeChannelMembers>;
8779
+ }
8780
+ /** `bird.realtime.members` — acts on a member across all of its connections. */
8781
+ declare class RealtimeMembersResource extends RealtimeBase {
8782
+ /**
8783
+ * Disconnect every active connection a member holds — sign-out, ban, or a
8784
+ * revoked session. Resolves once the disconnect is applied; the member may
8785
+ * reconnect immediately unless your authorization endpoint refuses them.
8786
+ *
8787
+ * @example Kick a member off every connection
8788
+ * await bird.realtime.members.disconnect("rap_01krdgeqcxet5s7t44vh8rt9mg", "user_42");
8789
+ */
8790
+ disconnect(appId: string, memberId: string, options?: RealtimeRequestOptions): APIPromise<void>;
8791
+ }
8792
+ /**
8793
+ * `bird.realtime` — publish events to a Realtime app's channels and inspect its
8794
+ * live state. Every method needs the app's key/secret pair: set it once as
8795
+ * `realtime: { key, secret }` on the client, or pass `{ key, secret }` in a
8796
+ * call's options to reach a different app. Reached as `bird.realtime.*`.
8797
+ */
8798
+ declare class RealtimeResource extends RealtimeBase {
8799
+ /** Channel state — `bird.realtime.channels.list(...)`, `.get(...)`, `.members(...)`. */
8800
+ readonly channels: RealtimeChannelsResource;
8801
+ /** Members — `bird.realtime.members.disconnect(...)`. */
8802
+ readonly members: RealtimeMembersResource;
8803
+ constructor(core: ConstructorParameters<typeof Resource>[0], client: ConstructorParameters<typeof Resource>[1], config?: RealtimeOptions);
8804
+ /**
8805
+ * Publish one event to one or more of the app's channels. Listing several
8806
+ * channels broadcasts the same event to all of them in a single call. Resolves
8807
+ * once the event is accepted — delivery to connected clients is asynchronous.
8808
+ *
8809
+ * Pass `exclude_connection_id` to skip the connection that triggered the
8810
+ * change, so the originating client doesn't echo its own update.
8811
+ *
8812
+ * @example Broadcast an event to a channel
8813
+ * const result = await bird.realtime.publish("rap_01krdgeqcxet5s7t44vh8rt9mg", {
8814
+ * event: "order.updated",
8815
+ * channels: ["orders", "presence-lobby"],
8816
+ * data: { order_id: "ord_123", status: "shipped" },
8817
+ * });
8818
+ * console.log(result.data?.length); // one entry per channel
8819
+ */
8820
+ publish(appId: string, params: RealtimePublishParams, options?: RealtimeRequestOptions): APIPromise<RealtimePublishResult>;
8821
+ /**
8822
+ * Publish up to 10 events in one request, each to a single channel. Use it to
8823
+ * fan different events out at once; to send the *same* event to many channels,
8824
+ * use `publish` with several `channels` instead.
8825
+ *
8826
+ * @example Publish two events in one call
8827
+ * await bird.realtime.publishBatch("rap_01krdgeqcxet5s7t44vh8rt9mg", {
8828
+ * events: [
8829
+ * { event: "order.created", channel: "orders", data: { id: 1 } },
8830
+ * { event: "order.updated", channel: "orders", data: { id: 2 } },
8831
+ * ],
8832
+ * });
8833
+ */
8834
+ publishBatch(appId: string, params: RealtimeBatchPublishParams, options?: RealtimeRequestOptions): APIPromise<RealtimeBatchPublishResult>;
8105
8835
  }
8106
8836
  //#endregion
8107
8837
  //#region src/client.d.ts
@@ -8126,6 +8856,11 @@ interface BirdClientOptions {
8126
8856
  email?: EmailChannelDefaults;
8127
8857
  /** Webhooks config — `secret` is the default used by `bird.webhooks.unwrap`. */
8128
8858
  webhooks?: WebhookOptions;
8859
+ /**
8860
+ * Realtime app credentials. Every `bird.realtime.*` call authenticates to the
8861
+ * Realtime edge with this key/secret pair; a call's options can override it.
8862
+ */
8863
+ realtime?: RealtimeOptions;
8129
8864
  }
8130
8865
  /** A raw request for the `bird.request` escape hatch. */
8131
8866
  interface BirdRequest {
@@ -8185,8 +8920,6 @@ declare class BirdClient<const O extends BirdClientOptions = BirdClientOptions>
8185
8920
  readonly smsTemplates: SmsTemplatesResource;
8186
8921
  /** The WhatsApp channel — `bird.whatsapp.send(...)`, `.get(...)`, `.list(...)`, `.listEvents(...)`. */
8187
8922
  readonly whatsapp: WhatsappResource;
8188
- /** WhatsApp templates — `bird.whatsappTemplates.list(...)`. */
8189
- readonly whatsappTemplates: WhatsappTemplatesResource;
8190
8923
  /** The Verify product — `bird.verify.verifications.create(...)`, `.check(...)`. */
8191
8924
  readonly verify: VerifyResource;
8192
8925
  /** Contacts — `bird.contacts.create(...)`, `.list(...)`, `.get(...)`, `.batch(...)`, … */
@@ -8207,6 +8940,8 @@ declare class BirdClient<const O extends BirdClientOptions = BirdClientOptions>
8207
8940
  readonly mailboxThread: MailboxThreadResource;
8208
8941
  /** Thread messages — `bird.mailboxThreadMessage.list(...)`, `.get(...)`, `.reply(...)`, `.body(...)`, … */
8209
8942
  readonly mailboxThreadMessage: MailboxThreadMessageResource;
8943
+ /** Realtime — `bird.realtime.publish(...)`, `.channels.list(...)`, `.members.disconnect(...)`, … */
8944
+ readonly realtime: RealtimeResource;
8210
8945
  constructor(options: O);
8211
8946
  /**
8212
8947
  * Escape hatch for endpoints the typed resources don't cover. Runs the full
@@ -8260,11 +8995,6 @@ declare const WebhookEventType: {
8260
8995
  readonly EmailScheduled: "email.scheduled";
8261
8996
  readonly EmailSuppressionCreated: "email_suppression.created";
8262
8997
  readonly EmailUnsubscribed: "email.unsubscribed";
8263
- readonly RealtimeCacheChannels: "realtime.cache_channels";
8264
- readonly RealtimeChannelExistence: "realtime.channel_existence";
8265
- readonly RealtimeClientEvents: "realtime.client_events";
8266
- readonly RealtimeConnectionCount: "realtime.connection_count";
8267
- readonly RealtimePresence: "realtime.presence";
8268
8998
  readonly SmsAccepted: "sms.accepted";
8269
8999
  readonly SmsDelivered: "sms.delivered";
8270
9000
  readonly SmsExpired: "sms.expired";
@@ -8294,5 +9024,5 @@ declare const WebhookEventType: {
8294
9024
  /** A known webhook event type value. */
8295
9025
  type WebhookEventTypeValue = (typeof WebhookEventType)[keyof typeof WebhookEventType];
8296
9026
  //#endregion
8297
- export { type APIPromise, type Audience, type AudienceAddContactsParams, type AudienceContactsQuery, type AudienceCreateParams, type AudienceListQuery, type AudienceMember, type AudienceRemoveContactsParams, type AudienceUpdateParams, BirdAPIError, BirdAuthError, BirdBadRequestError, BirdBillingError, BirdClient, type BirdClientOptions, BirdConflictError, BirdConnectionError, BirdError, BirdInternalError, BirdMisdirectedError, BirdNotFoundError, BirdNotImplementedError, BirdPayloadTooLargeError, BirdPermissionError, BirdPreconditionError, BirdRateLimitError, type BirdRequest, type BirdResponse, BirdServiceUnavailableError, BirdTimeoutError, BirdValidationError, type BirdWebhookEvent, BirdWebhookVerificationError, type Contact, type ContactBatchParams, type ContactCreateParams, type ContactListQuery, type ContactProperty, type ContactPropertyCreateParams, type ContactPropertyListQuery, type ContactPropertyUpdateParams, type ContactUpdateParams, type ContactUpsertResult, type CursorPage, type DnsRecord, type Domain, type DomainCapabilities, type DomainCreateParams, type DomainDkim, type DomainListQuery, type DomainUpdateParams, type EmailChannelDefaults, type EmailListQuery, type EmailMailboxLabelList, type EmailMessage, type EmailSendBatchParams, type EmailSendBatchResult, type EmailSendParams, type EmailStatsByBounceCodeQuery, type EmailStatsByBounceCodeResponse, type EmailStatsByBroadcastQuery, type EmailStatsByBroadcastResponse, type EmailStatsByCategoryQuery, type EmailStatsByCategoryResponse, type EmailStatsByClientQuery, type EmailStatsByClientResponse, type EmailStatsByComplaintTypeQuery, type EmailStatsByComplaintTypeResponse, type EmailStatsByLocationQuery, type EmailStatsByLocationResponse, type EmailStatsByMailboxProviderQuery, type EmailStatsByMailboxProviderRegionQuery, type EmailStatsByMailboxProviderRegionResponse, type EmailStatsByMailboxProviderResponse, type EmailStatsByRecipientDomainQuery, type EmailStatsByRecipientDomainResponse, type EmailStatsBySendingDomainQuery, type EmailStatsBySendingDomainResponse, type EmailStatsBySendingIpQuery, type EmailStatsBySendingIpResponse, type EmailStatsByTagQuery, type EmailStatsByTemplateQuery, type EmailStatsByTemplateResponse, type EmailStatsDailyQuery, type EmailStatsHourlyQuery, type EmailStatsResponse, type EmailStatsSummary, type EmailStatsSummaryQuery, type EmailStatsTagsResponse, type EmailThread, type EmailThreadList, type EmailThreadMessage, type EmailThreadMessageAttachmentList, type EmailThreadMessageBody, type EmailThreadMessageList, type ErrorDetail, type ErrorNextAction, type Mailbox, type MailboxComposeParams, type MailboxCreateParams, type MailboxList, type MailboxListQuery, type MailboxReceiveRuleCreateParams, type MailboxReceiveRuleListQuery, type MailboxStatsResponse, type MailboxThreadListQuery, type MailboxThreadMessageListQuery, type MailboxThreadMessageReplyParams, type MailboxThreadUpdateParams, type MailboxUpdateParams, type PaginatedPromise, type ReceiveRule, type ReceiveRuleList, type RequestOptions, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, type UnmetGate, type Verification, type VerificationCheckParams, type VerificationCheckResult, type VerificationCreateParams, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, type WhatsAppEventList, type WhatsAppMessage, type WhatsAppTemplate, type WhatsAppTemplateList, type WhatsappListEventsQuery, type WhatsappListQuery, type WhatsappSendParams, baseUrlForRegion, regionFromApiKey };
9027
+ export { type APIPromise, type Audience, type AudienceAddContactsParams, type AudienceCreateParams, type AudienceListContactsQuery, type AudienceListQuery, type AudienceMember, type AudienceRemoveContactsParams, type AudienceUpdateParams, BirdAPIError, BirdAuthError, BirdBadRequestError, BirdBillingError, BirdClient, type BirdClientOptions, BirdConflictError, BirdConnectionError, BirdError, BirdInternalError, BirdMisdirectedError, BirdNotFoundError, BirdNotImplementedError, BirdPayloadTooLargeError, BirdPermissionError, BirdPreconditionError, BirdRateLimitError, type BirdRequest, type BirdResponse, BirdServiceUnavailableError, BirdTimeoutError, BirdValidationError, type BirdWebhookEvent, BirdWebhookVerificationError, type Contact, type ContactBatchParams, type ContactCreateParams, type ContactListQuery, type ContactProperty, type ContactPropertyCreateParams, type ContactPropertyListQuery, type ContactPropertyUpdateParams, type ContactUpdateParams, type ContactUpsertResult, type CursorPage, type DnsRecord, type Domain, type DomainCapabilities, type DomainCreateParams, type DomainDkim, type DomainListQuery, type DomainUpdateParams, type EmailChannelDefaults, type EmailListQuery, type EmailMailboxLabelList, type EmailMessage, type EmailSendBatchParams, type EmailSendBatchResult, type EmailSendParams, type EmailStatsByBounceCodeQuery, type EmailStatsByBounceCodeResponse, type EmailStatsByBroadcastQuery, type EmailStatsByBroadcastResponse, type EmailStatsByCategoryQuery, type EmailStatsByCategoryResponse, type EmailStatsByClientQuery, type EmailStatsByClientResponse, type EmailStatsByComplaintTypeQuery, type EmailStatsByComplaintTypeResponse, type EmailStatsByLocationQuery, type EmailStatsByLocationResponse, type EmailStatsByMailboxProviderQuery, type EmailStatsByMailboxProviderRegionQuery, type EmailStatsByMailboxProviderRegionResponse, type EmailStatsByMailboxProviderResponse, type EmailStatsByRecipientDomainQuery, type EmailStatsByRecipientDomainResponse, type EmailStatsBySendingDomainQuery, type EmailStatsBySendingDomainResponse, type EmailStatsBySendingIpQuery, type EmailStatsBySendingIpResponse, type EmailStatsByTagQuery, type EmailStatsByTemplateQuery, type EmailStatsByTemplateResponse, type EmailStatsDailyQuery, type EmailStatsHourlyQuery, type EmailStatsResponse, type EmailStatsSummary, type EmailStatsSummaryQuery, type EmailStatsTagsResponse, type EmailThread, type EmailThreadMessage, type EmailThreadMessageAttachmentList, type EmailThreadMessageBody, type ErrorDetail, type ErrorNextAction, type Mailbox, type MailboxComposeParams, type MailboxCreateParams, type MailboxListQuery, type MailboxReceiveRuleCreateParams, type MailboxReceiveRuleListQuery, type MailboxStatsResponse, type MailboxThreadDeleteQuery, type MailboxThreadListQuery, type MailboxThreadMessageListQuery, type MailboxThreadMessageReplyParams, type MailboxThreadUpdateParams, type MailboxUpdateParams, type PaginatedPromise, type RealtimeBatchPublishParams, type RealtimeBatchPublishResult, type RealtimeChannelGetQuery, type RealtimeChannelInclude, type RealtimeChannelInfo, type RealtimeChannelListItem, type RealtimeChannelMember, type RealtimeChannelMembers, type RealtimeChannelsList, type RealtimeChannelsListQuery, type RealtimeOptions, type RealtimePublishParams, type RealtimePublishResult, type RealtimeRequestOptions, type ReceiveRule, type RequestOptions, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, type UnmetGate, type Verification, type VerificationCheckResult, type VerifyVerificationsCheckParams, type VerifyVerificationsCreateParams, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, type WhatsAppEventList, type WhatsAppMessage, type WhatsappListEventsQuery, type WhatsappListQuery, type WhatsappSendParams, baseUrlForRegion, regionFromApiKey };
8298
9028
  //# sourceMappingURL=index.d.mts.map