# Organizations

## List Organizations

`organizations.list(OrganizationListParams**kwargs)  -> SyncPaginatedCursor[Organization]`

**get** `/api/v2/organizations`

List organizations the current user can access.

### Parameters

- `name: Optional[str]`

- `page_size: Optional[int]`

- `page_token: Optional[str]`

### Returns

- `class Organization: …`

  API response schema for an organization.

  - `id: str`

    The organization's unique identifier.

  - `name: str`

    The organization's display name.

  - `created_at: Optional[datetime]`

    Creation datetime

  - `metadata: Optional[Dict[str, object]]`

    Additional organization metadata.

  - `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
)
page = client.organizations.list()
page = page.items[0]
print(page.id)
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "name": "name",
      "created_at": "2019-12-27T18:11:19.117Z",
      "metadata": {
        "foo": "bar"
      },
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Create Organization

`organizations.create(OrganizationCreateParams**kwargs)  -> Organization`

**post** `/api/v2/organizations`

Create a new organization.

### Parameters

- `name: str`

  The organization's display name.

### Returns

- `class Organization: …`

  API response schema for an organization.

  - `id: str`

    The organization's unique identifier.

  - `name: str`

    The organization's display name.

  - `created_at: Optional[datetime]`

    Creation datetime

  - `metadata: Optional[Dict[str, object]]`

    Additional organization metadata.

  - `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
)
organization = client.organizations.create(
    name="x",
)
print(organization.id)
```

#### Response

```json
{
  "id": "id",
  "name": "name",
  "created_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Get Organization

`organizations.get(strorganization_id)  -> Organization`

**get** `/api/v2/organizations/{organization_id}`

Get an organization by ID.

### Parameters

- `organization_id: str`

### Returns

- `class Organization: …`

  API response schema for an organization.

  - `id: str`

    The organization's unique identifier.

  - `name: str`

    The organization's display name.

  - `created_at: Optional[datetime]`

    Creation datetime

  - `metadata: Optional[Dict[str, object]]`

    Additional organization metadata.

  - `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
)
organization = client.organizations.get(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(organization.id)
```

#### Response

```json
{
  "id": "id",
  "name": "name",
  "created_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Update Organization

`organizations.update(strorganization_id, OrganizationUpdateParams**kwargs)  -> Organization`

**put** `/api/v2/organizations/{organization_id}`

Update an existing organization.

### Parameters

- `organization_id: str`

- `name: str`

  The organization's new display name.

### Returns

- `class Organization: …`

  API response schema for an organization.

  - `id: str`

    The organization's unique identifier.

  - `name: str`

    The organization's display name.

  - `created_at: Optional[datetime]`

    Creation datetime

  - `metadata: Optional[Dict[str, object]]`

    Additional organization metadata.

  - `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
)
organization = client.organizations.update(
    organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    name="x",
)
print(organization.id)
```

#### Response

```json
{
  "id": "id",
  "name": "name",
  "created_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Organization

`organizations.delete(strorganization_id)`

**delete** `/api/v2/organizations/{organization_id}`

Delete an organization by ID.

### Parameters

- `organization_id: 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.delete(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
```

## Get Organization Usage

`organizations.get_usage(strorganization_id, OrganizationGetUsageParams**kwargs)  -> UsageAndPlan`

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

Get usage for a specific organization.

### Parameters

- `organization_id: str`

- `get_current_invoice_total: Optional[bool]`

### Returns

- `class UsageAndPlan: …`

  - `plan: Plan`

    - `limits: PlanLimits`

      - `allow_pay_as_you_go: bool`

        Whether usage is allowed after credit grants are exhausted

      - `max_concurrent_index_jobs: Optional[int]`

      - `max_concurrent_parse_jobs_other: Optional[int]`

      - `max_concurrent_parse_jobs_premium: Optional[int]`

      - `max_data_sinks: Optional[int]`

      - `max_data_sources: Optional[int]`

      - `max_embedding_models: Optional[int]`

      - `max_extraction_agents: Optional[int]`

      - `max_extraction_jobs: Optional[int]`

      - `max_extraction_runs: Optional[int]`

      - `max_files_per_index: Optional[int]`

      - `max_indexes: Optional[int]`

      - `max_monthly_invoice_total_usd: Optional[int]`

      - `max_organizations: Optional[int]`

      - `max_pages_per_index: Optional[int]`

      - `max_projects: Optional[int]`

      - `max_published_agents: Optional[int]`

      - `max_report_agent_sessions: Optional[int]`

      - `max_users: Optional[int]`

      - `mfa_enabled: bool`

      - `sso_enabled: bool`

      - `subscription_cost_usd: int`

      - `max_directories: Optional[int]`

      - `max_directory_files_per_directory: Optional[int]`

      - `max_directory_ingest_files: Optional[int]`

      - `max_directory_sync_plan_actions: Optional[int]`

      - `spending_soft_alerts_usd_cents: Optional[List[int]]`

        The amount of USD cents at which a soft alert should be triggered

    - `name: Literal["enterprise", "enterprise_contract", "enterprise_poc", 12 more]`

      - `"enterprise"`

      - `"enterprise_contract"`

      - `"enterprise_poc"`

      - `"free"`

      - `"free_contract"`

      - `"free_v1"`

      - `"free_v2"`

      - `"llama_parse"`

      - `"pro"`

      - `"pro_v1"`

      - `"pro_v2"`

      - `"starter_v1"`

      - `"starter_v2"`

      - `"unknown"`

      - `"yc_deal_v1"`

    - `plan_frequency: Literal["ANNUAL", "MONTHLY", "QUARTERLY"]`

      - `"ANNUAL"`

      - `"MONTHLY"`

      - `"QUARTERLY"`

    - `id: Optional[str]`

      The ID of the plan in Metronome

    - `current_billing_period: Optional[PlanCurrentBillingPeriod]`

      The current billing period

      - `end_date: datetime`

      - `start_date: datetime`

    - `ending_before: Optional[datetime]`

      The date the plan ends on

    - `failure_count: Optional[int]`

      The number of payment failures for this organization

    - `is_payment_failed: Optional[bool]`

      Whether the organization has a failed payment that requires support contact

    - `recurring_credits: Optional[List[PlanRecurringCredit]]`

      - `credit_amount: int`

      - `credit_type: PlanRecurringCreditCreditType`

        - `id: str`

        - `name: str`

      - `name: str`

      - `priority: float`

      - `product_id: str`

        The ID of the product in Metronome used to represent the credit grant

      - `rollover_fraction: float`

        The fraction of the credit that will roll over to the next period, between 0 and 1

      - `periods_duration: Optional[float]`

        How many billing periods the credit grant will last for

    - `starting_on: Optional[datetime]`

      The date the plan starts on

  - `usage: Usage`

    Account usage totals shown alongside the plan.

    - `active_alerts: Optional[List[Literal["configured_spend_limit_exceeded", "free_credits_exhausted", "has_spending_alert", 3 more]]]`

      - `"configured_spend_limit_exceeded"`

      - `"free_credits_exhausted"`

      - `"has_spending_alert"`

      - `"internal_spending_alert"`

      - `"plan_spend_limit_exceeded"`

      - `"plan_spend_limit_soft_alert"`

    - `active_free_credits_usage: Optional[List[UsageActiveFreeCreditsUsage]]`

      - `expires_at: datetime`

      - `grant_name: str`

      - `remaining_balance: int`

      - `starting_balance: int`

    - `current_invoice_total_usd_cents: Optional[int]`

    - `total_extraction_agents: Optional[int]`

    - `total_indexed_pages: Optional[int]`

    - `total_indexes: Optional[int]`

    - `total_users: Optional[int]`

### 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
)
usage_and_plan = client.organizations.get_usage(
    organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(usage_and_plan.plan)
```

#### Response

```json
{
  "plan": {
    "limits": {
      "allow_pay_as_you_go": true,
      "max_concurrent_index_jobs": 0,
      "max_concurrent_parse_jobs_other": 0,
      "max_concurrent_parse_jobs_premium": 0,
      "max_data_sinks": 0,
      "max_data_sources": 0,
      "max_embedding_models": 0,
      "max_extraction_agents": 0,
      "max_extraction_jobs": 0,
      "max_extraction_runs": 0,
      "max_files_per_index": 0,
      "max_indexes": 0,
      "max_monthly_invoice_total_usd": 0,
      "max_organizations": 0,
      "max_pages_per_index": 0,
      "max_projects": 0,
      "max_published_agents": 0,
      "max_report_agent_sessions": 0,
      "max_users": 0,
      "mfa_enabled": true,
      "sso_enabled": true,
      "subscription_cost_usd": 0,
      "max_directories": 0,
      "max_directory_files_per_directory": 0,
      "max_directory_ingest_files": 0,
      "max_directory_sync_plan_actions": 0,
      "spending_soft_alerts_usd_cents": [
        0
      ]
    },
    "name": "enterprise",
    "plan_frequency": "ANNUAL",
    "id": "id",
    "current_billing_period": {
      "end_date": "2019-12-27T18:11:19.117Z",
      "start_date": "2019-12-27T18:11:19.117Z"
    },
    "ending_before": "2019-12-27T18:11:19.117Z",
    "failure_count": 0,
    "is_payment_failed": true,
    "recurring_credits": [
      {
        "credit_amount": 0,
        "credit_type": {
          "id": "id",
          "name": "name"
        },
        "name": "name",
        "priority": 0,
        "product_id": "product_id",
        "rollover_fraction": 0,
        "periods_duration": 0
      }
    ],
    "starting_on": "2019-12-27T18:11:19.117Z"
  },
  "usage": {
    "active_alerts": [
      "configured_spend_limit_exceeded"
    ],
    "active_free_credits_usage": [
      {
        "expires_at": "2019-12-27T18:11:19.117Z",
        "grant_name": "grant_name",
        "remaining_balance": 0,
        "starting_balance": 0
      }
    ],
    "current_invoice_total_usd_cents": 0,
    "total_extraction_agents": 0,
    "total_indexed_pages": 0,
    "total_indexes": 0,
    "total_users": 0
  }
}
```

## Domain Types

### Organization

- `class Organization: …`

  API response schema for an organization.

  - `id: str`

    The organization's unique identifier.

  - `name: str`

    The organization's display name.

  - `created_at: Optional[datetime]`

    Creation datetime

  - `metadata: Optional[Dict[str, object]]`

    Additional organization metadata.

  - `updated_at: Optional[datetime]`

    Update datetime

### Organization Member

- `class OrganizationMember: …`

  A user's membership in an organization, including roles.

  - `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.

### Role

- `class Role: …`

  Schema for a 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

### Usage And Plan

- `class UsageAndPlan: …`

  - `plan: Plan`

    - `limits: PlanLimits`

      - `allow_pay_as_you_go: bool`

        Whether usage is allowed after credit grants are exhausted

      - `max_concurrent_index_jobs: Optional[int]`

      - `max_concurrent_parse_jobs_other: Optional[int]`

      - `max_concurrent_parse_jobs_premium: Optional[int]`

      - `max_data_sinks: Optional[int]`

      - `max_data_sources: Optional[int]`

      - `max_embedding_models: Optional[int]`

      - `max_extraction_agents: Optional[int]`

      - `max_extraction_jobs: Optional[int]`

      - `max_extraction_runs: Optional[int]`

      - `max_files_per_index: Optional[int]`

      - `max_indexes: Optional[int]`

      - `max_monthly_invoice_total_usd: Optional[int]`

      - `max_organizations: Optional[int]`

      - `max_pages_per_index: Optional[int]`

      - `max_projects: Optional[int]`

      - `max_published_agents: Optional[int]`

      - `max_report_agent_sessions: Optional[int]`

      - `max_users: Optional[int]`

      - `mfa_enabled: bool`

      - `sso_enabled: bool`

      - `subscription_cost_usd: int`

      - `max_directories: Optional[int]`

      - `max_directory_files_per_directory: Optional[int]`

      - `max_directory_ingest_files: Optional[int]`

      - `max_directory_sync_plan_actions: Optional[int]`

      - `spending_soft_alerts_usd_cents: Optional[List[int]]`

        The amount of USD cents at which a soft alert should be triggered

    - `name: Literal["enterprise", "enterprise_contract", "enterprise_poc", 12 more]`

      - `"enterprise"`

      - `"enterprise_contract"`

      - `"enterprise_poc"`

      - `"free"`

      - `"free_contract"`

      - `"free_v1"`

      - `"free_v2"`

      - `"llama_parse"`

      - `"pro"`

      - `"pro_v1"`

      - `"pro_v2"`

      - `"starter_v1"`

      - `"starter_v2"`

      - `"unknown"`

      - `"yc_deal_v1"`

    - `plan_frequency: Literal["ANNUAL", "MONTHLY", "QUARTERLY"]`

      - `"ANNUAL"`

      - `"MONTHLY"`

      - `"QUARTERLY"`

    - `id: Optional[str]`

      The ID of the plan in Metronome

    - `current_billing_period: Optional[PlanCurrentBillingPeriod]`

      The current billing period

      - `end_date: datetime`

      - `start_date: datetime`

    - `ending_before: Optional[datetime]`

      The date the plan ends on

    - `failure_count: Optional[int]`

      The number of payment failures for this organization

    - `is_payment_failed: Optional[bool]`

      Whether the organization has a failed payment that requires support contact

    - `recurring_credits: Optional[List[PlanRecurringCredit]]`

      - `credit_amount: int`

      - `credit_type: PlanRecurringCreditCreditType`

        - `id: str`

        - `name: str`

      - `name: str`

      - `priority: float`

      - `product_id: str`

        The ID of the product in Metronome used to represent the credit grant

      - `rollover_fraction: float`

        The fraction of the credit that will roll over to the next period, between 0 and 1

      - `periods_duration: Optional[float]`

        How many billing periods the credit grant will last for

    - `starting_on: Optional[datetime]`

      The date the plan starts on

  - `usage: Usage`

    Account usage totals shown alongside the plan.

    - `active_alerts: Optional[List[Literal["configured_spend_limit_exceeded", "free_credits_exhausted", "has_spending_alert", 3 more]]]`

      - `"configured_spend_limit_exceeded"`

      - `"free_credits_exhausted"`

      - `"has_spending_alert"`

      - `"internal_spending_alert"`

      - `"plan_spend_limit_exceeded"`

      - `"plan_spend_limit_soft_alert"`

    - `active_free_credits_usage: Optional[List[UsageActiveFreeCreditsUsage]]`

      - `expires_at: datetime`

      - `grant_name: str`

      - `remaining_balance: int`

      - `starting_balance: int`

    - `current_invoice_total_usd_cents: Optional[int]`

    - `total_extraction_agents: Optional[int]`

    - `total_indexed_pages: Optional[int]`

    - `total_indexes: Optional[int]`

    - `total_users: Optional[int]`

### User Organization Role

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

# 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

# Roles

## List Roles

`organizations.roles.list(strorganization_id)  -> RoleListResponse`

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

List all roles in an organization.

### Parameters

- `organization_id: str`

### Returns

- `List[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

### 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
)
roles = client.organizations.roles.list(
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(roles)
```

#### Response

```json
[
  {
    "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"
  }
]
```

## Domain Types

### Role List Response

- `List[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
