--- title: "Integrations with External Knowledge Management Systems" slug: "ai-agents-integrations-with-external-knowledge-management-systems" updated: 2026-11-30T12:16:57Z published: 2026-11-30T12:16:57Z canonical: "docs.sestek.com/ai-agents-integrations-with-external-knowledge-management-systems" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.sestek.com/llms.txt > Use this file to discover all available pages before exploring further. # Integrations with External Knowledge Management Systems The External Knowledge Base API keeps a knowledge base in SESTEK AI Agents in step with a third-party knowledge management system. You can upload, list and delete documents; add, list, update and delete websites; give documents and websites tag values; and refresh the index. Every call, reads included, works on the project's Draft, and changes reach the live agent when you publish the project. Knowledge bases, documents and websites are addressed by their Version Group ID, the id that stays the same across the project's versions. There is no call that returns a single document or website: list them and pick by `versionGroupId`. > **📝 Note:** Before you start, you need an API client that carries the `dataservice_external_knowledge_base` scope. There is no screen in the product to create or view it: request it from SESTEK support. A token without the scope returns 403. | Placeholder | Meaning | | --- | --- | | **`{identityServerUrl}`** | The identity server of your environment, which issues access tokens. | | **`{baseUrl}`** | The address of your SESTEK AI Agents installation. | | **`{accessToken}`** | The token you get in the first step. | | **`{knowledgeBaseVersionGroupId}`** | The Version Group ID of the knowledge base. | | **`{documentVersionGroupId}`** | A document's `versionGroupId`, from the document list. | | **`{websiteVersionGroupId}`** | A website's `versionGroupId`, from the add response or the website list. | All calls sit under `{baseUrl}/api/external/knowledge-bases`. The examples keep a product-support knowledge base in step: a user guide tagged `Product` = `Dishwasher`, and the support pages of `https://www.example.com/support`. --- ## Get an access token Request a token with the client SESTEK support gave you. The body is form-urlencoded, not JSON. For more on tokens, see [Getting an Access Token](https://docs.sestek.com/docs/en/virtual-agent-getting-an-access-token). **Endpoint:** `POST {identityServerUrl}/connect/token` **Content type:** `application/x-www-form-urlencoded` ``` curl --location '{identityServerUrl}/connect/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'client_id={clientId}' \ --data-urlencode 'client_secret={clientSecret}' \ --data-urlencode 'scope=dataservice_external_knowledge_base' ``` Send the token as `Authorization: Bearer {accessToken}` on every call. The token also decides the tenant, so no request names one. --- ## Upload a document **Endpoint:** `POST {baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/documents` **Content type:** `multipart/form-data` ``` curl --location '{baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/documents' \ --header 'Authorization: Bearer {accessToken}' \ --form 'file=@"UserGuide.pdf"' \ --form 'documentType="TextOnly"' \ --form 'tags[0].name="Product"' \ --form 'tags[0].value="Dishwasher"' \ --form 'tags[1].name="Model"' \ --form 'tags[1].value="DW-500"' ``` **Expected response:** `204 No Content`. The document is accepted; follow its processing in the document list. | Field | Required | Description | | --- | --- | --- | | **`file`** | Yes | The file to upload. One file per call. | | **`documentType`** | Yes | How the file is processed. See the table below. | | **`tags[0].name`**, **`tags[0].value`**, **`tags[1].name`** ... | No | Tag values for the document, indexed from 0. Each tag needs both a name and a value. | | Value | Supported files | | --- | --- | | **`TextOnly`** | txt, md, pdf, pptx, docx, xlsx, csv | | **`Advanced`** | pdf | | **`Faq`** | xlsx | | **`DataTable`** | xlsx | `Advanced` and `DataTable` need an LLM configuration selected in the knowledge base's Document Processing step. On a knowledge base in Basic Text Processing they are refused. **Tags.** A tag name must already be defined in the knowledge base's Tags, and a tag can appear only once per document. A call that breaks a tag rule is rejected and changes nothing. Tags cannot be changed on their own: re-upload the file with the new tags. **Uploading the same file name again** (case is ignored) replaces the document in place, and it keeps its `versionGroupId`. This is refused while the document is `Pending` or `Processing`. The tags work like this on a re-upload: | `tags` in the call | Result | | --- | --- | | **Omitted or empty** | The document keeps its current tags. | | **One or more tags** | They replace the document's tags. | An integration that never sends tags therefore leaves tags set in the product untouched. > **📝 Note:** A `Faq` document takes its tags from the Excel file's columns, and tags sent in the call are ignored. The file needs Question and Answer columns, and every other column must match a tag defined on the knowledge base. Column tags have no value and come back as `"value": ""`. Re-uploading a `Faq` file under the same name replaces its tags with the new file's columns, so a file with no tag columns removes every tag. A `Faq` document re-uploaded under the same name as another type loses its column tags and takes the tags sent in the call. --- ## List documents **Endpoint:** `GET {baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/documents` ``` curl --location '{baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/documents' \ --header 'Authorization: Bearer {accessToken}' ``` **Expected response:** `200 OK` ``` [ { "versionGroupId": "{documentVersionGroupId}", "lastModificationTime": "2026-11-09T10:32:15Z", "name": "UserGuide.pdf", "sizeInBytes": 482193, "documentType": "TextOnly", "trainStatus": "Indexed", "ingestionStage": "Completed", "ingestionErrorMessage": null, "ingestionStartDate": "2026-11-09T10:30:02Z", "tags": [ { "name": "Product", "value": "Dishwasher" } ] } ] ``` The list returns the Draft's documents, most recently changed first. `documentType` is the name (`TextOnly`, `Advanced`, `Faq`, `DataTable`), not a number. `tags` is always present, `[]` when the document has none. --- ## Delete a document **Endpoint:** `DELETE {baseUrl}/api/external/knowledge-bases/documents/{documentVersionGroupId}` ``` curl --location --request DELETE '{baseUrl}/api/external/knowledge-bases/documents/{documentVersionGroupId}' \ --header 'Authorization: Bearer {accessToken}' ``` **Expected response:** `204 No Content` A `Processing` document cannot be deleted; a `Pending` one can. --- ## Add a website **Endpoint:** `POST {baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/websites` **Content type:** `application/json` ``` curl --location '{baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/websites' \ --header 'Authorization: Bearer {accessToken}' \ --header 'Content-Type: application/json' \ --data-raw '{ "url": "https://www.example.com/support", "crawlMode": "MultiplePages", "crawlerType": "Adaptive", "contentExtractionMethod": "ReadableTextWithFallback", "maximumPagesToCrawl": 500, "maximumCrawlDepth": 3, "allowCrawlingExternalWebsites": false, "includeUrls": ["https://www.example.com/support/*"], "excludeUrls": ["https://www.example.com/support/archive/*"], "tags": [ { "name": "Product", "value": "Dishwasher" } ] }' ``` **Expected response:** `200 OK` ``` { "versionGroupId": "{websiteVersionGroupId}" } ``` | Field | Type | Required | Values | | --- | --- | --- | --- | | **`url`** | string | Yes | Starts with `http://` or `https://`, up to 2048 characters. Cannot be changed later. | | **`crawlMode`** | string | Yes | `SinglePage`, `MultiplePages` | | **`crawlerType`** | string | Yes | `Adaptive`, `HeadlessBrowser`, `RawHtml` | | **`contentExtractionMethod`** | string | Yes | `ReadableTextWithFallback`, `ReadableText`, `Extractus`, `None` | | **`maximumPagesToCrawl`** | integer | Yes | 1 to 10000 | | **`maximumCrawlDepth`** | integer | Yes | 0 to 100 | | **`allowCrawlingExternalWebsites`** | boolean | Yes | `true` or `false` | | **`includeUrls`** | string array | No | Up to 100 URL patterns. Each starts with `http://` or `https://`, uses `*` as a wildcard and contains no spaces. | | **`excludeUrls`** | string array | No | Same rules as `includeUrls`. | | **`tags`** | array of `name` and `value` | No | Same rules as document tags. | These are the settings of the website form in the product. Enum values are names and must match exactly, case included. With `SinglePage`, the website is saved with 1 page, depth 0 and `allowCrawlingExternalWebsites` set to `false` whatever you send, but the values you send must still be in range. The URL must be new to the knowledge base (case is ignored), must resolve, and must not point to an address your installation does not allow, such as localhost. The website is crawled as soon as it is added; follow it in the website list. A URL that resolves but answers with an error page or too slowly is still accepted, and ends `Failed` after crawling. If the website cannot be handed over for crawling, it is saved as `Failed` and the list shows `ingestionErrorMessage`. --- ## List websites **Endpoint:** `GET {baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/websites` ``` curl --location '{baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/websites' \ --header 'Authorization: Bearer {accessToken}' ``` **Expected response:** `200 OK` ``` [ { "versionGroupId": "{websiteVersionGroupId}", "url": "https://www.example.com/support", "crawlMode": "MultiplePages", "crawlerType": "Adaptive", "contentExtractionMethod": "ReadableTextWithFallback", "maximumPagesToCrawl": 500, "maximumCrawlDepth": 3, "allowCrawlingExternalWebsites": false, "includeUrls": ["https://www.example.com/support/*"], "excludeUrls": [], "tags": [ { "name": "Product", "value": "Dishwasher" } ], "trainStatus": "Indexed", "crawledPagesCount": 412, "ingestionStage": "Completed", "ingestionErrorMessage": null, "ingestionStartDate": "2026-11-09T08:02:41Z", "lastModificationTime": "2026-11-09T08:15:00Z" } ] ``` The list returns the Draft's websites, most recently changed first, or `[]` when there are none. `crawledPagesCount` can be `null` while the website waits to be crawled. --- ## Update a website **Endpoint:** `PUT {baseUrl}/api/external/knowledge-bases/websites/{websiteVersionGroupId}` **Content type:** `application/json` The body is the add body without `url`, which cannot change. The seven required settings must be sent again. This example raises the crawl limits, keeps `includeUrls` and `tags`, and clears `excludeUrls`: ``` curl --location --request PUT '{baseUrl}/api/external/knowledge-bases/websites/{websiteVersionGroupId}' \ --header 'Authorization: Bearer {accessToken}' \ --header 'Content-Type: application/json' \ --data-raw '{ "crawlMode": "MultiplePages", "crawlerType": "Adaptive", "contentExtractionMethod": "ReadableTextWithFallback", "maximumPagesToCrawl": 800, "maximumCrawlDepth": 4, "allowCrawlingExternalWebsites": false, "excludeUrls": [] }' ``` **Expected response:** `204 No Content` | In the body | `includeUrls`, `excludeUrls`, `tags` | | --- | --- | | **Omitted** | Kept as they are. | | **A list** | Replaces the current values. | | **An empty list** | Clears them. Unlike a document upload, an empty `tags` list removes the website's tags. | Every successful update recrawls the whole website. A `Processing` website cannot be updated. --- ## Delete a website **Endpoint:** `DELETE {baseUrl}/api/external/knowledge-bases/websites/{websiteVersionGroupId}` ``` curl --location --request DELETE '{baseUrl}/api/external/knowledge-bases/websites/{websiteVersionGroupId}' \ --header 'Authorization: Bearer {accessToken}' ``` **Expected response:** `204 No Content` The website and its crawled content are removed. A `Processing` website cannot be deleted; a `Pending` one can. --- ## Refresh the index This is the same as Refresh Index in the product. It first re-sends the knowledge base's settings for processing, then re-processes the `Failed` and `TrainingAvailable` documents and websites. `Indexed` sources are not touched. **Endpoint:** `POST {baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/refresh-index` ``` curl --location --request POST '{baseUrl}/api/external/knowledge-bases/{knowledgeBaseVersionGroupId}/refresh-index' \ --header 'Authorization: Bearer {accessToken}' ``` **Expected response:** `204 No Content` The call is refused while any document or website is `Pending` or `Processing`, so wait for the previous run to finish before calling it again. If the settings cannot be sent, the call returns 403 and nothing is processed. --- ## Status values Documents and websites report their state in `trainStatus`: | `trainStatus` | Meaning | | --- | --- | | **`Indexed`** | Processed and ready for search. | | **`TrainingAvailable`** | Needs re-indexing, and is still searchable. Refresh the index. | | **`Pending`** | Queued until a processing slot is free. Can be deleted. If `ingestionStartDate` is not null, the source was indexed before and the date is that of the last completed run. | | **`Processing`** | Being processed. Cannot be re-uploaded, updated or deleted. | | **`Failed`** | Processing failed. Refresh the index to retry. | `ingestionStage` shows the step a source is at: `Initial`, `Loading`, `Crawling`, `Chunking`, `Persisting`, `Completed`, `Failed`, `Canceling`, `Canceled`, or `null`. --- ## Changes in v5.14 If your integration was built on v5.13, these are the changes in behaviour: | Area | Before (v5.13) | From v5.14 | | --- | --- | --- | | **Websites** | Not available | Add, list, update and delete websites. | | **Tags on upload** | Not available | `tags` on document upload; omitted keeps existing tags. | | **Document list** | No `tags` field | `tags` on every document, `[]` if none. Matters only if you validate the response schema strictly. | | **Refresh the index** | Returned 204; if the settings could not be sent, the sources failed later | Sends the settings first; if that fails, 403 (`Raven:0100249` or `Raven:0100250`) and nothing is processed. | | **`Faq` re-upload, same name, with tag columns** | Refused (409) | Accepted; tags replaced by the file's columns. | | **`Faq` re-upload, same name, without tag columns** | Old tags kept | Old tags removed. | | **`Faq` document re-uploaded as another type, same name** | Column tags kept with no value, so tag-filtered searches missed the document | Column tags removed; tags sent in the call are written. | | **Website URL check** | Not checked | Checked when a website is added, in the API and in the product (`Raven:0100498`). | --- ## Limits | Limit | Value | | --- | --- | | **Request size, document upload** | 30 MB | | **Files per upload call** | 1 | | **Default tenant limits** (can differ per installation) | 5 MB per file, 200 documents per knowledge base, 500 MB per knowledge base, 5 GB per tenant | | **Sources processed at once** | 5 per knowledge base; the rest wait as `Pending` | | **Tags per knowledge base** | 20 | | **Tag name and value** | 64 characters each | | **Websites per knowledge base** | No limit | --- ## Errors Refusals with a code return 403 with this body. Branch on `error.code`: ``` { "error": { "code": "Raven:0100256", "message": "A website with this URL already exists in the knowledge base." } } ``` The not-found refusals and the Basic Text Processing refusal have no code: their sentence is in `error.code`, and `error.message` holds a generic text. A 400 lists each problem in `error.validationErrors`. A 401, or a 403 for a missing scope, has an empty body. | Status | Meaning | | --- | --- | | **400** | The body failed validation: a required field is missing, a value is out of range, there are more than 100 URLs, an enum name does not match (for example "The CrawlMode field must be one of: SinglePage, MultiplePages."), a tag name or value is missing or too long, or `file` or `documentType` is missing. | | **401** | The token is missing or not valid. | | **403** | Empty body: the token does not carry the `dataservice_external_knowledge_base` scope. | | **403** | "Knowledge base with version group id {id} not found.", "Document with version group id {id} not found." or "Website with version group id {id} not found." The id does not exist or belongs to another tenant. | | **403** | `Raven:0100269` "Unsupported file format. Please upload only: {supportedFormats}." The file's extension does not fit `documentType`. | | **403** | "Cannot create Advanced or DataTable type documents because the knowledge base is in Basic Text Processing mode." Select an LLM configuration in the knowledge base's Document Processing step. | | **403** | `Raven:0100270` "The document '{fileName}' is currently being processed and cannot be updated or deleted." `Raven:0100295` "The document '{fileName}' is in 'Pending' status and cannot be updated." Wait until the document list shows it finished. | | **403** | `Raven:0100274` "The website '{website}' is currently being processed and cannot be updated or deleted." | | **403** | `Raven:0100434` "The tag '{name}' is no longer defined on this knowledge base. Refresh the page and try again." Define the tag in the knowledge base's Tags. `Raven:0100576` "The same tag cannot be applied twice to '{source}'." | | **403** | `Faq` file: `Raven:0100431` "The file must contain Question and Answer columns." `Raven:0100432` "One or more columns do not match any knowledge base tag. Add them from the Tags section or update your Excel file." `Raven:0100433` "The file contains duplicate tag columns. Column names must be unique regardless of case. Update your Excel file and upload again." | | **403** | Website URL: `Raven:0100256` "A website with this URL already exists in the knowledge base." `Raven:0100258` "URL must start with http:// or https://." `Raven:0100259` "URL is not a valid absolute URL." `Raven:0100260` "URL is not reachable. Please verify the URL is correct and accessible." `Raven:0100498` "URL points to an address that is not allowed." (loopback, localhost, link-local or metadata addresses, and on a stricter installation also private network addresses). | | **403** | `Raven:0100296` "Reindexing is not allowed for this knowledge base while a data source is in 'Pending' or 'Processing' status." | | **403** | `Raven:0100249` "The Knowledge Base has missing required fields in its LLM configuration." Complete the LLM configuration in the knowledge base's Document Processing step. `Raven:0100250` "An error occurred while synchronizing the Knowledge Base." | | **403** | Right after a Publish the knowledge base is cloned, and some writes are refused while that runs or if it failed. Adding a document or website, or refreshing the index: `Raven:0100283` "This knowledge base cannot be edited or modified while it is being cloned or if cloning has failed." Updating a website: `Raven:0100413` "This website cannot be edited while its knowledge base is being cloned or if cloning has failed." Deleting: `Raven:0100285` "This data source cannot be deleted while its knowledge base is being cloned or if cloning has failed." | | **403** | `Raven:0100527` "Project '{projectName}' has a transfer import in progress." Writes are refused until the import finishes; reads keep working. | | **403** | `Raven:0100275` (document) or `Raven:0100276` (website): the delete could not be completed, and the source is kept. |