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 with url.
  • file: a PDF, DOCX, TXT or CSV file, uploaded as multipart/form-data.
  • text: pasted content with a title.
  • qa: a question and the answer you 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

Something unclear or missing? Tell us and we will fix the page.