# Users

## List Organization Users

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

Get all users in an organization.

### Path Parameters

- `organization_id: string`

### Cookie Parameters

- `session: optional string`

### Returns

- `id: string`

  Unique identifier

- `organization_id: string`

  The organization's ID.

- `roles: array of 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 of object { id, access, description, 3 more }`

      The actual permissions of the role.

      - `id: string`

        Unique identifier

      - `access: boolean`

        Whether the permission is granted or not.

      - `description: string`

        A description for the permission.

      - `name: string`

        A name for the permission.

      - `created_at: optional string`

        Creation datetime

      - `updated_at: optional string`

        Update datetime

    - `created_at: optional string`

      Creation datetime

    - `updated_at: optional string`

      Update datetime

  - `user_id: string`

    The user's ID.

  - `created_at: optional string`

    Creation datetime

  - `project_ids: optional array of string`

    The project ID scope.

  - `updated_at: optional string`

    Update datetime

- `created_at: optional string`

  Creation datetime

- `email: optional string`

  The user's email address.

- `invited_by_user_email: optional string`

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

- `invited_by_user_id: optional string`

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

- `pending: optional boolean`

  Whether the user's membership is pending account signup.

- `updated_at: optional string`

  Update datetime

- `user_id: optional string`

  The user's ID.

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/organizations/$ORGANIZATION_ID/users \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

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

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

Add a user to an organization.

### Path Parameters

- `organization_id: string`

### Cookie Parameters

- `session: optional string`

### Body Parameters

- `body: array of object { project_ids, email, role_id, user_id }`

  - `project_ids: array of string`

    The project IDs to add the user to.

  - `email: optional string`

    The user's email address.

  - `role_id: optional string`

    The role ID to assign to the user.

  - `user_id: optional string`

    The user's ID.

### Returns

- `id: string`

  Unique identifier

- `organization_id: string`

  The organization's ID.

- `roles: array of 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 of object { id, access, description, 3 more }`

      The actual permissions of the role.

      - `id: string`

        Unique identifier

      - `access: boolean`

        Whether the permission is granted or not.

      - `description: string`

        A description for the permission.

      - `name: string`

        A name for the permission.

      - `created_at: optional string`

        Creation datetime

      - `updated_at: optional string`

        Update datetime

    - `created_at: optional string`

      Creation datetime

    - `updated_at: optional string`

      Update datetime

  - `user_id: string`

    The user's ID.

  - `created_at: optional string`

    Creation datetime

  - `project_ids: optional array of string`

    The project ID scope.

  - `updated_at: optional string`

    Update datetime

- `created_at: optional string`

  Creation datetime

- `email: optional string`

  The user's email address.

- `invited_by_user_email: optional string`

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

- `invited_by_user_id: optional string`

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

- `pending: optional boolean`

  Whether the user's membership is pending account signup.

- `updated_at: optional string`

  Update datetime

- `user_id: optional string`

  The user's ID.

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/organizations/$ORGANIZATION_ID/users \
    -X PUT \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
    -d '[
          {
            "project_ids": [
              "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
            ],
            "email": "dev@stainless.com",
            "role_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            "user_id": "user_id"
          }
        ]'
```

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

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

Remove users from an organization.

### Path Parameters

- `organization_id: string`

- `member_user_id: string`

### Cookie Parameters

- `session: optional string`

### Body Parameters

- `body: optional array of string`

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/organizations/$ORGANIZATION_ID/users/$MEMBER_USER_ID \
    -X DELETE \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

## Assign Role To User In Organization

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

Assign a role to a user in an organization.

### Path Parameters

- `organization_id: string`

### Cookie Parameters

- `session: optional string`

### Body Parameters

- `organization_id: string`

  The organization's ID.

- `role_id: string`

  The role's ID.

- `user_id: string`

  The user's ID.

### Returns

- `UserOrganizationRole object { id, organization_id, role, 4 more }`

  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 of object { id, access, description, 3 more }`

      The actual permissions of the role.

      - `id: string`

        Unique identifier

      - `access: boolean`

        Whether the permission is granted or not.

      - `description: string`

        A description for the permission.

      - `name: string`

        A name for the permission.

      - `created_at: optional string`

        Creation datetime

      - `updated_at: optional string`

        Update datetime

    - `created_at: optional string`

      Creation datetime

    - `updated_at: optional string`

      Update datetime

  - `user_id: string`

    The user's ID.

  - `created_at: optional string`

    Creation datetime

  - `project_ids: optional array of string`

    The project ID scope.

  - `updated_at: optional string`

    Update datetime

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/organizations/$ORGANIZATION_ID/users/roles \
    -X PUT \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
    -d '{
          "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
          "role_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
          "user_id": "user_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

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

List all projects for a user in an organization.

### Path Parameters

- `organization_id: string`

- `user_id: string`

### Cookie Parameters

- `session: optional string`

### Returns

- `id: string`

  Unique identifier

- `name: string`

- `organization_id: string`

  The Organization ID the project is under.

- `created_at: optional string`

  Creation datetime

- `is_default: optional boolean`

  Whether this project is the default project for the user.

- `updated_at: optional string`

  Update datetime

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/organizations/$ORGANIZATION_ID/users/$USER_ID/projects \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

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

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

Add a user to a project.

### Path Parameters

- `organization_id: string`

- `user_id: string`

### Query Parameters

- `project_id: optional string`

### Cookie Parameters

- `session: optional string`

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/organizations/$ORGANIZATION_ID/users/$USER_ID/projects \
    -X PUT \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

#### Response

```json
{}
```

## Remove User From Project

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

Remove a user from a project.

### Path Parameters

- `organization_id: string`

- `user_id: string`

- `project_id: string`

### Cookie Parameters

- `session: optional string`

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/organizations/$ORGANIZATION_ID/users/$USER_ID/projects/$PROJECT_ID \
    -X DELETE \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

#### Response

```json
{}
```

## Domain Types

### User List Members Response

- `UserListMembersResponse = array of OrganizationMember`

  - `id: string`

    Unique identifier

  - `organization_id: string`

    The organization's ID.

  - `roles: array of 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 of object { id, access, description, 3 more }`

        The actual permissions of the role.

        - `id: string`

          Unique identifier

        - `access: boolean`

          Whether the permission is granted or not.

        - `description: string`

          A description for the permission.

        - `name: string`

          A name for the permission.

        - `created_at: optional string`

          Creation datetime

        - `updated_at: optional string`

          Update datetime

      - `created_at: optional string`

        Creation datetime

      - `updated_at: optional string`

        Update datetime

    - `user_id: string`

      The user's ID.

    - `created_at: optional string`

      Creation datetime

    - `project_ids: optional array of string`

      The project ID scope.

    - `updated_at: optional string`

      Update datetime

  - `created_at: optional string`

    Creation datetime

  - `email: optional string`

    The user's email address.

  - `invited_by_user_email: optional string`

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

  - `invited_by_user_id: optional string`

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

  - `pending: optional boolean`

    Whether the user's membership is pending account signup.

  - `updated_at: optional string`

    Update datetime

  - `user_id: optional string`

    The user's ID.

### User Add Response

- `UserAddResponse = array of OrganizationMember`

  - `id: string`

    Unique identifier

  - `organization_id: string`

    The organization's ID.

  - `roles: array of 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 of object { id, access, description, 3 more }`

        The actual permissions of the role.

        - `id: string`

          Unique identifier

        - `access: boolean`

          Whether the permission is granted or not.

        - `description: string`

          A description for the permission.

        - `name: string`

          A name for the permission.

        - `created_at: optional string`

          Creation datetime

        - `updated_at: optional string`

          Update datetime

      - `created_at: optional string`

        Creation datetime

      - `updated_at: optional string`

        Update datetime

    - `user_id: string`

      The user's ID.

    - `created_at: optional string`

      Creation datetime

    - `project_ids: optional array of string`

      The project ID scope.

    - `updated_at: optional string`

      Update datetime

  - `created_at: optional string`

    Creation datetime

  - `email: optional string`

    The user's email address.

  - `invited_by_user_email: optional string`

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

  - `invited_by_user_id: optional string`

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

  - `pending: optional boolean`

    Whether the user's membership is pending account signup.

  - `updated_at: optional string`

    Update datetime

  - `user_id: optional string`

    The user's ID.

### User List Projects Response

- `UserListProjectsResponse = array of object { id, name, organization_id, 3 more }`

  - `id: string`

    Unique identifier

  - `name: string`

  - `organization_id: string`

    The Organization ID the project is under.

  - `created_at: optional string`

    Creation datetime

  - `is_default: optional boolean`

    Whether this project is the default project for the user.

  - `updated_at: optional string`

    Update datetime

### User Add To Project Response

- `UserAddToProjectResponse = unknown`

### User Remove From Project Response

- `UserRemoveFromProjectResponse = unknown`
