# Organizations

## List Organizations

`client.Organizations.List(ctx, query) (*PaginatedCursor[Organization], error)`

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

List organizations the current user can access.

### Parameters

- `query OrganizationListParams`

  - `Name param.Field[string]`

  - `PageSize param.Field[int64]`

  - `PageToken param.Field[string]`

### Returns

- `type Organization struct{…}`

  API response schema for an organization.

  - `ID string`

    The organization's unique identifier.

  - `Name string`

    The organization's display name.

  - `CreatedAt Time`

    Creation datetime

  - `Metadata map[string, any]`

    Additional organization metadata.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Organizations.List(context.TODO(), llamacloudadmin.OrganizationListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
```

#### 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.New(ctx, body) (*Organization, error)`

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

Create a new organization.

### Parameters

- `body OrganizationNewParams`

  - `Name param.Field[string]`

    The organization's display name.

### Returns

- `type Organization struct{…}`

  API response schema for an organization.

  - `ID string`

    The organization's unique identifier.

  - `Name string`

    The organization's display name.

  - `CreatedAt Time`

    Creation datetime

  - `Metadata map[string, any]`

    Additional organization metadata.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  organization, err := client.Organizations.New(context.TODO(), llamacloudadmin.OrganizationNewParams{
    Name: "x",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, organizationID) (*Organization, error)`

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

Get an organization by ID.

### Parameters

- `organizationID string`

### Returns

- `type Organization struct{…}`

  API response schema for an organization.

  - `ID string`

    The organization's unique identifier.

  - `Name string`

    The organization's display name.

  - `CreatedAt Time`

    Creation datetime

  - `Metadata map[string, any]`

    Additional organization metadata.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  organization, err := client.Organizations.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, organizationID, body) (*Organization, error)`

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

Update an existing organization.

### Parameters

- `organizationID string`

- `body OrganizationUpdateParams`

  - `Name param.Field[string]`

    The organization's new display name.

### Returns

- `type Organization struct{…}`

  API response schema for an organization.

  - `ID string`

    The organization's unique identifier.

  - `Name string`

    The organization's display name.

  - `CreatedAt Time`

    Creation datetime

  - `Metadata map[string, any]`

    Additional organization metadata.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  organization, err := client.Organizations.Update(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.OrganizationUpdateParams{
      Name: "x",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, organizationID) error`

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

Delete an organization by ID.

### Parameters

- `organizationID string`

### Example

```go
package main

import (
  "context"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Organizations.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
  if err != nil {
    panic(err.Error())
  }
}
```

## Get Organization Usage

`client.Organizations.GetUsage(ctx, organizationID, query) (*UsageAndPlan, error)`

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

Get usage for a specific organization.

### Parameters

- `organizationID string`

- `query OrganizationGetUsageParams`

  - `GetCurrentInvoiceTotal param.Field[bool]`

### Returns

- `type UsageAndPlan struct{…}`

  - `Plan UsageAndPlanPlan`

    - `Limits UsageAndPlanPlanLimits`

      - `AllowPayAsYouGo bool`

        Whether usage is allowed after credit grants are exhausted

      - `MaxConcurrentIndexJobs int64`

      - `MaxConcurrentParseJobsOther int64`

      - `MaxConcurrentParseJobsPremium int64`

      - `MaxDataSinks int64`

      - `MaxDataSources int64`

      - `MaxEmbeddingModels int64`

      - `MaxExtractionAgents int64`

      - `MaxExtractionJobs int64`

      - `MaxExtractionRuns int64`

      - `MaxFilesPerIndex int64`

      - `MaxIndexes int64`

      - `MaxMonthlyInvoiceTotalUsd int64`

      - `MaxOrganizations int64`

      - `MaxPagesPerIndex int64`

      - `MaxProjects int64`

      - `MaxPublishedAgents int64`

      - `MaxReportAgentSessions int64`

      - `MaxUsers int64`

      - `MfaEnabled bool`

      - `SSOEnabled bool`

      - `SubscriptionCostUsd int64`

      - `MaxDirectories int64`

      - `MaxDirectoryFilesPerDirectory int64`

      - `MaxDirectoryIngestFiles int64`

      - `MaxDirectorySyncPlanActions int64`

      - `SpendingSoftAlertsUsdCents []int64`

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

    - `Name string`

      - `const UsageAndPlanPlanNameEnterprise UsageAndPlanPlanName = "enterprise"`

      - `const UsageAndPlanPlanNameEnterpriseContract UsageAndPlanPlanName = "enterprise_contract"`

      - `const UsageAndPlanPlanNameEnterprisePoc UsageAndPlanPlanName = "enterprise_poc"`

      - `const UsageAndPlanPlanNameFree UsageAndPlanPlanName = "free"`

      - `const UsageAndPlanPlanNameFreeContract UsageAndPlanPlanName = "free_contract"`

      - `const UsageAndPlanPlanNameFreeV1 UsageAndPlanPlanName = "free_v1"`

      - `const UsageAndPlanPlanNameFreeV2 UsageAndPlanPlanName = "free_v2"`

      - `const UsageAndPlanPlanNameLlamaParse UsageAndPlanPlanName = "llama_parse"`

      - `const UsageAndPlanPlanNamePro UsageAndPlanPlanName = "pro"`

      - `const UsageAndPlanPlanNameProV1 UsageAndPlanPlanName = "pro_v1"`

      - `const UsageAndPlanPlanNameProV2 UsageAndPlanPlanName = "pro_v2"`

      - `const UsageAndPlanPlanNameStarterV1 UsageAndPlanPlanName = "starter_v1"`

      - `const UsageAndPlanPlanNameStarterV2 UsageAndPlanPlanName = "starter_v2"`

      - `const UsageAndPlanPlanNameUnknown UsageAndPlanPlanName = "unknown"`

      - `const UsageAndPlanPlanNameYcDealV1 UsageAndPlanPlanName = "yc_deal_v1"`

    - `PlanFrequency string`

      - `const UsageAndPlanPlanPlanFrequencyAnnual UsageAndPlanPlanPlanFrequency = "ANNUAL"`

      - `const UsageAndPlanPlanPlanFrequencyMonthly UsageAndPlanPlanPlanFrequency = "MONTHLY"`

      - `const UsageAndPlanPlanPlanFrequencyQuarterly UsageAndPlanPlanPlanFrequency = "QUARTERLY"`

    - `ID string`

      The ID of the plan in Metronome

    - `CurrentBillingPeriod UsageAndPlanPlanCurrentBillingPeriod`

      The current billing period

      - `EndDate Time`

      - `StartDate Time`

    - `EndingBefore Time`

      The date the plan ends on

    - `FailureCount int64`

      The number of payment failures for this organization

    - `IsPaymentFailed bool`

      Whether the organization has a failed payment that requires support contact

    - `RecurringCredits []UsageAndPlanPlanRecurringCredit`

      - `CreditAmount int64`

      - `CreditType UsageAndPlanPlanRecurringCreditCreditType`

        - `ID string`

        - `Name string`

      - `Name string`

      - `Priority float64`

      - `ProductID string`

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

      - `RolloverFraction float64`

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

      - `PeriodsDuration float64`

        How many billing periods the credit grant will last for

    - `StartingOn Time`

      The date the plan starts on

  - `Usage UsageAndPlanUsage`

    Account usage totals shown alongside the plan.

    - `ActiveAlerts []string`

      - `const UsageAndPlanUsageActiveAlertConfiguredSpendLimitExceeded UsageAndPlanUsageActiveAlert = "configured_spend_limit_exceeded"`

      - `const UsageAndPlanUsageActiveAlertFreeCreditsExhausted UsageAndPlanUsageActiveAlert = "free_credits_exhausted"`

      - `const UsageAndPlanUsageActiveAlertHasSpendingAlert UsageAndPlanUsageActiveAlert = "has_spending_alert"`

      - `const UsageAndPlanUsageActiveAlertInternalSpendingAlert UsageAndPlanUsageActiveAlert = "internal_spending_alert"`

      - `const UsageAndPlanUsageActiveAlertPlanSpendLimitExceeded UsageAndPlanUsageActiveAlert = "plan_spend_limit_exceeded"`

      - `const UsageAndPlanUsageActiveAlertPlanSpendLimitSoftAlert UsageAndPlanUsageActiveAlert = "plan_spend_limit_soft_alert"`

    - `ActiveFreeCreditsUsage []UsageAndPlanUsageActiveFreeCreditsUsage`

      - `ExpiresAt Time`

      - `GrantName string`

      - `RemainingBalance int64`

      - `StartingBalance int64`

    - `CurrentInvoiceTotalUsdCents int64`

    - `TotalExtractionAgents int64`

    - `TotalIndexedPages int64`

    - `TotalIndexes int64`

    - `TotalUsers int64`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  usageAndPlan, err := client.Organizations.GetUsage(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.OrganizationGetUsageParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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

- `type Organization struct{…}`

  API response schema for an organization.

  - `ID string`

    The organization's unique identifier.

  - `Name string`

    The organization's display name.

  - `CreatedAt Time`

    Creation datetime

  - `Metadata map[string, any]`

    Additional organization metadata.

  - `UpdatedAt Time`

    Update datetime

### Organization Member

- `type OrganizationMember struct{…}`

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

  - `ID string`

    Unique identifier

  - `OrganizationID string`

    The organization's ID.

  - `Roles []UserOrganizationRole`

    The roles of the user in the organization.

    - `ID string`

      Unique identifier

    - `OrganizationID string`

      The organization's ID.

    - `Role Role`

      The role.

      - `ID string`

        Unique identifier

      - `Name string`

        A name for the role.

      - `Permissions []RolePermission`

        The actual permissions of the role.

        - `ID string`

          Unique identifier

        - `Access bool`

          Whether the permission is granted or not.

        - `Description string`

          A description for the permission.

        - `Name string`

          A name for the permission.

        - `CreatedAt Time`

          Creation datetime

        - `UpdatedAt Time`

          Update datetime

      - `CreatedAt Time`

        Creation datetime

      - `UpdatedAt Time`

        Update datetime

    - `UserID string`

      The user's ID.

    - `CreatedAt Time`

      Creation datetime

    - `ProjectIDs []string`

      The project ID scope.

    - `UpdatedAt Time`

      Update datetime

  - `CreatedAt Time`

    Creation datetime

  - `Email string`

    The user's email address.

  - `InvitedByUserEmail string`

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

  - `InvitedByUserID string`

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

  - `Pending bool`

    Whether the user's membership is pending account signup.

  - `UpdatedAt Time`

    Update datetime

  - `UserID string`

    The user's ID.

### Role

- `type Role struct{…}`

  Schema for a role.

  - `ID string`

    Unique identifier

  - `Name string`

    A name for the role.

  - `Permissions []RolePermission`

    The actual permissions of the role.

    - `ID string`

      Unique identifier

    - `Access bool`

      Whether the permission is granted or not.

    - `Description string`

      A description for the permission.

    - `Name string`

      A name for the permission.

    - `CreatedAt Time`

      Creation datetime

    - `UpdatedAt Time`

      Update datetime

  - `CreatedAt Time`

    Creation datetime

  - `UpdatedAt Time`

    Update datetime

### Usage And Plan

- `type UsageAndPlan struct{…}`

  - `Plan UsageAndPlanPlan`

    - `Limits UsageAndPlanPlanLimits`

      - `AllowPayAsYouGo bool`

        Whether usage is allowed after credit grants are exhausted

      - `MaxConcurrentIndexJobs int64`

      - `MaxConcurrentParseJobsOther int64`

      - `MaxConcurrentParseJobsPremium int64`

      - `MaxDataSinks int64`

      - `MaxDataSources int64`

      - `MaxEmbeddingModels int64`

      - `MaxExtractionAgents int64`

      - `MaxExtractionJobs int64`

      - `MaxExtractionRuns int64`

      - `MaxFilesPerIndex int64`

      - `MaxIndexes int64`

      - `MaxMonthlyInvoiceTotalUsd int64`

      - `MaxOrganizations int64`

      - `MaxPagesPerIndex int64`

      - `MaxProjects int64`

      - `MaxPublishedAgents int64`

      - `MaxReportAgentSessions int64`

      - `MaxUsers int64`

      - `MfaEnabled bool`

      - `SSOEnabled bool`

      - `SubscriptionCostUsd int64`

      - `MaxDirectories int64`

      - `MaxDirectoryFilesPerDirectory int64`

      - `MaxDirectoryIngestFiles int64`

      - `MaxDirectorySyncPlanActions int64`

      - `SpendingSoftAlertsUsdCents []int64`

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

    - `Name string`

      - `const UsageAndPlanPlanNameEnterprise UsageAndPlanPlanName = "enterprise"`

      - `const UsageAndPlanPlanNameEnterpriseContract UsageAndPlanPlanName = "enterprise_contract"`

      - `const UsageAndPlanPlanNameEnterprisePoc UsageAndPlanPlanName = "enterprise_poc"`

      - `const UsageAndPlanPlanNameFree UsageAndPlanPlanName = "free"`

      - `const UsageAndPlanPlanNameFreeContract UsageAndPlanPlanName = "free_contract"`

      - `const UsageAndPlanPlanNameFreeV1 UsageAndPlanPlanName = "free_v1"`

      - `const UsageAndPlanPlanNameFreeV2 UsageAndPlanPlanName = "free_v2"`

      - `const UsageAndPlanPlanNameLlamaParse UsageAndPlanPlanName = "llama_parse"`

      - `const UsageAndPlanPlanNamePro UsageAndPlanPlanName = "pro"`

      - `const UsageAndPlanPlanNameProV1 UsageAndPlanPlanName = "pro_v1"`

      - `const UsageAndPlanPlanNameProV2 UsageAndPlanPlanName = "pro_v2"`

      - `const UsageAndPlanPlanNameStarterV1 UsageAndPlanPlanName = "starter_v1"`

      - `const UsageAndPlanPlanNameStarterV2 UsageAndPlanPlanName = "starter_v2"`

      - `const UsageAndPlanPlanNameUnknown UsageAndPlanPlanName = "unknown"`

      - `const UsageAndPlanPlanNameYcDealV1 UsageAndPlanPlanName = "yc_deal_v1"`

    - `PlanFrequency string`

      - `const UsageAndPlanPlanPlanFrequencyAnnual UsageAndPlanPlanPlanFrequency = "ANNUAL"`

      - `const UsageAndPlanPlanPlanFrequencyMonthly UsageAndPlanPlanPlanFrequency = "MONTHLY"`

      - `const UsageAndPlanPlanPlanFrequencyQuarterly UsageAndPlanPlanPlanFrequency = "QUARTERLY"`

    - `ID string`

      The ID of the plan in Metronome

    - `CurrentBillingPeriod UsageAndPlanPlanCurrentBillingPeriod`

      The current billing period

      - `EndDate Time`

      - `StartDate Time`

    - `EndingBefore Time`

      The date the plan ends on

    - `FailureCount int64`

      The number of payment failures for this organization

    - `IsPaymentFailed bool`

      Whether the organization has a failed payment that requires support contact

    - `RecurringCredits []UsageAndPlanPlanRecurringCredit`

      - `CreditAmount int64`

      - `CreditType UsageAndPlanPlanRecurringCreditCreditType`

        - `ID string`

        - `Name string`

      - `Name string`

      - `Priority float64`

      - `ProductID string`

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

      - `RolloverFraction float64`

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

      - `PeriodsDuration float64`

        How many billing periods the credit grant will last for

    - `StartingOn Time`

      The date the plan starts on

  - `Usage UsageAndPlanUsage`

    Account usage totals shown alongside the plan.

    - `ActiveAlerts []string`

      - `const UsageAndPlanUsageActiveAlertConfiguredSpendLimitExceeded UsageAndPlanUsageActiveAlert = "configured_spend_limit_exceeded"`

      - `const UsageAndPlanUsageActiveAlertFreeCreditsExhausted UsageAndPlanUsageActiveAlert = "free_credits_exhausted"`

      - `const UsageAndPlanUsageActiveAlertHasSpendingAlert UsageAndPlanUsageActiveAlert = "has_spending_alert"`

      - `const UsageAndPlanUsageActiveAlertInternalSpendingAlert UsageAndPlanUsageActiveAlert = "internal_spending_alert"`

      - `const UsageAndPlanUsageActiveAlertPlanSpendLimitExceeded UsageAndPlanUsageActiveAlert = "plan_spend_limit_exceeded"`

      - `const UsageAndPlanUsageActiveAlertPlanSpendLimitSoftAlert UsageAndPlanUsageActiveAlert = "plan_spend_limit_soft_alert"`

    - `ActiveFreeCreditsUsage []UsageAndPlanUsageActiveFreeCreditsUsage`

      - `ExpiresAt Time`

      - `GrantName string`

      - `RemainingBalance int64`

      - `StartingBalance int64`

    - `CurrentInvoiceTotalUsdCents int64`

    - `TotalExtractionAgents int64`

    - `TotalIndexedPages int64`

    - `TotalIndexes int64`

    - `TotalUsers int64`

### User Organization Role

- `type UserOrganizationRole struct{…}`

  Schema for a user's role in an organization.

  - `ID string`

    Unique identifier

  - `OrganizationID string`

    The organization's ID.

  - `Role Role`

    The role.

    - `ID string`

      Unique identifier

    - `Name string`

      A name for the role.

    - `Permissions []RolePermission`

      The actual permissions of the role.

      - `ID string`

        Unique identifier

      - `Access bool`

        Whether the permission is granted or not.

      - `Description string`

        A description for the permission.

      - `Name string`

        A name for the permission.

      - `CreatedAt Time`

        Creation datetime

      - `UpdatedAt Time`

        Update datetime

    - `CreatedAt Time`

      Creation datetime

    - `UpdatedAt Time`

      Update datetime

  - `UserID string`

    The user's ID.

  - `CreatedAt Time`

    Creation datetime

  - `ProjectIDs []string`

    The project ID scope.

  - `UpdatedAt Time`

    Update datetime

# Users

## List Organization Users

`client.Organizations.Users.ListMembers(ctx, organizationID) (*[]OrganizationMember, error)`

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

Get all users in an organization.

### Parameters

- `organizationID string`

### Returns

- `type OrganizationUserListMembersResponse []OrganizationMember`

  - `ID string`

    Unique identifier

  - `OrganizationID string`

    The organization's ID.

  - `Roles []UserOrganizationRole`

    The roles of the user in the organization.

    - `ID string`

      Unique identifier

    - `OrganizationID string`

      The organization's ID.

    - `Role Role`

      The role.

      - `ID string`

        Unique identifier

      - `Name string`

        A name for the role.

      - `Permissions []RolePermission`

        The actual permissions of the role.

        - `ID string`

          Unique identifier

        - `Access bool`

          Whether the permission is granted or not.

        - `Description string`

          A description for the permission.

        - `Name string`

          A name for the permission.

        - `CreatedAt Time`

          Creation datetime

        - `UpdatedAt Time`

          Update datetime

      - `CreatedAt Time`

        Creation datetime

      - `UpdatedAt Time`

        Update datetime

    - `UserID string`

      The user's ID.

    - `CreatedAt Time`

      Creation datetime

    - `ProjectIDs []string`

      The project ID scope.

    - `UpdatedAt Time`

      Update datetime

  - `CreatedAt Time`

    Creation datetime

  - `Email string`

    The user's email address.

  - `InvitedByUserEmail string`

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

  - `InvitedByUserID string`

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

  - `Pending bool`

    Whether the user's membership is pending account signup.

  - `UpdatedAt Time`

    Update datetime

  - `UserID string`

    The user's ID.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  organizationMembers, err := client.Organizations.Users.ListMembers(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, organizationID, body) (*[]OrganizationMember, error)`

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

Add a user to an organization.

### Parameters

- `organizationID string`

- `body OrganizationUserAddParams`

  - `Body param.Field[[]OrganizationUserAddParamsBody]`

    - `ProjectIDs []string`

      The project IDs to add the user to.

    - `Email string`

      The user's email address.

    - `RoleID string`

      The role ID to assign to the user.

    - `UserID string`

      The user's ID.

### Returns

- `type OrganizationUserAddResponse []OrganizationMember`

  - `ID string`

    Unique identifier

  - `OrganizationID string`

    The organization's ID.

  - `Roles []UserOrganizationRole`

    The roles of the user in the organization.

    - `ID string`

      Unique identifier

    - `OrganizationID string`

      The organization's ID.

    - `Role Role`

      The role.

      - `ID string`

        Unique identifier

      - `Name string`

        A name for the role.

      - `Permissions []RolePermission`

        The actual permissions of the role.

        - `ID string`

          Unique identifier

        - `Access bool`

          Whether the permission is granted or not.

        - `Description string`

          A description for the permission.

        - `Name string`

          A name for the permission.

        - `CreatedAt Time`

          Creation datetime

        - `UpdatedAt Time`

          Update datetime

      - `CreatedAt Time`

        Creation datetime

      - `UpdatedAt Time`

        Update datetime

    - `UserID string`

      The user's ID.

    - `CreatedAt Time`

      Creation datetime

    - `ProjectIDs []string`

      The project ID scope.

    - `UpdatedAt Time`

      Update datetime

  - `CreatedAt Time`

    Creation datetime

  - `Email string`

    The user's email address.

  - `InvitedByUserEmail string`

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

  - `InvitedByUserID string`

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

  - `Pending bool`

    Whether the user's membership is pending account signup.

  - `UpdatedAt Time`

    Update datetime

  - `UserID string`

    The user's ID.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  organizationMembers, err := client.Organizations.Users.Add(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.OrganizationUserAddParams{
      Body: []llamacloudadmin.OrganizationUserAddParamsBody{llamacloudadmin.OrganizationUserAddParamsBody{
        ProjectIDs: []string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"},
      }},
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, memberUserID, params) error`

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

Remove users from an organization.

### Parameters

- `memberUserID string`

- `params OrganizationUserDeleteParams`

  - `OrganizationID param.Field[string]`

    Path param

  - `Body param.Field[[]string]`

    Body param

### Example

```go
package main

import (
  "context"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Organizations.Users.Delete(
    context.TODO(),
    "member_user_id",
    llamacloudadmin.OrganizationUserDeleteParams{
      OrganizationID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    },
  )
  if err != nil {
    panic(err.Error())
  }
}
```

## Assign Role To User In Organization

`client.Organizations.Users.AssignRole(ctx, organizationID, body) (*UserOrganizationRole, error)`

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

Assign a role to a user in an organization.

### Parameters

- `organizationID string`

- `body OrganizationUserAssignRoleParams`

  - `OrganizationID param.Field[string]`

    The organization's ID.

  - `RoleID param.Field[string]`

    The role's ID.

  - `UserID param.Field[string]`

    The user's ID.

### Returns

- `type UserOrganizationRole struct{…}`

  Schema for a user's role in an organization.

  - `ID string`

    Unique identifier

  - `OrganizationID string`

    The organization's ID.

  - `Role Role`

    The role.

    - `ID string`

      Unique identifier

    - `Name string`

      A name for the role.

    - `Permissions []RolePermission`

      The actual permissions of the role.

      - `ID string`

        Unique identifier

      - `Access bool`

        Whether the permission is granted or not.

      - `Description string`

        A description for the permission.

      - `Name string`

        A name for the permission.

      - `CreatedAt Time`

        Creation datetime

      - `UpdatedAt Time`

        Update datetime

    - `CreatedAt Time`

      Creation datetime

    - `UpdatedAt Time`

      Update datetime

  - `UserID string`

    The user's ID.

  - `CreatedAt Time`

    Creation datetime

  - `ProjectIDs []string`

    The project ID scope.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  userOrganizationRole, err := client.Organizations.Users.AssignRole(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.OrganizationUserAssignRoleParams{
      OrganizationID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      RoleID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      UserID: "user_id",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, userID, query) (*[]OrganizationUserListProjectsResponse, error)`

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

List all projects for a user in an organization.

### Parameters

- `userID string`

- `query OrganizationUserListProjectsParams`

  - `OrganizationID param.Field[string]`

### Returns

- `type OrganizationUserListProjectsResponse []OrganizationUserListProjectsResponse`

  - `ID string`

    Unique identifier

  - `Name string`

  - `OrganizationID string`

    The Organization ID the project is under.

  - `CreatedAt Time`

    Creation datetime

  - `IsDefault bool`

    Whether this project is the default project for the user.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Organizations.Users.ListProjects(
    context.TODO(),
    "user_id",
    llamacloudadmin.OrganizationUserListProjectsParams{
      OrganizationID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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(ctx, userID, params) (*OrganizationUserAddToProjectResponse, error)`

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

Add a user to a project.

### Parameters

- `userID string`

- `params OrganizationUserAddToProjectParams`

  - `OrganizationID param.Field[string]`

    Path param

  - `ProjectID param.Field[string]`

    Query param

### Returns

- `type OrganizationUserAddToProjectResponse interface{…}`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Organizations.Users.AddToProject(
    context.TODO(),
    "user_id",
    llamacloudadmin.OrganizationUserAddToProjectParams{
      OrganizationID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response)
}
```

#### Response

```json
{}
```

## Remove User From Project

`client.Organizations.Users.RemoveFromProject(ctx, projectID, body) (*OrganizationUserRemoveFromProjectResponse, error)`

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

Remove a user from a project.

### Parameters

- `projectID string`

- `body OrganizationUserRemoveFromProjectParams`

  - `OrganizationID param.Field[string]`

  - `UserID param.Field[string]`

### Returns

- `type OrganizationUserRemoveFromProjectResponse interface{…}`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Organizations.Users.RemoveFromProject(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.OrganizationUserRemoveFromProjectParams{
      OrganizationID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      UserID: "user_id",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response)
}
```

#### Response

```json
{}
```

# Roles

## List Roles

`client.Organizations.Roles.List(ctx, organizationID) (*[]Role, error)`

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

List all roles in an organization.

### Parameters

- `organizationID string`

### Returns

- `type OrganizationRoleListResponse []Role`

  - `ID string`

    Unique identifier

  - `Name string`

    A name for the role.

  - `Permissions []RolePermission`

    The actual permissions of the role.

    - `ID string`

      Unique identifier

    - `Access bool`

      Whether the permission is granted or not.

    - `Description string`

      A description for the permission.

    - `Name string`

      A name for the permission.

    - `CreatedAt Time`

      Creation datetime

    - `UpdatedAt Time`

      Update datetime

  - `CreatedAt Time`

    Creation datetime

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  roles, err := client.Organizations.Roles.List(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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"
  }
]
```
