Skip to content
Product Docs

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.

ParametersExpand Collapse
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.

formatemail
role_id: Optional[str]

The role ID to assign to the user.

formatuuid
user_id: Optional[str]

The user’s ID.

ReturnsExpand Collapse
id: str

Unique identifier

formatuuid
organization_id: str

The organization’s ID.

formatuuid

The roles of the user in the organization.

id: str

Unique identifier

formatuuid
organization_id: str

The organization’s ID.

formatuuid
role: Role

The role.

id: str

Unique identifier

formatuuid
name: str

A name for the role.

maxLength3000
minLength1
permissions: List[Permission]

The actual permissions of the role.

id: str

Unique identifier

formatuuid
access: bool

Whether the permission is granted or not.

description: Optional[str]

A description for the permission.

name: str

A name for the permission.

maxLength3000
minLength1
created_at: Optional[datetime]

Creation datetime

formatdate-time
updated_at: Optional[datetime]

Update datetime

formatdate-time
created_at: Optional[datetime]

Creation datetime

formatdate-time
updated_at: Optional[datetime]

Update datetime

formatdate-time
user_id: str

The user’s ID.

created_at: Optional[datetime]

Creation datetime

formatdate-time
project_ids: Optional[List[str]]

The project ID scope.

updated_at: Optional[datetime]

Update datetime

formatdate-time
created_at: Optional[datetime]

Creation datetime

formatdate-time
email: Optional[str]

The user’s email address.

formatemail
Deprecatedinvited_by_user_email: Optional[str]

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

formatemail
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

formatdate-time
user_id: Optional[str]

The user’s ID.

Add Users To Organization

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)
[
  {
    "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"
  }
]
Returns Examples
[
  {
    "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"
  }
]