# Attachments

## List Attachments

`AttachmentListPage beta().attachments().list(AttachmentListParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

**get** `/api/v1/beta/attachments`

List the attachments associated with a file (e.g. per-page screenshots).

### Parameters

- `AttachmentListParams params`

  - `String sourceId`

    File UUID or directory file ID (dfl-...).

  - `Optional<String> organizationId`

  - `Optional<Long> pageSize`

  - `Optional<String> pageToken`

  - `Optional<String> projectId`

### Returns

- `class AttachmentListResponse:`

  Metadata for a single file attachment.

  - `String name`

    Name of the attachment

  - `long size`

    Size of the attachment in bytes

  - `Optional<LocalDateTime> lastModified`

    When the attachment was last modified

### Example

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

import ai.llamaindex.llamacloud.client.LlamaCloudClient;
import ai.llamaindex.llamacloud.client.okhttp.LlamaCloudOkHttpClient;
import ai.llamaindex.llamacloud.models.beta.attachments.AttachmentListPage;
import ai.llamaindex.llamacloud.models.beta.attachments.AttachmentListParams;

public final class Main {
    private Main() {}

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

        AttachmentListParams params = AttachmentListParams.builder()
            .sourceId("source_id")
            .build();
        AttachmentListPage page = client.beta().attachments().list(params);
    }
}
```

#### Response

```json
{
  "items": [
    {
      "name": "name",
      "size": 0,
      "last_modified": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Get Attachment

`PresignedUrl beta().attachments().get(AttachmentGetParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

**get** `/api/v1/beta/attachments/{attachment_name}`

Return a presigned download URL for a specific attachment.

### Parameters

- `AttachmentGetParams params`

  - `Optional<String> attachmentName`

  - `String sourceId`

    File UUID or directory file ID (dfl-...).

  - `Optional<String> organizationId`

  - `Optional<String> projectId`

### Returns

- `class PresignedUrl:`

  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> formFields`

    Form fields for a presigned POST request

### Example

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

import ai.llamaindex.llamacloud.client.LlamaCloudClient;
import ai.llamaindex.llamacloud.client.okhttp.LlamaCloudOkHttpClient;
import ai.llamaindex.llamacloud.models.beta.attachments.AttachmentGetParams;
import ai.llamaindex.llamacloud.models.files.PresignedUrl;

public final class Main {
    private Main() {}

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

        AttachmentGetParams params = AttachmentGetParams.builder()
            .attachmentName("attachment_name")
            .sourceId("source_id")
            .build();
        PresignedUrl presignedUrl = client.beta().attachments().get(params);
    }
}
```

#### Response

```json
{
  "expires_at": "2019-12-27T18:11:19.117Z",
  "url": "https://example.com",
  "form_fields": {
    "foo": "string"
  }
}
```
