---
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`

## Request

- Base URL: `https://api.myaltimate.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.myaltimate.com/knowledge_bases/v2/upload`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

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.

## Request body `multipart/form-data`

- BodyUploadWithKbCreationKnowledgeBasesV2UploadPost
  - `name` string, required
  - `file` string, binary, nullable
  - `markdown_content` string, nullable
  - `description` string, nullable
  - `privacy` 'public' | 'private'
  - `chunking_strategy` string, nullable
  - `icon` string, nullable

## 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.dev/myaltimate/apis/myaltimate-api.md) - [All operations](https://skmtc.dev/myaltimate/apis/myaltimate-api/llms.txt) - [OpenAPI document](https://skmtc.dev/myaltimate/apis/myaltimate-api/revisions/727657ce54e9?raw)
