Skip to main content
FIXED · agent One live knowledge base belongs to an agent. Its attached numbers use that base on enabled channels. Only the active revision and eligible, unsuppressed pieces enter live retrieval. NOT OFFERED → do this instead · number Knowledge and its enabled channels belong to the agent. Retired per-number knowledge operations return 410 number_knowledge_removed. Use separate agents when a number needs different knowledge or none. YOU CAN CHANGE · source Use pasted text, PDF, DOCX or plain UTF-8 text, or discover a website and import selected pages. API submissions can request review. SCOPE · agent Review knowledge drafts and publish approved material. Limits per base: sources 50 · kbTokens 100,000 · topics 1,000. Read the compact AI rules Prepare text, files or selected website pages for an agent’s knowledge base, with review requested before new facts become live.
Input: Text, files or selected pages ·
Output: Preparation job ·
Next task: Review the draft
The important part
  • Create one knowledge base for the agent, not for each number.
  • Save the operation key and returned job ID before starting another import.
  • Set review:true explicitly; the API default can publish after preparation.

Before you start

  • An account API credential in NIXFLEX_API_KEY and an owned active agent ID in NXF_AGENT_ID.
  • Knowledge enabled for the account. API-managed and mixed-origin agents can be hidden from dashboard knowledge screens while remaining accessible to the owning API key.
  • A durable operation record in your application. Knowledge writes require an Idempotency-Key: 8–128 letters, digits, dots, underscores, colons or hyphens. The prompt: prefix is reserved. Use one key per intended operation and retain it across an uncertain response.
The examples use the production API address. Set the intended account credential privately in NIXFLEX_API_KEY before running anything. Knowledge examples require Node/CLI 0.11.0 or later or Python 0.4.0 or later.

Create or read the base

Read capabilities and GET /v1/agents/{agent_id}/knowledge-base. The scope reply contains own and effective; they can be null before creation. Create the singleton with PUT at the same path, a new idempotency key and this body:
Save own.id as NXF_KNOWLEDGE_BASE_ID and its integer rev. An update to an existing base needs its current expected_revision. The settings channels are inbound, outbound, web_voice, web_chat and sms; only inbound starts enabled. Campaigns use outbound, with no separate campaign switch. not_found must be nonblank and at most 500 characters. Create or update an agent base documents the scope envelope. Retired number-knowledge routes return 410; never create a number-level base. Old retained number-base rows are not automatically converted into live agent knowledge. Re-add the intended facts to the current agent and review them explicitly.

Submit material for review

Set NXF_IDEMPOTENCY_KEY to a fresh operation key. The same text import is shown in all four tabs: Use this body in each example. Save it as request-112.json for the CLI.
review:true is deliberate. The public API defaults to false, which can publish after preparation; dashboard imports always require review. Flags and review reminders can force a draft even when false was requested. For files, POST raw bytes to the same source endpoint with Content-Type: application/octet-stream, X-Filename, X-Review: true and the idempotency header. Do not send base64 or a local path. Supported contents are UTF-8 text, PDF with selectable text and DOCX. A preview via source measure counts privately without saving a source; it is not publication clearance. For websites, create a discovery job, read its result.pages, let the user choose IDs, then submit discovery_id, page_ids and review:true to website imports. A direct source.type:url or qa is refused.

Check the accepted job

HTTP 202 means preparation was accepted. Save the job ID in the same application record as the base ID and idempotency key. Read the job until it reaches needs_review, ready, failed, cancelled or deleted. ready can also mean unchanged input; it does not by itself prove that new facts were published. If the response is lost, retry the same intention with the original key and unchanged input. A new key could add a duplicate source. Honour next_retry_at and stop polling when the user leaves; resume from the saved job later.

Fix rejected sources

Local file validation is not a complete virus scan. A configured but unavailable scanner may hold PDF or DOCX processing at safety_check or safety_waiting until its reported expiry.

Continue the workflow