POST
/
v4
/
knowledge-bases
/
{knowledge_base_id}
/
upload_files
import SGPClient from 'sgp';

const client = new SGPClient({
  apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const createKnowledgeBaseUploadsFromFilesResponse = await client.knowledgeBases.uploadFiles(
    'knowledge_base_id',
    {
      chunking_strategy_config: 'chunking_strategy_config',
      data_source_config: 'data_source_config',
      files: [fs.createReadStream('path/to/file')],
      force_reupload: true,
    },
  );

  console.log(createKnowledgeBaseUploadsFromFilesResponse.upload_ids);
}

main();
{
  "upload_ids": [
    "<string>"
  ]
}

Authorizations

x-api-key
string
header
required

Path Parameters

knowledge_base_id
string
required

Body

multipart/form-data
files
file[]
required
data_source_config
string
required
chunking_strategy_config
string
required
force_reupload
boolean
required
tagging_information
string

Response

200
application/json
Successful Response
upload_ids
string[]
required

List of upload IDs that have been kicked off by the upload API