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

# Overview

### To upload a document, the process involves two steps:

1. **Generate a pre-signed upload URL**

First, call the [`/generate_presigned_url_no_auth`](/api-reference/conversational-ai-agent-interactions/generate-presigned-url) endpoint.

This returns a pre-signed URL **(valid for 5 minutes)** and associated form fields including the `file_type` (MIME type).

**⚠️ Important**

* **File size limit: 2MB**
* **Presigned URLs are valid for 5 minutes**

Example response:

```json theme={null}
{
  "data": {
    "url": {
      "url": "https://chatzy-kb-store.s3.us-east-1.amazonaws.com/",
      "fields": {
        "Content-Type": "application/pdf",
        "bucket": "chatzy-kb-store",
        "X-Amz-Algorithm": "AWS4-HMAC-SHA256",
        "X-Amz-Credential": "...",
        "X-Amz-Date": "20250821T075218Z",
        "X-Amz-Security-Token": "...",
        "key": "icons/3fa1d79c-79d5-48b0-abcc-65ab4cd0073a",
        "Policy": "...",
        "X-Amz-Signature": "..."
      }
    }
  }
}
```

2. **Upload the file**

* Make a `POST` request to the returned url (`https://chatzy-kb-store.s3.us-east-1.amazonaws.com/`).
* Send the provided fields and the file itself as `multipart form data`.
* **If the upload succeeds, AWS S3 responds with HTTP 204 (No Content)**.
* Any other response indicates an error, handle it accordingly.

<img src="https://mintcdn.com/chatzyai/jXmVKZ3P6KCTbIH5/images/upload_documents_1.png?fit=max&auto=format&n=jXmVKZ3P6KCTbIH5&q=85&s=2662fbad4d0ee00560083d19dd2d1c87" alt="audio_input" width="766" height="281" data-path="images/upload_documents_1.png" />

***

### Using Uploaded Documents in [`/get_inference`](/api-reference/conversational-ai-agent-interactions/send-message-to-conversational-ai-agent)

Once documents are uploaded, they should be passed as part of the documents field in the [`/get_inference`](/api-reference/conversational-ai-agent-interactions/send-message-to-conversational-ai-agent) API payload.

Each document must contain:

* `file_name` -> Original file name (e.g., "document.pdf")
* `mime_type` -> File [MIME](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types) type (e.g., "application/pdf")
* `s3_url` -> Built using the returned key from [`/generate_presigned_url_no_auth`](/api-reference/conversational-ai-agent-interactions/generate-presigned-url)

Format for `s3_url`:

```http theme={null}
https://chatzy-kb-store.s3.amazonaws.com{key}
```

> 👆 Key here is the `key` field in above example response, you will get your own unique key in the response upon calling this endpoint: [`/generate_presigned_url_no_auth`](/api-reference/conversational-ai-agent-interactions/generate-presigned-url).

Example documents array:

```json theme={null}
[
  {
    "file_name": "document.pdf",
    "mime_type": "application/pdf",
    "s3_url": "https://chatzy-kb-store.s3.amazonaws.com/icons/3fa1d79c-79d5-48b0-abcc-65ab4cd0073a"
  }
]
```

**⚠️ Important**

* A **maximum of 5 files** can be attached in a single `/get_inference` request.
* If the user sends only files (without message content), the request payload **must add a default `message` object** with content as following:

```json theme={null}
{
  "role": "user",
  "content": "Document(s) Attached"
}
```

If the user provides both message content and documents, then use the given message content along with the documents.
