API ReferenceFiles
Create a file from text
POST /api/v1/files/text — create a `.txt` file from inline text content.
POST /api/v1/files/textCreate 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
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | ✓ | Display name. Sanitized into a safe filename. |
content | string | ✓ | 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
| Status | detail | When |
|---|---|---|
500 | "Failed to upload text to storage" | Storage backend rejected the write. |
500 | "Failed to create file from text" | DB or enqueue failed. |