---
title: "Upload With Kb Creation"
method: POST
path: "/knowledge_bases/v2/upload"
tags: ["Knowledge Bases V2"]
---

# Upload With Kb Creation

`POST /knowledge_bases/v2/upload`

Create a new knowledge base with either file upload or markdown content.

This endpoint supports two modes:
1. **File Upload**: Provide 'file' parameter with document (PDF, DOCX, MD, TXT)
2. **Markdown Content**: Provide 'markdown_content' parameter with markdown text

Process:
1. Validates and uploads content to S3
2. Creates a new knowledge base
3. Creates a document record (version 1)
4. Returns KB and document info for async processing

The document processing (chunking, vectorization) happens asynchronously via Celery.

Note: You must provide either 'file' OR 'markdown_content', but not both.

## Response `201`

Successful Response

- KnowledgeBaseWithDocumentResponse — Response after creating knowledge base with document
  - `success` boolean, required
  - `knowledge_base_id` integer, required
  - `knowledge_base_public_id` string, required
  - `document_id` integer, required
  - `document_public_id` string, required
  - `name` string, required
  - `version` integer, required
  - `processing_status` string, required
  - `celery_task_id` string, nullable
  - `message` string, nullable

## Other responses

- `400` — Invalid file or upload error
- `413` — File too large
- `422` — Validation Error

---

[API](https://skmtc.net/myaltimate/apis/fastapi.md) · [All operations](https://skmtc.net/myaltimate/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/myaltimate/fastapi/versions/50769cbf05d5/schema)
