> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Attachment

Represents an uploaded file stored in AWS S3 with metadata and utility methods.

Provides a structured way to handle file information for files stored in S3, including methods for generating presigned URLs, serialization, and accessing file metadata.

```python theme={null}
class Attachment(BaseModel)
```

## Properties

**file\_name** `str`

The name of the file in the S3 bucket

**key** `str`

The key of the file in the S3 bucket

**bucket** `str`

The S3 bucket name where the file is stored

**region** `str`

The AWS region where the S3 bucket is located

**endpoint** `str`

Optional custom S3 endpoint URL. Defaults to None for standard AWS S3

**suggested\_file\_name** `str`

A human-readable filename suggestion for downloads or display

**file\_type** `AttachmentType`

The type of the file

## Methods

> [accordion] **json**
>
> Returns a JSON-serializable dictionary representation of the file.
>
> **Returns:** `dict`
>
> Complete model data including all fields

> [accordion] to\_dict
>
> Converts the file metadata to a dictionary.
>
> **Returns:** `dict[str, str]`
>
> Dictionary with file\_name, key, bucket, region, endpoint, suggested\_file\_name, and file\_type

> [accordion] from\_dict
>
> Class method to create an Attachment instance from a dictionary.
>
> **expiration** `optional[int]`
>
> URL expiration time in seconds. Defaults to 432000 (5 days)
>
> **Returns:** `str`
>
> Presigned URL for downloading the file

> [accordion] get\_s3\_key
>
> Returns the full S3 URL for the file.
>
> **Returns:** `str`
>
> Complete S3 URL in format: [https://bucket.s3.region.amazonaws.com/filename](https://bucket.s3.region.amazonaws.com/filename)

> [accordion] get\_file\_path
>
> Returns the file path/key within the S3 bucket.
>
> **Returns:** `str`
>
> The file\_name attribute (S3 object key)

## Examples

```python Basic Usage theme={null}
from intuned_browser import upload_file_to_s3, Attachment
async def automation(page, params, **_kwargs):
    uploaded_file: Attachment = await upload_file_to_s3(
        file=my_file,
        configs=s3_config
    )

    # Access file properties
    print(uploaded_file.file_name)
    print(uploaded_file.suggested_file_name)
```

```python Working with Presigned URLs theme={null}
from intuned_browser import upload_file_to_s3, Attachment
async def automation(page, params, **_kwargs):
    uploaded_file: Attachment = await upload_file_to_s3(file=my_file)

    # Generate a presigned URL for temporary access
    download_url = await uploaded_file.get_signed_url(expiration=3600)  # 1 hour expiration

    # Get the permanent S3 URL
    s3_url = uploaded_file.get_s3_key()
```

```python Serialization theme={null}
from intuned_browser import upload_file_to_s3, Attachment
async def automation(page, params, **_kwargs):
    uploaded_file: Attachment = await upload_file_to_s3(file=my_file)

    # Convert to dictionary for storage or API responses
    file_dict = uploaded_file.to_dict()
    file_json = uploaded_file.__json__()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.