> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base44.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Users Module

> Invite users to the app via base44.users.

> [!WARNING]
>
> This page is part of an AI coding agent skill and is written for agents, not humans. For the human-readable Base44 docs, see the [developer documentation](https://docs.base44.com/developers).

# Users Module

Invite users to the app via `base44.users`.

## Contents

* [Methods](#methods)
* [Examples](#examples) (Invite User)
* [Roles](#roles)
* [Notes](#notes)

## Methods

| Method | Signature | Description |
| - | - | - |
| `inviteUser(user_email, role)` | `Promise<any>` | Invite a user to the app |

## Examples

### Invite User

```javascript theme={null}
// Invite a user with "user" role
await base44.users.inviteUser("newuser@example.com", "user");

// Invite an admin
await base44.users.inviteUser("admin@example.com", "admin");
```

### Invite Multiple Users

```javascript theme={null}
const usersToInvite = [
  { email: "user1@example.com", role: "user" },
  { email: "user2@example.com", role: "user" },
  { email: "manager@example.com", role: "admin" }
];

for (const user of usersToInvite) {
  await base44.users.inviteUser(user.email, user.role);
  console.log(`Invited ${user.email} as ${user.role}`);
}
```

## Roles

The `role` parameter must be one of:

| Role | Description |
| - | - |
| `"user"` | Standard user with default permissions |
| `"admin"` | Administrator with elevated permissions |

**Note:** Only `"user"` and `"admin"` are valid role values. An error will be thrown if you pass any other value.

## Notes

* **Email invitation**: The invited user receives an email with a link to join the app
* **Duplicate handling**: Inviting an existing user will re-send the invitation
* **Also available in auth**: `base44.auth.inviteUser()` provides the same functionality
* **Role validation**: Only `"user"` or `"admin"` are accepted

```javascript theme={null}
// These are equivalent:
await base44.users.inviteUser("newuser@example.com", "user");
await base44.auth.inviteUser("newuser@example.com", "user");
```

## Type Definitions

There's no exported `UsersModule` type or `users.types.ts` in the SDK — `base44.users` is a small inline object with one method. The shape, for reference:

```typescript theme={null}
// Not an exported SDK type — shape of base44.users for reference only.
interface UsersModuleShape {
  /**
   * Invite a user to the application.
   * @param user_email - User's email address.
   * @param role - User's role ('user' or 'admin').
   * @returns Promise resolving when the invitation is sent.
   * @throws Error if role is not 'user' or 'admin'. Exact message:
   *   `Invalid role: "${role}". Role must be either "user" or "admin".`
   */
  inviteUser(user_email: string, role: "user" | "admin"): Promise<any>;
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.