Create Knowledge Base Data Source Link

Create Knowledge Base Data Source Link

This method allows you to link a data source to a knowledge base.

When you link a data source to a knowledge base, the initial status of the link is NOT_INDEXED. This means that the data source is linked to the knowledge base, but none of the documents in the data source have been added to an index of the knowledge base yet.

Once you trigger an indexing, or the refresh policy triggers an indexing automatically, documents from the data source are added to the index, and the status of the link is updated to INDEXED.

Similarly, when you unlink a data source from the knowledge base, the status of the link becomes PENDING_UNLINKING, because there may still be documents from the data source in the index. Once you trigger a new indexing (or an indexing is started automatically due to the refresh policy), the status of the link is updated to UNLINKING.

Once all documents from a data source have been removed from the index, the link is removed.

Note that you can undo the removal of the link between a data source and the knowledge base prior to triggering an indexing (as no modifications to any index has been triggered yet). For details, refer to the method to Cancel unlinking a data source and a knowledge base.

Request
URI
POST
https://{api_host}/api/v1/control/knowledge-bases/{knowledge_base_id}/data-sources
COPY
Path Parameters
string
knowledge_base_id
Required

knowledge_base_id


Request Body
LinkedDataSourceCreateRequest of type(s) application/json
Required
{
    "data_source_id": "string"
}
string As uuid As uuid
data_source_id
Required

ID of the data source to link to the knowledge base.

Authentication
This operation uses the following authentication methods.
Responses
200

Successful Response

Returns LinkedDataSource of type(s) application/json
"LinkedDataSource Object"
string As uuid As uuid
id
Required

ID of the link between a knowledge base and a data source.

string
state
Required

State of the link between a knowledge base and a data source.

Possible values are : NOT_INDEXED, INDEXED, PENDING_UNLINKING, UNLINKING,
object
data_source
Required

A data source.


400

The knowledge base does not support linking to a data source.

Operation doesn't return any data structure

404

Invalid knowledge base or data source ID.

Operation doesn't return any data structure

409

The knowledge base is already linked to this data source.

Operation doesn't return any data structure

422

Validation Error

Returns HTTPValidationError of type(s) application/json
"HTTPValidationError Object"
array of object
detail
Optional

detail


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"data_source_id:"string"}' https://{api_host}/api/v1/control/knowledge-bases/{knowledge_base_id}/data-sources