Context
Organization invitation emails are now sent from cloud-api through Resend and invitation rows track delivery metadata (email_status, email_sent_at, email_last_error, email_message_id). We need admin-facing APIs so operators can oversee delivery health and manually recover failed/skipped emails.
Goals
- Give platform admins visibility into organization invitation email delivery status.
- Allow admins to resend invitation emails when delivery failed, was skipped, or needs manual retry.
- Preserve auditability and avoid exposing invitation tokens unnecessarily.
Proposed API work
- Add admin-only endpoints under the existing admin route namespace to list invitation email deliveries with filters for organization, recipient email, status, date range, and invitation status.
- Include response fields for organization id/name, invitation id, recipient email, role, invitation status, email status, sent timestamp, last error, Resend email id, inviter id/email, created/expires/responded timestamps.
- Add admin-only resend endpoint for a single invitation, reusing the same Resend sender/template path as normal invitation creation.
- Add optional bulk resend endpoint for filtered failed/skipped/not_attempted pending invitations, with clear per-invitation results.
- Record each resend attempt back onto
organization_invitations delivery columns and emit structured logs/metrics.
- Enforce safe resend rules: invitation must exist, still be pending, and not expired unless a separate reissue flow is implemented.
Acceptance criteria
- Platform admin auth is required for all endpoints.
- Listing supports pagination and deterministic ordering.
- Resend returns per-invitation success/failure with sanitized errors.
- Failed resend does not delete or invalidate existing invitations.
- Tests cover permissions, listing filters, single resend success/failure, expired/non-pending resend rejection, and delivery metadata updates.
Cross references
Context
Organization invitation emails are now sent from
cloud-apithrough Resend and invitation rows track delivery metadata (email_status,email_sent_at,email_last_error,email_message_id). We need admin-facing APIs so operators can oversee delivery health and manually recover failed/skipped emails.Goals
Proposed API work
organization_invitationsdelivery columns and emit structured logs/metrics.Acceptance criteria
Cross references