Skip to content

feat: add usage resource - #1111

Merged
dielduarte merged 2 commits into
canaryfrom
feat/usage-endpoint
Sep 25, 2026
Merged

dielduarte merged 2 commits into
canaryfrom
feat/usage-endpoint

Conversation

@dielduarte

@dielduarte dielduarte commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds resend.usage.get() for GET /usage, exposing account-level usage/quotas (emails, contacts, segments, broadcasts, ai_credits, automation_runs, domains, rate_limit).

Notes

  • Extracted from the shared preview-headless-dashboard branch (feat: preview-headless-dashboard #1043) — this PR only touches the usage resource, none of that branch's other bundled/unrelated preview features.
  • Fixed ai_credits.limit to allow null (was number-only there), matching the actual API response.
  • Part of the /usage GA rollout (DEV-2183).

Summary by cubic

Adds resend.usage.get() for the GET /usage endpoint, exposing account-level usage and quotas for emails, contacts, segments, broadcasts, AI credits, automation runs, domains, and rate limit.

New Features

  • Registers the new Usage resource on the Resend client and exports its interfaces from the package root.
  • Types ai_credits.limit as number | null to match the actual API response.
  • Bumps the package version to 6.30.0.

Written for commit c8e9c49. Summary will update on new commits.

Review in cubic

Adds resend.usage.get() for GET /usage, exposing account-level
usage/quotas (emails, contacts, segments, broadcasts, ai_credits,
automation_runs, domains, rate_limit).

Extracted from the shared headless-dashboard preview branch and
fixed ai_credits.limit to allow null, matching the actual API response.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/resend@1111

commit: c8e9c49

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Confidence score: 5/5

  • src/usage/interfaces/get-usage.interface.ts omits the documented generated_at field, preventing resend.usage.get() consumers from reading when the usage snapshot was generated; add generated_at: string to the response type.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/usage/interfaces/get-usage.interface.ts">

<violation number="1" location="src/usage/interfaces/get-usage.interface.ts:3">
P3: `GetUsageResponseSuccess` omits the documented top-level `generated_at` field, so `resend.usage.get()` consumers can't read when the usage snapshot was generated. Add `generated_at: string;` to the type.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/usage/interfaces/get-usage.interface.ts
Comment thread src/usage/usage.spec.ts
headers: {},
});

const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a fake api evey tests uses btw!

@dielduarte
dielduarte marked this pull request as ready for review September 25, 2026 15:35
@dielduarte
dielduarte requested a review from a team as a code owner September 25, 2026 15:35
@dielduarte
dielduarte requested a review from a-carciu September 25, 2026 15:36

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Adds resend.usage.get() for GET /usage, exports usage interfaces, and bumps the package to 6.30.0. This is a new public SDK API surface and release tied to a GA rollout.

Re-trigger cubic

@dielduarte
dielduarte merged commit f9dc751 into canary Sep 25, 2026
12 of 13 checks passed
@dielduarte
dielduarte deleted the feat/usage-endpoint branch September 25, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants