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

# Invite users to a project

> Add users to a project with the Node.js SDK.

`client.projects().inviteMembers()` adds users to a project with the roles that you choose.

## Parameters

**options** `InviteMemberToProjectOptions` *required*

**properties**

**projectId** `string` *required*

The ID of the project.

**emails** `string[]`

The email addresses of the users to invite. Set `emails`, `usernames`, or both, or the method throws an error.

**usernames** `string[]`

The usernames of the users to invite.

**roleSlugs** `string[]` (default: \["member"])

The slugs of the [roles](https://infisical.com/docs/documentation/platform/access-controls/role-based-access-controls.md#project-level-access-controls) to give the users in the project.

## Returns

**memberships** `Membership[]`

One membership for each invited user, with its `id` and the user's `userId`.

```typescript By email theme={"dark"}
const memberships = await client.projects().inviteMembers({
  projectId: "<project-id>",
  emails: ["dana@example.com"],
});
```

```typescript With roles theme={"dark"}
const memberships = await client.projects().inviteMembers({
  projectId: "<project-id>",
  usernames: ["dana"],
  roleSlugs: ["viewer"],
});
```

```json Response theme={"dark"}
[
  {
    "id": "7f6e5d4c-3b2a-4f1e-9d8c-7b6a5f4e3d2c",
    "userId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
    "projectId": "5e8d7c6b-4a3f-4e2d-9c1b-0a9f8e7d6c5b",
    "createdAt": "2026-12-02T10:44:31.067Z",
    "updatedAt": "2026-12-02T10:44:31.067Z"
  }
]
```


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