> ## Documentation Index
> Fetch the complete documentation index at: https://chainlit-5-wd-prompt.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Attachment

> Create Read Update and Delete methods for Attachment

## Create attachment

```python
attachment = await client.api.create_attachment(
    thread_id="<THREAD_UUID>",
    step_id="<STEP_UUID>"
    name="my_attachment",
    content_type="text/plain",
    content="Hello world",
)
```

<ParamField path="thread_id" type="uuid" required>
  Thread id in string format
</ParamField>

<ParamField path="step_id" type="uuid" required>
  Step id in string format
</ParamField>

<ParamField path="id" type="uuid">
  Id in string format
</ParamField>

<ParamField path="metadata" type="Dict">
  Metadata in dictionary format
</ParamField>

<ParamField path="mime" type="string">
  Mime in string format
</ParamField>

<ParamField path="name" type="string">
  Name in string format
</ParamField>

<ParamField path="object_key" type="string">
  Object key in string format
</ParamField>

<ParamField path="url" type="string">
  Url in string format
</ParamField>

<ParamField path="content" type="Union[bytes, str]">
  Content that can be either of bytes or string format
</ParamField>

<ParamField path="path" type="string">
  Path in string format
</ParamField>

### Return type

<ResponseField name="attachment" type="Attachment">
  Return an Attachment
</ResponseField>

## Update attachment

```python
attachment = await client.api.update_attachment(
    id="<ATTACHMENT_UUID>",
    update_params={
        "name": "my_attachment",
        "content_type": "text/plain",
        "content": "Hello world",
    },
)
```

<ParamField path="id" type="uuid" required>
  Id in string format
</ParamField>

<ParamField path="metadata" type="Dict">
  Metadata in dictionary format
</ParamField>

<ParamField path="mime" type="string">
  Mime in string format
</ParamField>

<ParamField path="name" type="string">
  Name in string format
</ParamField>

<ParamField path="objectKey" type="string">
  Object key in string format
</ParamField>

<ParamField path="url" type="string">
  Url in string format
</ParamField>

### Return type

<ResponseField name="attachment" type="Attachment">
  Return an Attachment
</ResponseField>

## Get attachment

```python
attachment = await client.api.get_attachment(id="<ATTACHMENT_UUID>")
```

<ParamField path="id" type="uuid" required>
  Id in string format
</ParamField>

### Return type

<ResponseField name="attachment" type="Attachment">
  Return an Attachment, can be None if the attachment is not found
</ResponseField>

## Delete attachment

```python
attachment = await client.api.delete_attachment(id="<ATTACHMENT_UUID>")
```

<ParamField path="id" type="uuid" required>
  Id in string format
</ParamField>
