---
title: "Upload document"
method: POST
path: "/knowledge-bases/{id}/documents"
tags: ["Knowledge Bases"]
---

# Upload document

`POST /knowledge-bases/{id}/documents`

## Request

- Base URL: `https://api.telvana.com`
- URL: `https://api.telvana.com/knowledge-bases/{id}/documents`
- Auth: API key in header `x-api-key`

Upload a document to a knowledge base. The document is processed through a pipeline:

1. **Upload** — File is stored in S3
2. **Parse** — Text is extracted from the file (PDF, DOCX, TXT, MD, CSV, JSON supported)
3. **Chunk** — Text is split into ~2200 character chunks with sentence-boundary overlap
4. **Embed** — Each chunk is converted to a 3072-dimension vector using Google Gemini embeddings
5. **Index** — Vectors are upserted into the Qdrant collection for semantic search

The endpoint returns the document record immediately after processing completes. If parsing or embedding fails, the document is marked as FAILED with an error message.

**Supported file types:** PDF, DOCX, TXT, MD, CSV, JSON

**Maximum file size:** 50 MB

## Path parameters

- `id` string, required

## Response `201`

Document uploaded and processed successfully

- object
  - `data` object
    - `id` string
    - `knowledgeBaseId` string
    - `filename` string
    - `originalName` string
    - `fileType` string
    - `fileSize` integer
    - `status` string
    - `chunkCount` integer
    - `processedAt` string, date-time
  - `message` string

## Other responses

- `400`: Bad request - Invalid file type or size
- `401`: Unauthorized
- `404`: Knowledge base not found

---

[API](https://skmtc.dev/telvana/apis/telvana-api.md) · [All operations](https://skmtc.dev/telvana/apis/telvana-api/llms.txt) · [OpenAPI document](https://skmtc.dev/telvana/apis/telvana-api/revisions/a70ff9063cdf?raw)
