Skip to content

Admin APIs for invitation email delivery oversight and resend #578

@PierreLeGuen

Description

@PierreLeGuen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions