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

# Upload document

> Upload a document to object storage and trigger automated vector chunking and indexing

Upload a `.pdf`, `.docx`, or `.txt` document to your organization's knowledge base. The document is securely stored in object storage and parsed into text chunks. Embeddings are generated and indexed into the vector database for real-time Retrieval-Augmented Generation (RAG).

***

### Authentication

This endpoint requires Bearer token authentication.

```http theme={null}
Authorization: Bearer <token>
```

| Header          | Type     | Required | Description                                     | Format           |
| :-------------- | :------- | :------- | :---------------------------------------------- | :--------------- |
| `Authorization` | `string` | **Yes**  | Scoped organization API key or Bearer JWT token | `Bearer <token>` |

***

### Input parameters

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication. Format: `Bearer <token>`.
</ParamField>

<ParamField body="file" type="file" required>
  The multipart form file upload. Supported formats: `.pdf`, `.docx`, `.txt`.
</ParamField>

***

### Response Fields

<ResponseField name="id" type="string">
  Unique UUID identifier of the knowledge document.
</ResponseField>

<ResponseField name="organization_id" type="string">
  UUID of the organization owning the document.
</ResponseField>

<ResponseField name="document_type" type="string">
  Detected document format type (`pdf`, `docx`, `txt`).
</ResponseField>

<ResponseField name="file_name" type="string">
  Original filename of the uploaded document.
</ResponseField>

<ResponseField name="uploaded_at" type="string">
  ISO 8601 timestamp of upload completion.
</ResponseField>

<ResponseField name="updated_at" type="string">
  ISO 8601 timestamp of last metadata update.
</ResponseField>

***

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.sayvy.ai/api/v1/knowledge-base/upload" \
    -H "Authorization: Bearer <token>" \
    -F "file=@/path/to/product_manual.pdf"
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.sayvy.ai/api/v1/knowledge-base/upload"

  headers = {
      "Authorization": "Bearer <token>"
  }

  with open("product_manual.pdf", "rb") as f:
      files = {"file": ("product_manual.pdf", f, "application/pdf")}
      response = requests.post(url, headers=headers, files=files)

  print(response.status_code)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const formData = new FormData();
  formData.append("file", fileInputElement.files[0]);

  const response = await fetch("https://api.sayvy.ai/api/v1/knowledge-base/upload", {
    method: "POST",
    headers: {
      "Authorization": "Bearer <token>"
    },
    body: formData
  });

  const data = await response.json();
  console.log(data);
  ```

  ```java Java theme={null}
  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://api.sayvy.ai/api/v1/knowledge-base/upload"))
      .header("Authorization", "Bearer <token>")
      .POST(ofMimeMultipartData(Map.of("file", Paths.get("product_manual.pdf")), boundary))
      .build();

  HttpResponse<String> response =
      HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
  System.out.println(response.body());
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "id": "c5d1e2f3-4a5b-6c7d-8e9f-0123456789ab",
    "organization_id": "93f35dc2-5d46-4e58-a9ee-038c35d9bcf1",
    "document_type": "pdf",
    "file_name": "product_manual.pdf",
    "uploaded_at": "2026-09-07T12:00:00Z",
    "updated_at": "2026-09-07T12:00:00Z"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "detail": "Unsupported file format. Please upload a PDF, DOCX, or TXT file."
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "detail": "Unauthorized"
  }
  ```

  ```json 429 Too Many Requests theme={null}
  {
    "error": "rate_limit_exceeded",
    "message": "Rate limit exceeded for endpoint. Please retry after backoff.",
    "retry_after": 60
  }
  ```
</ResponseExample>

***

<div
  style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
backgroundColor: "rgba(255, 255, 255, 0.03)",
border: "1px solid rgba(255, 255, 255, 0.08)",
borderRadius: "16px",
padding: "10px 18px",
marginTop: "40px",
gap: "16px",
flexWrap: "wrap"
}}
>
  <a
    href="/api-reference/knowledge-base/overview"
    style={{
display: "inline-flex",
alignItems: "center",
gap: "6px",
color: "#94A3B8",
textDecoration: "none",
fontSize: "14px",
fontWeight: "500",
padding: "4px 8px"
}}
  >
    <span style={{ fontSize: "16px" }}>‹</span> Previous
  </a>

  <div
    style={{
display: "flex",
alignItems: "center",
gap: "16px",
backgroundColor: "rgba(255, 255, 255, 0.04)",
border: "1px solid rgba(255, 255, 255, 0.06)",
borderRadius: "12px",
padding: "8px 16px",
marginLeft: "auto"
}}
  >
    <div style={{ textAlign: "right" }}>
      <div style={{ fontSize: "13px", fontWeight: "700", color: "#F8FAFC" }}>List documents</div>

      <div style={{ fontSize: "11px", color: "#94A3B8", maxWidth: "260px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
        GET /api/v1/knowledge-base
      </div>
    </div>

    <div style={{ width: "1px", height: "24px", backgroundColor: "rgba(255, 255, 255, 0.1)" }} />

    <a
      href="/api-reference/knowledge-base/list-documents"
      style={{
  display: "inline-flex",
  alignItems: "center",
  gap: "6px",
  color: "#94A3B8",
  textDecoration: "none",
  fontSize: "14px",
  fontWeight: "500"
}}
    >
      Next <span style={{ fontSize: "16px" }}>›</span>
    </a>
  </div>
</div>
