Skip to content

feat(usage): add support for GET /usage endpoint - #165

Merged
dielduarte merged 3 commits into
mainfrom
feat/usage-endpoint
Sep 25, 2026
Merged

dielduarte merged 3 commits into
mainfrom
feat/usage-endpoint

Conversation

@dielduarte

@dielduarte dielduarte commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds IResend.UsageAsync() for account-level usage/quotas (emails, contacts, segments, broadcasts, AI credits, automation runs, domains, rate limit).
  • Live-tested against two real accounts — correct, distinct data returned for each, matching the spec exactly.

Part of the /usage GA rollout (DEV-2183). Reference implementation: resend-node#1111.


Summary by cubic

Adds IResend.UsageAsync() for retrieving account-level usage and quota data (emails, contacts, segments, broadcasts, AI credits, automation runs, domains, and rate limit), part of the /usage GA rollout (DEV-2183). Bumps the package version to 0.21.0. No breaking changes.

Changes

  • Introduces Usage and nested DTOs following the existing read-only resource conventions.
  • Adds a mock UsageController to the test API server for integration coverage, including assertions for reset timestamps and monthly sent/received counts.

Written for commit 716f7cb. Summary will update on new commits.

Review in cubic

Adds IResend.UsageAsync() to retrieve account-level usage and quota
data (emails, contacts, segments, broadcasts, AI credits, automation
runs, domains, and the account's rate limit), following the same
partial-class/DTO conventions as other read-only resources like
EmailMetrics and Segments.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 15 files

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

Re-trigger cubic

Comment thread src/Resend/UsageContacts.cs
Comment thread src/Resend/Usage.cs
Comment thread tests/Resend.Tests/ResendClientTests.Usage.cs
Comment thread tools/Resend.ApiServer/Controllers/UsageController.cs Outdated
Comment thread src/Resend/UsageEmailDaily.cs
…xture typo

- Fixes a used/sent+received mismatch in the monthly fixture (5422 -> 5442).
- Adds assertions for daily/monthly/automation_runs MomentReset and
  monthly Sent/Received, which were previously unasserted.

@klotty klotty left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

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

Auto-approved: Adds read-only GET /usage support via UsageAsync and DTOs, with a mock API controller and integration tests; the change is additive, follows existing SDK patterns, and alters no existing behavior.

Re-trigger cubic

@dielduarte
dielduarte marked this pull request as ready for review September 25, 2026 18:08
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.

3 participants