Docs
Knowledge bases

Knowledge bases

Knowledge bases and the documents inside them — what your assistants can search during a call.

A knowledge base is a named collection of documents. Attach it to an assistant with connectKnowledgeIds, and the assistant searches it when a caller asks something the prompt does not cover. Each document is indexed (chunked and embedded) when it is added, and again when its text changes. Only indexStatus: "INDEXED" means its current text is searchable.

Beta. This API is documented but not yet frozen. Response fields and error codes may change without a version bump. Pin your integration to the fields you use, and expect additions.

Two levels

  • Knowledge bases — /api/knowledge and /api/knowledge/{knowledgeId}. A base's prompt is its usage note: one sentence telling the assistant when to look here. The list returns every base in your token's workspace, whoever created it, one page at a time (limit, cursor).
  • Documents — /api/knowledge/{knowledgeId}/documents/…. A document belongs to exactly one base and is addressed through it; a valid document id under the wrong base is a not-found.

Ownership

Any member can read every base and document in the workspace. Changing or deleting a base, and changing, deleting or re-indexing a document, is gated by ownership — a MEMBER acts only on rows they created; ADMIN and OWNER on any. Any member can add a document to any base. Deleting a base deletes every document in it, including documents other members added.

Indexing

Adding a document indexes it before the response returns. A 201 means the document is saved and its search entries are written; they are usually searchable within seconds. If indexing fails you get DOCUMENT_INDEXING_FAILED, and the document is usually rolled back, so send the create again. In rare cases the document stays, and the list shows it as FAILED. It keeps its name and counts toward the cap, so a second create with that name answers RESOURCE_CONFLICT. Re-index that document instead.

Replacing a document's text saves first and re-indexes in the background. The response says indexStatus: "PENDING". The status then moves to INDEXING, then to INDEXED, or to FAILED if indexing fails. Until it reads INDEXED, the assistant can still answer from the previous text. The background job is best-effort. If it is lost, a daily job at 07:00 UTC re-indexes the document. That job takes 20 documents per run across all workspaces, oldest first, so the wait can be longer than a day. It tries one document at most 5 times; after that, only the re-index endpoint retries it. To retry sooner, call the re-index endpoint; it queues nothing while the document still reads INDEXING.

GET /api/knowledge/index-status counts, per base, the documents that are FAILED, or PENDING or INDEXING for more than ten minutes. It does not count a document that is re-indexing normally. To follow one document, read its indexStatus.

Plan caps

The workspace owner's plan sets three caps: bases per workspace, documents per workspace (all bases together), and extracted characters per document. Hypergrowth has no base or document cap. Over a cap answers SUBSCRIPTION_LIMIT_EXCEEDED with the cap in detail. Replacing a document's text is checked against the character cap too. A request body over 4.5 MB is refused before dBel reads it, so split a very large document into several.

Example — add a text document

curl -X POST https://dbel.ai/api/knowledge/clx…/documents \
  -H "Authorization: Bearer $DBEL_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "PLAIN_TEXT",
    "name": "Opening hours",
    "text": "We are open Monday to Friday, 9am to 5pm."
  }'

To store a web page's content, send "type": "URL" with url, name and text. dBel does not fetch the page: it indexes only the text you send, and stores the url with it. PDFs are uploaded from the dashboard. A token can download a stored PDF's original file with the PDF download endpoint below.

Endpoints

GET/api/knowledge

List the workspace's knowledge bases.

Every base in the token's workspace, whoever created it — the same set the dashboard shows.

Auth: Bearer token · any workspace member

Query parameters

FieldTypeNotes
limitinteger 1–100Rows per page. Default 20.
cursorstringThe nextCursor from the previous page.

Responses

200 JSON body:

FieldTypeNotes
basesobject[]
bases[].idstring
bases[].namestring
bases[].promptstring
bases[].createdAtdatetime
bases[].updatedAtdatetime
hasMoreboolean
nextCursorstring | null

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

POST/api/knowledge

Create a knowledge base.

Auth: Bearer token · any workspace member

Request body

application/json

FieldTypeNotes
name *stringmin 1, matches ^[A-Za-z0-9_]+$, max 64
prompt *stringmin 1, max 512

Responses

201 JSON body:

FieldTypeNotes
baseobject
base.idstring
base.namestring
base.promptstring
base.createdAtdatetime
base.updatedAtdatetime

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/knowledge/{knowledgeId}

Fetch one knowledge base and the ids of the assistants using it.

Auth: Bearer token · any workspace member

Responses

200 JSON body:

FieldTypeNotes
baseobject
base.idstring
base.namestring
base.promptstring
base.createdAtdatetime
base.updatedAtdatetime
base.assistantIdsstring[]

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

PATCH/api/knowledge/{knowledgeId}

Rename a knowledge base or change its usage note.

RESOURCE_CONFLICT means another knowledge base in the workspace has that name, ignoring case.

Auth: Bearer token · any workspace member · a MEMBER may act only on rows they created (ADMIN/OWNER on any)

Request body

application/json

FieldTypeNotes
namestringmin 1, matches ^[A-Za-z0-9_]+$, max 64
promptstringmin 1, max 512

Responses

200 JSON body:

FieldTypeNotes
baseobject
base.idstring
base.namestring
base.promptstring
base.createdAtdatetime
base.updatedAtdatetime

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

DELETE/api/knowledge/{knowledgeId}

Delete a knowledge base and every document in it.

Auth: Bearer token · any workspace member · a MEMBER may act only on rows they created (ADMIN/OWNER on any)

Responses

204 No body.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/knowledge/index-status

Count the workspace's documents that failed to index, or are stuck for more than ten minutes.

Auth: Bearer token · any workspace member

Responses

200 JSON body:

FieldTypeNotes
notSearchablenumber
basesobject[]
bases[].baseIdstring
bases[].baseNamestring
bases[].countnumber

bases lists only bases with at least one counted document, highest count first. An empty array means no document needs attention.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/knowledge/{knowledgeId}/documents

List a knowledge base's documents, newest first.

Document reads share one per-workspace rate limit across list, detail and PDF.

Auth: Bearer token · any workspace member

Query parameters

FieldTypeNotes
limitinteger 1–100Rows per page. Default 20.
cursorstringThe nextCursor from the previous page.

Responses

200 JSON body:

FieldTypeNotes
documentsobject[]
documents[].idstring
documents[].namestring
documents[].mime_typeenum: PDF | JPEG_IMAGE | PNG_IMAGE | MP3_AUDIO | MP4_VIDEO | JSON | CSV | PLAIN_TEXT | URL | null
documents[].urlstring | null
documents[].indexStatusenum: PENDING | INDEXING | INDEXED | FAILED
documents[].indexedAtdatetime | null
documents[].indexAttemptsnumber
documents[].deleteRequestedAtdatetime | null
documents[].createdAtdatetime
documents[].updatedAtdatetime
hasMoreboolean
nextCursorstring | null

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

POST/api/knowledge/{knowledgeId}/documents

Add a document from text you send (type PLAIN_TEXT or URL) and index it.

Auth: Bearer token · any workspace member

Request body

application/json

Over JSON only the PLAIN_TEXT and URL variants are usable; the PDF variant needs a binary fileBuffer, which JSON cannot carry (the dashboard uploads PDFs through a session-only route).

When type = "PDF":

FieldTypeNotes
type *"PDF"
name *stringmin 1, max 96
fileBuffer *any
text *stringmin 1

When type = "PLAIN_TEXT":

FieldTypeNotes
type *"PLAIN_TEXT"
name *stringmin 1, max 96
text *stringmin 1

When type = "URL":

FieldTypeNotes
type *"URL"
url *stringURL
name *stringmin 1, max 96
text *stringmin 1

Responses

201 JSON body:

FieldTypeNotes
documentIdstring
documentNamestring
mimeTypeenum: PDF | JPEG_IMAGE | PNG_IMAGE | MP3_AUDIO | MP4_VIDEO | JSON | CSV | PLAIN_TEXT | URL | null

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/knowledge/{knowledgeId}/documents/{documentId}

Fetch one document, including its extracted text.

Auth: Bearer token · any workspace member

Responses

200 JSON body:

FieldTypeNotes
documentobjectcontent is the extracted text. The raw PDF bytes are never returned here.
document.idstring
document.baseIdstring
document.namestring
document.mime_typeenum: PDF | JPEG_IMAGE | PNG_IMAGE | MP3_AUDIO | MP4_VIDEO | JSON | CSV | PLAIN_TEXT | URL | null
document.contentstring | null
document.createdAtdatetime
document.updatedAtdatetime
document.urlstring | null
document.indexStatusenum: PENDING | INDEXING | INDEXED | FAILED
document.indexedAtdatetime | null
document.indexAttemptsnumber
document.deleteRequestedAtdatetime | null
document.lastReconciledAtdatetime | null

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

GET/api/knowledge/{knowledgeId}/documents/pdf

Download a PDF document's original file.

A document that is not a PDF, or has no stored file, answers DOCUMENT_NOT_FOUND_OR_UNAUTHORIZED. Shares the document-read rate limit with the list and detail.

Auth: Bearer token · any workspace member

Query parameters

FieldTypeNotes
documentId *stringThe PDF document to download.

Responses

200 application/pdf The file's bytes, with Cache-Control: private, no-store.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

PATCH/api/knowledge/{knowledgeId}/documents/{documentId}

Rename a document, or replace its text and re-index it.

RESOURCE_CONFLICT means another document in the knowledge base has that name, ignoring case.

Auth: Bearer token · any workspace member · a MEMBER may act only on rows they created (ADMIN/OWNER on any)

Request body

application/json

Send name, text or both; other keys are ignored, and a body with neither answers INVALID_REQUEST_BODY. A name-only body renames in place (indexStatus unchanged); a body with text saves and answers indexStatus: PENDING while re-indexing runs.

FieldTypeNotes
namestringmin 1, max 96
textstringmin 1

Responses

200 JSON body:

FieldTypeNotes
documentIdstring
documentNamestring
typeenum: PDF | JPEG_IMAGE | PNG_IMAGE | MP3_AUDIO | MP4_VIDEO | JSON | CSV | PLAIN_TEXT | URL | null
indexStatusenum: PENDING | INDEXING | INDEXED | FAILED

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

DELETE/api/knowledge/{knowledgeId}/documents/{documentId}

Delete a document and its search vectors.

Auth: Bearer token · any workspace member · a MEMBER may act only on rows they created (ADMIN/OWNER on any)

Responses

204 No body.

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return

POST/api/knowledge/{knowledgeId}/documents/{documentId}/reindex

Queue a document for re-indexing.

No request body. The work runs after the response; poll the document's indexStatus. queued: false means the document was already INDEXING, so nothing new was queued. A claim from a lost job stays INDEXING until the daily sweep marks it FAILED.

Auth: Bearer token · any workspace member · a MEMBER may act only on rows they created (ADMIN/OWNER on any)

Responses

200 JSON body:

FieldTypeNotes
documentIdstring
indexStatus"PENDING" | "INDEXING"
queuedboolean

Errors

Problem Details (RFC 9457). Each code links to its reference page.

Plus the auth-layer codes every endpoint can return