# Files

## Get Pipeline File Status Counts

`FileGetStatusCountsResponse pipelines().files().getStatusCounts(FileGetStatusCountsParamsparams = FileGetStatusCountsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

**get** `/api/v1/pipelines/{pipeline_id}/files/status-counts`

Get files for a pipeline.

### Parameters

- `FileGetStatusCountsParams params`

  - `Optional<String> pipelineId`

  - `Optional<String> dataSourceId`

  - `Optional<Boolean> onlyManuallyUploaded`

### Returns

- `class FileGetStatusCountsResponse:`

  - `Counts counts`

    The counts of files by status

  - `long totalCount`

    The total number of files

  - `Optional<String> dataSourceId`

    The ID of the data source that the files belong to

  - `Optional<Boolean> onlyManuallyUploaded`

    Whether to only count manually uploaded files

  - `Optional<String> pipelineId`

    The ID of the pipeline that the files belong to

### 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.pipelines.files.FileGetStatusCountsParams;
import com.llamacloud_prod.api.models.pipelines.files.FileGetStatusCountsResponse;

public final class Main {
    private Main() {}

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

        FileGetStatusCountsResponse response = client.pipelines().files().getStatusCounts("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
    }
}
```

#### Response

```json
{
  "counts": {
    "foo": 0
  },
  "total_count": 0,
  "data_source_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "only_manually_uploaded": true,
  "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
```

## Get Pipeline File Status

`ManagedIngestionStatusResponse pipelines().files().getStatus(FileGetStatusParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

**get** `/api/v1/pipelines/{pipeline_id}/files/{file_id}/status`

Get status of a file for a pipeline.

### Parameters

- `FileGetStatusParams params`

  - `String pipelineId`

  - `Optional<String> fileId`

### Returns

- `class ManagedIngestionStatusResponse:`

  - `Status status`

    Status of the ingestion.

    - `NOT_STARTED("NOT_STARTED")`

    - `IN_PROGRESS("IN_PROGRESS")`

    - `SUCCESS("SUCCESS")`

    - `ERROR("ERROR")`

    - `PARTIAL_SUCCESS("PARTIAL_SUCCESS")`

    - `CANCELLED("CANCELLED")`

  - `Optional<LocalDateTime> deploymentDate`

    Date of the deployment.

  - `Optional<LocalDateTime> effectiveAt`

    When the status is effective

  - `Optional<List<Error>> error`

    List of errors that occurred during ingestion.

    - `String jobId`

      ID of the job that failed.

    - `String message`

      List of errors that occurred during ingestion.

    - `Step step`

      Name of the job that failed.

      - `MANAGED_INGESTION("MANAGED_INGESTION")`

      - `DATA_SOURCE("DATA_SOURCE")`

      - `FILE_UPDATER("FILE_UPDATER")`

      - `PARSE("PARSE")`

      - `TRANSFORM("TRANSFORM")`

      - `INGESTION("INGESTION")`

      - `METADATA_UPDATE("METADATA_UPDATE")`

  - `Optional<String> jobId`

    ID of the latest job.

### 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.pipelines.ManagedIngestionStatusResponse;
import com.llamacloud_prod.api.models.pipelines.files.FileGetStatusParams;

public final class Main {
    private Main() {}

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

        FileGetStatusParams params = FileGetStatusParams.builder()
            .pipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .build();
        ManagedIngestionStatusResponse managedIngestionStatusResponse = client.pipelines().files().getStatus(params);
    }
}
```

#### Response

```json
{
  "status": "NOT_STARTED",
  "deployment_date": "2019-12-27T18:11:19.117Z",
  "effective_at": "2019-12-27T18:11:19.117Z",
  "error": [
    {
      "job_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "message": "message",
      "step": "MANAGED_INGESTION"
    }
  ],
  "job_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
```

## Add Files To Pipeline Api

`List<PipelineFile> pipelines().files().create(FileCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

**put** `/api/v1/pipelines/{pipeline_id}/files`

Add files to a pipeline.

### Parameters

- `FileCreateParams params`

  - `Optional<String> pipelineId`

  - `List<Body> body`

    - `String fileId`

      The ID of the file

    - `Optional<CustomMetadata> customMetadata`

      Custom metadata for the file

      - `class UnionMember0:`

      - `List<JsonValue>`

      - `String`

      - `double`

      - `boolean`

### 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.pipelines.files.FileCreateParams;
import com.llamacloud_prod.api.models.pipelines.files.PipelineFile;

public final class Main {
    private Main() {}

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

        FileCreateParams params = FileCreateParams.builder()
            .pipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .addBody(FileCreateParams.Body.builder()
                .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
                .build())
            .build();
        List<PipelineFile> pipelineFiles = client.pipelines().files().create(params);
    }
}
```

#### Response

```json
[
  {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "config_hash": {
      "foo": {
        "foo": "bar"
      }
    },
    "created_at": "2019-12-27T18:11:19.117Z",
    "custom_metadata": {
      "foo": {
        "foo": "bar"
      }
    },
    "data_source_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "external_file_id": "external_file_id",
    "file_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "file_size": 0,
    "file_type": "file_type",
    "indexed_page_count": 0,
    "last_modified_at": "2019-12-27T18:11:19.117Z",
    "name": "name",
    "permission_info": {
      "foo": {
        "foo": "bar"
      }
    },
    "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "resource_info": {
      "foo": {
        "foo": "bar"
      }
    },
    "status": "NOT_STARTED",
    "status_updated_at": "2019-12-27T18:11:19.117Z",
    "updated_at": "2019-12-27T18:11:19.117Z"
  }
]
```

## Update Pipeline File

`PipelineFile pipelines().files().update(FileUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

**put** `/api/v1/pipelines/{pipeline_id}/files/{file_id}`

Update a file for a pipeline.

### Parameters

- `FileUpdateParams params`

  - `String pipelineId`

  - `Optional<String> fileId`

  - `Optional<CustomMetadata> customMetadata`

    Custom metadata for the file

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

### Returns

- `class PipelineFile:`

  A file associated with a pipeline.

  - `String id`

    Unique identifier for the pipeline file.

  - `String pipelineId`

    The ID of the pipeline that the file is associated with.

  - `Optional<ConfigHash> configHash`

    Hashes for the configuration of the pipeline.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<LocalDateTime> createdAt`

    When the pipeline file was created.

  - `Optional<CustomMetadata> customMetadata`

    Custom metadata for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<String> dataSourceId`

    The ID of the data source that the file belongs to.

  - `Optional<String> externalFileId`

    The ID of the file in the external system.

  - `Optional<String> fileId`

    The ID of the file.

  - `Optional<Long> fileSize`

    Size of the file in bytes.

  - `Optional<String> fileType`

    File type (e.g. pdf, docx, etc.).

  - `Optional<Long> indexedPageCount`

    The number of pages that have been indexed for this file.

  - `Optional<LocalDateTime> lastModifiedAt`

    The last modified time of the file.

  - `Optional<String> name`

    Name of the file.

  - `Optional<PermissionInfo> permissionInfo`

    Permission information for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<String> projectId`

    The ID of the project that the file belongs to.

  - `Optional<ResourceInfo> resourceInfo`

    Resource information for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<Status> status`

    Status of the pipeline file.

    - `NOT_STARTED("NOT_STARTED")`

    - `IN_PROGRESS("IN_PROGRESS")`

    - `SUCCESS("SUCCESS")`

    - `ERROR("ERROR")`

    - `CANCELLED("CANCELLED")`

  - `Optional<LocalDateTime> statusUpdatedAt`

    The last time the status was updated.

  - `Optional<LocalDateTime> updatedAt`

    When the pipeline file was last updated.

### 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.pipelines.files.FileUpdateParams;
import com.llamacloud_prod.api.models.pipelines.files.PipelineFile;

public final class Main {
    private Main() {}

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

        FileUpdateParams params = FileUpdateParams.builder()
            .pipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .build();
        PipelineFile pipelineFile = client.pipelines().files().update(params);
    }
}
```

#### Response

```json
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "config_hash": {
    "foo": {
      "foo": "bar"
    }
  },
  "created_at": "2019-12-27T18:11:19.117Z",
  "custom_metadata": {
    "foo": {
      "foo": "bar"
    }
  },
  "data_source_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "external_file_id": "external_file_id",
  "file_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "file_size": 0,
  "file_type": "file_type",
  "indexed_page_count": 0,
  "last_modified_at": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "permission_info": {
    "foo": {
      "foo": "bar"
    }
  },
  "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "resource_info": {
    "foo": {
      "foo": "bar"
    }
  },
  "status": "NOT_STARTED",
  "status_updated_at": "2019-12-27T18:11:19.117Z",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Pipeline File

`pipelines().files().delete(FileDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

**delete** `/api/v1/pipelines/{pipeline_id}/files/{file_id}`

Delete a file from a pipeline.

### Parameters

- `FileDeleteParams params`

  - `String pipelineId`

  - `Optional<String> fileId`

### 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.pipelines.files.FileDeleteParams;

public final class Main {
    private Main() {}

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

        FileDeleteParams params = FileDeleteParams.builder()
            .pipelineId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .build();
        client.pipelines().files().delete(params);
    }
}
```

## List Pipeline Files2

`FileListPage pipelines().files().list(FileListParamsparams = FileListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

**get** `/api/v1/pipelines/{pipeline_id}/files2`

List files for a pipeline with optional filtering, sorting, and pagination.

### Parameters

- `FileListParams params`

  - `Optional<String> pipelineId`

  - `Optional<String> dataSourceId`

  - `Optional<String> fileNameContains`

  - `Optional<Long> limit`

  - `Optional<Long> offset`

  - `Optional<Boolean> onlyManuallyUploaded`

  - `Optional<String> orderBy`

  - `Optional<List<Status>> statuses`

    Filter by file statuses

    - `NOT_STARTED("NOT_STARTED")`

    - `IN_PROGRESS("IN_PROGRESS")`

    - `SUCCESS("SUCCESS")`

    - `ERROR("ERROR")`

    - `CANCELLED("CANCELLED")`

### Returns

- `class PipelineFile:`

  A file associated with a pipeline.

  - `String id`

    Unique identifier for the pipeline file.

  - `String pipelineId`

    The ID of the pipeline that the file is associated with.

  - `Optional<ConfigHash> configHash`

    Hashes for the configuration of the pipeline.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<LocalDateTime> createdAt`

    When the pipeline file was created.

  - `Optional<CustomMetadata> customMetadata`

    Custom metadata for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<String> dataSourceId`

    The ID of the data source that the file belongs to.

  - `Optional<String> externalFileId`

    The ID of the file in the external system.

  - `Optional<String> fileId`

    The ID of the file.

  - `Optional<Long> fileSize`

    Size of the file in bytes.

  - `Optional<String> fileType`

    File type (e.g. pdf, docx, etc.).

  - `Optional<Long> indexedPageCount`

    The number of pages that have been indexed for this file.

  - `Optional<LocalDateTime> lastModifiedAt`

    The last modified time of the file.

  - `Optional<String> name`

    Name of the file.

  - `Optional<PermissionInfo> permissionInfo`

    Permission information for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<String> projectId`

    The ID of the project that the file belongs to.

  - `Optional<ResourceInfo> resourceInfo`

    Resource information for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<Status> status`

    Status of the pipeline file.

    - `NOT_STARTED("NOT_STARTED")`

    - `IN_PROGRESS("IN_PROGRESS")`

    - `SUCCESS("SUCCESS")`

    - `ERROR("ERROR")`

    - `CANCELLED("CANCELLED")`

  - `Optional<LocalDateTime> statusUpdatedAt`

    The last time the status was updated.

  - `Optional<LocalDateTime> updatedAt`

    When the pipeline file was last updated.

### 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.pipelines.files.FileListPage;
import com.llamacloud_prod.api.models.pipelines.files.FileListParams;

public final class Main {
    private Main() {}

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

        FileListPage page = client.pipelines().files().list("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
    }
}
```

#### Response

```json
{
  "files": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "config_hash": {
        "foo": {
          "foo": "bar"
        }
      },
      "created_at": "2019-12-27T18:11:19.117Z",
      "custom_metadata": {
        "foo": {
          "foo": "bar"
        }
      },
      "data_source_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "external_file_id": "external_file_id",
      "file_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "file_size": 0,
      "file_type": "file_type",
      "indexed_page_count": 0,
      "last_modified_at": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "permission_info": {
        "foo": {
          "foo": "bar"
        }
      },
      "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "resource_info": {
        "foo": {
          "foo": "bar"
        }
      },
      "status": "NOT_STARTED",
      "status_updated_at": "2019-12-27T18:11:19.117Z",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "limit": 0,
  "offset": 0,
  "total_count": 0
}
```

## Domain Types

### Pipeline File

- `class PipelineFile:`

  A file associated with a pipeline.

  - `String id`

    Unique identifier for the pipeline file.

  - `String pipelineId`

    The ID of the pipeline that the file is associated with.

  - `Optional<ConfigHash> configHash`

    Hashes for the configuration of the pipeline.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<LocalDateTime> createdAt`

    When the pipeline file was created.

  - `Optional<CustomMetadata> customMetadata`

    Custom metadata for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<String> dataSourceId`

    The ID of the data source that the file belongs to.

  - `Optional<String> externalFileId`

    The ID of the file in the external system.

  - `Optional<String> fileId`

    The ID of the file.

  - `Optional<Long> fileSize`

    Size of the file in bytes.

  - `Optional<String> fileType`

    File type (e.g. pdf, docx, etc.).

  - `Optional<Long> indexedPageCount`

    The number of pages that have been indexed for this file.

  - `Optional<LocalDateTime> lastModifiedAt`

    The last modified time of the file.

  - `Optional<String> name`

    Name of the file.

  - `Optional<PermissionInfo> permissionInfo`

    Permission information for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<String> projectId`

    The ID of the project that the file belongs to.

  - `Optional<ResourceInfo> resourceInfo`

    Resource information for the file.

    - `class UnionMember0:`

    - `List<JsonValue>`

    - `String`

    - `double`

    - `boolean`

  - `Optional<Status> status`

    Status of the pipeline file.

    - `NOT_STARTED("NOT_STARTED")`

    - `IN_PROGRESS("IN_PROGRESS")`

    - `SUCCESS("SUCCESS")`

    - `ERROR("ERROR")`

    - `CANCELLED("CANCELLED")`

  - `Optional<LocalDateTime> statusUpdatedAt`

    The last time the status was updated.

  - `Optional<LocalDateTime> updatedAt`

    When the pipeline file was last updated.
