zoxaAI
Homepage
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-text

Create 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

FieldTypeRequiredNotes
titlestring✓Display name. Sanitized into a safe filename internally.
contentstring✓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

StatusdetailWhen
500"Failed to upload text to storage"Storage backend rejected the write.
500"Failed to create document from text"DB or enqueue failed.

On this page