curl --request POST \
--url https://www.chatbase.co/api/v2/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support Bot",
"url": "https://example.com",
"instructions": "<string>",
"model": "gpt-5.6-terra",
"temp": 0
}
'import requests
url = "https://www.chatbase.co/api/v2/agents"
payload = {
"name": "Support Bot",
"url": "https://example.com",
"instructions": "<string>",
"model": "gpt-5.6-terra",
"temp": 0
}
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({
name: 'Support Bot',
url: 'https://example.com',
instructions: '<string>',
model: 'gpt-5.6-terra',
temp: 0
})
};
fetch('https://www.chatbase.co/api/v2/agents', 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/v2/agents",
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([
'name' => 'Support Bot',
'url' => 'https://example.com',
'instructions' => '<string>',
'model' => 'gpt-5.6-terra',
'temp' => 0
]),
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/v2/agents"
payload := strings.NewReader("{\n \"name\": \"Support Bot\",\n \"url\": \"https://example.com\",\n \"instructions\": \"<string>\",\n \"model\": \"gpt-5.6-terra\",\n \"temp\": 0\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/v2/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Support Bot\",\n \"url\": \"https://example.com\",\n \"instructions\": \"<string>\",\n \"model\": \"gpt-5.6-terra\",\n \"temp\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v2/agents")
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 \"name\": \"Support Bot\",\n \"url\": \"https://example.com\",\n \"instructions\": \"<string>\",\n \"model\": \"gpt-5.6-terra\",\n \"temp\": 0\n}"
response = http.request(request)
puts response.read_body{
"id": "5QHA6VB-DIAbBhxwqxfdi",
"pendingSteps": [
"ADD_SOURCE"
]
}{
"error": {
"code": "VALIDATION_INVALID_BODY",
"message": "Invalid request"
}
}{
"error": {
"code": "AUTH_MISSING_API_KEY",
"message": "Authentication required"
}
}{
"error": {
"code": "SUBSCRIPTION_API_RESTRICTED_PLAN",
"message": "A Standard plan or higher is required to access the API"
}
}{
"error": {
"code": "RATE_LIMIT_TOO_MANY_REQUESTS",
"message": "Too many requests, please try again later"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Something went wrong, please try again"
}
}{
"error": {
"code": "SERVICE_UNDER_MAINTENANCE",
"message": "The API is temporarily unavailable for scheduled maintenance, please try again later"
}
}Create agent
Creates a new agent. If url is provided, a link source is created from that URL and training is queued automatically.
The agent is always created even if source setup or training fails — id is always returned. Check pendingSteps in the response to see which steps need to be retried:
ADD_SOURCE— the URL could not be added as a source. Add sources manually via the Sources API.TRAIN_AGENT— training could not be started. Trigger it manually viaPOST /agents/{agentId}/train.
When pendingSteps is absent, all steps succeeded.
Subject to plan agent limits — returns AGENT_LIMIT_REACHED (403) when the account has reached its maximum number of agents.
curl --request POST \
--url https://www.chatbase.co/api/v2/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support Bot",
"url": "https://example.com",
"instructions": "<string>",
"model": "gpt-5.6-terra",
"temp": 0
}
'import requests
url = "https://www.chatbase.co/api/v2/agents"
payload = {
"name": "Support Bot",
"url": "https://example.com",
"instructions": "<string>",
"model": "gpt-5.6-terra",
"temp": 0
}
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({
name: 'Support Bot',
url: 'https://example.com',
instructions: '<string>',
model: 'gpt-5.6-terra',
temp: 0
})
};
fetch('https://www.chatbase.co/api/v2/agents', 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/v2/agents",
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([
'name' => 'Support Bot',
'url' => 'https://example.com',
'instructions' => '<string>',
'model' => 'gpt-5.6-terra',
'temp' => 0
]),
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/v2/agents"
payload := strings.NewReader("{\n \"name\": \"Support Bot\",\n \"url\": \"https://example.com\",\n \"instructions\": \"<string>\",\n \"model\": \"gpt-5.6-terra\",\n \"temp\": 0\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/v2/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Support Bot\",\n \"url\": \"https://example.com\",\n \"instructions\": \"<string>\",\n \"model\": \"gpt-5.6-terra\",\n \"temp\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v2/agents")
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 \"name\": \"Support Bot\",\n \"url\": \"https://example.com\",\n \"instructions\": \"<string>\",\n \"model\": \"gpt-5.6-terra\",\n \"temp\": 0\n}"
response = http.request(request)
puts response.read_body{
"id": "5QHA6VB-DIAbBhxwqxfdi",
"pendingSteps": [
"ADD_SOURCE"
]
}{
"error": {
"code": "VALIDATION_INVALID_BODY",
"message": "Invalid request"
}
}{
"error": {
"code": "AUTH_MISSING_API_KEY",
"message": "Authentication required"
}
}{
"error": {
"code": "SUBSCRIPTION_API_RESTRICTED_PLAN",
"message": "A Standard plan or higher is required to access the API"
}
}{
"error": {
"code": "RATE_LIMIT_TOO_MANY_REQUESTS",
"message": "Too many requests, please try again later"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Something went wrong, please try again"
}
}{
"error": {
"code": "SERVICE_UNDER_MAINTENANCE",
"message": "The API is temporarily unavailable for scheduled maintenance, please try again later"
}
}Authorizations
API key from your account settings
Body
Agent name
1 - 100"Support Bot"
Homepage URL of the product. The agent is pre-configured to answer questions about this website.
"https://example.com"
System prompt / instructions for the agent
AI model to use
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 "gpt-5.6-terra"
Model temperature (0–1)
0 <= x <= 10
Agent visibility (default: private)
public, private Response
Agent created
The agent ID
"5QHA6VB-DIAbBhxwqxfdi"
Steps that failed after the agent was created, absent when everything succeeded. ADD_SOURCE — the provided URL could not be added as a source; add sources manually via the Sources API. TRAIN_AGENT — training could not be started; trigger it manually via POST /agents/{agentId}/train.
ADD_SOURCE, TRAIN_AGENT 