# Organizations

## List Organizations

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

List organizations the current user can access.

### Query Parameters

- `name: optional string`

- `page_size: optional number`

- `page_token: optional string`

### Cookie Parameters

- `session: optional string`

### Returns

- `items: array of Organization`

  The list of items.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at: optional string`

    Creation datetime

  - `metadata: optional map[unknown]`

    Additional organization metadata.

  - `updated_at: optional string`

    Update datetime

- `next_page_token: optional string`

  A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

- `total_size: optional number`

  The total number of items available. This is only populated when specifically requested. The value may be an estimate and can be used for display purposes only.

### Example

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

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

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

Create a new organization.

### Cookie Parameters

- `session: optional string`

### Body Parameters

- `name: string`

  The organization's display name.

### Returns

- `Organization object { id, name, created_at, 2 more }`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at: optional string`

    Creation datetime

  - `metadata: optional map[unknown]`

    Additional organization metadata.

  - `updated_at: optional string`

    Update datetime

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v2/organizations \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
    -d '{
          "name": "x"
        }'
```

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

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

Get an organization by ID.

### Path Parameters

- `organization_id: string`

### Cookie Parameters

- `session: optional string`

### Returns

- `Organization object { id, name, created_at, 2 more }`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at: optional string`

    Creation datetime

  - `metadata: optional map[unknown]`

    Additional organization metadata.

  - `updated_at: optional string`

    Update datetime

### Example

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

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

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

Update an existing organization.

### Path Parameters

- `organization_id: string`

### Cookie Parameters

- `session: optional string`

### Body Parameters

- `name: string`

  The organization's new display name.

### Returns

- `Organization object { id, name, created_at, 2 more }`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at: optional string`

    Creation datetime

  - `metadata: optional map[unknown]`

    Additional organization metadata.

  - `updated_at: optional string`

    Update datetime

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v2/organizations/$ORGANIZATION_ID \
    -X PUT \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
    -d '{
          "name": "x"
        }'
```

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

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

Delete an organization by ID.

### Path Parameters

- `organization_id: string`

### Cookie Parameters

- `session: optional string`

### Example

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

## Get Organization Usage

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

Get usage for a specific organization.

### Path Parameters

- `organization_id: string`

### Query Parameters

- `get_current_invoice_total: optional boolean`

### Cookie Parameters

- `session: optional string`

### Returns

- `UsageAndPlan object { plan, usage }`

  - `plan: object { limits, name, plan_frequency, 7 more }`

    - `limits: object { allow_pay_as_you_go, max_concurrent_index_jobs, max_concurrent_parse_jobs_other, 24 more }`

      - `allow_pay_as_you_go: boolean`

        Whether usage is allowed after credit grants are exhausted

      - `max_concurrent_index_jobs: number`

      - `max_concurrent_parse_jobs_other: number`

      - `max_concurrent_parse_jobs_premium: number`

      - `max_data_sinks: number`

      - `max_data_sources: number`

      - `max_embedding_models: number`

      - `max_extraction_agents: number`

      - `max_extraction_jobs: number`

      - `max_extraction_runs: number`

      - `max_files_per_index: number`

      - `max_indexes: number`

      - `max_monthly_invoice_total_usd: number`

      - `max_organizations: number`

      - `max_pages_per_index: number`

      - `max_projects: number`

      - `max_published_agents: number`

      - `max_report_agent_sessions: number`

      - `max_users: number`

      - `mfa_enabled: boolean`

      - `sso_enabled: boolean`

      - `subscription_cost_usd: number`

      - `max_directories: optional number`

      - `max_directory_files_per_directory: optional number`

      - `max_directory_ingest_files: optional number`

      - `max_directory_sync_plan_actions: optional number`

      - `spending_soft_alerts_usd_cents: optional array of number`

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

    - `name: "enterprise" or "enterprise_contract" or "enterprise_poc" or 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" or "MONTHLY" or "QUARTERLY"`

      - `"ANNUAL"`

      - `"MONTHLY"`

      - `"QUARTERLY"`

    - `id: optional string`

      The ID of the plan in Metronome

    - `current_billing_period: optional object { end_date, start_date }`

      The current billing period

      - `end_date: string`

      - `start_date: string`

    - `ending_before: optional string`

      The date the plan ends on

    - `failure_count: optional number`

      The number of payment failures for this organization

    - `is_payment_failed: optional boolean`

      Whether the organization has a failed payment that requires support contact

    - `recurring_credits: optional array of object { credit_amount, credit_type, name, 4 more }`

      - `credit_amount: number`

      - `credit_type: object { id, name }`

        - `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: optional number`

        How many billing periods the credit grant will last for

    - `starting_on: optional string`

      The date the plan starts on

  - `usage: object { active_alerts, active_free_credits_usage, current_invoice_total_usd_cents, 4 more }`

    Account usage totals shown alongside the plan.

    - `active_alerts: optional array of "configured_spend_limit_exceeded" or "free_credits_exhausted" or "has_spending_alert" or 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 array of object { expires_at, grant_name, remaining_balance, starting_balance }`

      - `expires_at: string`

      - `grant_name: string`

      - `remaining_balance: number`

      - `starting_balance: number`

    - `current_invoice_total_usd_cents: optional number`

    - `total_extraction_agents: optional number`

    - `total_indexed_pages: optional number`

    - `total_indexes: optional number`

    - `total_users: optional number`

### Example

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

#### 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 object { id, name, created_at, 2 more }`

  API response schema for an organization.

  - `id: string`

    The organization's unique identifier.

  - `name: string`

    The organization's display name.

  - `created_at: optional string`

    Creation datetime

  - `metadata: optional map[unknown]`

    Additional organization metadata.

  - `updated_at: optional string`

    Update datetime

### Organization Member

- `OrganizationMember object { id, organization_id, roles, 7 more }`

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

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

### Role

- `Role object { id, name, permissions, 2 more }`

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

### Usage And Plan

- `UsageAndPlan object { plan, usage }`

  - `plan: object { limits, name, plan_frequency, 7 more }`

    - `limits: object { allow_pay_as_you_go, max_concurrent_index_jobs, max_concurrent_parse_jobs_other, 24 more }`

      - `allow_pay_as_you_go: boolean`

        Whether usage is allowed after credit grants are exhausted

      - `max_concurrent_index_jobs: number`

      - `max_concurrent_parse_jobs_other: number`

      - `max_concurrent_parse_jobs_premium: number`

      - `max_data_sinks: number`

      - `max_data_sources: number`

      - `max_embedding_models: number`

      - `max_extraction_agents: number`

      - `max_extraction_jobs: number`

      - `max_extraction_runs: number`

      - `max_files_per_index: number`

      - `max_indexes: number`

      - `max_monthly_invoice_total_usd: number`

      - `max_organizations: number`

      - `max_pages_per_index: number`

      - `max_projects: number`

      - `max_published_agents: number`

      - `max_report_agent_sessions: number`

      - `max_users: number`

      - `mfa_enabled: boolean`

      - `sso_enabled: boolean`

      - `subscription_cost_usd: number`

      - `max_directories: optional number`

      - `max_directory_files_per_directory: optional number`

      - `max_directory_ingest_files: optional number`

      - `max_directory_sync_plan_actions: optional number`

      - `spending_soft_alerts_usd_cents: optional array of number`

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

    - `name: "enterprise" or "enterprise_contract" or "enterprise_poc" or 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" or "MONTHLY" or "QUARTERLY"`

      - `"ANNUAL"`

      - `"MONTHLY"`

      - `"QUARTERLY"`

    - `id: optional string`

      The ID of the plan in Metronome

    - `current_billing_period: optional object { end_date, start_date }`

      The current billing period

      - `end_date: string`

      - `start_date: string`

    - `ending_before: optional string`

      The date the plan ends on

    - `failure_count: optional number`

      The number of payment failures for this organization

    - `is_payment_failed: optional boolean`

      Whether the organization has a failed payment that requires support contact

    - `recurring_credits: optional array of object { credit_amount, credit_type, name, 4 more }`

      - `credit_amount: number`

      - `credit_type: object { id, name }`

        - `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: optional number`

        How many billing periods the credit grant will last for

    - `starting_on: optional string`

      The date the plan starts on

  - `usage: object { active_alerts, active_free_credits_usage, current_invoice_total_usd_cents, 4 more }`

    Account usage totals shown alongside the plan.

    - `active_alerts: optional array of "configured_spend_limit_exceeded" or "free_credits_exhausted" or "has_spending_alert" or 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 array of object { expires_at, grant_name, remaining_balance, starting_balance }`

      - `expires_at: string`

      - `grant_name: string`

      - `remaining_balance: number`

      - `starting_balance: number`

    - `current_invoice_total_usd_cents: optional number`

    - `total_extraction_agents: optional number`

    - `total_indexed_pages: optional number`

    - `total_indexes: optional number`

    - `total_users: optional number`

### User Organization Role

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

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

# Roles

## List Roles

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

List all roles in an organization.

### Path Parameters

- `organization_id: string`

### Cookie Parameters

- `session: optional string`

### Returns

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

### Example

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

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