resend 6.29.0 → 6.31.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.cjs CHANGED
@@ -25,7 +25,7 @@ let postal_mime = require("postal-mime");
25
25
  postal_mime = __toESM(postal_mime);
26
26
  let standardwebhooks = require("standardwebhooks");
27
27
  //#region package.json
28
- var version = "6.29.0";
28
+ var version = "6.31.0";
29
29
  //#endregion
30
30
  //#region src/common/utils/build-pagination-query.ts
31
31
  function buildPaginationUrl(base, options) {
@@ -1203,6 +1203,16 @@ var Topics = class {
1203
1203
  }
1204
1204
  };
1205
1205
  //#endregion
1206
+ //#region src/usage/usage.ts
1207
+ var Usage = class {
1208
+ constructor(resend) {
1209
+ this.resend = resend;
1210
+ }
1211
+ async get() {
1212
+ return await this.resend.get("/usage");
1213
+ }
1214
+ };
1215
+ //#endregion
1206
1216
  //#region src/webhooks/events/attempts/attempts.ts
1207
1217
  var Attempts = class {
1208
1218
  constructor(resend) {
@@ -1298,6 +1308,7 @@ var Resend = class {
1298
1308
  this.suppressions = new Suppressions(this);
1299
1309
  this.templates = new Templates(this);
1300
1310
  this.topics = new Topics(this);
1311
+ this.usage = new Usage(this);
1301
1312
  this.webhooks = new Webhooks(this);
1302
1313
  if (!key) {
1303
1314
  if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
package/dist/index.d.cts CHANGED
@@ -716,19 +716,19 @@ interface EmailRenderOptions {
716
716
  /**
717
717
  * The React component used to write the message.
718
718
  *
719
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
719
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
720
720
  */
721
721
  react: React$1.ReactNode;
722
722
  /**
723
723
  * The HTML version of the message.
724
724
  *
725
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
725
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
726
726
  */
727
727
  html: string;
728
728
  /**
729
729
  * The plain text version of the message.
730
730
  *
731
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
731
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
732
732
  */
733
733
  text: string;
734
734
  }
@@ -736,7 +736,7 @@ interface SegmentOptions {
736
736
  /**
737
737
  * The id of the segment you want to send to
738
738
  *
739
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
739
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
740
740
  */
741
741
  segmentId: string;
742
742
  /**
@@ -749,7 +749,7 @@ type SendBroadcastOnCreationOptions = {
749
749
  * Whether to send the broadcast immediately or keep it as a draft.
750
750
  * If not provided or set to false, the broadcast will be created as a draft.
751
751
  *
752
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
752
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
753
753
  */
754
754
  send: true;
755
755
  /**
@@ -757,7 +757,7 @@ type SendBroadcastOnCreationOptions = {
757
757
  * The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z)
758
758
  * or relative time (eg: in 2 days).
759
759
  *
760
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
760
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
761
761
  */
762
762
  scheduledAt?: string;
763
763
  } | {
@@ -765,7 +765,7 @@ type SendBroadcastOnCreationOptions = {
765
765
  * Whether to send the broadcast immediately or keep it as a draft.
766
766
  * If not provided or set to false, the broadcast will be created as a draft.
767
767
  *
768
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
768
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
769
769
  */
770
770
  send?: false;
771
771
  /**
@@ -773,7 +773,7 @@ type SendBroadcastOnCreationOptions = {
773
773
  * The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z)
774
774
  * or relative time (eg: in 2 days).
775
775
  *
776
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
776
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
777
777
  */
778
778
  scheduledAt?: never;
779
779
  };
@@ -781,37 +781,37 @@ interface CreateBroadcastBaseOptions {
781
781
  /**
782
782
  * The name of the broadcast
783
783
  *
784
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
784
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
785
785
  */
786
786
  name?: string;
787
787
  /**
788
788
  * A short snippet of text displayed as a preview in recipients' inboxes, often shown below or beside the subject line.
789
789
  *
790
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
790
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
791
791
  */
792
792
  previewText?: string;
793
793
  /**
794
794
  * Sender email address. To include a friendly name, use the format `"Your Name <sender@domain.com>"`
795
795
  *
796
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
796
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
797
797
  */
798
798
  from: string;
799
799
  /**
800
800
  * Reply-to email address. For multiple addresses, send as an array of strings.
801
801
  *
802
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
802
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
803
803
  */
804
804
  replyTo?: string | string[];
805
805
  /**
806
806
  * Email subject.
807
807
  *
808
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
808
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
809
809
  */
810
810
  subject: string;
811
811
  /**
812
812
  * The id of the topic you want to send to
813
813
  *
814
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
814
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
815
815
  */
816
816
  topicId?: string | null;
817
817
  }
@@ -917,7 +917,7 @@ interface SendBroadcastBaseOptions {
917
917
  * The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z)
918
918
  * or relative time (eg: in 2 days).
919
919
  *
920
- * @link https://resend.com/docs/api-reference/broadcasts/send#body-parameters
920
+ * @link https://resend.com/docs/api-reference/broadcasts/send-broadcast#body-parameters
921
921
  */
922
922
  scheduledAt?: string;
923
923
  }
@@ -2348,8 +2348,67 @@ declare class Topics {
2348
2348
  remove(id: string): Promise<RemoveTopicResponse>;
2349
2349
  }
2350
2350
  //#endregion
2351
+ //#region src/usage/interfaces/get-usage.interface.d.ts
2352
+ export type GetUsageResponseSuccess = {
2353
+ object: 'usage';
2354
+ emails: {
2355
+ daily: {
2356
+ used: number;
2357
+ limit: number | null;
2358
+ sent: number;
2359
+ received: number;
2360
+ resets_at: string;
2361
+ };
2362
+ monthly: {
2363
+ used: number;
2364
+ limit: number;
2365
+ sent: number;
2366
+ received: number;
2367
+ resets_at: string;
2368
+ };
2369
+ };
2370
+ contacts: {
2371
+ used: number;
2372
+ limit: number;
2373
+ };
2374
+ segments: {
2375
+ used: number;
2376
+ limit: number | null;
2377
+ };
2378
+ broadcasts: {
2379
+ used: number;
2380
+ limit: null;
2381
+ };
2382
+ ai_credits: {
2383
+ used: number;
2384
+ limit: number | null;
2385
+ next_increase_at: string | null;
2386
+ };
2387
+ automation_runs: {
2388
+ used: number;
2389
+ limit: number;
2390
+ resets_at: string;
2391
+ };
2392
+ domains: {
2393
+ used: number;
2394
+ limit: number | null;
2395
+ };
2396
+ rate_limit: {
2397
+ limit: number;
2398
+ duration: string;
2399
+ };
2400
+ };
2401
+ export type GetUsageResponse = Response<GetUsageResponseSuccess>;
2402
+ //#endregion
2403
+ //#region src/usage/usage.d.ts
2404
+ declare class Usage {
2405
+ private readonly resend;
2406
+ constructor(resend: Resend);
2407
+ get(): Promise<GetUsageResponse>;
2408
+ }
2409
+ //#endregion
2351
2410
  //#region src/webhooks/interfaces/webhook-event.interface.d.ts
2352
- type WebhookEvent = 'email.sent' | 'email.scheduled' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'email.suppressed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted' | 'suppression.added' | 'suppression.removed';
2411
+ type WebhookEvent = 'email.sent' | 'email.scheduled' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'email.suppressed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'contact.topics.updated' | 'domain.created' | 'domain.updated' | 'domain.deleted' | 'suppression.added' | 'suppression.removed' | 'topic.created' | 'topic.updated' | 'topic.deleted';
2353
2412
  interface BaseEmailEventData {
2354
2413
  broadcast_id?: string;
2355
2414
  created_at: string;
@@ -2409,6 +2468,13 @@ interface ContactEventData {
2409
2468
  last_name?: string | null;
2410
2469
  unsubscribed: boolean;
2411
2470
  }
2471
+ interface ContactTopicsEventData {
2472
+ email: string;
2473
+ topics: {
2474
+ id: string;
2475
+ subscription: 'opt_in' | 'opt_out';
2476
+ }[];
2477
+ }
2412
2478
  interface DomainRecord {
2413
2479
  record: string;
2414
2480
  name: string;
@@ -2433,6 +2499,15 @@ interface SuppressionEventData {
2433
2499
  source_id: string | null;
2434
2500
  created_at: string;
2435
2501
  }
2502
+ interface TopicEventData {
2503
+ id: string;
2504
+ name: string;
2505
+ description: string | null;
2506
+ default_subscription: 'opt_in' | 'opt_out';
2507
+ deleted: boolean;
2508
+ created_at: string;
2509
+ updated_at: string;
2510
+ }
2436
2511
  interface EmailSentEvent {
2437
2512
  type: 'email.sent';
2438
2513
  created_at: string;
@@ -2511,6 +2586,11 @@ interface ContactDeletedEvent {
2511
2586
  created_at: string;
2512
2587
  data: ContactEventData;
2513
2588
  }
2589
+ interface ContactTopicsUpdatedEvent {
2590
+ type: 'contact.topics.updated';
2591
+ created_at: string;
2592
+ data: ContactTopicsEventData;
2593
+ }
2514
2594
  interface DomainCreatedEvent {
2515
2595
  type: 'domain.created';
2516
2596
  created_at: string;
@@ -2536,7 +2616,22 @@ interface SuppressionRemovedEvent {
2536
2616
  created_at: string;
2537
2617
  data: SuppressionEventData;
2538
2618
  }
2539
- type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent;
2619
+ interface TopicCreatedEvent {
2620
+ type: 'topic.created';
2621
+ created_at: string;
2622
+ data: TopicEventData;
2623
+ }
2624
+ interface TopicUpdatedEvent {
2625
+ type: 'topic.updated';
2626
+ created_at: string;
2627
+ data: TopicEventData;
2628
+ }
2629
+ interface TopicDeletedEvent {
2630
+ type: 'topic.deleted';
2631
+ created_at: string;
2632
+ data: TopicEventData;
2633
+ }
2634
+ type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactTopicsUpdatedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent | TopicCreatedEvent | TopicUpdatedEvent | TopicDeletedEvent;
2540
2635
  //#endregion
2541
2636
  //#region src/webhooks/interfaces/list-webhook-events.interface.d.ts
2542
2637
  type WebhookEventLogStatus = 'success' | 'pending' | 'failed' | 'attempting';
@@ -2743,6 +2838,7 @@ export declare class Resend {
2743
2838
  readonly suppressions: Suppressions;
2744
2839
  readonly templates: Templates;
2745
2840
  readonly topics: Topics;
2841
+ readonly usage: Usage;
2746
2842
  readonly webhooks: Webhooks;
2747
2843
  constructor(key?: string | undefined, options?: ResendOptions);
2748
2844
  private logError;
@@ -2754,4 +2850,4 @@ export declare class Resend {
2754
2850
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2755
2851
  }
2756
2852
  //#endregion
2757
- export type { ContactCreatedEvent, ContactDeletedEvent, ContactUpdatedEvent, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, ErrorResponse, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, OAuthGrant, RemoveWebhookResponse, RemoveWebhookResponseSuccess, ReplayWebhookEventOptions, ReplayWebhookEventResponse, ReplayWebhookEventResponseSuccess, ResendOptions, Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, RotateWebhookSigningSecretResponse, RotateWebhookSigningSecretResponseSuccess, SuppressionAddedEvent, SuppressionRemovedEvent, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, Webhook, WebhookEvent, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
2853
+ export type { ContactCreatedEvent, ContactDeletedEvent, ContactTopicsUpdatedEvent, ContactUpdatedEvent, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, ErrorResponse, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, OAuthGrant, RemoveWebhookResponse, RemoveWebhookResponseSuccess, ReplayWebhookEventOptions, ReplayWebhookEventResponse, ReplayWebhookEventResponseSuccess, ResendOptions, Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, RotateWebhookSigningSecretResponse, RotateWebhookSigningSecretResponseSuccess, SuppressionAddedEvent, SuppressionRemovedEvent, TopicCreatedEvent, TopicDeletedEvent, TopicUpdatedEvent, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, Webhook, WebhookEvent, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
package/dist/index.d.mts CHANGED
@@ -716,19 +716,19 @@ interface EmailRenderOptions {
716
716
  /**
717
717
  * The React component used to write the message.
718
718
  *
719
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
719
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
720
720
  */
721
721
  react: React$1.ReactNode;
722
722
  /**
723
723
  * The HTML version of the message.
724
724
  *
725
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
725
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
726
726
  */
727
727
  html: string;
728
728
  /**
729
729
  * The plain text version of the message.
730
730
  *
731
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
731
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
732
732
  */
733
733
  text: string;
734
734
  }
@@ -736,7 +736,7 @@ interface SegmentOptions {
736
736
  /**
737
737
  * The id of the segment you want to send to
738
738
  *
739
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
739
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
740
740
  */
741
741
  segmentId: string;
742
742
  /**
@@ -749,7 +749,7 @@ type SendBroadcastOnCreationOptions = {
749
749
  * Whether to send the broadcast immediately or keep it as a draft.
750
750
  * If not provided or set to false, the broadcast will be created as a draft.
751
751
  *
752
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
752
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
753
753
  */
754
754
  send: true;
755
755
  /**
@@ -757,7 +757,7 @@ type SendBroadcastOnCreationOptions = {
757
757
  * The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z)
758
758
  * or relative time (eg: in 2 days).
759
759
  *
760
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
760
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
761
761
  */
762
762
  scheduledAt?: string;
763
763
  } | {
@@ -765,7 +765,7 @@ type SendBroadcastOnCreationOptions = {
765
765
  * Whether to send the broadcast immediately or keep it as a draft.
766
766
  * If not provided or set to false, the broadcast will be created as a draft.
767
767
  *
768
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
768
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
769
769
  */
770
770
  send?: false;
771
771
  /**
@@ -773,7 +773,7 @@ type SendBroadcastOnCreationOptions = {
773
773
  * The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z)
774
774
  * or relative time (eg: in 2 days).
775
775
  *
776
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
776
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
777
777
  */
778
778
  scheduledAt?: never;
779
779
  };
@@ -781,37 +781,37 @@ interface CreateBroadcastBaseOptions {
781
781
  /**
782
782
  * The name of the broadcast
783
783
  *
784
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
784
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
785
785
  */
786
786
  name?: string;
787
787
  /**
788
788
  * A short snippet of text displayed as a preview in recipients' inboxes, often shown below or beside the subject line.
789
789
  *
790
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
790
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
791
791
  */
792
792
  previewText?: string;
793
793
  /**
794
794
  * Sender email address. To include a friendly name, use the format `"Your Name <sender@domain.com>"`
795
795
  *
796
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
796
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
797
797
  */
798
798
  from: string;
799
799
  /**
800
800
  * Reply-to email address. For multiple addresses, send as an array of strings.
801
801
  *
802
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
802
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
803
803
  */
804
804
  replyTo?: string | string[];
805
805
  /**
806
806
  * Email subject.
807
807
  *
808
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
808
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
809
809
  */
810
810
  subject: string;
811
811
  /**
812
812
  * The id of the topic you want to send to
813
813
  *
814
- * @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
814
+ * @link https://resend.com/docs/api-reference/broadcasts/create-broadcast#body-parameters
815
815
  */
816
816
  topicId?: string | null;
817
817
  }
@@ -917,7 +917,7 @@ interface SendBroadcastBaseOptions {
917
917
  * The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z)
918
918
  * or relative time (eg: in 2 days).
919
919
  *
920
- * @link https://resend.com/docs/api-reference/broadcasts/send#body-parameters
920
+ * @link https://resend.com/docs/api-reference/broadcasts/send-broadcast#body-parameters
921
921
  */
922
922
  scheduledAt?: string;
923
923
  }
@@ -2348,8 +2348,67 @@ declare class Topics {
2348
2348
  remove(id: string): Promise<RemoveTopicResponse>;
2349
2349
  }
2350
2350
  //#endregion
2351
+ //#region src/usage/interfaces/get-usage.interface.d.ts
2352
+ export type GetUsageResponseSuccess = {
2353
+ object: 'usage';
2354
+ emails: {
2355
+ daily: {
2356
+ used: number;
2357
+ limit: number | null;
2358
+ sent: number;
2359
+ received: number;
2360
+ resets_at: string;
2361
+ };
2362
+ monthly: {
2363
+ used: number;
2364
+ limit: number;
2365
+ sent: number;
2366
+ received: number;
2367
+ resets_at: string;
2368
+ };
2369
+ };
2370
+ contacts: {
2371
+ used: number;
2372
+ limit: number;
2373
+ };
2374
+ segments: {
2375
+ used: number;
2376
+ limit: number | null;
2377
+ };
2378
+ broadcasts: {
2379
+ used: number;
2380
+ limit: null;
2381
+ };
2382
+ ai_credits: {
2383
+ used: number;
2384
+ limit: number | null;
2385
+ next_increase_at: string | null;
2386
+ };
2387
+ automation_runs: {
2388
+ used: number;
2389
+ limit: number;
2390
+ resets_at: string;
2391
+ };
2392
+ domains: {
2393
+ used: number;
2394
+ limit: number | null;
2395
+ };
2396
+ rate_limit: {
2397
+ limit: number;
2398
+ duration: string;
2399
+ };
2400
+ };
2401
+ export type GetUsageResponse = Response<GetUsageResponseSuccess>;
2402
+ //#endregion
2403
+ //#region src/usage/usage.d.ts
2404
+ declare class Usage {
2405
+ private readonly resend;
2406
+ constructor(resend: Resend);
2407
+ get(): Promise<GetUsageResponse>;
2408
+ }
2409
+ //#endregion
2351
2410
  //#region src/webhooks/interfaces/webhook-event.interface.d.ts
2352
- type WebhookEvent = 'email.sent' | 'email.scheduled' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'email.suppressed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted' | 'suppression.added' | 'suppression.removed';
2411
+ type WebhookEvent = 'email.sent' | 'email.scheduled' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'email.suppressed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'contact.topics.updated' | 'domain.created' | 'domain.updated' | 'domain.deleted' | 'suppression.added' | 'suppression.removed' | 'topic.created' | 'topic.updated' | 'topic.deleted';
2353
2412
  interface BaseEmailEventData {
2354
2413
  broadcast_id?: string;
2355
2414
  created_at: string;
@@ -2409,6 +2468,13 @@ interface ContactEventData {
2409
2468
  last_name?: string | null;
2410
2469
  unsubscribed: boolean;
2411
2470
  }
2471
+ interface ContactTopicsEventData {
2472
+ email: string;
2473
+ topics: {
2474
+ id: string;
2475
+ subscription: 'opt_in' | 'opt_out';
2476
+ }[];
2477
+ }
2412
2478
  interface DomainRecord {
2413
2479
  record: string;
2414
2480
  name: string;
@@ -2433,6 +2499,15 @@ interface SuppressionEventData {
2433
2499
  source_id: string | null;
2434
2500
  created_at: string;
2435
2501
  }
2502
+ interface TopicEventData {
2503
+ id: string;
2504
+ name: string;
2505
+ description: string | null;
2506
+ default_subscription: 'opt_in' | 'opt_out';
2507
+ deleted: boolean;
2508
+ created_at: string;
2509
+ updated_at: string;
2510
+ }
2436
2511
  interface EmailSentEvent {
2437
2512
  type: 'email.sent';
2438
2513
  created_at: string;
@@ -2511,6 +2586,11 @@ interface ContactDeletedEvent {
2511
2586
  created_at: string;
2512
2587
  data: ContactEventData;
2513
2588
  }
2589
+ interface ContactTopicsUpdatedEvent {
2590
+ type: 'contact.topics.updated';
2591
+ created_at: string;
2592
+ data: ContactTopicsEventData;
2593
+ }
2514
2594
  interface DomainCreatedEvent {
2515
2595
  type: 'domain.created';
2516
2596
  created_at: string;
@@ -2536,7 +2616,22 @@ interface SuppressionRemovedEvent {
2536
2616
  created_at: string;
2537
2617
  data: SuppressionEventData;
2538
2618
  }
2539
- type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent;
2619
+ interface TopicCreatedEvent {
2620
+ type: 'topic.created';
2621
+ created_at: string;
2622
+ data: TopicEventData;
2623
+ }
2624
+ interface TopicUpdatedEvent {
2625
+ type: 'topic.updated';
2626
+ created_at: string;
2627
+ data: TopicEventData;
2628
+ }
2629
+ interface TopicDeletedEvent {
2630
+ type: 'topic.deleted';
2631
+ created_at: string;
2632
+ data: TopicEventData;
2633
+ }
2634
+ type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactTopicsUpdatedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent | TopicCreatedEvent | TopicUpdatedEvent | TopicDeletedEvent;
2540
2635
  //#endregion
2541
2636
  //#region src/webhooks/interfaces/list-webhook-events.interface.d.ts
2542
2637
  type WebhookEventLogStatus = 'success' | 'pending' | 'failed' | 'attempting';
@@ -2743,6 +2838,7 @@ export declare class Resend {
2743
2838
  readonly suppressions: Suppressions;
2744
2839
  readonly templates: Templates;
2745
2840
  readonly topics: Topics;
2841
+ readonly usage: Usage;
2746
2842
  readonly webhooks: Webhooks;
2747
2843
  constructor(key?: string | undefined, options?: ResendOptions);
2748
2844
  private logError;
@@ -2754,4 +2850,4 @@ export declare class Resend {
2754
2850
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2755
2851
  }
2756
2852
  //#endregion
2757
- export type { ContactCreatedEvent, ContactDeletedEvent, ContactUpdatedEvent, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, ErrorResponse, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, OAuthGrant, RemoveWebhookResponse, RemoveWebhookResponseSuccess, ReplayWebhookEventOptions, ReplayWebhookEventResponse, ReplayWebhookEventResponseSuccess, ResendOptions, Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, RotateWebhookSigningSecretResponse, RotateWebhookSigningSecretResponseSuccess, SuppressionAddedEvent, SuppressionRemovedEvent, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, Webhook, WebhookEvent, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
2853
+ export type { ContactCreatedEvent, ContactDeletedEvent, ContactTopicsUpdatedEvent, ContactUpdatedEvent, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, ErrorResponse, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, OAuthGrant, RemoveWebhookResponse, RemoveWebhookResponseSuccess, ReplayWebhookEventOptions, ReplayWebhookEventResponse, ReplayWebhookEventResponseSuccess, ResendOptions, Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, RotateWebhookSigningSecretResponse, RotateWebhookSigningSecretResponseSuccess, SuppressionAddedEvent, SuppressionRemovedEvent, TopicCreatedEvent, TopicDeletedEvent, TopicUpdatedEvent, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, Webhook, WebhookEvent, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import PostalMime from "postal-mime";
2
2
  import { Webhook } from "standardwebhooks";
3
3
  //#region package.json
4
- var version = "6.29.0";
4
+ var version = "6.31.0";
5
5
  //#endregion
6
6
  //#region src/common/utils/build-pagination-query.ts
7
7
  function buildPaginationUrl(base, options) {
@@ -1179,6 +1179,16 @@ var Topics = class {
1179
1179
  }
1180
1180
  };
1181
1181
  //#endregion
1182
+ //#region src/usage/usage.ts
1183
+ var Usage = class {
1184
+ constructor(resend) {
1185
+ this.resend = resend;
1186
+ }
1187
+ async get() {
1188
+ return await this.resend.get("/usage");
1189
+ }
1190
+ };
1191
+ //#endregion
1182
1192
  //#region src/webhooks/events/attempts/attempts.ts
1183
1193
  var Attempts = class {
1184
1194
  constructor(resend) {
@@ -1274,6 +1284,7 @@ var Resend = class {
1274
1284
  this.suppressions = new Suppressions(this);
1275
1285
  this.templates = new Templates(this);
1276
1286
  this.topics = new Topics(this);
1287
+ this.usage = new Usage(this);
1277
1288
  this.webhooks = new Webhooks(this);
1278
1289
  if (!key) {
1279
1290
  if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.29.0",
3
+ "version": "6.31.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",