Skip to main content
POST
Create Document by Text

Authorizations

Authorization
string
header
required

Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).

Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).

Path Parameters

dataset_id
string<uuid>
required

Knowledge base ID. From List Knowledge Bases.

Body

application/json
name
string
required

Document name.

text
string
required

Document text content.

indexing_technique
enum<string>

Required when adding the first document to a knowledge base. Subsequent documents inherit the knowledge base's indexing technique if omitted. high_quality uses embedding models for precise search; economy uses keyword-based indexing.

Available options:
high_quality,
economy
doc_form
enum<string>
default:text_model

text_model for standard text chunking, hierarchical_model for parent-child chunk structure, qa_model for question-answer pair extraction.

Available options:
text_model,
hierarchical_model,
qa_model
doc_language
string
default:English

Language of the document for processing optimization.

process_rule
object

Processing rules for chunking.

retrieval_model
object

Controls how chunks are searched and ranked when querying this knowledge base.

embedding_model
string

Embedding model name. Use the model field from Get Available Models with model_type=text-embedding.

embedding_model_provider
string

Embedding model provider. Use the provider field from Get Available Models with model_type=text-embedding.

original_document_id
string

Original document ID for versioning. Get it from List Documents.

Response

Document created successfully.

document
object
batch
string

Batch ID for tracking indexing progress.