Skip to content
Framework Docs

Create Index

IndexCreateResponse beta().indexes().create(IndexCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/api/v1/indexes

Create a searchable index over a source directory.

ParametersExpand Collapse
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")
ReturnsExpand Collapse
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

formatdate-time
Optional<String> description

Index description.

Optional<LocalDateTime> lastExportedAt

Last export time.

formatdate-time
Optional<LocalDateTime> lastSyncedAt

Last sync time.

formatdate-time
Optional<Metadata> metadata

Build state and diagnostic info.

Optional<LocalDateTime> updatedAt

Update datetime

formatdate-time

Create Index

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);
    }
}
{
  "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"
}
Returns Examples
{
  "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"
}