Chatbase offers an API for you to interact with your chatbots if you are subscribed to a paid plan. To get an API key, go to your account page and scroll to the bottom.


To talk to a chatbot you need to make a POST request to with and the Headers: Authorization: Bearer <Your-Secret-Key> and have messages, chatId, temperatureand stream in the body of the request.

chatId is the id in the URL on the chatbot page. It will look something like chatbase--1--pdf-p680fxvnm.

messages is an array holding maximum the last 7 messages between the user and the assistant. It will look like

  { content: 'How can i help you?', role: 'assistant' },
  { content: 'What is chatbase?', role: 'user' }

stream is a boolean to indicate whether to stream back partial progress or send the full response once it's ready.

Example Requests


curl \
  -H 'Authorization: Bearer <Your-Secret-Key>' \
  -d '{"messages":[{"content":"How can i help you?","role":"assistant"},{"content":"What is chatbase?","role":"user"}],"chatId":"chatbase--1--pdf-p680fxvnm","stream":false, "temperature": 0}'


const response = await fetch('', {
  method: 'POST',
  headers: {
    Authorization: `Bearer <Your-Secret-Key>`
  body: JSON.stringify({
    messages: [
      { content: 'How can I help you?', role: 'assistant' },
      { content: 'What is chatbase?', role: 'user' }
    chatId: 'chatbase--1--pdf-p680fxvnm',
    stream: false,
    temperature: 0


If stream is set to true, words will be sent back as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. If stream is set to false the response will look like

{"text": "Chatbase is an AI chatbot builder that lets you create a GPT based chatbot that knows data."}

To read the stream in javascript

// This data is a ReadableStream
const data = response.body;

if (!data) {
  // error happened

const reader = data.getReader();
const decoder = new TextDecoder();
let done = false;

while (!done) {
  const { value, done: doneReading } = await;
  done = doneReading;
  const chunkValue = decoder.decode(value);
  console.log(chunkValue); // This will log chunks of the chatbot reply until the reply is finished.

If you have any more questions on how to use the API message me on twitter.