---
title: "Create a knowledge base"
method: POST
path: "/v1/knowledgebases"
tags: ["Knowledge Bases"]
---

# Create a knowledge base

`POST /v1/knowledgebases`

## Request

- Base URL: `https://api.pyai.com`
- URL: `https://api.pyai.com/v1/knowledgebases`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Create a hosted knowledge base. Names are unique per organization (case-insensitive). Requires the `kb:manage` scope.

## Request body

- object
  - `name` string, required
  - `embed_model` string: Embedding model id. Defaults to the platform standard; change only with guidance.

## Response `201`

Knowledge base created

- Knowledgebase
  - `id` string
  - `orgId` string
  - `name` string
  - `embedModel` string
  - `docCount` integer
  - `bytes` integer
  - `status` 'active' | 'deleted'
  - `createdAt` integer: Unix ms.

## Other responses

- `400`: Invalid request (bad field, unsupported value)
- `409`: A knowledge base with that name already exists in this organization.

---

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