Get source

GET/v2/agents/{agentId}/sources/{sourceId}

Fetch one source of an agent by its ID to read its type, title, training status, size and the reason it failed, if it did.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

Returns a single source. Call it to follow a source through training after you create or update it, or to read why training failed.

Request

GET /v2/agents/{agentId}/sources/{sourceId}

Path parameters:

Name Type Required Description
agentId string Yes The ID of the agent, starting with agt_.
sourceId string Yes The ID of the source, starting with src_.

The call has no query parameters and no body. A source moves from queued to training and ends as ready or failed. The Sources API overview has a polling function you can copy.

Example request

curl https://api.askocto.co/v2/agents/agt_8f3k2m/sources/src_4n7c2w \
  -H "Authorization: Bearer $OCTO_API_KEY"
const response = await fetch(
  "https://api.askocto.co/v2/agents/agt_8f3k2m/sources/src_4n7c2w",
  { headers: { Authorization: `Bearer ${process.env.OCTO_API_KEY}` } },
)

const source = await response.json()
if (source.status === "failed") console.error(source.failureReason)

Example response

A successful call returns 200 OK. This source failed, so failureReason is set.

{
  "id": "src_4n7c2w",
  "type": "file",
  "title": "Returns policy",
  "status": "failed",
  "characters": 0,
  "failureReason": "The file contains no readable text.",
  "createdAt": "2026-03-19T15:02:00Z"
}

Response fields

Name 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.
question, answer string The approved pair. Only on qa 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.

After a failure, fix the cause and send the change with Update source or Update file source. Either call queues the source for training again.

Errors

Status Code When
401 unauthorized The API key is missing, malformed or deleted.
404 not_found The agent or the source does not exist in your workspace.
429 rate_limited Too many requests. Wait for the number of seconds in the Retry-After header.

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