# Upload Document

Upload a document to a collection. Currently we support a maximum file size of 10 MB and the following content types

* PDF (.pdf)
* Plaintext (.txt)
* CSV (.csv)
* Markdown (.md)
* Microsoft Words (.docx)

{% hint style="danger" %}
Documents have to be uniquely named.  If one document is uploaded with a name that is the same as one already uploaded, it will replace that document.
{% endhint %}

{% tabs %}
{% tab title="HTTP" %}

```
POST /docs/add HTTP/1.1
Api-Key: my_api_key
Host: my_account_id.us-west-2.aws.chatbees.ai

Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="example.txt"
Content-Type: text/plain

[File content here]

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="request"

{
  "namespace_name": "string",
  "collection_name": "string"
}
----WebKitFormBoundary7MA4YWxkTrZu0gW--
```

{% endtab %}

{% tab title="Python" %}

```
import chatbees as cb

# Configure API key
cb.init(api_key="my_api_key", account_id="my_account_id")

# Create a collection called llm_research.
collection = cb.collection('llm_research')
cb.create_collection(collection)

# Local file and URLs are both supported.
# URL must contain the full scheme prefix (http:// or https://)
cb.collection('llm_research').upload_document('/path/to/file.pdf')
cb.collection('llm_research').upload_document('https://path/to/file.pdf')
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chatbees.ai/chatbees/api-references/document-operations/upload-document.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
