Skip to main content
POST
/
v1
/
knowledge-bases
/
sources
Add a knowledge base source — file, URL, or inline text (auto-creates the 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 2.file='@example-file'
{
  "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

Your API key sent as a Bearer credential — Authorization: Bearer <api_key>, where <api_key> starts with oi_sk_ (create one via POST /v1/api-keys). Although the field is labelled 'token', paste your API key here. A dashboard JWT is also accepted on this header for the same endpoints.

Body

multipart/form-data
type
enum<string>
required
Available options:
url
Example:

"url"

source
string
required

Publicly accessible URL to crawl. OneInbox reads all linked pages automatically.

Example:

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

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.