Start here. This is the direct spoken answer to practice first.
Why this question matters
Invitation flows sit at the edge of identity, authorization, email, and product onboarding. A reliable design keeps account creation controlled while still making the first user experience simple.
I would model invitations as records with invited email, tenant or account scope, intended role, status, expiry time, invited-by user, and a server-generated one-time token. The accept endpoint would validate the token, expiry, status, and email ownership, then create or link the user account and membership in one transaction. Email delivery can be asynchronous, but accepting the invite is the source of truth for activation.