[GH-ISSUE #8829] Extend organization.listInvitations with Filtering & Query Options #11205

Open
opened 2026-04-13 07:33:10 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @anmol-fzr on GitHub (Mar 29, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8829

Is this suited for github?

  • Yes, this is suited for github

Currently, the organization.listInvitations method only supports filtering by organizationId. This limits its usability in real-world applications where more granular control over invitation queries is often required.

In many applications, invitations need to be filtered and managed based on additional attributes such as:

status (e.g., pending, accepted, revoked)
email
inviterId
createdAt (date ranges)
expiresAt

Describe the solution you'd like

Enhance organization.listInvitations to support additional query parameters.

Example API Design

  query: {
    organizationId: "org-id",
    status: ["pending"],              // optional
    email: "user@example.com",      // optional
    inviterId: "user-id",           // optional
  },
});

Describe alternatives you've considered

Allow a generic filters object:

query: {
  organizationId: "org-id",
  filters: {
    status: "pending",
    email: { contains: "@gmail.com" },
  }
}

Additional context

Pagination support (limit, cursor) could be added alongside filters
Index-aware filtering for performance (e.g., organizationId, email)
Backward compatibility can be maintained by keeping existing API unchanged

Originally created by @anmol-fzr on GitHub (Mar 29, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8829 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Currently, the organization.listInvitations method only supports filtering by organizationId. This limits its usability in real-world applications where more granular control over invitation queries is often required. In many applications, invitations need to be filtered and managed based on additional attributes such as: status (e.g., pending, accepted, revoked) email inviterId createdAt (date ranges) expiresAt ### Describe the solution you'd like Enhance organization.listInvitations to support additional query parameters. Example API Design ```const { data, error } = await authClient.organization.listInvitations({ query: { organizationId: "org-id", status: ["pending"], // optional email: "user@example.com", // optional inviterId: "user-id", // optional }, }); ``` ### Describe alternatives you've considered Allow a generic filters object: ``` query: { organizationId: "org-id", filters: { status: "pending", email: { contains: "@gmail.com" }, } } ``` ### Additional context Pagination support (limit, cursor) could be added alongside filters Index-aware filtering for performance (e.g., organizationId, email) Backward compatibility can be maintained by keeping existing API unchanged
GiteaMirror added the enhancement label 2026-04-13 07:33:11 -05:00
Author
Owner

@anmol-fzr commented on GitHub (Mar 29, 2026):

I’d like to work on this feature.

Planning to extend organization.listInvitations to support additional query filters (e.g., status, email, date ranges) while maintaining backward compatibility.

I’ll start by reviewing the current implementation and propose an API + schema update before proceeding with the full implementation.

Please let me know if there are any design constraints or preferences I should be aware of.

<!-- gh-comment-id:4150852729 --> @anmol-fzr commented on GitHub (Mar 29, 2026): I’d like to work on this feature. Planning to extend `organization.listInvitations` to support additional query filters (e.g., `status`, `email`, date ranges) while maintaining backward compatibility. I’ll start by reviewing the current implementation and propose an API + schema update before proceeding with the full implementation. Please let me know if there are any design constraints or preferences I should be aware of.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#11205