# Attachments

## List Attachments

`beta.attachments.list(AttachmentListParams**kwargs)  -> SyncPaginatedCursor[AttachmentListResponse]`

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

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

### Parameters

- `source_id: str`

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

- `organization_id: Optional[str]`

- `page_size: Optional[int]`

- `page_token: Optional[str]`

- `project_id: Optional[str]`

### Returns

- `class AttachmentListResponse: …`

  Metadata for a single file attachment.

  - `name: str`

    Name of the attachment

  - `size: int`

    Size of the attachment in bytes

  - `last_modified: Optional[datetime]`

    When the attachment was last modified

### Example

```python
import os
from llama_cloud import LlamaCloud

client = LlamaCloud(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
page = client.beta.attachments.list(
    source_id="source_id",
)
page = page.items[0]
print(page.name)
```

#### 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

`beta.attachments.get(strattachment_name, AttachmentGetParams**kwargs)  -> PresignedURL`

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

Return a presigned download URL for a specific attachment.

### Parameters

- `attachment_name: str`

- `source_id: str`

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

- `organization_id: Optional[str]`

- `project_id: Optional[str]`

### Returns

- `class PresignedURL: …`

  Schema for a presigned URL.

  - `expires_at: datetime`

    The time at which the presigned URL expires

  - `url: str`

    A presigned URL for IO operations against a private file

  - `form_fields: Optional[Dict[str, str]]`

    Form fields for a presigned POST request

### Example

```python
import os
from llama_cloud import LlamaCloud

client = LlamaCloud(
    api_key=os.environ.get("LLAMA_CLOUD_API_KEY"),  # This is the default and can be omitted
)
presigned_url = client.beta.attachments.get(
    attachment_name="attachment_name",
    source_id="source_id",
)
print(presigned_url.expires_at)
```

#### Response

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

## Domain Types

### Attachment List Response

- `class AttachmentListResponse: …`

  Metadata for a single file attachment.

  - `name: str`

    Name of the attachment

  - `size: int`

    Size of the attachment in bytes

  - `last_modified: Optional[datetime]`

    When the attachment was last modified
