zoxaAI
Homepage
API ReferenceFiles

Create a file from text

POST /api/v1/files/text — create a `.txt` file from inline text content.

POST /api/v1/files/text

Create a file from inline text content. Equivalent to POST /knowledge-base/create-from-text but returns the FileResponse shape used elsewhere under /files.

Request body

FieldTypeRequiredNotes
namestring✓Display name. Sanitized into a safe filename.
contentstring✓UTF-8 text.
retrievalMode"chunked" / "full_document"—Default "chunked".

Response

201 Created with the same shape as POST /files.

Examples

curl -X POST https://dashboard.zoxa.ai/api/v1/files/text \
  -H "X-API-Key: zsk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Refund policy",
    "content": "Refunds within 30 days...",
    "retrievalMode": "full_document"
  }'
const file = await fetch("https://dashboard.zoxa.ai/api/v1/files/text", {
  method: "POST",
  headers: { "X-API-Key": "zsk_...", "Content-Type": "application/json" },
  body: JSON.stringify({
    name: "Refund policy",
    content: "Refunds within 30 days...",
    retrievalMode: "full_document",
  }),
}).then((r) => r.json());
import httpx
file = httpx.post(
    "https://dashboard.zoxa.ai/api/v1/files/text",
    headers={"X-API-Key": "zsk_..."},
    json={
        "name": "Refund policy",
        "content": "Refunds within 30 days...",
        "retrievalMode": "full_document",
    },
).json()

Errors

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

On this page