# Admin

## Get Llm Info

`AdminGetLlmsInfoResponse admin().getLlmsInfo(AdminGetLlmsInfoParamsparams = AdminGetLlmsInfoParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

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

Get Llm Info

### Parameters

- `AdminGetLlmsInfoParams params`

### Returns

- `class AdminGetLlmsInfoResponse:`

  - `LlmInfo llmInfo`

    - `Optional<String> internalModelName`

    - `boolean valid`

    - `Optional<String> errorMessage`

    - `Optional<LocalDateTime> lastValidated`

### Example

```java
package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetLlmsInfoParams;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetLlmsInfoResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        AdminGetLlmsInfoResponse response = client.admin().getLlmsInfo();
    }
}
```

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

`AdminGetLicenseInfoResponse admin().getLicenseInfo(AdminGetLicenseInfoParamsparams = AdminGetLicenseInfoParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

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

Get License Info

### Parameters

- `AdminGetLicenseInfoParams params`

  - `Optional<Boolean> includeScopes`

    Whether to include scopes in the response

### Returns

- `class AdminGetLicenseInfoResponse:`

  - `LocalDateTime expiresAt`

    License expiration date

  - `String status`

    License validation status

  - `Optional<String> message`

    License message

  - `Optional<List<String>> scopes`

    License scopes

### Example

```java
package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetLicenseInfoParams;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetLicenseInfoResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        AdminGetLicenseInfoResponse response = client.admin().getLicenseInfo();
    }
}
```

#### Response

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

## Get File Store Info

`AdminGetFilestoresInfoResponse admin().getFilestoresInfo(AdminGetFilestoresInfoParamsparams = AdminGetFilestoresInfoParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

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

Get File Store Info

### Parameters

- `AdminGetFilestoresInfoParams params`

### Returns

- `class AdminGetFilestoresInfoResponse:`

  - `Status status`

    - `MISSING_BUCKETS("missing_buckets")`

    - `MISSING_CREDENTIALS("missing_credentials")`

    - `OK("ok")`

  - `Optional<AvailableBuckets> availableBuckets`

  - `Optional<UnavailableBuckets> unavailableBuckets`

### Example

```java
package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetFilestoresInfoParams;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetFilestoresInfoResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        AdminGetFilestoresInfoResponse response = client.admin().getFilestoresInfo();
    }
}
```

#### Response

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

## Get Llamaextract Features

`AdminGetLlamaextractFeaturesResponse admin().getLlamaextractFeatures(AdminGetLlamaextractFeaturesParamsparams = AdminGetLlamaextractFeaturesParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

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

Get LlamaExtract feature availability based on available models.

### Parameters

- `AdminGetLlamaextractFeaturesParams params`

### Returns

- `class AdminGetLlamaextractFeaturesResponse:`

  - `List<AvailableMode> availableModes`

    - `String mode`

    - `String parseMode`

    - `Status status`

      - `AVAILABLE("available")`

      - `UNAVAILABLE("unavailable")`

    - `Optional<List<String>> availableExtractModels`

    - `Optional<List<String>> availableParseModels`

    - `Optional<List<String>> missingExtractModels`

    - `Optional<List<String>> missingParseModels`

  - `SchemaGeneration schemaGeneration`

    - `String model`

    - `Status status`

      - `AVAILABLE("available")`

      - `UNAVAILABLE("unavailable")`

### Example

```java
package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetLlamaextractFeaturesParams;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetLlamaextractFeaturesResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        AdminGetLlamaextractFeaturesResponse response = client.admin().getLlamaextractFeatures();
    }
}
```

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

`AdminGetOcrStatusResponse admin().getOcrStatus(AdminGetOcrStatusParamsparams = AdminGetOcrStatusParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

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

Get OCR service health status including GPU availability.

### Parameters

- `AdminGetOcrStatusParams params`

### Returns

- `class AdminGetOcrStatusResponse:`

  Response model for OCR service health/GPU status.

  - `Status status`

    - `DEGRADED("degraded")`

    - `OK("ok")`

    - `UNAVAILABLE("unavailable")`

  - `Optional<String> device`

  - `Optional<String> errorMessage`

  - `Optional<Boolean> gpuAvailable`

  - `Optional<Long> gpuDeviceCount`

  - `Optional<String> gpuDeviceName`

### Example

```java
package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetOcrStatusParams;
import ai.llamaindex.llamacloudadmin.models.admin.AdminGetOcrStatusResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        AdminGetOcrStatusResponse response = client.admin().getOcrStatus();
    }
}
```

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

`UserClaims admin().users().getClaims(UserGetClaimsParamsparams = UserGetClaimsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

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

- `UserGetClaimsParams params`

  - `Optional<String> userId`

### Returns

- `class UserClaims:`

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

  - `CustomClaims claims`

    The user's resolved custom claims.

    - `Optional<Boolean> allowOrgDeletion`

      Whether the user is allowed to delete organizations.

    - `Optional<Boolean> allowedOrgCreation`

      Whether the user is allowed to create organizations.

    - `Optional<Boolean> apiDatasourceAccess`

      Whether the user is allowed to access API data sources.

    - `Optional<Long> maximumOrgCreation`

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

  - `String userId`

    The user ID the claims belong to.

### Example

```java
package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.users.UserClaims;
import ai.llamaindex.llamacloudadmin.models.admin.users.UserGetClaimsParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        UserClaims userClaims = client.admin().users().getClaims("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

`UserClaims admin().users().updateClaims(UserUpdateClaimsParamsparams = UserUpdateClaimsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

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

- `UserUpdateClaimsParams params`

  - `Optional<String> userId`

  - `Optional<List<RemoveClaim>> removeClaims`

    Names of claims to reset to their system default.

    - `ALLOW_ORG_DELETION("allow_org_deletion")`

    - `ALLOWED_ORG_CREATION("allowed_org_creation")`

    - `API_DATASOURCE_ACCESS("api_datasource_access")`

    - `MAXIMUM_ORG_CREATION("maximum_org_creation")`

  - `Optional<SetClaims> setClaims`

    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.

    - `Optional<Boolean> allowOrgDeletion`

      Whether the user is allowed to delete organizations.

    - `Optional<Boolean> allowedOrgCreation`

      Whether the user is allowed to create organizations.

    - `Optional<Boolean> apiDatasourceAccess`

      Whether the user is allowed to access API data sources.

    - `Optional<Long> maximumOrgCreation`

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

### Returns

- `class UserClaims:`

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

  - `CustomClaims claims`

    The user's resolved custom claims.

    - `Optional<Boolean> allowOrgDeletion`

      Whether the user is allowed to delete organizations.

    - `Optional<Boolean> allowedOrgCreation`

      Whether the user is allowed to create organizations.

    - `Optional<Boolean> apiDatasourceAccess`

      Whether the user is allowed to access API data sources.

    - `Optional<Long> maximumOrgCreation`

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

  - `String userId`

    The user ID the claims belong to.

### Example

```java
package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.users.UserClaims;
import ai.llamaindex.llamacloudadmin.models.admin.users.UserUpdateClaimsParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        UserClaims userClaims = client.admin().users().updateClaims("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

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

  - `Optional<Boolean> allowOrgDeletion`

    Whether the user is allowed to delete organizations.

  - `Optional<Boolean> allowedOrgCreation`

    Whether the user is allowed to create organizations.

  - `Optional<Boolean> apiDatasourceAccess`

    Whether the user is allowed to access API data sources.

  - `Optional<Long> maximumOrgCreation`

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

### User Claims

- `class UserClaims:`

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

  - `CustomClaims claims`

    The user's resolved custom claims.

    - `Optional<Boolean> allowOrgDeletion`

      Whether the user is allowed to delete organizations.

    - `Optional<Boolean> allowedOrgCreation`

      Whether the user is allowed to create organizations.

    - `Optional<Boolean> apiDatasourceAccess`

      Whether the user is allowed to access API data sources.

    - `Optional<Long> maximumOrgCreation`

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

  - `String userId`

    The user ID the claims belong to.

# Usage Metrics

## Aggregate Usage Metrics

`UsageMetricAggregateResponse admin().usageMetrics().aggregate(UsageMetricAggregateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

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

- `UsageMetricAggregateParams params`

  - `String dayOnOrAfter`

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

  - `String dayOnOrBefore`

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

  - `List<String> groupBy`

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

  - `Optional<List<EventType>> eventTypes`

    Filter by event types

    - `AUDIO_SECONDS_PARSED("audio_seconds_parsed")`

    - `CHART_PARSING_AGENTIC("chart_parsing_agentic")`

    - `CHART_PARSING_EFFICIENT("chart_parsing_efficient")`

    - `CHART_PARSING_PLUS("chart_parsing_plus")`

    - `CHAT_MESSAGE_SENT("chat_message_sent")`

    - `CONFIDENCE_SCORE_HIGH("confidence_score_high")`

    - `DIRECTORY_COUNT_SNAPSHOT("directory_count_snapshot")`

    - `DIRECTORY_FILE_COUNT_SNAPSHOT("directory_file_count_snapshot")`

    - `DIRECTORY_FILES_EXPORTED("directory_files_exported")`

    - `DIRECTORY_FILES_INGESTED("directory_files_ingested")`

    - `DIRECTORY_PAGES_EXPORTED("directory_pages_exported")`

    - `EXTRACTION_NUM_PAGES("extraction_num_pages")`

    - `FORM_PARSING_PAGES("form_parsing_pages")`

    - `IMAGE_CLASSIFIED("image_classified")`

    - `INDEX_RETRIEVE_QUERY("index_retrieve_query")`

    - `LAYOUT_AWARE_CHART_EXTRACTION("layout_aware_chart_extraction")`

    - `LAYOUT_AWARE_PARSING("layout_aware_parsing")`

    - `LAYOUT_EXTRACTED("layout_extracted")`

    - `PAGES_CLASSIFIED("pages_classified")`

    - `PAGES_EMBEDDED("pages_embedded")`

    - `PAGES_INDEXED("pages_indexed")`

    - `PAGES_PARSED("pages_parsed")`

    - `PAGES_SPLIT("pages_split")`

    - `PAGES_VERIFIED("pages_verified")`

    - `PRECISE_BBOX_EXTRACTION("precise_bbox_extraction")`

    - `SET_TOTAL_INDEXES("set_total_indexes")`

    - `SET_TOTAL_PAGES_INDEXED("set_total_pages_indexed")`

    - `SPREADSHEET_REGIONS_EXTRACTED("spreadsheet_regions_extracted")`

    - `STORED_FILE_COUNT("stored_file_count")`

    - `STORED_FILE_MB("stored_file_mb")`

  - `Optional<String> organizationId`

    Filter by organization ID

  - `Optional<String> projectId`

    Filter by project ID

  - `Optional<String> userId`

    Filter by user ID

### Returns

- `class UsageMetricAggregateResponse:`

  Response containing usage metrics aggregated by one or more dimensions.

  - `List<Bucket> buckets`

    The aggregation buckets, ordered by total credits descending

    - `Dimensions dimensions`

      The dimension values that define this bucket

    - `long metricCount`

      Number of metric rows in this bucket

    - `TotalCredits totalCredits`

      Total credits consumed by metrics in this bucket

      - `double`

      - `String`

    - `long totalValue`

      Total of the metric `value` field in this bucket

  - `List<GroupBy> groupBy`

    The dimensions the metrics were grouped by

    - `DAY("day")`

    - `EVENT_TYPE("event_type")`

    - `ORGANIZATION_ID("organization_id")`

    - `PROJECT_ID("project_id")`

    - `USER_ID("user_id")`

### Example

```java
package ai.llamaindex.llamacloudadmin.example;

import ai.llamaindex.llamacloudadmin.client.LlamaCloudAdminClient;
import ai.llamaindex.llamacloudadmin.client.okhttp.LlamaCloudAdminOkHttpClient;
import ai.llamaindex.llamacloudadmin.models.admin.usagemetrics.UsageMetricAggregateParams;
import ai.llamaindex.llamacloudadmin.models.admin.usagemetrics.UsageMetricAggregateResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudAdminClient client = LlamaCloudAdminOkHttpClient.fromEnv();

        UsageMetricAggregateParams params = UsageMetricAggregateParams.builder()
            .dayOnOrAfter("day_on_or_after")
            .dayOnOrBefore("day_on_or_before")
            .addGroupBy("string")
            .build();
        UsageMetricAggregateResponse response = client.admin().usageMetrics().aggregate(params);
    }
}
```

#### Response

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