Skip to main content
The Sources API lets you manage the content your agent is trained on. You can list, inspect, create, update, delete, and restore sources without touching the dashboard.

Hostname routing

File upload operations use a different base URL from all other endpoints.
OperationBase URL
All read operations and JSON-body writeshttps://www.chatbase.co/api/v2
Create or update file sourceshttps://files.chatbase.co/api/v2
Using the wrong host for file uploads will return a 404.

Source types

TypeListGetCreateUpdateDeleteRestore
text
qna
link
file
notionPage
Notion pages appear in list and get results, but cannot be created or updated via the API. Manage Notion sources through the Notion integration in the dashboard.

Source status

Every source has a status field that reflects its position in the training lifecycle.
StatusMeaning
untrainedNewly created; not yet included in a training run
trainedPart of the agent’s active knowledge base
updatedContent changed since last training — retrain needed
toBeDeletedtedMarked for removal; will be removed on the next training run
deletedPermanently removed. Only returned by the DELETE endpoint response; never appears in list or get results.
When Get sources summary returns shouldRetrain: true, at least one source has untrained, updated, or toBeDeletedted status. Retrain your agent from the dashboard to apply the changes.

Endpoints

List sources

Paginated list with optional type and name filters

Sources summary

Aggregate counts and sizes per source type

Get source

Retrieve a single source by ID

Create source

Create text, Q&A, and link sources

Create file source

Upload PDF, DOCX, or TXT files

Update source

Update text, Q&A, and link sources

Update file source

Replace file content or rename a file source

Delete source

Soft-delete with restore support

Restore source

Undo a pending deletion

Error codes

Sources-specific error codes beyond the standard authentication and rate-limiting errors:
CodeHTTPDescription
SOURCE_NOT_FOUND404Source doesn’t exist, belongs to a different agent, or has been permanently deleted.
SOURCE_TYPE_NOT_SUPPORTED400Attempting to update a notionPage via PUT. Manage Notion sources through the dashboard.
SOURCE_PENDING_DELETION409Source has toBeDeletedted status. Restore it before making edits.
SOURCE_NOT_RESTORABLE409Restore was called on a source that is not in toBeDeletedted state.
SOURCE_LINK_LIMIT_EXCEEDED422The 15 crawl/sitemap-parent limit per agent has been reached. Delete an existing crawl or sitemap source before adding another.
SOURCE_SIZE_LIMIT_EXCEEDED422Creating or updating this source would exceed the plan’s storage limit. Remove existing sources or upgrade your plan.
SOURCE_DUPLICATE409A link source with this URL and linkType already exists for this agent.
SOURCE_URL_IMMUTABLE400A link’s URL cannot be changed via PUT. Delete and recreate the source to use a different URL.