Sources API overview
The source object of the Askocto API v2, the source types and statuses, how training works and a map of the endpoints that manage an agent's knowledge.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Sources are the knowledge of an agent. The agent answers from them, and the answer shows which sources it used. Each source belongs to one agent, so every path starts with /v2/agents/{agentId}/sources. Use the endpoints to add content from a script, check whether training finished and remove what is outdated.
The source object
{
"id": "src_91xa7d",
"type": "website",
"title": "Help center",
"status": "ready",
"url": "https://example.com/help",
"characters": 48210,
"failureReason": null,
"createdAt": "2026-03-14T09:45:00Z"
}
| Field | Type | Description |
|---|---|---|
id |
string | The source ID, starting with src_. |
type |
string | website, file, text or qa. |
title |
string | The name shown in the dashboard and in the sources of a chat reply. |
status |
string | queued, training, ready or failed. |
url |
string | The crawled address. Only on website sources. |
characters |
integer | The size of the content the agent can read. |
failureReason |
string or null | Why training failed. null unless the status is failed. |
createdAt |
string | An ISO 8601 UTC time. |
Q&A sources also return question and answer. Help center imports appear as website sources.
Types
website: a page or sitemap that is crawled. Created withurl.file: a PDF, DOCX, TXT or CSV file, uploaded asmultipart/form-data.text: pasted content with atitle.qa: aquestionand theansweryou approve.
Statuses
A new source starts as queued, moves to training, and ends as ready or failed. The agent only uses a source once it is ready. Poll Get source until the status changes.
async function waitUntilReady(agentId, sourceId) {
const url = `https://api.askocto.co/v2/agents/${agentId}/sources/${sourceId}`
for (;;) {
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.OCTO_API_KEY}` },
})
const source = await response.json()
if (source.status === "ready" || source.status === "failed") return source
await new Promise((resolve) => setTimeout(resolve, 5000))
}
}
Updating a source queues it for training again. Website sources can also retrain on a schedule, see Toggle auto retrain. The dashboard view of the same data is described in Data sources.
Endpoints
- List sources returns the sources of an agent.
- Get sources summary returns counts by status and type.
- Get source returns one source.
- Create source adds a website, text or Q&A source.
- Create file source uploads a file.
- Update source changes a title, address or text.
- Update file source replaces the file of a file source.
- Delete source removes a source.
POST /v2/agents/{agentId}/sources/{sourceId}/restore, Restore source, is deprecated. See Restore source (deprecated).