Kaizen
Browse modulesAuthenticationauth/serverInterfaces

Interface: OrganizationConfig

Defined in: server/auth/organization-config.ts:9

Extends

  • Pick<OrganizationOptions, | "allowUserToCreateOrganization" | "organizationLimit" | "membershipLimit" | "ac" | "roles" | "creatorRole" | "invitationExpiresIn" | "invitationLimit" | "cancelPendingInvitationsOnReInvite" | "requireEmailVerificationOnInvitation" | "disableOrganizationDeletion">

Properties

ac?

optional ac?: AccessControl;

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:58

Configure the roles and permissions for the organization plugin.

Inherited from

Pick.ac

allowUserToCreateOrganization?

optional allowUserToCreateOrganization?: 
  | boolean
  | ((user: {
  createdAt: Date;
  email: string;
  emailVerified: boolean;
  id: string;
  image?: string | null;
  name: string;
  updatedAt: Date;
} & Record<string, any>) => Awaitable<boolean>);

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:22

Configure whether new users are able to create new organizations. You can also pass a function that returns a boolean.

Example

allowUserToCreateOrganization: async (user) => {
		const plan = await getUserPlan(user);
     return plan.name === "pro";
}

Default

true

Inherited from

Pick.allowUserToCreateOrganization

cancelPendingInvitationsOnReInvite?

optional cancelPendingInvitationsOnReInvite?: boolean;

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:166

Cancel pending invitations on re-invite.

Default

false

Inherited from

Pick.cancelPendingInvitationsOnReInvite

creatorRole?

optional creatorRole?: string;

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:45

The role that is assigned to the creator of the organization.

Default

"owner"

Inherited from

Pick.creatorRole

disableOrganizationDeletion?

optional disableOrganizationDeletion?: boolean;

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:292

Disable organization deletion

Default

false

Inherited from

Pick.disableOrganizationDeletion

enabled?

optional enabled?: boolean;

Defined in: server/auth/organization-config.ts:34

Omitted configuration keeps the historical organization plugin.


invitationExpiresIn?

optional invitationExpiresIn?: number;

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:150

The expiration time for the invitation link.

Default

48 hours

Inherited from

Pick.invitationExpiresIn

invitationLimit?

optional invitationLimit?: 
  | number
  | ((data: {
  member: {
     createdAt: Date;
     id: string;
     organizationId: string;
     role: string;
     userId: string;
  } & Record<string, any>;
  organization: {
     createdAt: Date;
     id: string;
     logo?: string | null;
     metadata?: any;
     name: string;
     slug: string;
  } & Record<string, any>;
  user: {
     createdAt: Date;
     email: string;
     emailVerified: boolean;
     id: string;
     image?: string | null;
     name: string;
     updatedAt: Date;
  } & Record<string, any>;
}, ctx: AuthContext) => Awaitable<number>);

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:156

The maximum invitation a user can send.

Default

100

Inherited from

Pick.invitationLimit

membershipLimit?

optional membershipLimit?: 
  | number
  | ((user: {
  createdAt: Date;
  email: string;
  emailVerified: boolean;
  id: string;
  image?: string | null;
  name: string;
  updatedAt: Date;
}, organization: {
  createdAt: Date;
  id: string;
  logo?: string | null;
  metadata?: any;
  name: string;
  slug: string;
}) => number | Promise<number>);

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:53

The maximum number of members allowed in an organization.

You can also pass a function that returns the limit number

Default

100

Inherited from

Pick.membershipLimit

organizationHooks?

optional organizationHooks?: Omit<{
  afterAcceptInvitation?: (data: {
     invitation: {
        createdAt: Date;
        email: string;
        expiresAt: Date;
        id: string;
        inviterId: string;
        organizationId: string;
        role: string;
        status: "pending" | "rejected" | "canceled" | "accepted";
        teamId?: string | null;
     } & Record<string, any>;
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterAddMember?: (data: {
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterAddTeamMember?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
     } & Record<string, any>;
     teamMember: {
        createdAt: Date;
        id: string;
        teamId: string;
        userId: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterCancelInvitation?: (data: {
     cancelledBy: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
     invitation: {
        createdAt: Date;
        email: string;
        expiresAt: Date;
        id: string;
        inviterId: string;
        organizationId: string;
        role: string;
        status: "pending" | "rejected" | "canceled" | "accepted";
        teamId?: string | null;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
  }) => Promise<void>;
  afterCreateInvitation?: (data: {
     invitation: {
        createdAt: Date;
        email: string;
        expiresAt: Date;
        id: string;
        inviterId: string;
        organizationId: string;
        role: string;
        status: "pending" | "rejected" | "canceled" | "accepted";
        teamId?: string | null;
     } & Record<string, any>;
     inviter: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
  }) => Promise<void>;
  afterCreateOrganization?: (data: {
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterCreateTeam?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
     } & Record<string, any>;
     user?: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterDeleteOrganization?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }, ctx?: GenericEndpointContext) => Promise<void>;
  afterDeleteTeam?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
     } & Record<string, any>;
     user?: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterRejectInvitation?: (data: {
     invitation: {
        createdAt: Date;
        email: string;
        expiresAt: Date;
        id: string;
        inviterId: string;
        organizationId: string;
        role: string;
        status: "pending" | "rejected" | "canceled" | "accepted";
        teamId?: string | null;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterRemoveMember?: (data: {
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterRemoveTeamMember?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
     } & Record<string, any>;
     teamMember: {
        createdAt: Date;
        id: string;
        teamId: string;
        userId: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterUpdateMemberRole?: (data: {
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     previousRole: string;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterUpdateOrganization?: (data: {
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     organization:   | {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
      } & Record<string, any>
        | null;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  afterUpdateTeam?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team:   | {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
      } & Record<string, any>
        | null;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  beforeAcceptInvitation?: (data: {
     invitation: {
        createdAt: Date;
        email: string;
        expiresAt: Date;
        id: string;
        inviterId: string;
        organizationId: string;
        role: string;
        status: "pending" | "rejected" | "canceled" | "accepted";
        teamId?: string | null;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  beforeAddMember?: (data: {
     member: {
      [key: string]: any;
        organizationId: string;
        role: string;
        userId: string;
     };
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
   }) => Promise<
     | void
     | {
     data: Record<string, any>;
  }>;
  beforeAddTeamMember?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
     } & Record<string, any>;
     teamMember: {
      [key: string]: any;
        teamId: string;
        userId: string;
     };
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
   }) => Promise<
     | void
     | {
     data: Record<string, any>;
  }>;
  beforeCancelInvitation?: (data: {
     cancelledBy: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
     invitation: {
        createdAt: Date;
        email: string;
        expiresAt: Date;
        id: string;
        inviterId: string;
        organizationId: string;
        role: string;
        status: "pending" | "rejected" | "canceled" | "accepted";
        teamId?: string | null;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
  }) => Promise<void>;
  beforeCreateInvitation?: (data: {
     invitation: {
      [key: string]: any;
        email: string;
        inviterId: string;
        organizationId: string;
        role: string;
        teamId?: string;
     };
     inviter: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
   }) => Promise<
     | void
     | {
     data: Record<string, any>;
  }>;
  beforeCreateOrganization?: (data: {
     organization: {
      [key: string]: any;
        logo?: string | null;
        metadata?: Record<string, any>;
        name?: string;
        slug?: string;
     };
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
   }) => Promise<
     | void
     | {
     data: Record<string, any>;
  }>;
  beforeCreateTeam?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
      [key: string]: any;
        name: string;
        organizationId: string;
     };
     user?: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
   }) => Promise<
     | void
     | {
     data: Record<string, any>;
  }>;
  beforeDeleteOrganization?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }, ctx?: GenericEndpointContext) => Promise<void>;
  beforeDeleteTeam?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
     } & Record<string, any>;
     user?: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  beforeRejectInvitation?: (data: {
     invitation: {
        createdAt: Date;
        email: string;
        expiresAt: Date;
        id: string;
        inviterId: string;
        organizationId: string;
        role: string;
        status: "pending" | "rejected" | "canceled" | "accepted";
        teamId?: string | null;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  beforeRemoveMember?: (data: {
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  beforeRemoveTeamMember?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
     } & Record<string, any>;
     teamMember: {
        createdAt: Date;
        id: string;
        teamId: string;
        userId: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
  }) => Promise<void>;
  beforeUpdateMemberRole?: (data: {
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     newRole: string;
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
   }) => Promise<
     | void
     | {
     data: {
      [key: string]: any;
        role: string;
     };
  }>;
  beforeUpdateOrganization?: (data: {
     member: {
        createdAt: Date;
        id: string;
        organizationId: string;
        role: string;
        userId: string;
     } & Record<string, any>;
     organization: {
      [key: string]: any;
        logo?: string | null;
        metadata?: Record<string, any>;
        name?: string;
        slug?: string;
     };
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
   }) => Promise<
     | void
     | {
     data: {
      [key: string]: any;
        logo?: string | null;
        metadata?: Record<..., ...>;
        name?: string;
        slug?: string;
     };
  }>;
  beforeUpdateTeam?: (data: {
     organization: {
        createdAt: Date;
        id: string;
        logo?: string | null;
        metadata?: any;
        name: string;
        slug: string;
     } & Record<string, any>;
     team: {
        createdAt: Date;
        id: string;
        name: string;
        organizationId: string;
        updatedAt?: Date;
     } & Record<string, any>;
     updates: {
      [key: string]: any;
        name?: string;
     };
     user: {
        createdAt: Date;
        email: string;
        emailVerified: boolean;
        id: string;
        image?: string | null;
        name: string;
        updatedAt: Date;
     } & Record<string, any>;
   }) => Promise<
     | void
     | {
     data: Record<string, any>;
  }>;
}, `${string}Team${string}`>;

Defined in: server/auth/organization-config.ts:32


organizationLimit?

optional organizationLimit?: 
  | number
  | ((user: {
  createdAt: Date;
  email: string;
  emailVerified: boolean;
  id: string;
  image?: string | null;
  name: string;
  updatedAt: Date;
} & Record<string, any>) => Awaitable<boolean>);

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:38

The maximum number of organizations a user can create.

You can also pass a function that returns a boolean. The function should return true if the user has reached their organization limit, and false otherwise.

Default

unlimited

Example

organizationLimit: async (user) => {
  const plan = await getUserPlan(user);
  // Return true if the user has reached their organization limit, false otherwise
  return plan.name === "pro";
}

Inherited from

Pick.organizationLimit

requireEmailVerificationOnInvitation?

optional requireEmailVerificationOnInvitation?: boolean;

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:189

Require email verification before session-authenticated recipient invitation calls that carry an invitation ID (accept, reject, get).

When unset, Better Auth preserves the normal emailed-invitation flow for built-in opaque invitation IDs, including the default generator and advanced.database.generateId: "uuid". It requires verification for externally controlled or predictable invitation IDs, such as advanced.database.generateId: "serial" / false or custom ID generation.

Set this option to true when invitation IDs may be visible outside the invited user's mailbox, when organization invitation lists are exposed to members, or when verified email should be the ownership proof for by-ID invitation actions. Client-side listUserInvitations calls always require a verified session email because they enumerate invitation IDs from session.user.email. Server-side listUserInvitations calls without a session (caller passes ctx.query.email) continue to bypass the gate because the caller is trusted.

Default

undefined

Inherited from

Pick.requireEmailVerificationOnInvitation

roles?

optional roles?: {
[key: string]: Role<any> | undefined;
};

Defined in: ../node_modules/.pnpm/better-auth@1.7.5_a6de90e8c0027ab558a49d9c21123dfb/node_modules/better-auth/dist/plugins/organization/types.d.mts:62

Custom permissions for roles.

Index Signature

[key: string]: Role<any> | undefined

Inherited from

Pick.roles

schema?

optional schema?: {
  member?: {
     additionalFields?: Record<string, Omit<DBFieldAttribute, "fieldName"> & {
        fieldName?: undefined;
     }>;
  };
  organization?: {
     additionalFields?: Record<string, Omit<DBFieldAttribute, "fieldName"> & {
        fieldName?: undefined;
     }>;
  };
};

Defined in: server/auth/organization-config.ts:24

Custom fields require auth.schemaOwnership: "consumer" and app-owned migrations.

member?

optional member?: {
  additionalFields?: Record<string, Omit<DBFieldAttribute, "fieldName"> & {
     fieldName?: undefined;
  }>;
};
member.additionalFields?
optional additionalFields?: Record<string, Omit<DBFieldAttribute, "fieldName"> & {
  fieldName?: undefined;
}>;

organization?

optional organization?: {
  additionalFields?: Record<string, Omit<DBFieldAttribute, "fieldName"> & {
     fieldName?: undefined;
  }>;
};
organization.additionalFields?
optional additionalFields?: Record<string, Omit<DBFieldAttribute, "fieldName"> & {
  fieldName?: undefined;
}>;

sendInvitationEmail?

optional sendInvitationEmail?: (args: {
  email: string;
  invitationId: string;
  inviter: {
     email: string;
     id: string;
     name: string | null;
  };
  organization: {
     id: string;
     name: string;
     slug: string;
  };
}) => Promise<void>;

Defined in: server/auth/organization-config.ts:35

Parameters

ParameterTypeDescription
args{ email: string; invitationId: string; inviter: { email: string; id: string; name: string | null; }; organization: { id: string; name: string; slug: string; }; }-
args.emailstring-
args.invitationIdstringThe raw Better Auth invitation id. Better Auth does not generate an accept URL in this callback, so build your own link from this id and the accept path your app mounts (e.g. ${baseUrl}/accept-invitation/${invitationId}).
args.inviter{ email: string; id: string; name: string | null; }-
args.inviter.emailstring-
args.inviter.idstring-
args.inviter.namestring | null-
args.organization{ id: string; name: string; slug: string; }-
args.organization.idstring-
args.organization.namestring-
args.organization.slugstring-

Returns

Promise<void>

On this page