# Organizations

## List Organizations

`client.organizations.list(OrganizationListParamsquery?, RequestOptionsoptions?): PaginatedCursor<Organization>`

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

List organizations the current user can access.

### Parameters

- `query: OrganizationListParams`

  - `name?: string | null`

  - `page_size?: number | null`

  - `page_token?: string | null`

### Returns

- `Organization`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at?: string | null`

    Creation datetime

  - `metadata?: Record<string, unknown>`

    Additional organization metadata.

  - `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
});

// Automatically fetches more pages as needed.
for await (const organization of client.organizations.list()) {
  console.log(organization.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

`client.organizations.create(OrganizationCreateParamsbody, RequestOptionsoptions?): Organization`

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

Create a new organization.

### Parameters

- `body: OrganizationCreateParams`

  - `name: string`

    The organization's display name.

### Returns

- `Organization`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at?: string | null`

    Creation datetime

  - `metadata?: Record<string, unknown>`

    Additional organization metadata.

  - `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 organization = await client.organizations.create({ name: 'x' });

console.log(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

`client.organizations.get(stringorganizationID, RequestOptionsoptions?): Organization`

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

Get an organization by ID.

### Parameters

- `organizationID: string`

### Returns

- `Organization`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at?: string | null`

    Creation datetime

  - `metadata?: Record<string, unknown>`

    Additional organization metadata.

  - `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 organization = await client.organizations.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');

console.log(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

`client.organizations.update(stringorganizationID, OrganizationUpdateParamsbody, RequestOptionsoptions?): Organization`

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

Update an existing organization.

### Parameters

- `organizationID: string`

- `body: OrganizationUpdateParams`

  - `name: string`

    The organization's new display name.

### Returns

- `Organization`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at?: string | null`

    Creation datetime

  - `metadata?: Record<string, unknown>`

    Additional organization metadata.

  - `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 organization = await client.organizations.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
  name: 'x',
});

console.log(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

`client.organizations.delete(stringorganizationID, RequestOptionsoptions?): void`

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

Delete an organization by ID.

### Parameters

- `organizationID: string`

### 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.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
```

## Get Organization Usage

`client.organizations.getUsage(stringorganizationID, OrganizationGetUsageParamsquery?, RequestOptionsoptions?): UsageAndPlan`

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

Get usage for a specific organization.

### Parameters

- `organizationID: string`

- `query: OrganizationGetUsageParams`

  - `get_current_invoice_total?: boolean`

### Returns

- `UsageAndPlan`

  - `plan: Plan`

    - `limits: Limits`

      - `allow_pay_as_you_go: boolean`

        Whether usage is allowed after credit grants are exhausted

      - `max_concurrent_index_jobs: number | null`

      - `max_concurrent_parse_jobs_other: number | null`

      - `max_concurrent_parse_jobs_premium: number | null`

      - `max_data_sinks: number | null`

      - `max_data_sources: number | null`

      - `max_embedding_models: number | null`

      - `max_extraction_agents: number | null`

      - `max_extraction_jobs: number | null`

      - `max_extraction_runs: number | null`

      - `max_files_per_index: number | null`

      - `max_indexes: number | null`

      - `max_monthly_invoice_total_usd: number | null`

      - `max_organizations: number | null`

      - `max_pages_per_index: number | null`

      - `max_projects: number | null`

      - `max_published_agents: number | null`

      - `max_report_agent_sessions: number | null`

      - `max_users: number | null`

      - `mfa_enabled: boolean`

      - `sso_enabled: boolean`

      - `subscription_cost_usd: number`

      - `max_directories?: number | null`

      - `max_directory_files_per_directory?: number | null`

      - `max_directory_ingest_files?: number | null`

      - `max_directory_sync_plan_actions?: number | null`

      - `spending_soft_alerts_usd_cents?: Array<number> | null`

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

    - `name: "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: "ANNUAL" | "MONTHLY" | "QUARTERLY"`

      - `"ANNUAL"`

      - `"MONTHLY"`

      - `"QUARTERLY"`

    - `id?: string | null`

      The ID of the plan in Metronome

    - `current_billing_period?: CurrentBillingPeriod | null`

      The current billing period

      - `end_date: string`

      - `start_date: string`

    - `ending_before?: string | null`

      The date the plan ends on

    - `failure_count?: number`

      The number of payment failures for this organization

    - `is_payment_failed?: boolean`

      Whether the organization has a failed payment that requires support contact

    - `recurring_credits?: Array<RecurringCredit> | null`

      - `credit_amount: number`

      - `credit_type: CreditType`

        - `id: string`

        - `name: string`

      - `name: string`

      - `priority: number`

      - `product_id: string`

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

      - `rollover_fraction: number`

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

      - `periods_duration?: number`

        How many billing periods the credit grant will last for

    - `starting_on?: string | null`

      The date the plan starts on

  - `usage: Usage`

    Account usage totals shown alongside the plan.

    - `active_alerts?: Array<"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?: Array<ActiveFreeCreditsUsage>`

      - `expires_at: string`

      - `grant_name: string`

      - `remaining_balance: number`

      - `starting_balance: number`

    - `current_invoice_total_usd_cents?: number | null`

    - `total_extraction_agents?: number`

    - `total_indexed_pages?: number`

    - `total_indexes?: number`

    - `total_users?: number`

### 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 usageAndPlan = await client.organizations.getUsage('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');

console.log(usageAndPlan.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

- `Organization`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at?: string | null`

    Creation datetime

  - `metadata?: Record<string, unknown>`

    Additional organization metadata.

  - `updated_at?: string | null`

    Update datetime

### Organization Member

- `OrganizationMember`

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

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

### Role

- `Role`

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

### Usage And Plan

- `UsageAndPlan`

  - `plan: Plan`

    - `limits: Limits`

      - `allow_pay_as_you_go: boolean`

        Whether usage is allowed after credit grants are exhausted

      - `max_concurrent_index_jobs: number | null`

      - `max_concurrent_parse_jobs_other: number | null`

      - `max_concurrent_parse_jobs_premium: number | null`

      - `max_data_sinks: number | null`

      - `max_data_sources: number | null`

      - `max_embedding_models: number | null`

      - `max_extraction_agents: number | null`

      - `max_extraction_jobs: number | null`

      - `max_extraction_runs: number | null`

      - `max_files_per_index: number | null`

      - `max_indexes: number | null`

      - `max_monthly_invoice_total_usd: number | null`

      - `max_organizations: number | null`

      - `max_pages_per_index: number | null`

      - `max_projects: number | null`

      - `max_published_agents: number | null`

      - `max_report_agent_sessions: number | null`

      - `max_users: number | null`

      - `mfa_enabled: boolean`

      - `sso_enabled: boolean`

      - `subscription_cost_usd: number`

      - `max_directories?: number | null`

      - `max_directory_files_per_directory?: number | null`

      - `max_directory_ingest_files?: number | null`

      - `max_directory_sync_plan_actions?: number | null`

      - `spending_soft_alerts_usd_cents?: Array<number> | null`

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

    - `name: "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: "ANNUAL" | "MONTHLY" | "QUARTERLY"`

      - `"ANNUAL"`

      - `"MONTHLY"`

      - `"QUARTERLY"`

    - `id?: string | null`

      The ID of the plan in Metronome

    - `current_billing_period?: CurrentBillingPeriod | null`

      The current billing period

      - `end_date: string`

      - `start_date: string`

    - `ending_before?: string | null`

      The date the plan ends on

    - `failure_count?: number`

      The number of payment failures for this organization

    - `is_payment_failed?: boolean`

      Whether the organization has a failed payment that requires support contact

    - `recurring_credits?: Array<RecurringCredit> | null`

      - `credit_amount: number`

      - `credit_type: CreditType`

        - `id: string`

        - `name: string`

      - `name: string`

      - `priority: number`

      - `product_id: string`

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

      - `rollover_fraction: number`

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

      - `periods_duration?: number`

        How many billing periods the credit grant will last for

    - `starting_on?: string | null`

      The date the plan starts on

  - `usage: Usage`

    Account usage totals shown alongside the plan.

    - `active_alerts?: Array<"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?: Array<ActiveFreeCreditsUsage>`

      - `expires_at: string`

      - `grant_name: string`

      - `remaining_balance: number`

      - `starting_balance: number`

    - `current_invoice_total_usd_cents?: number | null`

    - `total_extraction_agents?: number`

    - `total_indexed_pages?: number`

    - `total_indexes?: number`

    - `total_users?: number`

### User Organization Role

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

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

# Roles

## List Roles

`client.organizations.roles.list(stringorganizationID, RequestOptionsoptions?): RoleListResponse`

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

List all roles in an organization.

### Parameters

- `organizationID: string`

### Returns

- `RoleListResponse = Array<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

### 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 roles = await client.organizations.roles.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');

console.log(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

- `RoleListResponse = Array<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
