> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/membership/users/new.md).

# Add a user

Add a user — with email and password, a username, a phone number, as a service user, or by invitation.

**Where:** Membership → Users → **Add New** · `/projects/<project>/membership/users/new`

## Before you start

* Membership is on for the project — see [Membership](/codemash/cloud/membership.md#enable-the-module).
* To give the user a role now, the role exists — see [Create a role](/codemash/cloud/membership/roles/new.md).
* You need the `membership:create` permission on users.

## Steps

1. Press **Add New**. The screen **Add New User** opens with the **Registration type** cards. **Email & password** is picked.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-d915db1959fd4e8457bd68ff470d8a1ecd5352bb%2Fusers-new-1.png?alt=media" alt="Add New User with six Registration type cards: Email &#x26; password (picked), Username &#x26; password, Phone, Invite, User as a service, Passkey; below the Identification block with Email address, Password and Display Name"><figcaption><p>The six registration types.</p></figcaption></figure>
2. Pick the card that fits. Each card shows its own form:

   | Card                    | What you enter                           | What Save does                                                                |
   | ----------------------- | ---------------------------------------- | ----------------------------------------------------------------------------- |
   | **Email & password**    | Email address, Password \*, Display Name | Creates an email login and the user; the person can sign in at once.          |
   | **Username & password** | Username, Password \*, Display Name      | Creates a username login, for apps without email addresses.                   |
   | **Phone**               | Phone Number \*, Display Name            | Creates a phone login.                                                        |
   | **Invite**              | Email address \*                         | Fires the **When invited** trigger — see the warning below.                   |
   | **User as a service**   | Display Name \*                          | Creates a service login for machine-to-machine calls.                         |
   | **Passkey**             | —                                        | Nothing to save: passkey users sign up on their own device, through your app. |
3. For **Email & password**, fill the form. The cards Email & password, Username & password and Phone also have the optional blocks **Personal Information**, **Address** and **Marketing** (Language, Time Zone, **Subscribed to News**).

   | Field                                                                  | Required | What it does                                                                                         | Example                    |
   | ---------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------- | -------------------------- |
   | Email address                                                          | yes      | The sign-in name and the primary email of the user.                                                  | `ada.lovelace@example.com` |
   | Password \*                                                            | yes      | Must meet the [password rules](/codemash/cloud/membership/settings/onboarding.md#password-settings). | `Analytic4l!Engine`        |
   | Display Name                                                           | no       | The name in the users list.                                                                          | `Ada Lovelace`             |
   | First Name, Last Name, Full Name                                       | no       | Profile fields.                                                                                      | `Ada`, `Lovelace`          |
   | Birth Date, Gender, Email, Phone                                       | no       | Profile fields.                                                                                      | —                          |
   | Country, Address, Address 2, City, State / Province, ZIP / Postal code | no       | The address.                                                                                         | —                          |
   | Language, Time Zone                                                    | no       | Used to send notifications in the right language and at the right time.                              | —                          |

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-62b95ffbbfc88d1331bfc503060571a14ab87027%2Fusers-new-2.png?alt=media" alt="Email &#x26; password form filled: Email address ada.lovelace@example.com, a hidden password, Display Name Ada Lovelace, First Name Ada, Last Name Lovelace"><figcaption><p>The Email &#x26; password form, filled in.</p></figcaption></figure>
4. Under **Roles**, tick the roles the user gets. **Managed only** hides the system roles.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-31d22538c677ba09bae043664bf49c45ac9e205d%2Fusers-new-3.png?alt=media" alt="Bottom of the form: Marketing block with Language and Subscribed to News, the Roles picker with Managed only ticked, content-editor ticked and support-agent not ticked, Cancel and Save"><figcaption><p>The Roles picker with <strong>content-editor</strong> ticked.</p></figcaption></figure>
5. Press **Save**.

The other cards, filled in:

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-50d9c6d41d4677b08c17e305f3f731f230f81735%2Fusers-new-5.png?alt=media" alt="Username &#x26; password card picked: Username ghopper, a hidden password, Display Name Grace Hopper"><figcaption><p><strong>Username &#x26; password</strong>.</p></figcaption></figure>

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-6da8ccf90ea88bc027e3b2a1b702ad34e9a3df97%2Fusers-new-6.png?alt=media" alt="Phone card picked: Phone Number +37060000002, Display Name Alan Turing"><figcaption><p><strong>Phone</strong>.</p></figcaption></figure>

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-3bfbe048f1fefa54fff252c657e69338346a9ee7%2Fusers-new-7.png?alt=media" alt="Invite card picked: Email address katherine.johnson@example.com"><figcaption><p><strong>Invite</strong>.</p></figcaption></figure>

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-5bd312a993265242375aaaabbb59161e98fced98%2Fusers-new-8.png?alt=media" alt="User as a service card picked: Display Name Reporting bot and the button Regenerate API Key"><figcaption><p><strong>User as a service</strong>.</p></figcaption></figure>

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-55ff218bc59b951f7d6f1901614504b9b78d0b6b%2Fusers-new-9.png?alt=media" alt="Passkey card picked: the Passkey sign-up panel says passkey users sign up themselves, passkey sign-in is enabled for this project, with the button Passkey settings and the link Integration guide"><figcaption><p><strong>Passkey</strong> — no form, only a pointer to the passkey settings.</p></figcaption></figure>

{% hint style="warning" %}
**Invite** does not create a user and does not send the invitation email in this version. **Save** fires the **When invited** [trigger](/codemash/cloud/membership/triggers.md) and the `membership.user.invited` webhook; the screen stays open. To send an invitation email today, add a **When invited** trigger with a **Send Email** action.
{% endhint %}

{% hint style="warning" %}
**Regenerate API Key ...** on the **User as a service** card opens a dialog, but **Submit** gives no key: the button is not connected yet. To get a key for SDK, CLI or REST calls, see [Keys and environments](/codemash/get-started/keys-and-environments.md).
{% endhint %}

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-dac06042816c0eb3c79276a67b3b7e162c0a5781%2Fusers-new-10.png?alt=media" alt="Dialog Regenerate API Key: Please note that regenerating the API key will invalidate the old key, Cancel and Submit"><figcaption><p>The <strong>Regenerate API Key</strong> dialog. It gives no key today.</p></figcaption></figure>

## Result

Cloud goes back to **Users** and the new person is in the list with lifecycle `Active`. The login gets an id like `usr_54bPhijPmABCWtGf30TeZ1`, the user an id like `ct_3iNjU3O7kLPq9Pi8fCKHDn`. A **When registered** trigger runs — see [Create a trigger](/codemash/cloud/membership/triggers/new.md).

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-7b2f637dc95bdb5ea09bd345450d639a431848aa%2Fusers-new-4.png?alt=media" alt="Users list after save with Reporting bot, Ada Lovelace, ghopper and Alan Turing"><figcaption><p>The new user in the list.</p></figcaption></figure>

Things to know today:

* **Roles** picked here are stored on the login. The user's **Roles** tab does not show them — check the login with the API, or set the roles again on the [user](/codemash/cloud/membership/users/edit.md).
* On **Username & password**, the **Display Name** you type lands in **First Name**; the list shows the username (here `ghopper`). Set the display name on the [user](/codemash/cloud/membership/users/edit.md).
* On **Phone**, the phone number is the login, but the user's **Primary Phone** stays empty.

## Change or remove it later

* **Edit** — [Edit a user](/codemash/cloud/membership/users/edit.md): profile, roles, marketing preferences, logins.
* **Delete** — [Delete a user](/codemash/cloud/membership/users/delete.md).

## Do it from code

```ts
const { id } = await norbix.api.membership.saveEmailUserNameWithPermissions({
  email: 'dorothy.v@example.com',
  password: 'Centaur!Rocket55',
  userGeneralInfo: { displayName: 'Dorothy Vaughan', firstName: 'Dorothy', lastName: 'Vaughan' },
  roles: ['support-agent'],
});
console.log(id); // usr_… (the login); the user (ct_…) is created with it
```

```sh
norbix api membership email user name with permissions save --email katherine.g@example.com --password 'Orbit!Math1962' --userGeneralInfo:json '{"displayName":"Katherine G."}'
```

Other cards have their own calls: `saveUserNameWithPermissions`, `savePhoneUserNameWithPermissions`, `saveSystemUserWithPermissions` and `inviteUser`. The client setup is on the [Membership page](/codemash/cloud/membership.md#use-it-from-code). API: [Save Email User Name With Permissions](/codemash/api-reference/membership/users/save-email-user-name-with-permissions.md) · [Invite User](/codemash/api-reference/membership/users/invite-user.md)
