# Users

## List Organization Users

`organizations.users.list_members(strorganization_id)  -> UserListMembersResponse`

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

Get all users in an organization.

### Parameters

- `organization_id: str`

### Returns

- `List[OrganizationMember]`

  - `id: str`

    Unique identifier

  - `organization_id: str`

    The organization's ID.

  - `roles: List[UserOrganizationRole]`

    The roles of the user in the organization.

    - `id: str`

      Unique identifier

    - `organization_id: str`

      The organization's ID.

    - `role: Role`

      The role.

      - `id: str`

        Unique identifier

      - `name: str`

        A name for the role.

      - `permissions: List[Permission]`

        The actual permissions of the role.

        - `id: str`

          Unique identifier

        - `access: bool`

          Whether the permission is granted or not.

        - `description: Optional[str]`

          A description for the permission.

        - `name: str`

          A name for the permission.

        - `created_at: Optional[datetime]`

          Creation datetime

        - `updated_at: Optional[datetime]`

          Update datetime

      - `created_at: Optional[datetime]`

        Creation datetime

      - `updated_at: Optional[datetime]`

        Update datetime

    - `user_id: str`

      The user's ID.

    - `created_at: Optional[datetime]`

      Creation datetime

    - `project_ids: Optional[List[str]]`

      The project ID scope.

    - `updated_at: Optional[datetime]`

      Update datetime

  - `created_at: Optional[datetime]`

    Creation datetime

  - `email: Optional[str]`

    The user's email address.

  - `invited_by_user_email: Optional[str]`

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

  - `invited_by_user_id: Optional[str]`

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

  - `pending: Optional[bool]`

    Whether the user's membership is pending account signup.

  - `updated_at: Optional[datetime]`

    Update datetime

  - `user_id: Optional[str]`

    The user's ID.

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
organization_members = client.organizations.users.list_members(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(organization_members)
```

#### 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

`organizations.users.add(strorganization_id, UserAddParams**kwargs)  -> UserAddResponse`

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

Add a user to an organization.

### Parameters

- `organization_id: str`

- `body: Iterable[Body]`

  - `project_ids: Optional[Sequence[str]]`

    The project IDs to add the user to.

  - `email: Optional[str]`

    The user's email address.

  - `role_id: Optional[str]`

    The role ID to assign to the user.

  - `user_id: Optional[str]`

    The user's ID.

### Returns

- `List[OrganizationMember]`

  - `id: str`

    Unique identifier

  - `organization_id: str`

    The organization's ID.

  - `roles: List[UserOrganizationRole]`

    The roles of the user in the organization.

    - `id: str`

      Unique identifier

    - `organization_id: str`

      The organization's ID.

    - `role: Role`

      The role.

      - `id: str`

        Unique identifier

      - `name: str`

        A name for the role.

      - `permissions: List[Permission]`

        The actual permissions of the role.

        - `id: str`

          Unique identifier

        - `access: bool`

          Whether the permission is granted or not.

        - `description: Optional[str]`

          A description for the permission.

        - `name: str`

          A name for the permission.

        - `created_at: Optional[datetime]`

          Creation datetime

        - `updated_at: Optional[datetime]`

          Update datetime

      - `created_at: Optional[datetime]`

        Creation datetime

      - `updated_at: Optional[datetime]`

        Update datetime

    - `user_id: str`

      The user's ID.

    - `created_at: Optional[datetime]`

      Creation datetime

    - `project_ids: Optional[List[str]]`

      The project ID scope.

    - `updated_at: Optional[datetime]`

      Update datetime

  - `created_at: Optional[datetime]`

    Creation datetime

  - `email: Optional[str]`

    The user's email address.

  - `invited_by_user_email: Optional[str]`

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

  - `invited_by_user_id: Optional[str]`

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

  - `pending: Optional[bool]`

    Whether the user's membership is pending account signup.

  - `updated_at: Optional[datetime]`

    Update datetime

  - `user_id: Optional[str]`

    The user's ID.

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
organization_members = client.organizations.users.add(
    organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    body=[{
        "project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"]
    }],
)
print(organization_members)
```

#### 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

`organizations.users.delete(strmember_user_id, UserDeleteParams**kwargs)`

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

Remove users from an organization.

### Parameters

- `organization_id: str`

- `member_user_id: str`

- `body: Optional[Sequence[str]]`

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
client.organizations.users.delete(
    member_user_id="member_user_id",
    organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
```

## Assign Role To User In Organization

`organizations.users.assign_role(strpath_organization_id, UserAssignRoleParams**kwargs)  -> UserOrganizationRole`

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

Assign a role to a user in an organization.

### Parameters

- `organization_id: str`

- `organization_id: str`

- `role_id: str`

  The role's ID.

- `user_id: str`

  The user's ID.

### Returns

- `class UserOrganizationRole: …`

  Schema for a user's role in an organization.

  - `id: str`

    Unique identifier

  - `organization_id: str`

    The organization's ID.

  - `role: Role`

    The role.

    - `id: str`

      Unique identifier

    - `name: str`

      A name for the role.

    - `permissions: List[Permission]`

      The actual permissions of the role.

      - `id: str`

        Unique identifier

      - `access: bool`

        Whether the permission is granted or not.

      - `description: Optional[str]`

        A description for the permission.

      - `name: str`

        A name for the permission.

      - `created_at: Optional[datetime]`

        Creation datetime

      - `updated_at: Optional[datetime]`

        Update datetime

    - `created_at: Optional[datetime]`

      Creation datetime

    - `updated_at: Optional[datetime]`

      Update datetime

  - `user_id: str`

    The user's ID.

  - `created_at: Optional[datetime]`

    Creation datetime

  - `project_ids: Optional[List[str]]`

    The project ID scope.

  - `updated_at: Optional[datetime]`

    Update datetime

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
user_organization_role = client.organizations.users.assign_role(
    path_organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    body_organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    role_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    user_id="user_id",
)
print(user_organization_role.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

`organizations.users.list_projects(struser_id, UserListProjectsParams**kwargs)  -> UserListProjectsResponse`

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

List all projects for a user in an organization.

### Parameters

- `organization_id: str`

- `user_id: str`

### Returns

- `List[UserListProjectsResponseItem]`

  - `id: str`

    Unique identifier

  - `name: str`

  - `organization_id: str`

    The Organization ID the project is under.

  - `created_at: Optional[datetime]`

    Creation datetime

  - `is_default: Optional[bool]`

    Whether this project is the default project for the user.

  - `updated_at: Optional[datetime]`

    Update datetime

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.organizations.users.list_projects(
    user_id="user_id",
    organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(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

`organizations.users.add_to_project(struser_id, UserAddToProjectParams**kwargs)  -> object`

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

Add a user to a project.

### Parameters

- `organization_id: str`

- `user_id: str`

- `project_id: Optional[str]`

### Returns

- `object`

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.organizations.users.add_to_project(
    user_id="user_id",
    organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response)
```

#### Response

```json
{}
```

## Remove User From Project

`organizations.users.remove_from_project(strproject_id, UserRemoveFromProjectParams**kwargs)  -> object`

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

Remove a user from a project.

### Parameters

- `organization_id: str`

- `user_id: str`

- `project_id: str`

### Returns

- `object`

### Example

```python
import os
from llama_cloud_admin import LlamaCloudAdmin

client = LlamaCloudAdmin(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
response = client.organizations.users.remove_from_project(
    project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    user_id="user_id",
)
print(response)
```

#### Response

```json
{}
```

## Domain Types

### User List Members Response

- `List[OrganizationMember]`

  - `id: str`

    Unique identifier

  - `organization_id: str`

    The organization's ID.

  - `roles: List[UserOrganizationRole]`

    The roles of the user in the organization.

    - `id: str`

      Unique identifier

    - `organization_id: str`

      The organization's ID.

    - `role: Role`

      The role.

      - `id: str`

        Unique identifier

      - `name: str`

        A name for the role.

      - `permissions: List[Permission]`

        The actual permissions of the role.

        - `id: str`

          Unique identifier

        - `access: bool`

          Whether the permission is granted or not.

        - `description: Optional[str]`

          A description for the permission.

        - `name: str`

          A name for the permission.

        - `created_at: Optional[datetime]`

          Creation datetime

        - `updated_at: Optional[datetime]`

          Update datetime

      - `created_at: Optional[datetime]`

        Creation datetime

      - `updated_at: Optional[datetime]`

        Update datetime

    - `user_id: str`

      The user's ID.

    - `created_at: Optional[datetime]`

      Creation datetime

    - `project_ids: Optional[List[str]]`

      The project ID scope.

    - `updated_at: Optional[datetime]`

      Update datetime

  - `created_at: Optional[datetime]`

    Creation datetime

  - `email: Optional[str]`

    The user's email address.

  - `invited_by_user_email: Optional[str]`

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

  - `invited_by_user_id: Optional[str]`

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

  - `pending: Optional[bool]`

    Whether the user's membership is pending account signup.

  - `updated_at: Optional[datetime]`

    Update datetime

  - `user_id: Optional[str]`

    The user's ID.

### User Add Response

- `List[OrganizationMember]`

  - `id: str`

    Unique identifier

  - `organization_id: str`

    The organization's ID.

  - `roles: List[UserOrganizationRole]`

    The roles of the user in the organization.

    - `id: str`

      Unique identifier

    - `organization_id: str`

      The organization's ID.

    - `role: Role`

      The role.

      - `id: str`

        Unique identifier

      - `name: str`

        A name for the role.

      - `permissions: List[Permission]`

        The actual permissions of the role.

        - `id: str`

          Unique identifier

        - `access: bool`

          Whether the permission is granted or not.

        - `description: Optional[str]`

          A description for the permission.

        - `name: str`

          A name for the permission.

        - `created_at: Optional[datetime]`

          Creation datetime

        - `updated_at: Optional[datetime]`

          Update datetime

      - `created_at: Optional[datetime]`

        Creation datetime

      - `updated_at: Optional[datetime]`

        Update datetime

    - `user_id: str`

      The user's ID.

    - `created_at: Optional[datetime]`

      Creation datetime

    - `project_ids: Optional[List[str]]`

      The project ID scope.

    - `updated_at: Optional[datetime]`

      Update datetime

  - `created_at: Optional[datetime]`

    Creation datetime

  - `email: Optional[str]`

    The user's email address.

  - `invited_by_user_email: Optional[str]`

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

  - `invited_by_user_id: Optional[str]`

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

  - `pending: Optional[bool]`

    Whether the user's membership is pending account signup.

  - `updated_at: Optional[datetime]`

    Update datetime

  - `user_id: Optional[str]`

    The user's ID.

### User List Projects Response

- `List[UserListProjectsResponseItem]`

  - `id: str`

    Unique identifier

  - `name: str`

  - `organization_id: str`

    The Organization ID the project is under.

  - `created_at: Optional[datetime]`

    Creation datetime

  - `is_default: Optional[bool]`

    Whether this project is the default project for the user.

  - `updated_at: Optional[datetime]`

    Update datetime
