# Indexes

## Get Index

`IndexGetResponse beta().indexes().get(IndexGetParamsparams = IndexGetParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

**get** `/api/v1/indexes/{index_id}`

Get an index by ID.

### Parameters

- `IndexGetParams params`

  - `Optional<String> indexId`

  - `Optional<String> organizationId`

  - `Optional<String> projectId`

### Returns

- `class IndexGetResponse:`

  A searchable index over a directory of documents.

  - `String id`

    Unique identifier

  - `String exportConfigId`

    ID of the export configuration.

  - `String name`

    Index name.

  - `String projectId`

    Project this index belongs to.

  - `String sourceDirectoryId`

    ID of the source directory.

  - `String syncConfigId`

    ID of the sync configuration.

  - `Optional<LocalDateTime> createdAt`

    Creation datetime

  - `Optional<String> description`

    Index description.

  - `Optional<LocalDateTime> lastExportedAt`

    Last export time.

  - `Optional<LocalDateTime> lastSyncedAt`

    Last sync time.

  - `Optional<Metadata> metadata`

    Build state and diagnostic info.

  - `Optional<LocalDateTime> updatedAt`

    Update datetime

### Example

```java
package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.beta.indexes.IndexGetParams;
import com.llamacloud_prod.api.models.beta.indexes.IndexGetResponse;

public final class Main {
    private Main() {}

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

        IndexGetResponse index = client.beta().indexes().get("index_id");
    }
}
```

#### Response

```json
{
  "id": "id",
  "export_config_id": "export_config_id",
  "name": "name",
  "project_id": "project_id",
  "source_directory_id": "source_directory_id",
  "sync_config_id": "sync_config_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "last_exported_at": "2019-12-27T18:11:19.117Z",
  "last_synced_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Index

`beta().indexes().delete(IndexDeleteParamsparams = IndexDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

**delete** `/api/v1/indexes/{index_id}`

Delete an index.

### Parameters

- `IndexDeleteParams params`

  - `Optional<String> indexId`

  - `Optional<String> organizationId`

  - `Optional<String> projectId`

### Example

```java
package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.beta.indexes.IndexDeleteParams;

public final class Main {
    private Main() {}

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

        client.beta().indexes().delete("index_id");
    }
}
```

## Create Index

`IndexCreateResponse beta().indexes().create(IndexCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

**post** `/api/v1/indexes`

Create a searchable index over a source directory.

### Parameters

- `IndexCreateParams params`

  - `Optional<String> organizationId`

  - `Optional<String> projectId`

  - `String sourceDirectoryId`

    ID of the source directory containing your documents.

  - `Optional<String> description`

    Optional description of the index.

  - `Optional<String> name`

    Optional display name for the index. If omitted, the index is named after the source directory.

  - `Optional<List<Product>> products`

    Product configurations for syncing. Omit to use a default parse configuration. Include an explicit entry per product type (e.g. parse, extract) to override the default.

    - `String productConfigId`

      ID of the product configuration.

    - `String productType`

      Product type. One of: parse, extract.

  - `Optional<List<String>> storeAttachments`

    Attachment kinds to store alongside parsed output. Each entry must be one of: screenshots, items. For example, ['screenshots'] renders and stores per-page screenshots; ['items'] stores structured items with bounding boxes. Omit or pass an empty list to skip attachments.

  - `Optional<String> syncFrequency`

    How often to re-run the sync. One of: manual, daily, on_source_change. Defaults to manual.

  - `Optional<VectorTarget> vectorTarget`

    Vector export destination for the index. 'DEFAULT' exports to the managed vector DB destination resolved from configuration. 'DISABLED' skips vector export — the export destination falls back to 'Download'.

    - `DEFAULT("DEFAULT")`

    - `DISABLED("DISABLED")`

### Returns

- `class IndexCreateResponse:`

  A searchable index over a directory of documents.

  - `String id`

    Unique identifier

  - `String exportConfigId`

    ID of the export configuration.

  - `String name`

    Index name.

  - `String projectId`

    Project this index belongs to.

  - `String sourceDirectoryId`

    ID of the source directory.

  - `String syncConfigId`

    ID of the sync configuration.

  - `Optional<LocalDateTime> createdAt`

    Creation datetime

  - `Optional<String> description`

    Index description.

  - `Optional<LocalDateTime> lastExportedAt`

    Last export time.

  - `Optional<LocalDateTime> lastSyncedAt`

    Last sync time.

  - `Optional<Metadata> metadata`

    Build state and diagnostic info.

  - `Optional<LocalDateTime> updatedAt`

    Update datetime

### Example

```java
package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.beta.indexes.IndexCreateParams;
import com.llamacloud_prod.api.models.beta.indexes.IndexCreateResponse;

public final class Main {
    private Main() {}

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

        IndexCreateParams params = IndexCreateParams.builder()
            .sourceDirectoryId("dir-abc123")
            .build();
        IndexCreateResponse index = client.beta().indexes().create(params);
    }
}
```

#### Response

```json
{
  "id": "id",
  "export_config_id": "export_config_id",
  "name": "name",
  "project_id": "project_id",
  "source_directory_id": "source_directory_id",
  "sync_config_id": "sync_config_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "last_exported_at": "2019-12-27T18:11:19.117Z",
  "last_synced_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Sync Index

`JsonValue beta().indexes().sync(IndexSyncParamsparams = IndexSyncParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

**post** `/api/v1/indexes/{index_id}/sync`

Trigger a sync and export for an existing index, re-parsing changed files and exporting updated chunks.

### Parameters

- `IndexSyncParams params`

  - `Optional<String> indexId`

  - `Optional<String> organizationId`

  - `Optional<String> projectId`

### Returns

- `class IndexSyncResponse:`

### Example

```java
package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.beta.indexes.IndexSyncParams;
import com.llamacloud_prod.api.models.beta.indexes.IndexSyncResponse;

public final class Main {
    private Main() {}

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

        IndexSyncResponse response = client.beta().indexes().sync("index_id");
    }
}
```

#### Response

```json
{}
```

## List Indexes

`IndexListPage beta().indexes().list(IndexListParamsparams = IndexListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

**get** `/api/v1/indexes`

List indexes for the current project.

### Parameters

- `IndexListParams params`

  - `Optional<String> organizationId`

  - `Optional<Long> pageSize`

  - `Optional<String> pageToken`

  - `Optional<String> projectId`

  - `Optional<String> sourceDirectoryId`

### Returns

- `class IndexListResponse:`

  A searchable index over a directory of documents.

  - `String id`

    Unique identifier

  - `String exportConfigId`

    ID of the export configuration.

  - `String name`

    Index name.

  - `String projectId`

    Project this index belongs to.

  - `String sourceDirectoryId`

    ID of the source directory.

  - `String syncConfigId`

    ID of the sync configuration.

  - `Optional<LocalDateTime> createdAt`

    Creation datetime

  - `Optional<String> description`

    Index description.

  - `Optional<LocalDateTime> lastExportedAt`

    Last export time.

  - `Optional<LocalDateTime> lastSyncedAt`

    Last sync time.

  - `Optional<Metadata> metadata`

    Build state and diagnostic info.

  - `Optional<LocalDateTime> updatedAt`

    Update datetime

### Example

```java
package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.beta.indexes.IndexListPage;
import com.llamacloud_prod.api.models.beta.indexes.IndexListParams;

public final class Main {
    private Main() {}

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

        IndexListPage page = client.beta().indexes().list();
    }
}
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "export_config_id": "export_config_id",
      "name": "name",
      "project_id": "project_id",
      "source_directory_id": "source_directory_id",
      "sync_config_id": "sync_config_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "last_exported_at": "2019-12-27T18:11:19.117Z",
      "last_synced_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
}
```
