API ReferenceKnowledge Base
Create from text
POST /api/v1/knowledge-base/create-from-text — ingest inline text directly without a file upload.
POST /api/v1/knowledge-base/create-from-textCreate a document from pasted text. zoxaAI writes the content to storage as a .txt, registers the document, and enqueues processing — all in one request.
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
title | string | ✓ | Display name. Sanitized into a safe filename internally. |
content | string | ✓ | UTF-8 text. |
retrieval_mode | "chunked" / "full_document" | — | Default "full_document". |
Response
Same shape as GET /knowledge-base/documents/{uuid}, with processing_status="pending" and total_chunks=0.
Examples
curl -X POST https://dashboard.zoxa.ai/api/v1/knowledge-base/create-from-text \
-H "X-API-Key: zsk_..." \
-H "Content-Type: application/json" \
-d '{
"title": "Refund policy",
"content": "Refunds are available within 30 days of purchase...",
"retrieval_mode": "full_document"
}'const doc = await fetch(
"https://dashboard.zoxa.ai/api/v1/knowledge-base/create-from-text",
{
method: "POST",
headers: { "X-API-Key": "zsk_...", "Content-Type": "application/json" },
body: JSON.stringify({
title: "Refund policy",
content: "Refunds are available within 30 days of purchase...",
retrieval_mode: "full_document",
}),
},
).then((r) => r.json());
console.log("documentId:", doc.document_uuid);import httpx
doc = httpx.post(
"https://dashboard.zoxa.ai/api/v1/knowledge-base/create-from-text",
headers={"X-API-Key": "zsk_..."},
json={
"title": "Refund policy",
"content": "Refunds are available within 30 days of purchase...",
"retrieval_mode": "full_document",
},
).json()Errors
| Status | detail | When |
|---|---|---|
500 | "Failed to upload text to storage" | Storage backend rejected the write. |
500 | "Failed to create document from text" | DB or enqueue failed. |
Related
POST /knowledge-base/upload-url— file-based ingestionGET /knowledge-base/documents/{uuid}— poll forprocessing_status="completed"