Endpoints
Datasource - Create
POST
/
datasources
File upload supported mime types
- text/csv’
- text/plain’
- text/markdown’
- application/pdf’
- application/json’
- application/vnd.openxmlformats-officedocument.presentationml.presentation
- application/vnd.openxmlformats-officedocument.wordprocessingml.document
- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Example JS Code to create a Datasource of type ‘file’
const apiUrl = 'https://api.chatvolt.ai';
const apiKey = 'XXX';
const datastoreId = 'XXX';
const fileName = 'test.pdf';
const buffer = fs.readFileSync(fileName);
const formData = new FormData();
formData.append(
'file',
new Blob([buffer], {
type: 'application/pdf',
}),
fileName
);
formData.append('type', 'file');
formData.append('datastoreId', datastoreId);
formData.append('fileName', fileName);
const res = await fetch(`${apiUrl}/datasources`, {
method: 'POST',
body: formData,
headers: {
Authorization: `Bearer ${apiKey}`,
},
});
Example JS Code to create a Datasource of type ‘web_page’
const apiUrl = 'https://api.chatvolt.ai';
const apiKey = 'XXX';
const datastoreId = 'XXX';
const res = await fetch(`${apiUrl}/datasources`, {
method: 'POST',
body: JSON.stringify({
datastoreId,
type: 'web_page',
name: 'Nuclear Fusion - Wikipedia',
config: {
source_url: 'https://en.wikipedia.org/wiki/Nuclear_fusion',
tags: [nuclear, fusion, generation],
},
}),
headers: {
ContentType: 'application/json',
Authorization: `Bearer ${apiKey}`,
},
});
Example JS Code to create a Datasource of type ‘web_site’ with a sitemap
const apiUrl = 'https://api.chatvolt.ai';
const apiKey = 'XXX';
const datastoreId = 'XXX';
const res = await fetch(`${apiUrl}/datasources`, {
method: 'POST',
body: JSON.stringify({
datastoreId,
type: 'web_site',
name: 'Chatvolt Docs',
config: {
// Sitemap
sitemap: 'https://docs.chatvolt.ai/sitemap.xml',
// Or Auto Discovery
source_url: 'https://docs.chatvolt.ai',
tags: [chatvolt, genai, chatbots],
},
}),
headers: {
ContentType: 'application/json',
Authorization: `Bearer ${apiKey}`,
},
});
Authorizations
Authorization
string
headerrequiredBearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
file
string
requiredfileName
string
type
enum<string>
requiredAvailable options:
file
datastoreId
string
requiredcustom_id
string
Useful for multi-tenant setups
Response
200 - application/json
id
string
type
string
name
string
status
enum<string>
Available options:
unsynched
, pending
, running
, synched
, error
, usage_limit_reached
groupId
string
updatedAt
string
createdAt
string
lastSynch
string
config
object
Was this page helpful?