Skip to main content
POST
/
v1
/
knowledge-bases
/
sources
Add source (auto-create KB)
curl --request POST \
  --url https://api.oneinbox.ai/v1/knowledge-bases/sources \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form type=url \
  --form source=https://docs.yourproduct.com/faq \
  --form file='@example-file'
{
  "knowledge_base_id": "kb_abc123",
  "source": {
    "id": "kbs_abc123",
    "knowledge_base_id": "<string>",
    "source": "<string>",
    "chunk_count": 123,
    "token_count": 123,
    "file_name": "<string>",
    "mime_type": "<string>",
    "file_size": 123,
    "error_message": "<string>",
    "created_at": "2023-11-07T05:31:56Z"
  },
  "job": {
    "id": "kbj_abc123",
    "knowledge_base_id": "<string>",
    "knowledge_base_source_id": "<string>",
    "type": "ingest_source",
    "payload": {
      "chunks": 123,
      "tokens": 123,
      "vector_indexed": true
    },
    "created_at": "2023-11-07T05:31:56Z",
    "completed_at": "2023-11-07T05:31:56Z",
    "error_message": "<string>"
  },
  "message": "Knowledge base auto-created. Source accepted. Ingestion is running in the background."
}

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.

Authorizations

Authorization
string
header
required

Use api_key from POST /v1/api-keys

Body

multipart/form-data
type
enum<string>

Source type. Required for URL and text sources. Omit entirely when uploading a file.

Available options:
url,
text
Example:

"url"

source
string

The URL or raw text to index. Required when type is url or text.

Example:

"https://docs.yourproduct.com/faq"

file
file

File to upload. Required when adding a file source. Supported formats — PDF, DOCX, XLSX, TXT, MD.

Response

202 - application/json

Accepted — KB auto-created and source is processing asynchronously

knowledge_base_id
string

ID of the auto-created knowledge base.

Example:

"kb_abc123"

source
object

The created source record

job
object

The background processing job. Poll GET /v1/knowledge-bases/{kb_id}/jobs/{job_id} for status.

message
string
Example:

"Knowledge base auto-created. Source accepted. Ingestion is running in the background."