# Admin

## Get Llm Info

`client.Admin.GetLlmsInfo(ctx) (*AdminGetLlmsInfoResponse, error)`

**get** `/api/v1/admin/llms/info`

Get Llm Info

### Returns

- `type AdminGetLlmsInfoResponse struct{…}`

  - `LlmInfo map[string, map[string, AdminGetLlmsInfoResponseLlmInfo]]`

    - `InternalModelName string`

    - `Valid bool`

    - `ErrorMessage string`

    - `LastValidated Time`

### 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.Admin.GetLlmsInfo(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.LlmInfo)
}
```

#### Response

```json
{
  "llm_info": {
    "foo": {
      "foo": {
        "internal_model_name": "internal_model_name",
        "valid": true,
        "error_message": "error_message",
        "last_validated": "2019-12-27T18:11:19.117Z"
      }
    }
  }
}
```

## Get License Info

`client.Admin.GetLicenseInfo(ctx, query) (*AdminGetLicenseInfoResponse, error)`

**get** `/api/v1/admin/license/info`

Get License Info

### Parameters

- `query AdminGetLicenseInfoParams`

  - `IncludeScopes param.Field[bool]`

    Whether to include scopes in the response

### Returns

- `type AdminGetLicenseInfoResponse struct{…}`

  - `ExpiresAt Time`

    License expiration date

  - `Status string`

    License validation status

  - `Message string`

    License message

  - `Scopes []string`

    License scopes

### 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.Admin.GetLicenseInfo(context.TODO(), llamacloudadmin.AdminGetLicenseInfoParams{

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

#### Response

```json
{
  "expires_at": "2019-12-27T18:11:19.117Z",
  "status": "status",
  "message": "message",
  "scopes": [
    "string"
  ]
}
```

## Get File Store Info

`client.Admin.GetFilestoresInfo(ctx) (*AdminGetFilestoresInfoResponse, error)`

**get** `/api/v1/admin/filestores/info`

Get File Store Info

### Returns

- `type AdminGetFilestoresInfoResponse struct{…}`

  - `Status AdminGetFilestoresInfoResponseStatus`

    - `const AdminGetFilestoresInfoResponseStatusMissingBuckets AdminGetFilestoresInfoResponseStatus = "missing_buckets"`

    - `const AdminGetFilestoresInfoResponseStatusMissingCredentials AdminGetFilestoresInfoResponseStatus = "missing_credentials"`

    - `const AdminGetFilestoresInfoResponseStatusOk AdminGetFilestoresInfoResponseStatus = "ok"`

  - `AvailableBuckets map[string, string]`

  - `UnavailableBuckets map[string, string]`

### 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.Admin.GetFilestoresInfo(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Status)
}
```

#### Response

```json
{
  "status": "missing_buckets",
  "available_buckets": {
    "foo": "string"
  },
  "unavailable_buckets": {
    "foo": "string"
  }
}
```

## Get Llamaextract Features

`client.Admin.GetLlamaextractFeatures(ctx) (*AdminGetLlamaextractFeaturesResponse, error)`

**get** `/api/v1/admin/llamaextract/features`

Get LlamaExtract feature availability based on available models.

### Returns

- `type AdminGetLlamaextractFeaturesResponse struct{…}`

  - `AvailableModes []AdminGetLlamaextractFeaturesResponseAvailableMode`

    - `Mode string`

    - `ParseMode string`

    - `Status string`

      - `const AdminGetLlamaextractFeaturesResponseAvailableModeStatusAvailable AdminGetLlamaextractFeaturesResponseAvailableModeStatus = "available"`

      - `const AdminGetLlamaextractFeaturesResponseAvailableModeStatusUnavailable AdminGetLlamaextractFeaturesResponseAvailableModeStatus = "unavailable"`

    - `AvailableExtractModels []string`

    - `AvailableParseModels []string`

    - `MissingExtractModels []string`

    - `MissingParseModels []string`

  - `SchemaGeneration AdminGetLlamaextractFeaturesResponseSchemaGeneration`

    - `Model string`

    - `Status string`

      - `const AdminGetLlamaextractFeaturesResponseSchemaGenerationStatusAvailable AdminGetLlamaextractFeaturesResponseSchemaGenerationStatus = "available"`

      - `const AdminGetLlamaextractFeaturesResponseSchemaGenerationStatusUnavailable AdminGetLlamaextractFeaturesResponseSchemaGenerationStatus = "unavailable"`

### 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.Admin.GetLlamaextractFeatures(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.AvailableModes)
}
```

#### Response

```json
{
  "available_modes": [
    {
      "mode": "mode",
      "parse_mode": "parse_mode",
      "status": "available",
      "available_extract_models": [
        "string"
      ],
      "available_parse_models": [
        "string"
      ],
      "missing_extract_models": [
        "string"
      ],
      "missing_parse_models": [
        "string"
      ]
    }
  ],
  "schema_generation": {
    "model": "model",
    "status": "available"
  }
}
```

## Get Ocr Health

`client.Admin.GetOcrStatus(ctx) (*AdminGetOcrStatusResponse, error)`

**get** `/api/v1/admin/ocr/statusz`

Get OCR service health status including GPU availability.

### Returns

- `type AdminGetOcrStatusResponse struct{…}`

  Response model for OCR service health/GPU status.

  - `Status AdminGetOcrStatusResponseStatus`

    - `const AdminGetOcrStatusResponseStatusDegraded AdminGetOcrStatusResponseStatus = "degraded"`

    - `const AdminGetOcrStatusResponseStatusOk AdminGetOcrStatusResponseStatus = "ok"`

    - `const AdminGetOcrStatusResponseStatusUnavailable AdminGetOcrStatusResponseStatus = "unavailable"`

  - `Device string`

  - `ErrorMessage string`

  - `GPUAvailable bool`

  - `GPUDeviceCount int64`

  - `GPUDeviceName string`

### 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.Admin.GetOcrStatus(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Status)
}
```

#### Response

```json
{
  "status": "degraded",
  "device": "device",
  "error_message": "error_message",
  "gpu_available": true,
  "gpu_device_count": 0,
  "gpu_device_name": "gpu_device_name"
}
```

# Users

## Get User Claims

`client.Admin.Users.GetClaims(ctx, userID) (*UserClaims, error)`

**get** `/api/v1/admin/users/{user_id}/claims`

Get a user's resolved custom claims.

Claims that have not been explicitly set fall back to their system default. Returns 404 if the user does not exist.

Global admin only.

### Parameters

- `userID string`

### Returns

- `type UserClaims struct{…}`

  A user's fully resolved custom claims after applying system defaults.

  - `Claims CustomClaims`

    The user's resolved custom claims.

    - `AllowOrgDeletion bool`

      Whether the user is allowed to delete organizations.

    - `AllowedOrgCreation bool`

      Whether the user is allowed to create organizations.

    - `APIDatasourceAccess bool`

      Whether the user is allowed to access API data sources.

    - `MaximumOrgCreation int64`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

  - `UserID string`

    The user ID the claims belong to.

### 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"),
  )
  userClaims, err := client.Admin.Users.GetClaims(context.TODO(), "user_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", userClaims.UserID)
}
```

#### Response

```json
{
  "claims": {
    "allow_org_deletion": true,
    "allowed_org_creation": true,
    "api_datasource_access": true,
    "maximum_org_creation": 0
  },
  "user_id": "user_id"
}
```

## Update User Claims

`client.Admin.Users.UpdateClaims(ctx, userID, body) (*UserClaims, error)`

**patch** `/api/v1/admin/users/{user_id}/claims`

Additively update a user's custom claims.

Claims in `set_claims` are added or overwritten; claims named in `remove_claims` are reset to their system default. Claims not referenced by either field are left unchanged, so a single claim can be changed without resending the full set. Returns the user's resolved claims after the update.

Returns 404 if the user does not exist.

Global admin only.

### Parameters

- `userID string`

- `body AdminUserUpdateClaimsParams`

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

    Names of claims to reset to their system default.

    - `const AdminUserUpdateClaimsParamsRemoveClaimAllowOrgDeletion AdminUserUpdateClaimsParamsRemoveClaim = "allow_org_deletion"`

    - `const AdminUserUpdateClaimsParamsRemoveClaimAllowedOrgCreation AdminUserUpdateClaimsParamsRemoveClaim = "allowed_org_creation"`

    - `const AdminUserUpdateClaimsParamsRemoveClaimAPIDatasourceAccess AdminUserUpdateClaimsParamsRemoveClaim = "api_datasource_access"`

    - `const AdminUserUpdateClaimsParamsRemoveClaimMaximumOrgCreation AdminUserUpdateClaimsParamsRemoveClaim = "maximum_org_creation"`

  - `SetClaims param.Field[AdminUserUpdateClaimsParamsSetClaims]`

    A partial set of custom claims for additive updates.

    Every field is optional. Only the claims explicitly provided in a request
    are added or overwritten; claims left unset are not touched, so callers can
    change a single claim without resending the full claim set.

    - `AllowOrgDeletion bool`

      Whether the user is allowed to delete organizations.

    - `AllowedOrgCreation bool`

      Whether the user is allowed to create organizations.

    - `APIDatasourceAccess bool`

      Whether the user is allowed to access API data sources.

    - `MaximumOrgCreation int64`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

### Returns

- `type UserClaims struct{…}`

  A user's fully resolved custom claims after applying system defaults.

  - `Claims CustomClaims`

    The user's resolved custom claims.

    - `AllowOrgDeletion bool`

      Whether the user is allowed to delete organizations.

    - `AllowedOrgCreation bool`

      Whether the user is allowed to create organizations.

    - `APIDatasourceAccess bool`

      Whether the user is allowed to access API data sources.

    - `MaximumOrgCreation int64`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

  - `UserID string`

    The user ID the claims belong to.

### 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"),
  )
  userClaims, err := client.Admin.Users.UpdateClaims(
    context.TODO(),
    "user_id",
    llamacloudadmin.AdminUserUpdateClaimsParams{

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

#### Response

```json
{
  "claims": {
    "allow_org_deletion": true,
    "allowed_org_creation": true,
    "api_datasource_access": true,
    "maximum_org_creation": 0
  },
  "user_id": "user_id"
}
```

## Domain Types

### Custom Claims

- `type CustomClaims struct{…}`

  Custom claims that dictate various limits or allowed behaviors.
  Currently these claims reside at a per user level. Claims may expand to a per organization level or project in the future.

  - `AllowOrgDeletion bool`

    Whether the user is allowed to delete organizations.

  - `AllowedOrgCreation bool`

    Whether the user is allowed to create organizations.

  - `APIDatasourceAccess bool`

    Whether the user is allowed to access API data sources.

  - `MaximumOrgCreation int64`

    Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

### User Claims

- `type UserClaims struct{…}`

  A user's fully resolved custom claims after applying system defaults.

  - `Claims CustomClaims`

    The user's resolved custom claims.

    - `AllowOrgDeletion bool`

      Whether the user is allowed to delete organizations.

    - `AllowedOrgCreation bool`

      Whether the user is allowed to create organizations.

    - `APIDatasourceAccess bool`

      Whether the user is allowed to access API data sources.

    - `MaximumOrgCreation int64`

      Cap on how many organizations this user may create. None means unlimited. Only enforced when allowed_org_creation is True.

  - `UserID string`

    The user ID the claims belong to.

# Usage Metrics

## Aggregate Usage Metrics

`client.Admin.UsageMetrics.Aggregate(ctx, query) (*AdminUsageMetricAggregateResponse, error)`

**get** `/api/v1/admin/usage-metrics/aggregate`

Aggregate usage metrics by one or more dimensions, reporting total credits used. Global admin only.

A date range is required, which bounds the scan via the `day`-leading index. Supplying `organization_id` narrows it further via the `(organization_id, day)` index.

Supported `group_by` dimensions: `day`, `organization_id`, `project_id`, `event_type`, `user_id`. Buckets are ordered by total credits descending.

### Parameters

- `query AdminUsageMetricAggregateParams`

  - `DayOnOrAfter param.Field[string]`

    Inclusive lower bound on the day (YYYY-MM-DD, UTC)

  - `DayOnOrBefore param.Field[string]`

    Inclusive upper bound on the day (YYYY-MM-DD, UTC)

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

    Dimensions to group by: day, organization_id, project_id, event_type, user_id

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

    Filter by event types

    - `const AdminUsageMetricAggregateParamsEventTypeAudioSecondsParsed AdminUsageMetricAggregateParamsEventType = "audio_seconds_parsed"`

    - `const AdminUsageMetricAggregateParamsEventTypeChartParsingAgentic AdminUsageMetricAggregateParamsEventType = "chart_parsing_agentic"`

    - `const AdminUsageMetricAggregateParamsEventTypeChartParsingEfficient AdminUsageMetricAggregateParamsEventType = "chart_parsing_efficient"`

    - `const AdminUsageMetricAggregateParamsEventTypeChartParsingPlus AdminUsageMetricAggregateParamsEventType = "chart_parsing_plus"`

    - `const AdminUsageMetricAggregateParamsEventTypeChatMessageSent AdminUsageMetricAggregateParamsEventType = "chat_message_sent"`

    - `const AdminUsageMetricAggregateParamsEventTypeConfidenceScoreHigh AdminUsageMetricAggregateParamsEventType = "confidence_score_high"`

    - `const AdminUsageMetricAggregateParamsEventTypeDirectoryCountSnapshot AdminUsageMetricAggregateParamsEventType = "directory_count_snapshot"`

    - `const AdminUsageMetricAggregateParamsEventTypeDirectoryFileCountSnapshot AdminUsageMetricAggregateParamsEventType = "directory_file_count_snapshot"`

    - `const AdminUsageMetricAggregateParamsEventTypeDirectoryFilesExported AdminUsageMetricAggregateParamsEventType = "directory_files_exported"`

    - `const AdminUsageMetricAggregateParamsEventTypeDirectoryFilesIngested AdminUsageMetricAggregateParamsEventType = "directory_files_ingested"`

    - `const AdminUsageMetricAggregateParamsEventTypeDirectoryPagesExported AdminUsageMetricAggregateParamsEventType = "directory_pages_exported"`

    - `const AdminUsageMetricAggregateParamsEventTypeExtractionNumPages AdminUsageMetricAggregateParamsEventType = "extraction_num_pages"`

    - `const AdminUsageMetricAggregateParamsEventTypeFormParsingPages AdminUsageMetricAggregateParamsEventType = "form_parsing_pages"`

    - `const AdminUsageMetricAggregateParamsEventTypeImageClassified AdminUsageMetricAggregateParamsEventType = "image_classified"`

    - `const AdminUsageMetricAggregateParamsEventTypeIndexRetrieveQuery AdminUsageMetricAggregateParamsEventType = "index_retrieve_query"`

    - `const AdminUsageMetricAggregateParamsEventTypeLayoutAwareChartExtraction AdminUsageMetricAggregateParamsEventType = "layout_aware_chart_extraction"`

    - `const AdminUsageMetricAggregateParamsEventTypeLayoutAwareParsing AdminUsageMetricAggregateParamsEventType = "layout_aware_parsing"`

    - `const AdminUsageMetricAggregateParamsEventTypeLayoutExtracted AdminUsageMetricAggregateParamsEventType = "layout_extracted"`

    - `const AdminUsageMetricAggregateParamsEventTypePagesClassified AdminUsageMetricAggregateParamsEventType = "pages_classified"`

    - `const AdminUsageMetricAggregateParamsEventTypePagesEmbedded AdminUsageMetricAggregateParamsEventType = "pages_embedded"`

    - `const AdminUsageMetricAggregateParamsEventTypePagesIndexed AdminUsageMetricAggregateParamsEventType = "pages_indexed"`

    - `const AdminUsageMetricAggregateParamsEventTypePagesParsed AdminUsageMetricAggregateParamsEventType = "pages_parsed"`

    - `const AdminUsageMetricAggregateParamsEventTypePagesSplit AdminUsageMetricAggregateParamsEventType = "pages_split"`

    - `const AdminUsageMetricAggregateParamsEventTypePagesVerified AdminUsageMetricAggregateParamsEventType = "pages_verified"`

    - `const AdminUsageMetricAggregateParamsEventTypePreciseBboxExtraction AdminUsageMetricAggregateParamsEventType = "precise_bbox_extraction"`

    - `const AdminUsageMetricAggregateParamsEventTypeSetTotalIndexes AdminUsageMetricAggregateParamsEventType = "set_total_indexes"`

    - `const AdminUsageMetricAggregateParamsEventTypeSetTotalPagesIndexed AdminUsageMetricAggregateParamsEventType = "set_total_pages_indexed"`

    - `const AdminUsageMetricAggregateParamsEventTypeSpreadsheetRegionsExtracted AdminUsageMetricAggregateParamsEventType = "spreadsheet_regions_extracted"`

    - `const AdminUsageMetricAggregateParamsEventTypeStoredFileCount AdminUsageMetricAggregateParamsEventType = "stored_file_count"`

    - `const AdminUsageMetricAggregateParamsEventTypeStoredFileMB AdminUsageMetricAggregateParamsEventType = "stored_file_mb"`

  - `OrganizationID param.Field[string]`

    Filter by organization ID

  - `ProjectID param.Field[string]`

    Filter by project ID

  - `UserID param.Field[string]`

    Filter by user ID

### Returns

- `type AdminUsageMetricAggregateResponse struct{…}`

  Response containing usage metrics aggregated by one or more dimensions.

  - `Buckets []AdminUsageMetricAggregateResponseBucket`

    The aggregation buckets, ordered by total credits descending

    - `Dimensions map[string, string]`

      The dimension values that define this bucket

    - `MetricCount int64`

      Number of metric rows in this bucket

    - `TotalCredits AdminUsageMetricAggregateResponseBucketTotalCreditsUnion`

      Total credits consumed by metrics in this bucket

      - `float64`

      - `string`

    - `TotalValue int64`

      Total of the metric `value` field in this bucket

  - `GroupBy []string`

    The dimensions the metrics were grouped by

    - `const AdminUsageMetricAggregateResponseGroupByDay AdminUsageMetricAggregateResponseGroupBy = "day"`

    - `const AdminUsageMetricAggregateResponseGroupByEventType AdminUsageMetricAggregateResponseGroupBy = "event_type"`

    - `const AdminUsageMetricAggregateResponseGroupByOrganizationID AdminUsageMetricAggregateResponseGroupBy = "organization_id"`

    - `const AdminUsageMetricAggregateResponseGroupByProjectID AdminUsageMetricAggregateResponseGroupBy = "project_id"`

    - `const AdminUsageMetricAggregateResponseGroupByUserID AdminUsageMetricAggregateResponseGroupBy = "user_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"),
  )
  response, err := client.Admin.UsageMetrics.Aggregate(context.TODO(), llamacloudadmin.AdminUsageMetricAggregateParams{
    DayOnOrAfter: "day_on_or_after",
    DayOnOrBefore: "day_on_or_before",
    GroupBy: []string{"string"},
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Buckets)
}
```

#### Response

```json
{
  "buckets": [
    {
      "dimensions": {
        "foo": "string"
      },
      "metric_count": 0,
      "total_credits": 0,
      "total_value": 0
    }
  ],
  "group_by": [
    "day"
  ]
}
```
