Members & Teams
Member, invitation, and team management is handled by Better Auth’s organization plugin. All endpoints below are served at /api/auth/organization/*.
Members
Section titled “Members”List members
Section titled “List members”GET /api/auth/organization/list-membersQuery parameters:
| Parameter | Type | Description |
|---|---|---|
organizationId | string | Organization to list members for. Defaults to the session’s active organization. |
limit | number | Max results to return (default: 100). |
offset | number | Offset for pagination (default: 0). |
sortBy | string | Field to sort by (default: "createdAt"). |
sortDirection | "asc" | "desc" | Sort direction (default: "desc"). |
Update a member’s role
Section titled “Update a member’s role”POST /api/auth/organization/update-member-roleContent-Type: application/jsonRequired role: Admin or owner.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
memberId | string | Yes | The member ID to update. |
role | "owner" | "admin" | "member" | Yes | The new role. |
organizationId | string | No | Defaults to the session’s active organization. |
Remove a member
Section titled “Remove a member”POST /api/auth/organization/remove-memberContent-Type: application/jsonRequired role: Admin or owner.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
memberId | string | Yes | The member ID to remove. |
organizationId | string | No | Defaults to the session’s active organization. |
Invitations
Section titled “Invitations”Invite a member
Section titled “Invite a member”POST /api/auth/organization/invite-memberContent-Type: application/jsonRequired role: Admin or owner.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Email address of the person to invite. |
role | "owner" | "admin" | "member" | Yes | Role to assign on acceptance. |
organizationId | string | No | Defaults to the session’s active organization. |
teamId | string | No | Team to add the member to on acceptance. |
resend | boolean | No | Re-send the invitation email if one is already pending for this address. |
List invitations
Section titled “List invitations”GET /api/auth/organization/get-invitationsRequired role: Admin or owner.
Query parameters:
| Parameter | Type | Description |
|---|---|---|
organizationId | string | Defaults to the session’s active organization. |
Returns pending invitations including id, email, role, teamId, status, and expiresAt.
Cancel an invitation
Section titled “Cancel an invitation”POST /api/auth/organization/cancel-invitationContent-Type: application/jsonRequired role: Admin or owner (or the user who sent the invitation).
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
invitationId | string | Yes | ID of the invitation to cancel. |
Accept an invitation
Section titled “Accept an invitation”POST /api/auth/organization/accept-invitationContent-Type: application/jsonCalled by the invitee after clicking the invitation link.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
invitationId | string | Yes | ID of the invitation to accept. |
List teams
Section titled “List teams”GET /api/auth/organization/list-teamsQuery parameters:
| Parameter | Type | Description |
|---|---|---|
organizationId | string | Defaults to the session’s active organization. |
Create a team
Section titled “Create a team”POST /api/auth/organization/create-teamContent-Type: application/jsonRequired role: Admin or owner.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Team name. |
organizationId | string | No | Defaults to the session’s active organization. |
Update a team
Section titled “Update a team”POST /api/auth/organization/update-teamContent-Type: application/jsonRequired role: Admin or owner.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
teamId | string | Yes | ID of the team to update. |
data.name | string | Yes | New team name. |
Delete a team
Section titled “Delete a team”POST /api/auth/organization/remove-teamContent-Type: application/jsonRequired role: Admin or owner.
Deleting a team does not remove its members from the organization — members’ teamId is set to null.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
teamId | string | Yes | ID of the team to delete. |
List team members
Section titled “List team members”GET /api/auth/organization/list-team-membersQuery parameters:
| Parameter | Type | Description |
|---|---|---|
teamId | string | ID of the team. |
Remove a member from a team
Section titled “Remove a member from a team”POST /api/auth/organization/remove-team-memberContent-Type: application/jsonRequired role: Admin or owner.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
teamId | string | Yes | |
userId | string | Yes |