Skip to main content

addDocumentFromUrl

client.knowledge.addDocumentFromUrl(id: string, data: AddKnowledgeDocumentFromUrlRequest): Promise<unknown>

Adds a document to a collection by fetching it from a URL.

Downloads the content at the specified URL and adds it as a document to the collection. The content is automatically parsed and chunked.

Parameters

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the target collection
dataAddKnowledgeDocumentFromUrlRequestYesRequest specifying the URL and optional metadata

Returns

Promise<unknown> — A promise that resolves when the document has been fetched and added

Example

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

const result = await client.knowledge.addDocumentFromUrl('id', /* AddKnowledgeDocumentFromUrlRequest */);
console.log(result);