Update Chatbot
Request
To replace the data of your chatbot with new data you need to make a POST
request to https://www.chatbase.co/api/v1/update-chatbot-data
with the Headers: Authorization: Bearer <Your-Secret-Key>
and payload that looks like:
const payload = { chatbotId: 'example-123', chatbotName: 'new name', sourceText: 'new source text that is less than your plan character limit....' };
or
const payload = { chatbotId: 'example-123', chatbotName: 'new name', urlsToScrape: [ 'https://www.new-website.com/', 'https://www.new-website.com/docs/1' ] };
If you provide a urlsToScrape
, Chatbase will scrape the text content on those pages and update the chatbot with that data
Example Requests
cURL
curl https://www.chatbase.co/api/v1/update-chatbot-data \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <Your-API-Key>' \ -d '{"chatbotId": "example-123", "chatbotName": "new name", "urlsToScrape": ["https://www.example.com", "https://www.example.com/blog"]}'
Javascript
const res = await fetch('/api/update-chatbot-data', { method: 'POST', headers: { Authorization: `Bearer <Your-Secret-Key>`, 'Content-Type': 'application/json' }, body: JSON.stringify({ chatbotId: 'example-123', chatbotName: 'new name ', sourceText: 'Source text that is less than your plan character limit......' }) }); const data = await res.json(); console.log(data); // {chatbotId: 'exampleId-123'}
Response
{"chatbotId": "exampleId-123"}