---
title: "Create document"
method: POST
path: "/v1alpha1/public/knowledge-base/document"
tags: ["KBPublicApiDocument", "Public-Docs"]
---

# Create document

`POST /v1alpha1/public/knowledge-base/document`

Upload or provide a URL to scrape and import as a knowledge base document. Supports both `application/json` and `multipart/form-data` content types.

## Query parameters

- `maxChunkSize` union — Determines how granularly each document is broken up. Range available is 500-1500 tokens, default is 1000. Smaller chunk size means narrower context, faster response, less tokens consumed, and greater risk of less accurate answers. Max chunk size affects the total amount of chunks parsed from a document - i.e., larger chunks means less chunks retrieved.
  - string
  - number
- `overwrite` union — If set to true, the existing table with the same name will be overwritten.
  - boolean
  - 'true' | 'false'
- `markdownConversion` union — When enabled, HTML is automatically converted to markdown to generate better chunks.
  - boolean
  - 'true' | 'false'
- `llmBasedChunks` union
  - boolean
  - 'true' | 'false'
- `llmGeneratedQ` union — When enabled, an LLM will be used to generate a question based on the document context and specific chunk, then prepend it to the chunk. This enhances retrieval by aligning chunks with potential user queries.
  - boolean
  - 'true' | 'false'
- `llmContentSummarization` union — When enabled, an LLM summarizes and rewrites the content, removing unnecessary information and focusing on important parts to optimize for retrieval. Limited to 15 rows per table upload.
  - boolean
  - 'true' | 'false'
- `llmPrependContext` union — When enabled, an LLM generates a context summary based on the document and chunk context, and prepends it to each chunk. This improves retrieval by providing additional context to each chunk. Note: If both llmGeneratedQ and llmPrependContext are set to true, llmGeneratedQ takes precedence, and the context summarization will not be applied.
  - boolean
  - 'true' | 'false'

## Headers

- `content-type` string

## Request body

- object
  - `data` object, required
    - `type` 'url', required
    - `url` string, required
    - `name` string
    - `refreshRate` 'daily' | 'weekly' | 'monthly' | 'never'
    - `folderID` string
    - `documentMetadata` object[] — An array of document metadata fields. > **💡 Tip:** This metadata can be used in agent KB metadata filter conditions. [Learn more about metadata filtering](/documentation/build/querying-the-knowledge-base#meta-data-filtering).
      - `key` string, required
      - `values` string[], required
    - `metadata` object — Chunk-level metadata that can be used in a KB API query request. > **⚠️ Warning:** This metadata can't be used in agent KB metadata filter conditions. Use `documentMetadata` instead if you need agent-level metadata filtering.
    - `projectEnvironmentIDOrAlias` string — The alias of the environment to target (ie. `main`). You can find this in the environments page of your agent. > **💡 Tip:** [Learn more about Environments](/documentation/deploy/environments).

## Response `201`

The document was created successfully.

- DocumentCreateOneUrlPublicResponse
  - `data` object, required
    - `documentID` string, required
    - `data` KBDocumentUrlData, required
      - `type` 'url', required
      - `name` string, required
      - `url` string, required
      - `refreshRate` 'daily' | 'weekly' | 'monthly' | 'never'
      - `lastSuccessUpdate` string
      - `accessTokenID` number
      - `integrationExternalID` string
      - `source` 'zendesk' | 'shopify'
    - `updatedAt` string, date-time, required
    - `status` KBDocumentStatus, required
      - `type` 'ERROR' | 'PENDING' | 'SUCCESS' | 'INITIALIZED', required
      - `data` unknown

---

[API](https://skmtc.dev/voiceflow/apis/general-runtime.md) · [All operations](https://skmtc.dev/voiceflow/apis/general-runtime/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/voiceflow/general-runtime/revisions/6b1c4f778c56/schema)
