# Users

## List Organization Users

`client.organizations.users.listMembers(stringorganizationID, RequestOptionsoptions?): UserListMembersResponse`

**get** `/api/v1/organizations/{organization_id}/users`

Get all users in an organization.

### Parameters

- `organizationID: string`

### Returns

- `UserListMembersResponse = Array<OrganizationMember>`

  - `id: string`

    Unique identifier

  - `organization_id: string`

    The organization's ID.

  - `roles: Array<UserOrganizationRole>`

    The roles of the user in the organization.

    - `id: string`

      Unique identifier

    - `organization_id: string`

      The organization's ID.

    - `role: Role`

      The role.

      - `id: string`

        Unique identifier

      - `name: string`

        A name for the role.

      - `permissions: Array<Permission>`

        The actual permissions of the role.

        - `id: string`

          Unique identifier

        - `access: boolean`

          Whether the permission is granted or not.

        - `description: string | null`

          A description for the permission.

        - `name: string`

          A name for the permission.

        - `created_at?: string | null`

          Creation datetime

        - `updated_at?: string | null`

          Update datetime

      - `created_at?: string | null`

        Creation datetime

      - `updated_at?: string | null`

        Update datetime

    - `user_id: string`

      The user's ID.

    - `created_at?: string | null`

      Creation datetime

    - `project_ids?: Array<string> | null`

      The project ID scope.

    - `updated_at?: string | null`

      Update datetime

  - `created_at?: string | null`

    Creation datetime

  - `email?: string | null`

    The user's email address.

  - `invited_by_user_email?: string | null`

    The email address of the user who added the user to the organization.

  - `invited_by_user_id?: string | null`

    The user ID of the user who added the user to the organization.

  - `pending?: boolean`

    Whether the user's membership is pending account signup.

  - `updated_at?: string | null`

    Update datetime

  - `user_id?: string | null`

    The user's ID.

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const organizationMembers = await client.organizations.users.listMembers(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);

console.log(organizationMembers);
```

#### Response

```json
[
  {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "roles": [
      {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "role": {
          "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
          "name": "x",
          "permissions": [
            {
              "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
              "access": true,
              "description": "description",
              "name": "x",
              "created_at": "2019-12-27T18:11:19.117Z",
              "updated_at": "2019-12-27T18:11:19.117Z"
            }
          ],
          "created_at": "2019-12-27T18:11:19.117Z",
          "updated_at": "2019-12-27T18:11:19.117Z"
        },
        "user_id": "user_id",
        "created_at": "2019-12-27T18:11:19.117Z",
        "project_ids": [
          "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
        ],
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "email": "dev@stainless.com",
    "invited_by_user_email": "dev@stainless.com",
    "invited_by_user_id": "invited_by_user_id",
    "pending": true,
    "updated_at": "2019-12-27T18:11:19.117Z",
    "user_id": "user_id"
  }
]
```

## Add Users To Organization

`client.organizations.users.add(stringorganizationID, UserAddParamsparams, RequestOptionsoptions?): UserAddResponse`

**put** `/api/v1/organizations/{organization_id}/users`

Add a user to an organization.

### Parameters

- `organizationID: string`

- `params: UserAddParams`

  - `body: Array<Body>`

    - `project_ids: Array<string> | null`

      The project IDs to add the user to.

    - `email?: string | null`

      The user's email address.

    - `role_id?: string | null`

      The role ID to assign to the user.

    - `user_id?: string | null`

      The user's ID.

### Returns

- `UserAddResponse = Array<OrganizationMember>`

  - `id: string`

    Unique identifier

  - `organization_id: string`

    The organization's ID.

  - `roles: Array<UserOrganizationRole>`

    The roles of the user in the organization.

    - `id: string`

      Unique identifier

    - `organization_id: string`

      The organization's ID.

    - `role: Role`

      The role.

      - `id: string`

        Unique identifier

      - `name: string`

        A name for the role.

      - `permissions: Array<Permission>`

        The actual permissions of the role.

        - `id: string`

          Unique identifier

        - `access: boolean`

          Whether the permission is granted or not.

        - `description: string | null`

          A description for the permission.

        - `name: string`

          A name for the permission.

        - `created_at?: string | null`

          Creation datetime

        - `updated_at?: string | null`

          Update datetime

      - `created_at?: string | null`

        Creation datetime

      - `updated_at?: string | null`

        Update datetime

    - `user_id: string`

      The user's ID.

    - `created_at?: string | null`

      Creation datetime

    - `project_ids?: Array<string> | null`

      The project ID scope.

    - `updated_at?: string | null`

      Update datetime

  - `created_at?: string | null`

    Creation datetime

  - `email?: string | null`

    The user's email address.

  - `invited_by_user_email?: string | null`

    The email address of the user who added the user to the organization.

  - `invited_by_user_id?: string | null`

    The user ID of the user who added the user to the organization.

  - `pending?: boolean`

    Whether the user's membership is pending account signup.

  - `updated_at?: string | null`

    Update datetime

  - `user_id?: string | null`

    The user's ID.

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const organizationMembers = await client.organizations.users.add(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  { body: [{ project_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'] }] },
);

console.log(organizationMembers);
```

#### Response

```json
[
  {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "roles": [
      {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "role": {
          "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
          "name": "x",
          "permissions": [
            {
              "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
              "access": true,
              "description": "description",
              "name": "x",
              "created_at": "2019-12-27T18:11:19.117Z",
              "updated_at": "2019-12-27T18:11:19.117Z"
            }
          ],
          "created_at": "2019-12-27T18:11:19.117Z",
          "updated_at": "2019-12-27T18:11:19.117Z"
        },
        "user_id": "user_id",
        "created_at": "2019-12-27T18:11:19.117Z",
        "project_ids": [
          "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
        ],
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "email": "dev@stainless.com",
    "invited_by_user_email": "dev@stainless.com",
    "invited_by_user_id": "invited_by_user_id",
    "pending": true,
    "updated_at": "2019-12-27T18:11:19.117Z",
    "user_id": "user_id"
  }
]
```

## Remove Users From Organization

`client.organizations.users.delete(stringmemberUserID, UserDeleteParamsparams, RequestOptionsoptions?): void`

**delete** `/api/v1/organizations/{organization_id}/users/{member_user_id}`

Remove users from an organization.

### Parameters

- `memberUserID: string`

- `params: UserDeleteParams`

  - `organization_id: string`

    Path param

  - `body?: Array<string> | null`

    Body param

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

await client.organizations.users.delete('member_user_id', {
  organization_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
});
```

## Assign Role To User In Organization

`client.organizations.users.assignRole(stringorganizationID, UserAssignRoleParamsbody, RequestOptionsoptions?): UserOrganizationRole`

**put** `/api/v1/organizations/{organization_id}/users/roles`

Assign a role to a user in an organization.

### Parameters

- `organizationID: string`

- `body: UserAssignRoleParams`

  - `organization_id: string`

    The organization's ID.

  - `role_id: string`

    The role's ID.

  - `user_id: string`

    The user's ID.

### Returns

- `UserOrganizationRole`

  Schema for a user's role in an organization.

  - `id: string`

    Unique identifier

  - `organization_id: string`

    The organization's ID.

  - `role: Role`

    The role.

    - `id: string`

      Unique identifier

    - `name: string`

      A name for the role.

    - `permissions: Array<Permission>`

      The actual permissions of the role.

      - `id: string`

        Unique identifier

      - `access: boolean`

        Whether the permission is granted or not.

      - `description: string | null`

        A description for the permission.

      - `name: string`

        A name for the permission.

      - `created_at?: string | null`

        Creation datetime

      - `updated_at?: string | null`

        Update datetime

    - `created_at?: string | null`

      Creation datetime

    - `updated_at?: string | null`

      Update datetime

  - `user_id: string`

    The user's ID.

  - `created_at?: string | null`

    Creation datetime

  - `project_ids?: Array<string> | null`

    The project ID scope.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const userOrganizationRole = await client.organizations.users.assignRole(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  {
    organization_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
    role_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
    user_id: 'user_id',
  },
);

console.log(userOrganizationRole.id);
```

#### Response

```json
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "role": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "name": "x",
    "permissions": [
      {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "access": true,
        "description": "description",
        "name": "x",
        "created_at": "2019-12-27T18:11:19.117Z",
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "updated_at": "2019-12-27T18:11:19.117Z"
  },
  "user_id": "user_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "project_ids": [
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  ],
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## List Projects By User

`client.organizations.users.listProjects(stringuserID, UserListProjectsParamsparams, RequestOptionsoptions?): UserListProjectsResponse`

**get** `/api/v1/organizations/{organization_id}/users/{user_id}/projects`

List all projects for a user in an organization.

### Parameters

- `userID: string`

- `params: UserListProjectsParams`

  - `organization_id: string`

### Returns

- `UserListProjectsResponse = Array<UserListProjectsResponseItem>`

  - `id: string`

    Unique identifier

  - `name: string`

  - `organization_id: string`

    The Organization ID the project is under.

  - `created_at?: string | null`

    Creation datetime

  - `is_default?: boolean`

    Whether this project is the default project for the user.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.organizations.users.listProjects('user_id', {
  organization_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
});

console.log(response);
```

#### Response

```json
[
  {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "name": "x",
    "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "created_at": "2019-12-27T18:11:19.117Z",
    "is_default": true,
    "updated_at": "2019-12-27T18:11:19.117Z"
  }
]
```

## Add User To Project

`client.organizations.users.addToProject(stringuserID, UserAddToProjectParamsparams, RequestOptionsoptions?): UserAddToProjectResponse`

**put** `/api/v1/organizations/{organization_id}/users/{user_id}/projects`

Add a user to a project.

### Parameters

- `userID: string`

- `params: UserAddToProjectParams`

  - `organization_id: string`

    Path param

  - `project_id?: string | null`

    Query param

### Returns

- `UserAddToProjectResponse = unknown`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.organizations.users.addToProject('user_id', {
  organization_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
});

console.log(response);
```

#### Response

```json
{}
```

## Remove User From Project

`client.organizations.users.removeFromProject(stringprojectID, UserRemoveFromProjectParamsparams, RequestOptionsoptions?): UserRemoveFromProjectResponse`

**delete** `/api/v1/organizations/{organization_id}/users/{user_id}/projects/{project_id}`

Remove a user from a project.

### Parameters

- `projectID: string`

- `params: UserRemoveFromProjectParams`

  - `organization_id: string`

  - `user_id: string`

### Returns

- `UserRemoveFromProjectResponse = unknown`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.organizations.users.removeFromProject(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  { organization_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', user_id: 'user_id' },
);

console.log(response);
```

#### Response

```json
{}
```

## Domain Types

### User List Members Response

- `UserListMembersResponse = Array<OrganizationMember>`

  - `id: string`

    Unique identifier

  - `organization_id: string`

    The organization's ID.

  - `roles: Array<UserOrganizationRole>`

    The roles of the user in the organization.

    - `id: string`

      Unique identifier

    - `organization_id: string`

      The organization's ID.

    - `role: Role`

      The role.

      - `id: string`

        Unique identifier

      - `name: string`

        A name for the role.

      - `permissions: Array<Permission>`

        The actual permissions of the role.

        - `id: string`

          Unique identifier

        - `access: boolean`

          Whether the permission is granted or not.

        - `description: string | null`

          A description for the permission.

        - `name: string`

          A name for the permission.

        - `created_at?: string | null`

          Creation datetime

        - `updated_at?: string | null`

          Update datetime

      - `created_at?: string | null`

        Creation datetime

      - `updated_at?: string | null`

        Update datetime

    - `user_id: string`

      The user's ID.

    - `created_at?: string | null`

      Creation datetime

    - `project_ids?: Array<string> | null`

      The project ID scope.

    - `updated_at?: string | null`

      Update datetime

  - `created_at?: string | null`

    Creation datetime

  - `email?: string | null`

    The user's email address.

  - `invited_by_user_email?: string | null`

    The email address of the user who added the user to the organization.

  - `invited_by_user_id?: string | null`

    The user ID of the user who added the user to the organization.

  - `pending?: boolean`

    Whether the user's membership is pending account signup.

  - `updated_at?: string | null`

    Update datetime

  - `user_id?: string | null`

    The user's ID.

### User Add Response

- `UserAddResponse = Array<OrganizationMember>`

  - `id: string`

    Unique identifier

  - `organization_id: string`

    The organization's ID.

  - `roles: Array<UserOrganizationRole>`

    The roles of the user in the organization.

    - `id: string`

      Unique identifier

    - `organization_id: string`

      The organization's ID.

    - `role: Role`

      The role.

      - `id: string`

        Unique identifier

      - `name: string`

        A name for the role.

      - `permissions: Array<Permission>`

        The actual permissions of the role.

        - `id: string`

          Unique identifier

        - `access: boolean`

          Whether the permission is granted or not.

        - `description: string | null`

          A description for the permission.

        - `name: string`

          A name for the permission.

        - `created_at?: string | null`

          Creation datetime

        - `updated_at?: string | null`

          Update datetime

      - `created_at?: string | null`

        Creation datetime

      - `updated_at?: string | null`

        Update datetime

    - `user_id: string`

      The user's ID.

    - `created_at?: string | null`

      Creation datetime

    - `project_ids?: Array<string> | null`

      The project ID scope.

    - `updated_at?: string | null`

      Update datetime

  - `created_at?: string | null`

    Creation datetime

  - `email?: string | null`

    The user's email address.

  - `invited_by_user_email?: string | null`

    The email address of the user who added the user to the organization.

  - `invited_by_user_id?: string | null`

    The user ID of the user who added the user to the organization.

  - `pending?: boolean`

    Whether the user's membership is pending account signup.

  - `updated_at?: string | null`

    Update datetime

  - `user_id?: string | null`

    The user's ID.

### User List Projects Response

- `UserListProjectsResponse = Array<UserListProjectsResponseItem>`

  - `id: string`

    Unique identifier

  - `name: string`

  - `organization_id: string`

    The Organization ID the project is under.

  - `created_at?: string | null`

    Creation datetime

  - `is_default?: boolean`

    Whether this project is the default project for the user.

  - `updated_at?: string | null`

    Update datetime

### User Add To Project Response

- `UserAddToProjectResponse = unknown`

### User Remove From Project Response

- `UserRemoveFromProjectResponse = unknown`
