POST/v2/gen-ai/knowledge_bases/{knowledge_base_uuid}/data_sources

Add a data source to a knowledge base

Adds a data source configuration to a knowledge base. Supply the source-specific settings for an AWS S3 bucket, Spaces bucket, or web crawler, and optionally configure chunking. Use this operation to add sources after creating a knowledge base or to attach a source during a later update.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 6 body fields
knowledge_base_uuidstringrequired
Identifier of the knowledge base to add the data source to.

Optional data source configuration, including source-specific settings and chunking options.

aws_data_sourceobjectoptional
AWS S3 Data Source
chunking_algorithmstringoptional
Chunking strategy: CHUNKING_ALGORITHM_UNKNOWN, CHUNKING_ALGORITHM_SECTION_BASED, CHUNKING_ALGORITHM_HIERARCHICAL, CHUNKING_ALGORITHM_SEMANTIC, or CHUNKING_ALGORITHM_FIXED_LENGTH. Defaults to CHUNKING_ALGORITHM_UNKNOWN when omitted.
Allowed:CHUNKING_ALGORITHM_UNKNOWNCHUNKING_ALGORITHM_SECTION_BASEDCHUNKING_ALGORITHM_HIERARCHICALCHUNKING_ALGORITHM_SEMANTICCHUNKING_ALGORITHM_FIXED_LENGTHDefault:CHUNKING_ALGORITHM_UNKNOWN
chunking_optionsobjectoptional
Chunking parameters, including child, maximum, and parent chunk sizes and the semantic threshold.
knowledge_base_uuidstringoptional
Knowledge base id
spaces_data_sourceobjectoptional
Spaces Bucket Data Source
web_crawler_data_sourceobjectoptional
WebCrawlerDataSource

6 status codes
200Returns information about the created knowledge base data source.
knowledge_base_data_sourceobjectoptional
Data Source configuration for Knowledge Bases
401Returned when authentication fails because the credentials are invalid.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
404Returned when the knowledge base or another requested resource is not found.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
429Returned when the API rate limit has been exceeded.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
500Returned when a server error occurs.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
defaultReturned when an unexpected error occurs.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

Error handling

A 401 is returned when authentication credentials are invalid. A 404 is returned if the knowledge_base_uuid path parameter does not identify an existing knowledge base or the requested resource cannot be found; a 429 is returned when the API rate limit is exceeded, and a 500 indicates a server error. chunking_algorithm and web_crawler_data_source.crawling_option must use one of their documented enum values when supplied.