Chat with a chatbot
curl --request POST \
--url https://www.chatbase.co/api/v1/chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chatbotId": "ckl123abc456",
"messages": [
{
"role": "user",
"content": "Hello, I need help with my order"
}
],
"conversationId": "conv_abc123",
"contactId": "user_123",
"model": "gpt-4o-mini",
"temperature": 0.7,
"stream": false
}
'import requests
url = "https://www.chatbase.co/api/v1/chat"
payload = {
"chatbotId": "ckl123abc456",
"messages": [
{
"role": "user",
"content": "Hello, I need help with my order"
}
],
"conversationId": "conv_abc123",
"contactId": "user_123",
"model": "gpt-4o-mini",
"temperature": 0.7,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatbotId: 'ckl123abc456',
messages: [{role: 'user', content: 'Hello, I need help with my order'}],
conversationId: 'conv_abc123',
contactId: 'user_123',
model: 'gpt-4o-mini',
temperature: 0.7,
stream: false
})
};
fetch('https://www.chatbase.co/api/v1/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.chatbase.co/api/v1/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chatbotId' => 'ckl123abc456',
'messages' => [
[
'role' => 'user',
'content' => 'Hello, I need help with my order'
]
],
'conversationId' => 'conv_abc123',
'contactId' => 'user_123',
'model' => 'gpt-4o-mini',
'temperature' => 0.7,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.chatbase.co/api/v1/chat"
payload := strings.NewReader("{\n \"chatbotId\": \"ckl123abc456\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, I need help with my order\"\n }\n ],\n \"conversationId\": \"conv_abc123\",\n \"contactId\": \"user_123\",\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.chatbase.co/api/v1/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chatbotId\": \"ckl123abc456\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, I need help with my order\"\n }\n ],\n \"conversationId\": \"conv_abc123\",\n \"contactId\": \"user_123\",\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v1/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chatbotId\": \"ckl123abc456\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, I need help with my order\"\n }\n ],\n \"conversationId\": \"conv_abc123\",\n \"contactId\": \"user_123\",\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"text": "Hello! How can I help you today?"
}{
"message": "Invalid request data"
}{
"message": "No API key provided."
}{
"message": "Access denied or quota exceeded"
}{
"message": "Internal server error"
}Chat
Chat with a chatbot
Send a message to a chatbot and receive a response. Supports streaming responses. Can continue existing conversations by providing a conversationId.
POST
/
chat
Chat with a chatbot
curl --request POST \
--url https://www.chatbase.co/api/v1/chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chatbotId": "ckl123abc456",
"messages": [
{
"role": "user",
"content": "Hello, I need help with my order"
}
],
"conversationId": "conv_abc123",
"contactId": "user_123",
"model": "gpt-4o-mini",
"temperature": 0.7,
"stream": false
}
'import requests
url = "https://www.chatbase.co/api/v1/chat"
payload = {
"chatbotId": "ckl123abc456",
"messages": [
{
"role": "user",
"content": "Hello, I need help with my order"
}
],
"conversationId": "conv_abc123",
"contactId": "user_123",
"model": "gpt-4o-mini",
"temperature": 0.7,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatbotId: 'ckl123abc456',
messages: [{role: 'user', content: 'Hello, I need help with my order'}],
conversationId: 'conv_abc123',
contactId: 'user_123',
model: 'gpt-4o-mini',
temperature: 0.7,
stream: false
})
};
fetch('https://www.chatbase.co/api/v1/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.chatbase.co/api/v1/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chatbotId' => 'ckl123abc456',
'messages' => [
[
'role' => 'user',
'content' => 'Hello, I need help with my order'
]
],
'conversationId' => 'conv_abc123',
'contactId' => 'user_123',
'model' => 'gpt-4o-mini',
'temperature' => 0.7,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.chatbase.co/api/v1/chat"
payload := strings.NewReader("{\n \"chatbotId\": \"ckl123abc456\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, I need help with my order\"\n }\n ],\n \"conversationId\": \"conv_abc123\",\n \"contactId\": \"user_123\",\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.chatbase.co/api/v1/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chatbotId\": \"ckl123abc456\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, I need help with my order\"\n }\n ],\n \"conversationId\": \"conv_abc123\",\n \"contactId\": \"user_123\",\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v1/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chatbotId\": \"ckl123abc456\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, I need help with my order\"\n }\n ],\n \"conversationId\": \"conv_abc123\",\n \"contactId\": \"user_123\",\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"text": "Hello! How can I help you today?"
}{
"message": "Invalid request data"
}{
"message": "No API key provided."
}{
"message": "Access denied or quota exceeded"
}{
"message": "Internal server error"
}Looking for API v2? The new Chatbase API v2 features structured error codes, cursor-based pagination, and SSE streaming. Note that API v2 is available starting from the Standard Plan. Check out the API v2 Reference →
Authorizations
API key in Bearer token format
Body
application/json
ID of the chatbot to chat with
Example:
"ckl123abc456"
Array of messages in the conversation
Show child attributes
Show child attributes
ID of existing conversation to continue, if not provided, the conversation will not be saved
Example:
"conv_abc123"
External ID of the contact/user
Example:
"user_123"
AI model to use for the response
Available options:
gpt-4o-mini, gpt-oss-120b, gpt-oss-20b, gpt-5.2, gpt-5.5, gpt-5.6-terra, gpt-5.6-luna, gpt-5-mini, gpt-5-nano, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-opus-4-5, claude-haiku-4-5, claude-sonnet-4-5, gemini-2.5-pro, gemini-3-flash, gemini-3.1-flash-lite, gemini-3.1-pro, gemini-3.5-flash, gemini-3.5-flash-lite, gemini-3.6-flash, grok-3, grok-3-mini, grok-4, DeepSeek-V3, DeepSeek-R1, DeepSeek-V4-Flash, Llama-4-Scout-17B-16E-Instruct, Llama-4-Maverick-17B-128E-Instruct-FP8, kimi-k2, mistral-medium-3.5, mistral-small-2603, glm-5.2, auto Example:
"gpt-4o-mini"
Temperature setting for AI response creativity
Required range:
0 <= x <= 1Example:
0.7
Whether to stream the response
Response
Chat response
The chatbot's response text
Example:
"Hello! How can I help you today?"
