Manage user memberships
How users join, switch, and leave organizations (a.k.a workspaces)
Users can be members of multiple organizations, with distinct roles and permissions for each. Access controls are dynamically assigned based on the user’s organizational context and specific role.
Explore the following example of Scalekit’s user data model:
Show me the User Object
{ "user": { "create_time": "2025-10-13T17:06:39.862Z", "email": "user@example.com", "external_id": "ext_12345a67b89c", "id": "usr_1234abcd5678efgh", "memberships": [ { "accepted_at": "2025-10-13T17:06:39.862Z", "created_at": "2025-10-13T17:06:39.862Z", "display_name": "AcmeCorp", "expires_at": "2025-10-13T17:06:39.862Z", "inviter_email": "string", "join_time": "2025-10-13T17:06:39.862Z", "membership_status": "ACTIVE", "metadata": { "department": "engineering", "location": "nyc-office" }, "name": "AcmeCorp", "organization_id": "org_1234abcd5678efgh", "roles": [ { "display_name": "Dev Team", "id": "role_79643236410327240", "name": "team_dev" } ] } ], "metadata": { "department": "engineering", "location": "nyc-office" }, "update_time": "2025-10-13T17:06:39.862Z", "user_profile": { "custom_attributes": { "department": "engineering", "security_clearance": "level2" }, "email_verified": true, "first_name": "John", "id": "usr_profile_1234abcd5678efgh", "last_name": "Doe", "locale": "en-US", "metadata": { "account_status": "active", "signup_source": "mobile_app" }, "name": "John Michael Doe", "phone_number": "+14155552671" } }}sManage user memberships API
Section titled “Manage user memberships ”While the dashboard is useful for manual operations, most applications need to manage users programmatically to integrate with existing systems. The examples below demonstrate common user management operations.
// 1. Install the Scalekit SDK
// 2. Create an organization// Use case: When a new company signs up for your B2B applicationconst { organization: { id: organizationId }} = await scalekit.organization.createOrganization("Megasoft");
// 3. Create a user and send invitation email// Use case: HR system integration, bulk user imports, or admin-initiated account creationconst { user } = await scalekit.user.createUserAndMembership("<organizationId>", { email: "user@example.com", userProfile: { firstName: "John", lastName: "Doe", }, sendInvitationEmail: true});
// 4. List users in an organization// Use case: Display user directory, security audits, billing calculations, or compliance reportingconst { users } = await scalekit.user.listOrganizationUsers("<organizationId>");
// 5. Update user profile// Use case: Sync changes from external systems, or when users update their profile informationawait scalekit.user.updateUser("<users[0].id>", { userProfile: { firstName: "John", lastName: "Smith", // Updated last name },});
// 6. Delete user permanently// Use case: User account closure, GDPR deletion requests, or cleaning up test accountsawait scalekit.user.deleteUser("<users[0].id>");organization = scalekit.organization.create_organization("Megasoft")organization_id = organization.iduser_response = scalekit.user.create_user_and_membership( "<organization_id>", email="user@example.com", user_profile={ "first_name": "John", "last_name": "Doe" }, send_invitation_email=True)users_response = scalekit.user.list_organization_users("<organization_id>")scalekit.user.update_user( "<users_response.users[0].id>", user_profile={ "first_name": "John", "last_name": "Smith" # Updated last name })scalekit.user.delete_user("<users_response.users[0].id>")// 1. Install the Scalekit SDK
// 2. Create an organization// Use case: When a new company signs up for your B2B applicationorganization, err := scalekitClient.Organization.CreateOrganization( ctx, "Megasoft", scalekit.CreateOrganizationOptions{},)
// 3. Create a user and send invitation email// Use case: HR system integration, bulk user imports, or admin-initiated account creationnewUser := &usersv1.CreateUser{ Email: "user@example.com", UserProfile: &usersv1.CreateUserProfile{ FirstName: "John", LastName: "Doe", },}userResp, err := scalekitClient.User().CreateUserAndMembership( ctx, "<organization.Id>", newUser, true, // sendInvitationEmail)
// 4. List users in an organization// Use case: Display user directory, security audits, billing calculations, or compliance reportingusers, err := scalekitClient.User().ListOrganizationUsers( ctx, "<organization.Id>", &scalekit.ListUsersOptions{},)
// 5. Update user profile// Use case: Sync changes from external systems, or when users update their profile informationupdateUser := &usersv1.UpdateUser{ UserProfile: &usersv1.UpdateUserProfile{ FirstName: "John", LastName: "Smith", // Updated last name },}scalekitClient.User().UpdateUser(ctx, "<users.Users[0].Id>", updateUser)
// 6. Delete user permanently// Use case: User account closure, GDPR deletion requests, or cleaning up test accountserr = scalekitClient.User().DeleteUser(ctx, "<users.Users[0].Id>")// 1. Install the Scalekit SDK
// 2. Create an organization// Use case: When a new company signs up for your B2B applicationCreateOrganization createOrganization = CreateOrganization.newBuilder() .setDisplayName("Megasoft") .build();
Organization organization = scalekitClient.organizations().create(createOrganization);
// 3. Create a user and send invitation email// Use case: HR system integration, bulk user imports, or admin-initiated account creationCreateUser createUser = CreateUser.newBuilder() .setEmail("user@example.com") .setUserProfile( CreateUserProfile.newBuilder() .setFirstName("John") .setLastName("Doe") .build()) .build();
CreateUserAndMembershipRequest createUserReq = CreateUserAndMembershipRequest.newBuilder() .setUser(createUser) .setSendInvitationEmail(true) .build();
CreateUserAndMembershipResponse userResp = scalekitClient.users() .createUserAndMembership("<organization.getId()>", createUserReq);
// 4. List users in an organization// Use case: Display user directory, security audits, billing calculations, or compliance reportingListOrganizationUsersRequest listReq = ListOrganizationUsersRequest.newBuilder() .build();
ListOrganizationUsersResponse users = scalekitClient.users() .listOrganizationUsers("<organization.getId()>", listReq);
// 5. Update user profile// Use case: Sync changes from external systems, or when users update their profile informationUpdateUser updateUser = UpdateUser.newBuilder() .setUserProfile( UpdateUserProfile.newBuilder() .setFirstName("John") .setLastName("Smith") // Updated last name .build()) .build();
UpdateUserRequest updateReq = UpdateUserRequest.newBuilder() .setUser(updateUser) .build();
scalekitClient.users().updateUser("<users.getUsers(0).getId()>", updateReq);
// 6. Delete user permanently// Use case: User account closure, GDPR deletion requests, or cleaning up test accountsscalekitClient.users().deleteUser("<users.getUsers(0).getId()>");Manage user memberships in the Scalekit dashboard
Section titled “Manage user memberships in the Scalekit dashboard”The Scalekit dashboard provides a fast, centralized way to manage users across organizations. Quickly view user lists, edit profile details, and update access controls—all from a single interface.
Go to Dashboard > Users
- Invite users to join an organization
- Assign roles
- Add them to organizations
- Suspend or deactivate users
- Update user information and role assignments
- View active and inactive users