Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.oneinbox.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Knowledge bases let your agent retrieve answers from your content — product docs, FAQs, policies, and files. Flow: Create KB → add sources (async) → poll jobs → attach kb_id to LLM model → agent uses it on calls.

All endpoints

StepMethodEndpoint
1POST/v1/knowledge-bases
2POST/v1/knowledge-bases/{kb_id}/sources
3GET/v1/knowledge-bases/{kb_id}/jobs/{job_id}
4PATCH/v1/models/{llm_id}
GET/v1/knowledge-bases/{kb_id}/sources
GET/v1/knowledge-bases/{kb_id}/jobs

How retrieval works

OneInbox chooses a mode based on total KB token budget (default 10k tokens):
  • ≤ 10k tokens — content is injected into the LLM system prompt at call time (no extra retrieval round-trips)
  • > 10k tokens — vector retrieval with a synthetic search_knowledge_base tool the LLM can call
Source uploads return 202 Accepted immediately. Poll the job_id until status is completed.
1

1. Create a knowledge base

curl -X POST https://api.oneinbox.ai/v1/knowledge-bases \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Docs",
    "chunk_size": 512,
    "multilingual": false
  }'
2

2a. Add a file source

Upload PDF, DOCX, XLSX, TXT, or MD (max 50 MiB per file). Use multipart/form-data:
curl -X POST "https://api.oneinbox.ai/v1/knowledge-bases/<kb_id>/sources" \
  -H "Authorization: Bearer <api_key>" \
  -F "file=@/path/to/document.pdf"
3

2b. Add a URL source

curl -X POST "https://api.oneinbox.ai/v1/knowledge-bases/<kb_id>/sources" \
  -H "Authorization: Bearer <api_key>" \
  -F "type=url" \
  -F "source=https://docs.example.com/faq"
4

2c. Add inline text

curl -X POST "https://api.oneinbox.ai/v1/knowledge-bases/<kb_id>/sources" \
  -H "Authorization: Bearer <api_key>" \
  -F "type=text" \
  -F "source=Our return policy is 30 days, no questions asked."
5

3. Poll the indexing job

All source uploads return 202 with a job ID:
{
  "job": {
    "id": "job_abc123",
    "status": "queued"
  }
}
Poll until completed or failed:
curl "https://api.oneinbox.ai/v1/knowledge-bases/<kb_id>/jobs/<job_id>" \
  -H "Authorization: Bearer <api_key>"
Status flow: queuedrunningcompleted | failed. On success, payload includes tokens, chunks, and vector_indexed.List recent jobs:
curl "https://api.oneinbox.ai/v1/knowledge-bases/<kb_id>/jobs" \
  -H "Authorization: Bearer <api_key>"
6

4. List sources (optional)

curl "https://api.oneinbox.ai/v1/knowledge-bases/<kb_id>/sources" \
  -H "Authorization: Bearer <api_key>"
Source rows include status (processing / ready / error), file_name, token_count, chunk_count, and error_message when applicable.
7

5. Attach to your LLM model

curl -X PATCH "https://api.oneinbox.ai/v1/models/<llm_id>" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{ "knowledge_base_ids": ["<kb_id>"] }'
Agents using this llm_id will use the KB on the next call.

Manage knowledge bases

curl https://api.oneinbox.ai/v1/knowledge-bases \
  -H "Authorization: Bearer <api_key>"

curl -X DELETE "https://api.oneinbox.ai/v1/knowledge-bases/<kb_id>" \
  -H "Authorization: Bearer <api_key>"

Next steps