# Directories ## Create Directory `DirectoryCreateResponse beta().directories().create(DirectoryCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/api/v1/beta/directories` Create a new directory within the specified project. ### Parameters - `DirectoryCreateParams params` - `Optional organizationId` - `Optional projectId` - `String name` Human-readable name for the directory. - `Optional description` Optional description shown to users. - `Optional expiresAt` When this directory expires. Required for ephemeral directories. - `Optional systemMetadata` Reserved system-managed metadata. - `Optional type` Directory type. Use 'ephemeral' for batch processing with automatic cleanup. - `USER("user")` - `EPHEMERAL("ephemeral")` ### Returns - `class DirectoryCreateResponse:` API response schema for a directory. - `String id` Unique identifier for the directory. - `String name` Human-readable name for the directory. - `String projectId` Project the directory belongs to. - `Optional createdAt` Creation datetime - `Optional deletedAt` Optional timestamp of when the directory was deleted. Null if not deleted. - `Optional description` Optional description shown to users. - `Optional expiresAt` When this directory expires and is eligible for cleanup. - `Optional systemMetadata` Reserved system-managed metadata. - `Optional type` Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. - `USER("user")` - `INDEX("index")` - `EPHEMERAL("ephemeral")` - `SYSTEM_EPHEMERAL("system_ephemeral")` - `Optional 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.directories.DirectoryCreateParams; import com.llamacloud_prod.api.models.beta.directories.DirectoryCreateResponse; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); DirectoryCreateParams params = DirectoryCreateParams.builder() .name("x") .build(); DirectoryCreateResponse directory = client.beta().directories().create(params); } } ``` #### Response ```json { "id": "id", "name": "x", "project_id": "project_id", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "description", "expires_at": "2019-12-27T18:11:19.117Z", "system_metadata": { "foo": "bar" }, "type": "user", "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## List Directories `DirectoryListPage beta().directories().list(DirectoryListParamsparams = DirectoryListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/api/v1/beta/directories` List Directories ### Parameters - `DirectoryListParams params` - `Optional includeDeleted` - `Optional name` - `Optional organizationId` - `Optional pageSize` - `Optional pageToken` - `Optional projectId` - `Optional type` - `USER("user")` - `INDEX("index")` - `EPHEMERAL("ephemeral")` ### Returns - `class DirectoryListResponse:` API response schema for a directory. - `String id` Unique identifier for the directory. - `String name` Human-readable name for the directory. - `String projectId` Project the directory belongs to. - `Optional createdAt` Creation datetime - `Optional deletedAt` Optional timestamp of when the directory was deleted. Null if not deleted. - `Optional description` Optional description shown to users. - `Optional expiresAt` When this directory expires and is eligible for cleanup. - `Optional systemMetadata` Reserved system-managed metadata. - `Optional type` Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. - `USER("user")` - `INDEX("index")` - `EPHEMERAL("ephemeral")` - `SYSTEM_EPHEMERAL("system_ephemeral")` - `Optional 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.directories.DirectoryListPage; import com.llamacloud_prod.api.models.beta.directories.DirectoryListParams; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); DirectoryListPage page = client.beta().directories().list(); } } ``` #### Response ```json { "items": [ { "id": "id", "name": "x", "project_id": "project_id", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "description", "expires_at": "2019-12-27T18:11:19.117Z", "system_metadata": { "foo": "bar" }, "type": "user", "updated_at": "2019-12-27T18:11:19.117Z" } ], "next_page_token": "next_page_token", "total_size": 0 } ``` ## Get Directory `DirectoryGetResponse beta().directories().get(DirectoryGetParamsparams = DirectoryGetParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/api/v1/beta/directories/{directory_id}` Retrieve a directory by its identifier. ### Parameters - `DirectoryGetParams params` - `Optional directoryId` - `Optional organizationId` - `Optional projectId` ### Returns - `class DirectoryGetResponse:` API response schema for a directory. - `String id` Unique identifier for the directory. - `String name` Human-readable name for the directory. - `String projectId` Project the directory belongs to. - `Optional createdAt` Creation datetime - `Optional deletedAt` Optional timestamp of when the directory was deleted. Null if not deleted. - `Optional description` Optional description shown to users. - `Optional expiresAt` When this directory expires and is eligible for cleanup. - `Optional systemMetadata` Reserved system-managed metadata. - `Optional type` Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. - `USER("user")` - `INDEX("index")` - `EPHEMERAL("ephemeral")` - `SYSTEM_EPHEMERAL("system_ephemeral")` - `Optional 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.directories.DirectoryGetParams; import com.llamacloud_prod.api.models.beta.directories.DirectoryGetResponse; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); DirectoryGetResponse directory = client.beta().directories().get("directory_id"); } } ``` #### Response ```json { "id": "id", "name": "x", "project_id": "project_id", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "description", "expires_at": "2019-12-27T18:11:19.117Z", "system_metadata": { "foo": "bar" }, "type": "user", "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Update Directory `DirectoryUpdateResponse beta().directories().update(DirectoryUpdateParamsparams = DirectoryUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **patch** `/api/v1/beta/directories/{directory_id}` Update directory metadata. ### Parameters - `DirectoryUpdateParams params` - `Optional directoryId` - `Optional organizationId` - `Optional projectId` - `Optional description` Updated description for the directory. - `Optional name` Updated name for the directory. ### Returns - `class DirectoryUpdateResponse:` API response schema for a directory. - `String id` Unique identifier for the directory. - `String name` Human-readable name for the directory. - `String projectId` Project the directory belongs to. - `Optional createdAt` Creation datetime - `Optional deletedAt` Optional timestamp of when the directory was deleted. Null if not deleted. - `Optional description` Optional description shown to users. - `Optional expiresAt` When this directory expires and is eligible for cleanup. - `Optional systemMetadata` Reserved system-managed metadata. - `Optional type` Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. - `USER("user")` - `INDEX("index")` - `EPHEMERAL("ephemeral")` - `SYSTEM_EPHEMERAL("system_ephemeral")` - `Optional 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.directories.DirectoryUpdateParams; import com.llamacloud_prod.api.models.beta.directories.DirectoryUpdateResponse; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); DirectoryUpdateResponse directory = client.beta().directories().update("directory_id"); } } ``` #### Response ```json { "id": "id", "name": "x", "project_id": "project_id", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "description", "expires_at": "2019-12-27T18:11:19.117Z", "system_metadata": { "foo": "bar" }, "type": "user", "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Delete Directory `beta().directories().delete(DirectoryDeleteParamsparams = DirectoryDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/api/v1/beta/directories/{directory_id}` Permanently delete a directory. ### Parameters - `DirectoryDeleteParams params` - `Optional directoryId` - `Optional organizationId` - `Optional 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.directories.DirectoryDeleteParams; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); client.beta().directories().delete("directory_id"); } } ``` # Files ## Add Directory File `FileAddResponse beta().directories().files().add(FileAddParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/api/v1/beta/directories/{directory_id}/files` Create a new file within the specified directory; the directory must exist in the project and `file_id` must reference an existing file. ### Parameters - `FileAddParams params` - `Optional directoryId` - `Optional organizationId` - `Optional projectId` - `String fileId` File ID for the storage location (required). - `Optional displayName` Display name for the file. If not provided, will use the file's name. - `Optional metadata` User-defined metadata key-value pairs to associate with the file. - `String` - `long` - `double` - `boolean` - `JsonValue;` - `List` - `Optional uniqueId` Unique identifier for the file in the directory. If not provided, will use the file's external_file_id or name. ### Returns - `class FileAddResponse:` API response schema for a directory file. - `String id` Unique identifier for the directory file. - `String directoryId` Directory the file belongs to. - `String displayName` Display name for the file. - `String projectId` Project the directory file belongs to. - `String uniqueId` Unique identifier for the file in the directory - `Optional createdAt` Creation datetime - `Optional deletedAt` Soft delete marker when the file is removed upstream or by user action. - `Optional downloadUrl` Schema for a presigned URL. - `LocalDateTime expiresAt` The time at which the presigned URL expires - `String url` A presigned URL for IO operations against a private file - `Optional formFields` Form fields for a presigned POST request - `Optional fileId` File ID for the storage location. - `Optional metadata` Merged metadata from all sources. Higher-priority sources override lower. - `String` - `long` - `double` - `boolean` - `JsonValue;` - `List` - `Optional 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.directories.files.FileAddParams; import com.llamacloud_prod.api.models.beta.directories.files.FileAddResponse; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); FileAddParams params = FileAddParams.builder() .directoryId("directory_id") .fileId("file_id") .build(); FileAddResponse response = client.beta().directories().files().add(params); } } ``` #### Response ```json { "id": "id", "directory_id": "directory_id", "display_name": "x", "project_id": "project_id", "unique_id": "x", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "download_url": { "expires_at": "2019-12-27T18:11:19.117Z", "url": "https://example.com", "form_fields": { "foo": "string" } }, "file_id": "file_id", "metadata": { "foo": "string" }, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## List Directory Files `FileListPage beta().directories().files().list(FileListParamsparams = FileListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/api/v1/beta/directories/{directory_id}/files` List all files within the specified directory with optional filtering and pagination. ### Parameters - `FileListParams params` - `Optional directoryId` - `Optional displayName` - `Optional displayNameContains` - `Optional> expand` Fields to expand on each directory file. - `Optional fileId` - `Optional includeDeleted` - `Optional organizationId` - `Optional pageSize` - `Optional pageToken` - `Optional projectId` - `Optional uniqueId` - `Optional updatedAtOnOrAfter` Include items updated at or after this timestamp (inclusive) - `Optional updatedAtOnOrBefore` Include items updated at or before this timestamp (inclusive) ### Returns - `class FileListResponse:` API response schema for a directory file. - `String id` Unique identifier for the directory file. - `String directoryId` Directory the file belongs to. - `String displayName` Display name for the file. - `String projectId` Project the directory file belongs to. - `String uniqueId` Unique identifier for the file in the directory - `Optional createdAt` Creation datetime - `Optional deletedAt` Soft delete marker when the file is removed upstream or by user action. - `Optional downloadUrl` Schema for a presigned URL. - `LocalDateTime expiresAt` The time at which the presigned URL expires - `String url` A presigned URL for IO operations against a private file - `Optional formFields` Form fields for a presigned POST request - `Optional fileId` File ID for the storage location. - `Optional metadata` Merged metadata from all sources. Higher-priority sources override lower. - `String` - `long` - `double` - `boolean` - `JsonValue;` - `List` - `Optional 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.directories.files.FileListPage; import com.llamacloud_prod.api.models.beta.directories.files.FileListParams; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); FileListPage page = client.beta().directories().files().list("directory_id"); } } ``` #### Response ```json { "items": [ { "id": "id", "directory_id": "directory_id", "display_name": "x", "project_id": "project_id", "unique_id": "x", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "download_url": { "expires_at": "2019-12-27T18:11:19.117Z", "url": "https://example.com", "form_fields": { "foo": "string" } }, "file_id": "file_id", "metadata": { "foo": "string" }, "updated_at": "2019-12-27T18:11:19.117Z" } ], "next_page_token": "next_page_token", "total_size": 0 } ``` ## Get Directory File `FileGetResponse beta().directories().files().get(FileGetParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/api/v1/beta/directories/{directory_id}/files/{directory_file_id}` Get a directory file by `directory_file_id`; to look up by `unique_id`, use the list endpoint with a filter. ### Parameters - `FileGetParams params` - `String directoryId` - `Optional directoryFileId` - `Optional> expand` Fields to expand. - `Optional organizationId` - `Optional projectId` ### Returns - `class FileGetResponse:` API response schema for a directory file. - `String id` Unique identifier for the directory file. - `String directoryId` Directory the file belongs to. - `String displayName` Display name for the file. - `String projectId` Project the directory file belongs to. - `String uniqueId` Unique identifier for the file in the directory - `Optional createdAt` Creation datetime - `Optional deletedAt` Soft delete marker when the file is removed upstream or by user action. - `Optional downloadUrl` Schema for a presigned URL. - `LocalDateTime expiresAt` The time at which the presigned URL expires - `String url` A presigned URL for IO operations against a private file - `Optional formFields` Form fields for a presigned POST request - `Optional fileId` File ID for the storage location. - `Optional metadata` Merged metadata from all sources. Higher-priority sources override lower. - `String` - `long` - `double` - `boolean` - `JsonValue;` - `List` - `Optional 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.directories.files.FileGetParams; import com.llamacloud_prod.api.models.beta.directories.files.FileGetResponse; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); FileGetParams params = FileGetParams.builder() .directoryId("directory_id") .directoryFileId("directory_file_id") .build(); FileGetResponse file = client.beta().directories().files().get(params); } } ``` #### Response ```json { "id": "id", "directory_id": "directory_id", "display_name": "x", "project_id": "project_id", "unique_id": "x", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "download_url": { "expires_at": "2019-12-27T18:11:19.117Z", "url": "https://example.com", "form_fields": { "foo": "string" } }, "file_id": "file_id", "metadata": { "foo": "string" }, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Update Directory File `FileUpdateResponse beta().directories().files().update(FileUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **patch** `/api/v1/beta/directories/{directory_id}/files/{directory_file_id}` Update directory-file metadata by `directory_file_id`; set `directory_id` to move the file to a different directory. To resolve from `unique_id`, list with a filter first. ### Parameters - `FileUpdateParams params` - `String directoryId` - `Optional directoryFileId` - `Optional organizationId` - `Optional projectId` - `Optional displayName` Updated display name. - `Optional metadata` User-defined metadata key-value pairs. Replaces the user metadata layer. - `String` - `long` - `double` - `boolean` - `JsonValue;` - `List` - `Optional targetDirectoryId` Move file to a different directory. - `Optional uniqueId` Updated unique identifier. ### Returns - `class FileUpdateResponse:` API response schema for a directory file. - `String id` Unique identifier for the directory file. - `String directoryId` Directory the file belongs to. - `String displayName` Display name for the file. - `String projectId` Project the directory file belongs to. - `String uniqueId` Unique identifier for the file in the directory - `Optional createdAt` Creation datetime - `Optional deletedAt` Soft delete marker when the file is removed upstream or by user action. - `Optional downloadUrl` Schema for a presigned URL. - `LocalDateTime expiresAt` The time at which the presigned URL expires - `String url` A presigned URL for IO operations against a private file - `Optional formFields` Form fields for a presigned POST request - `Optional fileId` File ID for the storage location. - `Optional metadata` Merged metadata from all sources. Higher-priority sources override lower. - `String` - `long` - `double` - `boolean` - `JsonValue;` - `List` - `Optional 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.directories.files.FileUpdateParams; import com.llamacloud_prod.api.models.beta.directories.files.FileUpdateResponse; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); FileUpdateParams params = FileUpdateParams.builder() .directoryId("directory_id") .directoryFileId("directory_file_id") .build(); FileUpdateResponse file = client.beta().directories().files().update(params); } } ``` #### Response ```json { "id": "id", "directory_id": "directory_id", "display_name": "x", "project_id": "project_id", "unique_id": "x", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "download_url": { "expires_at": "2019-12-27T18:11:19.117Z", "url": "https://example.com", "form_fields": { "foo": "string" } }, "file_id": "file_id", "metadata": { "foo": "string" }, "updated_at": "2019-12-27T18:11:19.117Z" } ``` ## Delete Directory File `beta().directories().files().delete(FileDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/api/v1/beta/directories/{directory_id}/files/{directory_file_id}` Delete a directory file by `directory_file_id`; to resolve from `unique_id`, list with a filter first. ### Parameters - `FileDeleteParams params` - `String directoryId` - `Optional directoryFileId` - `Optional organizationId` - `Optional 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.directories.files.FileDeleteParams; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); FileDeleteParams params = FileDeleteParams.builder() .directoryId("directory_id") .directoryFileId("directory_file_id") .build(); client.beta().directories().files().delete(params); } } ``` ## Upload File To Directory `FileUploadResponse beta().directories().files().upload(FileUploadParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/api/v1/beta/directories/{directory_id}/files/upload` Upload a file and create its directory entry in one call; `unique_id` / `display_name` default to values derived from file metadata. ### Parameters - `FileUploadParams params` - `Optional directoryId` - `Optional organizationId` - `Optional projectId` - `String uploadFile` - `Optional displayName` - `Optional externalFileId` - `Optional metadata` User metadata as a JSON object string. - `Optional uniqueId` ### Returns - `class FileUploadResponse:` API response schema for a directory file. - `String id` Unique identifier for the directory file. - `String directoryId` Directory the file belongs to. - `String displayName` Display name for the file. - `String projectId` Project the directory file belongs to. - `String uniqueId` Unique identifier for the file in the directory - `Optional createdAt` Creation datetime - `Optional deletedAt` Soft delete marker when the file is removed upstream or by user action. - `Optional downloadUrl` Schema for a presigned URL. - `LocalDateTime expiresAt` The time at which the presigned URL expires - `String url` A presigned URL for IO operations against a private file - `Optional formFields` Form fields for a presigned POST request - `Optional fileId` File ID for the storage location. - `Optional metadata` Merged metadata from all sources. Higher-priority sources override lower. - `String` - `long` - `double` - `boolean` - `JsonValue;` - `List` - `Optional 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.directories.files.FileUploadParams; import com.llamacloud_prod.api.models.beta.directories.files.FileUploadResponse; import java.io.ByteArrayInputStream; public final class Main { private Main() {} public static void main(String[] args) { LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv(); FileUploadParams params = FileUploadParams.builder() .directoryId("directory_id") .uploadFile(new ByteArrayInputStream("Example data".getBytes())) .build(); FileUploadResponse response = client.beta().directories().files().upload(params); } } ``` #### Response ```json { "id": "id", "directory_id": "directory_id", "display_name": "x", "project_id": "project_id", "unique_id": "x", "created_at": "2019-12-27T18:11:19.117Z", "deleted_at": "2019-12-27T18:11:19.117Z", "download_url": { "expires_at": "2019-12-27T18:11:19.117Z", "url": "https://example.com", "form_fields": { "foo": "string" } }, "file_id": "file_id", "metadata": { "foo": "string" }, "updated_at": "2019-12-27T18:11:19.117Z" } ```