curl --request PUT \
--url https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"content": "<string>"
}
'import requests
url = "https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId}"
payload = {
"name": "<string>",
"content": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', content: '<string>'})
};
fetch('https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId}', 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/{agentId}/sources/{sourceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'content' => '<string>'
]),
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/{agentId}/sources/{sourceId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"content\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"content\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"content\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "link",
"name": "<string>",
"size": 123,
"createdAt": "<string>",
"status": "untrained",
"metadata": {
"type": "individual"
}
}{
"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": "AGENT_NOT_FOUND",
"message": "Agent not found"
}
}{
"error": {
"code": "SOURCE_PENDING_DELETION",
"message": "Source is pending deletion and cannot be edited"
}
}{
"error": {
"code": "SOURCE_SIZE_LIMIT_EXCEEDED",
"message": "Chatbot storage limit exceeded"
}
}{
"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"
}
}Update source
Updates an existing source. Accepts text, qna, and link sources. File sources require a dedicated endpoint. A content change retrains the source immediately (status updated until it is live again). Link URL is immutable — to change it, delete and recreate the source. Ticket and Notion sources are not accepted.
Q&A request body limit: The total request body must not exceed 4.5 MB for Q&A sources.
curl --request PUT \
--url https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"content": "<string>"
}
'import requests
url = "https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId}"
payload = {
"name": "<string>",
"content": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', content: '<string>'})
};
fetch('https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId}', 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/{agentId}/sources/{sourceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'content' => '<string>'
]),
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/{agentId}/sources/{sourceId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"content\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"content\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v2/agents/{agentId}/sources/{sourceId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"content\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "link",
"name": "<string>",
"size": 123,
"createdAt": "<string>",
"status": "untrained",
"metadata": {
"type": "individual"
}
}{
"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": "AGENT_NOT_FOUND",
"message": "Agent not found"
}
}{
"error": {
"code": "SOURCE_PENDING_DELETION",
"message": "Source is pending deletion and cannot be edited"
}
}{
"error": {
"code": "SOURCE_SIZE_LIMIT_EXCEEDED",
"message": "Chatbot storage limit exceeded"
}
}{
"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
Path Parameters
The agent ID
1"5QHA6VB-DIAbBhxwqxfdi"
The source ID
1"a63a69a5-e7a9-4757-b73b-2041854d435d"
Body
Response
Updated source
Source ID
Source type
link, file, qna, notionPage, text Source name or URL
Source size in bytes
ISO 8601 creation timestamp
Training status of the source. failed means the last training run did not land; an earlier trained version, if any, stays live.
untrained, trained, toBeDeleted, updated, failed Link-specific metadata. Present only for type="link".
- Option 1
- Option 2
Show child attributes
Show child attributes
