# Admin

## Get Llm Info

`client.admin.getLlmsInfo(RequestOptionsoptions?): AdminGetLlmsInfoResponse`

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

Get Llm Info

### Returns

- `AdminGetLlmsInfoResponse`

  - `llm_info: Record<string, Record<string, ValidationStatus>>`

    - `internal_model_name: string | null`

    - `valid: boolean`

    - `error_message?: string | null`

    - `last_validated?: string`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.admin.getLlmsInfo();

console.log(response.llm_info);
```

#### 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(AdminGetLicenseInfoParamsquery?, RequestOptionsoptions?): AdminGetLicenseInfoResponse`

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

Get License Info

### Parameters

- `query: AdminGetLicenseInfoParams`

  - `include_scopes?: boolean`

    Whether to include scopes in the response

### Returns

- `AdminGetLicenseInfoResponse`

  - `expires_at: string`

    License expiration date

  - `status: string`

    License validation status

  - `message?: string | null`

    License message

  - `scopes?: Array<string> | null`

    License scopes

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.admin.getLicenseInfo();

console.log(response.expires_at);
```

#### Response

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

## Get File Store Info

`client.admin.getFilestoresInfo(RequestOptionsoptions?): AdminGetFilestoresInfoResponse`

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

Get File Store Info

### Returns

- `AdminGetFilestoresInfoResponse`

  - `status: "missing_buckets" | "missing_credentials" | "ok"`

    - `"missing_buckets"`

    - `"missing_credentials"`

    - `"ok"`

  - `available_buckets?: Record<string, string>`

  - `unavailable_buckets?: Record<string, string>`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.admin.getFilestoresInfo();

console.log(response.status);
```

#### Response

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

## Get Llamaextract Features

`client.admin.getLlamaextractFeatures(RequestOptionsoptions?): AdminGetLlamaextractFeaturesResponse`

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

Get LlamaExtract feature availability based on available models.

### Returns

- `AdminGetLlamaextractFeaturesResponse`

  - `available_modes: Array<AvailableMode>`

    - `mode: string`

    - `parse_mode: string`

    - `status: "available" | "unavailable"`

      - `"available"`

      - `"unavailable"`

    - `available_extract_models?: Array<string>`

    - `available_parse_models?: Array<string>`

    - `missing_extract_models?: Array<string>`

    - `missing_parse_models?: Array<string>`

  - `schema_generation: SchemaGeneration`

    - `model: string`

    - `status: "available" | "unavailable"`

      - `"available"`

      - `"unavailable"`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.admin.getLlamaextractFeatures();

console.log(response.available_modes);
```

#### 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(RequestOptionsoptions?): AdminGetOcrStatusResponse`

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

Get OCR service health status including GPU availability.

### Returns

- `AdminGetOcrStatusResponse`

  Response model for OCR service health/GPU status.

  - `status: "degraded" | "ok" | "unavailable"`

    - `"degraded"`

    - `"ok"`

    - `"unavailable"`

  - `device?: string`

  - `error_message?: string | null`

  - `gpu_available?: boolean`

  - `gpu_device_count?: number | null`

  - `gpu_device_name?: string | null`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.admin.getOcrStatus();

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

## Domain Types

### Admin Get Llms Info Response

- `AdminGetLlmsInfoResponse`

  - `llm_info: Record<string, Record<string, ValidationStatus>>`

    - `internal_model_name: string | null`

    - `valid: boolean`

    - `error_message?: string | null`

    - `last_validated?: string`

### Admin Get License Info Response

- `AdminGetLicenseInfoResponse`

  - `expires_at: string`

    License expiration date

  - `status: string`

    License validation status

  - `message?: string | null`

    License message

  - `scopes?: Array<string> | null`

    License scopes

### Admin Get Filestores Info Response

- `AdminGetFilestoresInfoResponse`

  - `status: "missing_buckets" | "missing_credentials" | "ok"`

    - `"missing_buckets"`

    - `"missing_credentials"`

    - `"ok"`

  - `available_buckets?: Record<string, string>`

  - `unavailable_buckets?: Record<string, string>`

### Admin Get Llamaextract Features Response

- `AdminGetLlamaextractFeaturesResponse`

  - `available_modes: Array<AvailableMode>`

    - `mode: string`

    - `parse_mode: string`

    - `status: "available" | "unavailable"`

      - `"available"`

      - `"unavailable"`

    - `available_extract_models?: Array<string>`

    - `available_parse_models?: Array<string>`

    - `missing_extract_models?: Array<string>`

    - `missing_parse_models?: Array<string>`

  - `schema_generation: SchemaGeneration`

    - `model: string`

    - `status: "available" | "unavailable"`

      - `"available"`

      - `"unavailable"`

### Admin Get Ocr Status Response

- `AdminGetOcrStatusResponse`

  Response model for OCR service health/GPU status.

  - `status: "degraded" | "ok" | "unavailable"`

    - `"degraded"`

    - `"ok"`

    - `"unavailable"`

  - `device?: string`

  - `error_message?: string | null`

  - `gpu_available?: boolean`

  - `gpu_device_count?: number | null`

  - `gpu_device_name?: string | null`

# Users

## Get User Claims

`client.admin.users.getClaims(stringuserID, RequestOptionsoptions?): UserClaims`

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

- `UserClaims`

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

  - `claims: CustomClaims`

    The user's resolved custom claims.

    - `allow_org_deletion?: boolean`

      Whether the user is allowed to delete organizations.

    - `allowed_org_creation?: boolean`

      Whether the user is allowed to create organizations.

    - `api_datasource_access?: boolean`

      Whether the user is allowed to access API data sources.

    - `maximum_org_creation?: number | null`

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

  - `user_id: string`

    The user ID the claims belong to.

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const userClaims = await client.admin.users.getClaims('user_id');

console.log(userClaims.user_id);
```

#### 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(stringuserID, UserUpdateClaimsParamsbody, RequestOptionsoptions?): UserClaims`

**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: UserUpdateClaimsParams`

  - `remove_claims?: Array<"allow_org_deletion" | "allowed_org_creation" | "api_datasource_access" | "maximum_org_creation"> | null`

    Names of claims to reset to their system default.

    - `"allow_org_deletion"`

    - `"allowed_org_creation"`

    - `"api_datasource_access"`

    - `"maximum_org_creation"`

  - `set_claims?: SetClaims | null`

    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.

    - `allow_org_deletion?: boolean | null`

      Whether the user is allowed to delete organizations.

    - `allowed_org_creation?: boolean | null`

      Whether the user is allowed to create organizations.

    - `api_datasource_access?: boolean | null`

      Whether the user is allowed to access API data sources.

    - `maximum_org_creation?: number | null`

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

### Returns

- `UserClaims`

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

  - `claims: CustomClaims`

    The user's resolved custom claims.

    - `allow_org_deletion?: boolean`

      Whether the user is allowed to delete organizations.

    - `allowed_org_creation?: boolean`

      Whether the user is allowed to create organizations.

    - `api_datasource_access?: boolean`

      Whether the user is allowed to access API data sources.

    - `maximum_org_creation?: number | null`

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

  - `user_id: string`

    The user ID the claims belong to.

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const userClaims = await client.admin.users.updateClaims('user_id');

console.log(userClaims.user_id);
```

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

- `CustomClaims`

  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.

  - `allow_org_deletion?: boolean`

    Whether the user is allowed to delete organizations.

  - `allowed_org_creation?: boolean`

    Whether the user is allowed to create organizations.

  - `api_datasource_access?: boolean`

    Whether the user is allowed to access API data sources.

  - `maximum_org_creation?: number | null`

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

### User Claims

- `UserClaims`

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

  - `claims: CustomClaims`

    The user's resolved custom claims.

    - `allow_org_deletion?: boolean`

      Whether the user is allowed to delete organizations.

    - `allowed_org_creation?: boolean`

      Whether the user is allowed to create organizations.

    - `api_datasource_access?: boolean`

      Whether the user is allowed to access API data sources.

    - `maximum_org_creation?: number | null`

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

  - `user_id: string`

    The user ID the claims belong to.

# Usage Metrics

## Aggregate Usage Metrics

`client.admin.usageMetrics.aggregate(UsageMetricAggregateParamsquery, RequestOptionsoptions?): UsageMetricAggregateResponse`

**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: UsageMetricAggregateParams`

  - `day_on_or_after: string`

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

  - `day_on_or_before: string`

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

  - `group_by: Array<string>`

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

  - `event_types?: Array<"audio_seconds_parsed" | "chart_parsing_agentic" | "chart_parsing_efficient" | 27 more> | null`

    Filter by event types

    - `"audio_seconds_parsed"`

    - `"chart_parsing_agentic"`

    - `"chart_parsing_efficient"`

    - `"chart_parsing_plus"`

    - `"chat_message_sent"`

    - `"confidence_score_high"`

    - `"directory_count_snapshot"`

    - `"directory_file_count_snapshot"`

    - `"directory_files_exported"`

    - `"directory_files_ingested"`

    - `"directory_pages_exported"`

    - `"extraction_num_pages"`

    - `"form_parsing_pages"`

    - `"image_classified"`

    - `"index_retrieve_query"`

    - `"layout_aware_chart_extraction"`

    - `"layout_aware_parsing"`

    - `"layout_extracted"`

    - `"pages_classified"`

    - `"pages_embedded"`

    - `"pages_indexed"`

    - `"pages_parsed"`

    - `"pages_split"`

    - `"pages_verified"`

    - `"precise_bbox_extraction"`

    - `"set_total_indexes"`

    - `"set_total_pages_indexed"`

    - `"spreadsheet_regions_extracted"`

    - `"stored_file_count"`

    - `"stored_file_mb"`

  - `organization_id?: string | null`

    Filter by organization ID

  - `project_id?: string | null`

    Filter by project ID

  - `user_id?: string | null`

    Filter by user ID

### Returns

- `UsageMetricAggregateResponse`

  Response containing usage metrics aggregated by one or more dimensions.

  - `buckets: Array<Bucket>`

    The aggregation buckets, ordered by total credits descending

    - `dimensions: Record<string, string>`

      The dimension values that define this bucket

    - `metric_count: number`

      Number of metric rows in this bucket

    - `total_credits: number | string`

      Total credits consumed by metrics in this bucket

      - `number`

      - `string`

    - `total_value: number`

      Total of the metric `value` field in this bucket

  - `group_by: Array<"day" | "event_type" | "organization_id" | 2 more>`

    The dimensions the metrics were grouped by

    - `"day"`

    - `"event_type"`

    - `"organization_id"`

    - `"project_id"`

    - `"user_id"`

### Example

```typescript
import LlamaCloudAdmin from '@llamaindex/llama-cloud-admin';

const client = new LlamaCloudAdmin({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const response = await client.admin.usageMetrics.aggregate({
  day_on_or_after: 'day_on_or_after',
  day_on_or_before: 'day_on_or_before',
  group_by: ['string'],
});

console.log(response.buckets);
```

#### Response

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

## Domain Types

### Usage Metric Aggregate Response

- `UsageMetricAggregateResponse`

  Response containing usage metrics aggregated by one or more dimensions.

  - `buckets: Array<Bucket>`

    The aggregation buckets, ordered by total credits descending

    - `dimensions: Record<string, string>`

      The dimension values that define this bucket

    - `metric_count: number`

      Number of metric rows in this bucket

    - `total_credits: number | string`

      Total credits consumed by metrics in this bucket

      - `number`

      - `string`

    - `total_value: number`

      Total of the metric `value` field in this bucket

  - `group_by: Array<"day" | "event_type" | "organization_id" | 2 more>`

    The dimensions the metrics were grouped by

    - `"day"`

    - `"event_type"`

    - `"organization_id"`

    - `"project_id"`

    - `"user_id"`
