Bases de conocimiento
Documentos que un asistente puede consultar durante una llamada.
GET /v1/knowledge-bases
List the knowledge bases
API key con knowledge:read · Rol: viewer o superior
Any signed-in member, or an API key with `knowledge:read`. The tenant's knowledge bases, newest first. `status` is `empty` (no documents), `processing` (a document is not done yet), `ready` (at least one document is searchable) or `failed` (every document failed). 401 when the token is missing, expired or invalid; 503 until knowledge bases are deployed.
Respuestas
200Successful Response · KnowledgeBaseListResponseNombre Tipo Requerido Descripción itemsKnowledgeBaseResponse[]sí items[].chunk_countintegersí items[].created_atstring (date-time)sí items[].descriptionstring | nullsí items[].document_countintegersí items[].embedding_modelstring | nullsí Null until the first document is indexed. items[].idstring (uuid)sí items[].namestringsí items[].reindexingbooleansí A reindex of the whole base is queued or running. items[].search_settingsSearchSettingsResponsesí items[].search_settings.hybridbooleansí Dense plus BM25, fused with RRF. items[].search_settings.rerankbooleansí Re-score the best candidates with a cross-encoder (slower). items[].search_settings.score_thresholdnumber | nullsí Minimum cosine similarity of the dense retriever; null: none. items[].search_settings.top_kintegersí items[].statusstringsí Of a whole base: `empty` has no documents, `processing` has one that is not done yet, `ready` has at least one searchable document, `failed` has only failed ones. (empty, processing, ready, failed) items[].updated_atstring (date-time)sí 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/knowledge-bases
Create a knowledge base
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) creates an empty knowledge base with a `name` (1 to 120 characters) and an optional `description` (up to 1,000). Audited as `knowledge_base.create` with the id and name only. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 422 when the body is invalid; 503 until knowledge bases are deployed.
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
description | string | null | ||
name | string | sí |
Respuestas
201Successful Response · KnowledgeBaseResponseNombre Tipo Requerido Descripción chunk_countintegersí created_atstring (date-time)sí descriptionstring | nullsí document_countintegersí embedding_modelstring | nullsí Null until the first document is indexed. idstring (uuid)sí namestringsí reindexingbooleansí A reindex of the whole base is queued or running. search_settingsSearchSettingsResponsesí search_settings.hybridbooleansí Dense plus BM25, fused with RRF. search_settings.rerankbooleansí Re-score the best candidates with a cross-encoder (slower). search_settings.score_thresholdnumber | nullsí Minimum cosine similarity of the dense retriever; null: none. search_settings.top_kintegersí statusstringsí Of a whole base: `empty` has no documents, `processing` has one that is not done yet, `ready` has at least one searchable document, `failed` has only failed ones. (empty, processing, ready, failed) updated_atstring (date-time)sí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
GET /v1/knowledge-bases/{knowledge_base_id}
One knowledge base
API key con knowledge:read · Rol: viewer o superior
Any signed-in member, or an API key with `knowledge:read`. 401 when the token is missing, expired or invalid; 404 when the base is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Respuestas
200Successful Response · KnowledgeBaseResponseNombre Tipo Requerido Descripción chunk_countintegersí created_atstring (date-time)sí descriptionstring | nullsí document_countintegersí embedding_modelstring | nullsí Null until the first document is indexed. idstring (uuid)sí namestringsí reindexingbooleansí A reindex of the whole base is queued or running. search_settingsSearchSettingsResponsesí search_settings.hybridbooleansí Dense plus BM25, fused with RRF. search_settings.rerankbooleansí Re-score the best candidates with a cross-encoder (slower). search_settings.score_thresholdnumber | nullsí Minimum cosine similarity of the dense retriever; null: none. search_settings.top_kintegersí statusstringsí Of a whole base: `empty` has no documents, `processing` has one that is not done yet, `ready` has at least one searchable document, `failed` has only failed ones. (empty, processing, ready, failed) updated_atstring (date-time)sí 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
PUT /v1/knowledge-bases/{knowledge_base_id}
Rename a knowledge base
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) replaces the `name` and `description`. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base is not one of the caller's tenant; 422 when the body is invalid; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
description | string | null | ||
name | string | sí |
Respuestas
200Successful Response · KnowledgeBaseResponseNombre Tipo Requerido Descripción chunk_countintegersí created_atstring (date-time)sí descriptionstring | nullsí document_countintegersí embedding_modelstring | nullsí Null until the first document is indexed. idstring (uuid)sí namestringsí reindexingbooleansí A reindex of the whole base is queued or running. search_settingsSearchSettingsResponsesí search_settings.hybridbooleansí Dense plus BM25, fused with RRF. search_settings.rerankbooleansí Re-score the best candidates with a cross-encoder (slower). search_settings.score_thresholdnumber | nullsí Minimum cosine similarity of the dense retriever; null: none. search_settings.top_kintegersí statusstringsí Of a whole base: `empty` has no documents, `processing` has one that is not done yet, `ready` has at least one searchable document, `failed` has only failed ones. (empty, processing, ready, failed) updated_atstring (date-time)sí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
DELETE /v1/knowledge-bases/{knowledge_base_id}
Delete a knowledge base and everything in it
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) deletes the base, its documents and, in the background, their vectors and files. Assistants that still list the base keep its id; their search tool answers that nothing was found. Audited as `knowledge_base.delete`. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Respuestas
204Successful Response401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
GET /v1/knowledge-bases/{knowledge_base_id}/documents
List the documents of a knowledge base
API key con knowledge:read · Rol: viewer o superior
Any signed-in member, or an API key with `knowledge:read`. Newest first. `status` is `awaiting_upload`, `uploaded`, `processing`, `ready` or `failed`; a `failed` document says why in `error_code`. 401 when the token is missing, expired or invalid; 404 when the base is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Respuestas
200Successful Response · DocumentListResponseNombre Tipo Requerido Descripción itemsDocumentResponse[]sí items[].chunk_countintegersí items[].created_atstring (date-time)sí items[].duplicate_ofstring (uuid) | nullsí Another document of the base has the same content: this one is `ready` with no chunks of its own. items[].error_codestring | nullsí Why a `failed` document failed: `unreadable_file`, `empty_document`, `too_many_pages`, `embedding_model_changed`, `no_text_layer` (a scanned file and OCR is off), `unreadable_file`, `internal_error`. items[].filenamestringsí items[].formatstringsí (pdf, docx, txt, md, csv, html) items[].idstring (uuid)sí items[].knowledge_base_idstring (uuid)sí items[].languagestring | nullsí `es`, `en` or `pt` when recognised. items[].last_synced_atstring (date-time) | nullsí items[].ocr_usedbooleansí items[].processed_atstring (date-time) | nullsí items[].size_bytesintegersí items[].source_idstring (uuid) | nullsí items[].source_typestringsí `file` or `url` (a page of a source). items[].source_urlstring | nullsí items[].statusstringsí (awaiting_upload, uploaded, processing, ready, failed) items[].tagsstring[]sí items[].titlestring | nullsí items[].token_countintegersí Approximate tokens of the indexed text. 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/knowledge-bases/{knowledge_base_id}/documents
Start uploading a document
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) declares a file (`filename`, `size_bytes` up to 25 MiB; the extension picks the format: pdf, docx, txt, md, csv or html). The answer is the document in `awaiting_upload` and a presigned `upload_url`: send the file to it with an HTTP `PUT`, with exactly `size_bytes` bytes, before `upload_expires_at`. The URL grants one object of the caller's own tenant and nothing else. Then call `POST /v1/knowledge-bases/{id}/documents/{document_id}/complete`. Audited as `document.create` with ids and the file name only. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base is not one of the caller's tenant; 422 when the body is invalid or the extension is not supported (`unsupported_format`); 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
filename | string | sí | A label; its extension picks the format (pdf, docx, txt, md, csv, html). |
size_bytes | integer | sí |
Respuestas
201Successful Response · DocumentCreatedResponseNombre Tipo Requerido Descripción documentDocumentResponsesí document.chunk_countintegersí document.created_atstring (date-time)sí document.duplicate_ofstring (uuid) | nullsí Another document of the base has the same content: this one is `ready` with no chunks of its own. document.error_codestring | nullsí Why a `failed` document failed: `unreadable_file`, `empty_document`, `too_many_pages`, `embedding_model_changed`, `no_text_layer` (a scanned file and OCR is off), `unreadable_file`, `internal_error`. document.filenamestringsí document.formatstringsí (pdf, docx, txt, md, csv, html) document.idstring (uuid)sí document.knowledge_base_idstring (uuid)sí document.languagestring | nullsí `es`, `en` or `pt` when recognised. document.last_synced_atstring (date-time) | nullsí document.ocr_usedbooleansí document.processed_atstring (date-time) | nullsí document.size_bytesintegersí document.source_idstring (uuid) | nullsí document.source_typestringsí `file` or `url` (a page of a source). document.source_urlstring | nullsí document.statusstringsí (awaiting_upload, uploaded, processing, ready, failed) document.tagsstring[]sí document.titlestring | nullsí document.token_countintegersí Approximate tokens of the indexed text. upload_expires_atstring (date-time)sí upload_urlstringsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
PUT /v1/knowledge-bases/{knowledge_base_id}/documents/{document_id}
Upload a new version of a document
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) replaces the file of a document with a new version. Same contract as `POST .../documents`: the answer is the document back in `awaiting_upload` and a presigned `upload_url` for exactly `size_bytes` bytes; then call `POST .../documents/{document_id}/complete`. The old version keeps answering searches until the new one is indexed. Tags are kept. Audited as `document.replace`. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base or document is not one of the caller's tenant; 409 `source_managed` for a page of a URL source (sync the source instead); 422 when the body is invalid or the extension is not supported (`unsupported_format`); 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
document_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
filename | string | sí | A label; its extension picks the format (pdf, docx, txt, md, csv, html). |
size_bytes | integer | sí |
Respuestas
200Successful Response · DocumentCreatedResponseNombre Tipo Requerido Descripción documentDocumentResponsesí document.chunk_countintegersí document.created_atstring (date-time)sí document.duplicate_ofstring (uuid) | nullsí Another document of the base has the same content: this one is `ready` with no chunks of its own. document.error_codestring | nullsí Why a `failed` document failed: `unreadable_file`, `empty_document`, `too_many_pages`, `embedding_model_changed`, `no_text_layer` (a scanned file and OCR is off), `unreadable_file`, `internal_error`. document.filenamestringsí document.formatstringsí (pdf, docx, txt, md, csv, html) document.idstring (uuid)sí document.knowledge_base_idstring (uuid)sí document.languagestring | nullsí `es`, `en` or `pt` when recognised. document.last_synced_atstring (date-time) | nullsí document.ocr_usedbooleansí document.processed_atstring (date-time) | nullsí document.size_bytesintegersí document.source_idstring (uuid) | nullsí document.source_typestringsí `file` or `url` (a page of a source). document.source_urlstring | nullsí document.statusstringsí (awaiting_upload, uploaded, processing, ready, failed) document.tagsstring[]sí document.titlestring | nullsí document.token_countintegersí Approximate tokens of the indexed text. upload_expires_atstring (date-time)sí upload_urlstringsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse409`source_managed`. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
PATCH /v1/knowledge-bases/{knowledge_base_id}/documents/{document_id}
Set the tags of a document
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) replaces the `tags` of a document: up to 20 labels of 1 to 40 characters, lower cased, without `:` or `,`. A search (and an assistant's attachment) can be limited to documents with a tag. Takes effect at once, without reindexing. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base or document is not one of the caller's tenant; 422 when the tags are not valid (`invalid_tags`); 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
document_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
tags | string[] | sí | Lower case labels without `:` or `,`; repeated ones are kept once. Used to filter a search to some documents. |
Respuestas
200Successful Response · DocumentResponseNombre Tipo Requerido Descripción chunk_countintegersí created_atstring (date-time)sí duplicate_ofstring (uuid) | nullsí Another document of the base has the same content: this one is `ready` with no chunks of its own. error_codestring | nullsí Why a `failed` document failed: `unreadable_file`, `empty_document`, `too_many_pages`, `embedding_model_changed`, `no_text_layer` (a scanned file and OCR is off), `unreadable_file`, `internal_error`. filenamestringsí formatstringsí (pdf, docx, txt, md, csv, html) idstring (uuid)sí knowledge_base_idstring (uuid)sí languagestring | nullsí `es`, `en` or `pt` when recognised. last_synced_atstring (date-time) | nullsí ocr_usedbooleansí processed_atstring (date-time) | nullsí size_bytesintegersí source_idstring (uuid) | nullsí source_typestringsí `file` or `url` (a page of a source). source_urlstring | nullsí statusstringsí (awaiting_upload, uploaded, processing, ready, failed) tagsstring[]sí titlestring | nullsí token_countintegersí Approximate tokens of the indexed text. 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
DELETE /v1/knowledge-bases/{knowledge_base_id}/documents/{document_id}
Delete a document and its vectors
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) deletes the document; its vectors and file are removed in the background. Audited as `document.delete`. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base or document is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
document_id | path | string (uuid) | sí |
Respuestas
204Successful Response401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/knowledge-bases/{knowledge_base_id}/documents/{document_id}/complete
Tell us the document is uploaded
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) says the file is uploaded. The control plane checks that the object exists and has the declared size, moves the document to `uploaded` and queues its ingestion: it is parsed, split into chunks, embedded and indexed in the background (`processing`, then `ready` or `failed`). 202 means accepted, not indexed: poll `GET /v1/knowledge-bases/{id}/documents`. Calling it again on a document that moved on returns the document. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base or document is not one of the caller's tenant; 409 when the file is not uploaded yet, has another size than declared, or the upload URL expired; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
document_id | path | string (uuid) | sí |
Respuestas
202Successful Response · DocumentResponseNombre Tipo Requerido Descripción chunk_countintegersí created_atstring (date-time)sí duplicate_ofstring (uuid) | nullsí Another document of the base has the same content: this one is `ready` with no chunks of its own. error_codestring | nullsí Why a `failed` document failed: `unreadable_file`, `empty_document`, `too_many_pages`, `embedding_model_changed`, `no_text_layer` (a scanned file and OCR is off), `unreadable_file`, `internal_error`. filenamestringsí formatstringsí (pdf, docx, txt, md, csv, html) idstring (uuid)sí knowledge_base_idstring (uuid)sí languagestring | nullsí `es`, `en` or `pt` when recognised. last_synced_atstring (date-time) | nullsí ocr_usedbooleansí processed_atstring (date-time) | nullsí size_bytesintegersí source_idstring (uuid) | nullsí source_typestringsí `file` or `url` (a page of a source). source_urlstring | nullsí statusstringsí (awaiting_upload, uploaded, processing, ready, failed) tagsstring[]sí titlestring | nullsí token_countintegersí Approximate tokens of the indexed text. 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse409The uploaded file is missing or differs. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/knowledge-bases/{knowledge_base_id}/documents/{document_id}/retry
Index a failed document again
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) queues the ingestion of a `failed` document again, from its stored file. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base or document is not one of the caller's tenant; 409 `not_failed` when the document did not fail; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
document_id | path | string (uuid) | sí |
Respuestas
202Successful Response · DocumentResponseNombre Tipo Requerido Descripción chunk_countintegersí created_atstring (date-time)sí duplicate_ofstring (uuid) | nullsí Another document of the base has the same content: this one is `ready` with no chunks of its own. error_codestring | nullsí Why a `failed` document failed: `unreadable_file`, `empty_document`, `too_many_pages`, `embedding_model_changed`, `no_text_layer` (a scanned file and OCR is off), `unreadable_file`, `internal_error`. filenamestringsí formatstringsí (pdf, docx, txt, md, csv, html) idstring (uuid)sí knowledge_base_idstring (uuid)sí languagestring | nullsí `es`, `en` or `pt` when recognised. last_synced_atstring (date-time) | nullsí ocr_usedbooleansí processed_atstring (date-time) | nullsí size_bytesintegersí source_idstring (uuid) | nullsí source_typestringsí `file` or `url` (a page of a source). source_urlstring | nullsí statusstringsí (awaiting_upload, uploaded, processing, ready, failed) tagsstring[]sí titlestring | nullsí token_countintegersí Approximate tokens of the indexed text. 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse409`not_failed`. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/knowledge-bases/{knowledge_base_id}/reindex
Index every document of a base again
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) queues a reindex: every document is read again from its stored file (or stored page text) and indexed with the embedding model and index layout the service has now. If the model changed, the old vectors are dropped first and searches return nothing until the documents are indexed again; otherwise the old ones keep answering. The service queues it by itself when `EMBEDDINGS_PROVIDER` or the model changed; this is the manual trigger. `reindexing` is true while it is queued or running; a second call meanwhile changes nothing. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Respuestas
202Successful Response · KnowledgeBaseResponseNombre Tipo Requerido Descripción chunk_countintegersí created_atstring (date-time)sí descriptionstring | nullsí document_countintegersí embedding_modelstring | nullsí Null until the first document is indexed. idstring (uuid)sí namestringsí reindexingbooleansí A reindex of the whole base is queued or running. search_settingsSearchSettingsResponsesí search_settings.hybridbooleansí Dense plus BM25, fused with RRF. search_settings.rerankbooleansí Re-score the best candidates with a cross-encoder (slower). search_settings.score_thresholdnumber | nullsí Minimum cosine similarity of the dense retriever; null: none. search_settings.top_kintegersí statusstringsí Of a whole base: `empty` has no documents, `processing` has one that is not done yet, `ready` has at least one searchable document, `failed` has only failed ones. (empty, processing, ready, failed) updated_atstring (date-time)sí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/knowledge-bases/{knowledge_base_id}/search
Test a search in a knowledge base
API key con knowledge:read · Rol: viewer o superior
Any signed-in member, or an API key with `knowledge:read`. Searches the base with `query` (1 to 500 characters) and returns up to `top_k` (1 to 10) chunks, best first, each with its `score`, `document_name`, `position` in the document, `heading`, `source_url` and the retrievers that found it (`matched_by`). `top_k`, `hybrid`, `rerank` and `score_threshold` default to the base's search settings; `tags` limits the search to documents with at least one of them. `mode` says how it ran. It is what the assistant's search tool does during a call. A base with no indexed document returns no hits. 401 when the token is missing, expired or invalid; 404 when the base is not one of the caller's tenant; 409 with code `reindex_required` while the base waits for a reindex after an embedding model change; 422 when the body is invalid or a tag is not valid (`invalid_tags`); 503 until knowledge bases are deployed or while the search service is down (`knowledge_unavailable`).
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
hybrid | boolean | null | Omitted: the base's `hybrid` setting. | |
query | string | sí | |
rerank | boolean | null | Omitted: the base's `rerank` setting. | |
score_threshold | number | null | Omitted: the base's `score_threshold` setting. | |
tags | string[] | null | Only documents with at least one of these tags. Omitted: all. | |
top_k | integer | null | 1 to 10. Omitted: the base setting (default 4). |
Respuestas
200Successful Response · SearchResponseNombre Tipo Requerido Descripción hitsSearchHitResponse[]sí hits[].document_idstring (uuid)sí hits[].document_namestringsí hits[].headingstring | nullsí hits[].matched_bystring[]sí Retrievers that found it: `dense`, `bm25`. hits[].positionintegersí Order of the chunk in its document, from 0. hits[].scorenumbersí Cosine similarity for a dense search, the fused RRF score for a hybrid one and the cross-encoder score after a rerank. Higher is better; compare only within one response. hits[].source_urlstring | nullsí The page, for a document of a URL source. hits[].textstringsí modestringsí How the search ran: `dense`, `hybrid`, `dense+rerank` or `hybrid+rerank`; `empty` when nothing is indexed and `filtered` when no document has the tags. 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse404Not found in the caller's tenant. · ErrorResponse409`reindex_required`. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
PATCH /v1/knowledge-bases/{knowledge_base_id}/search-settings
Change how a knowledge base is searched
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) changes the search settings of the base; only the fields sent change. `top_k` (1 to 10, default 4) is how many chunks a search returns; `score_threshold` (0 to 1, default none; send null to remove it) is the minimum cosine similarity of the dense retriever, and a chunk only the keyword retriever found is kept; `hybrid` (default true) adds a BM25 keyword retriever and fuses both with reciprocal rank fusion; `rerank` (default false) re-scores the best candidates with a cross-encoder, which finds better chunks and adds latency, and has no effect when the service has no reranker. The assistant's search tool uses these settings. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base is not one of the caller's tenant; 422 when the body is invalid; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
hybrid | boolean | null | ||
rerank | boolean | null | ||
score_threshold | number | null | ||
top_k | integer | null |
Respuestas
200Successful Response · KnowledgeBaseResponseNombre Tipo Requerido Descripción chunk_countintegersí created_atstring (date-time)sí descriptionstring | nullsí document_countintegersí embedding_modelstring | nullsí Null until the first document is indexed. idstring (uuid)sí namestringsí reindexingbooleansí A reindex of the whole base is queued or running. search_settingsSearchSettingsResponsesí search_settings.hybridbooleansí Dense plus BM25, fused with RRF. search_settings.rerankbooleansí Re-score the best candidates with a cross-encoder (slower). search_settings.score_thresholdnumber | nullsí Minimum cosine similarity of the dense retriever; null: none. search_settings.top_kintegersí statusstringsí Of a whole base: `empty` has no documents, `processing` has one that is not done yet, `ready` has at least one searchable document, `failed` has only failed ones. (empty, processing, ready, failed) updated_atstring (date-time)sí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
GET /v1/knowledge-bases/{knowledge_base_id}/sources
List the URL sources of a knowledge base
API key con knowledge:read · Rol: viewer o superior
Any signed-in member, or an API key with `knowledge:read`. Newest first, each with its schedule and what the last run did (`pages_added`, `pages_changed`, `pages_removed`, `pages_unchanged`, `pages_skipped`, `pages_failed`), how far an open sync got (`progress`: `found`, `fetched`, `indexed`, `failed`) and `stalled` when it has shown no sign of life for five minutes. 401 when the token is missing, expired or invalid; 404 when the base is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Respuestas
200Successful Response · SourceListResponseNombre Tipo Requerido Descripción itemsSourceResponse[]sí items[].created_atstring (date-time)sí items[].document_countintegersí items[].heartbeat_atstring (date-time) | nullsí Last time the sync reported it was alive; null before it starts. items[].idstring (uuid)sí items[].kindstringsí (url, sitemap, crawl) items[].knowledge_base_idstring (uuid)sí items[].last_errorstring | nullsí Why the last run failed: `fetch_failed`, `blocked_address`, `robots_disallowed`, `no_pages`, `dns_failure`, `tls_error`, `timed_out`, `sync_lost` or `internal_error`. items[].last_run_atstring (date-time) | nullsí items[].last_run_statusstring | nullsí `ok`, `partial` or `failed`. items[].max_depthintegersí items[].max_pagesintegersí items[].next_sync_atstring (date-time) | nullsí items[].pages_addedintegersí items[].pages_changedintegersí items[].pages_failedintegersí items[].pages_removedintegersí items[].pages_skippedintegersí Pages refused by robots.txt or equal to another document. items[].pages_unchangedintegersí items[].progressSourceProgressResponsesí items[].progress.failedintegersí URLs that could not be read, were refused or had no content. items[].progress.fetchedintegersí Pages fetched with readable main content. items[].progress.foundintegersí URLs discovered so far (visited or queued). items[].progress.indexedintegersí Documents of the source that are searchable. items[].refresh_intervalstringsí (off, daily, weekly) items[].same_domainbooleansí items[].stalledbooleansí True when a sync is open (`queued` or `running`) but has shown no sign of life for five minutes. `POST .../sync` then replaces it. items[].statusstringsí `queued` and `running` have a sync job open; `idle` is waiting for the next one. (queued, running, idle) items[].urlstringsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/knowledge-bases/{knowledge_base_id}/sources
Add a URL, sitemap or crawl as a source
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) adds a source and queues its first sync. `kind` is `url` (one page), `sitemap` (the pages a sitemap lists; `url` is the sitemap) or `crawl` (follow links from `url`, up to `max_depth` 0 to 5 and `max_pages` 1 to 500, `same_domain` default true). The service fetches only public http(s) hosts (private, loopback and link-local addresses are refused, redirects are checked hop by hop), obeys `robots.txt` for the `ecoBot` agent, caps the size and time of every page and extracts the main content as markdown. Each page becomes a document with its `source_url` and `title`. `refresh_interval` is `off`, `daily` or `weekly`. Audited as `knowledge_source.create`. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base is not one of the caller's tenant; 422 when the body is invalid or the URL is not a public http(s) address (`url_not_allowed`); 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
kind | string | sí | (url, sitemap, crawl) |
max_depth | integer | Links to follow from the start page. | |
max_pages | integer | ||
refresh_interval | string | (off, daily, weekly) | |
same_domain | boolean | A crawl or sitemap stays on the host of `url`. | |
url | string | sí |
Respuestas
201Successful Response · SourceResponseNombre Tipo Requerido Descripción created_atstring (date-time)sí document_countintegersí heartbeat_atstring (date-time) | nullsí Last time the sync reported it was alive; null before it starts. idstring (uuid)sí kindstringsí (url, sitemap, crawl) knowledge_base_idstring (uuid)sí last_errorstring | nullsí Why the last run failed: `fetch_failed`, `blocked_address`, `robots_disallowed`, `no_pages`, `dns_failure`, `tls_error`, `timed_out`, `sync_lost` or `internal_error`. last_run_atstring (date-time) | nullsí last_run_statusstring | nullsí `ok`, `partial` or `failed`. max_depthintegersí max_pagesintegersí next_sync_atstring (date-time) | nullsí pages_addedintegersí pages_changedintegersí pages_failedintegersí pages_removedintegersí pages_skippedintegersí Pages refused by robots.txt or equal to another document. pages_unchangedintegersí progressSourceProgressResponsesí progress.failedintegersí URLs that could not be read, were refused or had no content. progress.fetchedintegersí Pages fetched with readable main content. progress.foundintegersí URLs discovered so far (visited or queued). progress.indexedintegersí Documents of the source that are searchable. refresh_intervalstringsí (off, daily, weekly) same_domainbooleansí stalledbooleansí True when a sync is open (`queued` or `running`) but has shown no sign of life for five minutes. `POST .../sync` then replaces it. statusstringsí `queued` and `running` have a sync job open; `idle` is waiting for the next one. (queued, running, idle) urlstringsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
PATCH /v1/knowledge-bases/{knowledge_base_id}/sources/{source_id}
Change the refresh schedule of a source
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) sets `refresh_interval` (`off`, `daily`, `weekly`); the next automatic sync is that long from now. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base or source is not one of the caller's tenant; 422 when the body is invalid; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
source_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
refresh_interval | string | sí | (off, daily, weekly) |
Respuestas
200Successful Response · SourceResponseNombre Tipo Requerido Descripción created_atstring (date-time)sí document_countintegersí heartbeat_atstring (date-time) | nullsí Last time the sync reported it was alive; null before it starts. idstring (uuid)sí kindstringsí (url, sitemap, crawl) knowledge_base_idstring (uuid)sí last_errorstring | nullsí Why the last run failed: `fetch_failed`, `blocked_address`, `robots_disallowed`, `no_pages`, `dns_failure`, `tls_error`, `timed_out`, `sync_lost` or `internal_error`. last_run_atstring (date-time) | nullsí last_run_statusstring | nullsí `ok`, `partial` or `failed`. max_depthintegersí max_pagesintegersí next_sync_atstring (date-time) | nullsí pages_addedintegersí pages_changedintegersí pages_failedintegersí pages_removedintegersí pages_skippedintegersí Pages refused by robots.txt or equal to another document. pages_unchangedintegersí progressSourceProgressResponsesí progress.failedintegersí URLs that could not be read, were refused or had no content. progress.fetchedintegersí Pages fetched with readable main content. progress.foundintegersí URLs discovered so far (visited or queued). progress.indexedintegersí Documents of the source that are searchable. refresh_intervalstringsí (off, daily, weekly) same_domainbooleansí stalledbooleansí True when a sync is open (`queued` or `running`) but has shown no sign of life for five minutes. `POST .../sync` then replaces it. statusstringsí `queued` and `running` have a sync job open; `idle` is waiting for the next one. (queued, running, idle) urlstringsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
DELETE /v1/knowledge-bases/{knowledge_base_id}/sources/{source_id}
Delete a source and its pages
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) deletes the source, its documents and, in the background, their vectors and files. Audited as `knowledge_source.delete`. 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base or source is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
source_id | path | string (uuid) | sí |
Respuestas
204Successful Response401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
GET /v1/knowledge-bases/{knowledge_base_id}/sources/{source_id}/events
Read the activity log of a source
API key con knowledge:read · Rol: viewer o superior
Any signed-in member, or an API key with `knowledge:read`. The last 50 things the sync of this source did, newest first: when it started, how many pages it fetched, why a page or the whole run failed (`dns_failure`, `tls_error`, `timeout`, `http_error`, `robots_disallowed`, `blocked_address`, `timed_out`, `sync_lost`). Each event has a `code`, an optional `detail` (a host name or a short reason, never page contents) and an optional `count`. 401 when the token is missing, expired or invalid; 404 when the base or source is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
source_id | path | string (uuid) | sí |
Respuestas
200Successful Response · SourceEventListResponseNombre Tipo Requerido Descripción itemsSourceEventResponse[]sí The last 50 events, newest first. items[].codestringsí What happened, for example `sync_started`, `pages_fetched`, `dns_failure`, `tls_error`, `timeout`, `http_error`, `robots_disallowed`, `blocked_address`, `no_pages`, `timed_out`, `sync_lost`, `sync_finished`. items[].countinteger | nullsí How many pages the event is about. items[].detailstring | nullsí A host name or a short reason such as `http_403`; never page contents. items[].idintegersí items[].level"info" | "warn" | "error"sí Severity. (info, warn, error) items[].occurred_atstring (date-time)sí 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/knowledge-bases/{knowledge_base_id}/sources/{source_id}/sync
Fetch a source again
API key con knowledge:write · Rol: editor o superior
An `editor` or above (or an API key with `knowledge:write`) queues a re-sync: the pages are fetched again, compared by content hash, only the changed ones are indexed again, new pages are added and pages that disappeared (404 or no longer linked) are removed. 202 means accepted: poll `GET /v1/knowledge-bases/{id}/sources` for `status` `idle` and the counters. A second call while a healthy sync is open changes nothing; when the open sync is `stalled` the call replaces it with a new one (the retry). 401 when the token is missing, expired or invalid; 403 when the caller is a `viewer`; 404 when the base or source is not one of the caller's tenant; 503 until knowledge bases are deployed.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
knowledge_base_id | path | string (uuid) | sí | |
source_id | path | string (uuid) | sí |
Respuestas
202Successful Response · SourceResponseNombre Tipo Requerido Descripción created_atstring (date-time)sí document_countintegersí heartbeat_atstring (date-time) | nullsí Last time the sync reported it was alive; null before it starts. idstring (uuid)sí kindstringsí (url, sitemap, crawl) knowledge_base_idstring (uuid)sí last_errorstring | nullsí Why the last run failed: `fetch_failed`, `blocked_address`, `robots_disallowed`, `no_pages`, `dns_failure`, `tls_error`, `timed_out`, `sync_lost` or `internal_error`. last_run_atstring (date-time) | nullsí last_run_statusstring | nullsí `ok`, `partial` or `failed`. max_depthintegersí max_pagesintegersí next_sync_atstring (date-time) | nullsí pages_addedintegersí pages_changedintegersí pages_failedintegersí pages_removedintegersí pages_skippedintegersí Pages refused by robots.txt or equal to another document. pages_unchangedintegersí progressSourceProgressResponsesí progress.failedintegersí URLs that could not be read, were refused or had no content. progress.fetchedintegersí Pages fetched with readable main content. progress.foundintegersí URLs discovered so far (visited or queued). progress.indexedintegersí Documents of the source that are searchable. refresh_intervalstringsí (off, daily, weekly) same_domainbooleansí stalledbooleansí True when a sync is open (`queued` or `running`) but has shown no sign of life for five minutes. `POST .../sync` then replaces it. statusstringsí `queued` and `running` have a sync job open; `idle` is waiting for the next one. (queued, running, idle) urlstringsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this operation needs. · ErrorResponse404Not found in the caller's tenant. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Knowledge bases are not deployed yet. · ErrorResponsedefaultDefault Response · ErrorResponse