Referencia de la API

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

  • 200 Successful Response · KnowledgeBaseListResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreTipoRequeridoDescripción
descriptionstring | null
namestringsí

Respuestas

  • 201 Successful Response · KnowledgeBaseResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Respuestas

  • 200 Successful Response · KnowledgeBaseResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
descriptionstring | null
namestringsí

Respuestas

  • 200 Successful Response · KnowledgeBaseResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Respuestas

  • 204 Successful Response
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Respuestas

  • 200 Successful Response · DocumentListResponse
    NombreTipoRequeridoDescripció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.
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
filenamestringsíA label; its extension picks the format (pdf, docx, txt, md, csv, html).
size_bytesintegersí

Respuestas

  • 201 Successful Response · DocumentCreatedResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
document_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
filenamestringsíA label; its extension picks the format (pdf, docx, txt, md, csv, html).
size_bytesintegersí

Respuestas

  • 200 Successful Response · DocumentCreatedResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 409 `source_managed`. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
document_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
tagsstring[]síLower case labels without `:` or `,`; repeated ones are kept once. Used to filter a search to some documents.

Respuestas

  • 200 Successful Response · DocumentResponse
    NombreTipoRequeridoDescripció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.
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
document_idpathstring (uuid)sí

Respuestas

  • 204 Successful Response
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
document_idpathstring (uuid)sí

Respuestas

  • 202 Successful Response · DocumentResponse
    NombreTipoRequeridoDescripció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.
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 409 The uploaded file is missing or differs. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
document_idpathstring (uuid)sí

Respuestas

  • 202 Successful Response · DocumentResponse
    NombreTipoRequeridoDescripció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.
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 409 `not_failed`. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Respuestas

  • 202 Successful Response · KnowledgeBaseResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
hybridboolean | nullOmitted: the base's `hybrid` setting.
querystringsí
rerankboolean | nullOmitted: the base's `rerank` setting.
score_thresholdnumber | nullOmitted: the base's `score_threshold` setting.
tagsstring[] | nullOnly documents with at least one of these tags. Omitted: all.
top_kinteger | null1 to 10. Omitted: the base setting (default 4).

Respuestas

  • 200 Successful Response · SearchResponse
    NombreTipoRequeridoDescripció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.
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 409 `reindex_required`. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
hybridboolean | null
rerankboolean | null
score_thresholdnumber | null
top_kinteger | null

Respuestas

  • 200 Successful Response · KnowledgeBaseResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Respuestas

  • 200 Successful Response · SourceListResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
kindstringsí (url, sitemap, crawl)
max_depthintegerLinks to follow from the start page.
max_pagesinteger
refresh_intervalstring (off, daily, weekly)
same_domainbooleanA crawl or sitemap stays on the host of `url`.
urlstringsí

Respuestas

  • 201 Successful Response · SourceResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
source_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
refresh_intervalstringsí (off, daily, weekly)

Respuestas

  • 200 Successful Response · SourceResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
source_idpathstring (uuid)sí

Respuestas

  • 204 Successful Response
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
source_idpathstring (uuid)sí

Respuestas

  • 200 Successful Response · SourceEventListResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default 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

NombreEnTipoRequeridoDescripción
knowledge_base_idpathstring (uuid)sí
source_idpathstring (uuid)sí

Respuestas

  • 202 Successful Response · SourceResponse
    NombreTipoRequeridoDescripció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í
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this operation needs. · ErrorResponse
  • 404 Not found in the caller's tenant. · ErrorResponse
  • 429 The API key went over its requests per minute. · ErrorResponse
  • 503 Knowledge bases are not deployed yet. · ErrorResponse
  • default Default Response · ErrorResponse