Skip to main content
POST
/
v1
/
knowledge-bases
/
sources
Upload a file / add a URL or text WITHOUT pre-creating a KB (auto-creates one)
curl --request POST \
  --url https://api.oneinbox.ai/v1/knowledge-bases/sources \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'file=<string>' \
  --form 'type=<string>' \
  --form 'source=<string>' \
  --form 'name=<string>'
{
  "source": {
    "id": "<string>",
    "knowledge_base_id": "<string>",
    "type": "<string>",
    "source": "<string>",
    "chunk_count": 123,
    "status": "<string>",
    "error_message": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "file_name": "<string>",
    "mime_type": "<string>",
    "file_size": 123,
    "token_count": 0
  },
  "job": {
    "id": "<string>",
    "knowledge_base_id": "<string>",
    "knowledge_base_source_id": "<string>",
    "type": "<string>",
    "status": "<string>",
    "error_message": "<string>",
    "payload": {},
    "started_at": "2023-11-07T05:31:56Z",
    "completed_at": "2023-11-07T05:31:56Z",
    "created_at": "2023-11-07T05:31:56Z"
  },
  "message": "Source accepted. Ingestion is running in the background. Poll GET /v1/knowledge-bases/{kb_id}/jobs/{job_id} for status."
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
file
string | null
type
string | null
source
string | null
name
string | null

Response

Successful Response

201 response for POST /sources — returns the source and a job_id to poll.

source
KBSourceResponse · object
required
job
KBJobResponse · object
required
message
string
default:Source accepted. Ingestion is running in the background. Poll GET /v1/knowledge-bases/{kb_id}/jobs/{job_id} for status.