Skip to content
QwryAI
Documentation
Pages

Endpoints

Get sources summary

Count an agent's sources by type, see what's waiting to train, and check the training data allowance

get_sources_summary returns the totals behind the Data sources page: how many sources the agent has of each type, how many are being removed, how many have changes that aren't trained yet, and how much of the plan's training data allowance is used. It reads only; nothing changes.

POSThttps://api.qwryai.com/public/v1/tools/get_sources_summary

Authentication

Send your API key as Authorization: Bearer YOUR_API_KEY; it needs the Read agent settings permission. See Authentication.

Body parameters

NameTypeRequiredDescription
chatbotIdstringYesThe agent's id, from list_agents.

The tool takes no other arguments. An unknown field returns 400 INVALID_ARGUMENTS.

Request example

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/get_sources_summary' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"chatbotId": "YOUR_AGENT_ID"}'

Response

JSON
{
  "success": true,
  "data": {
    "total": 4,
    "active": 4,
    "pendingDeletion": 0,
    "pendingChanges": 1,
    "processing": 0,
    "totalBillableBytes": 12707,
    "byType": [
      { "type": "text", "sources": 1, "documents": 1, "bytes": 2658 },
      { "type": "tickets", "sources": 1, "documents": 0, "bytes": 0 },
      { "type": "url", "sources": 1, "documents": 2, "bytes": 9996 },
      { "type": "qa", "sources": 1, "documents": 1, "bytes": 53 }
    ],
    "trainingQuota": {
      "usedBytes": 12707,
      "desiredBytes": 12707,
      "limitBytes": 41943040,
      "exceeded": false
    }
  }
}
FieldTypeDescription
totalintegerEvery source the agent has, including ones being removed.
activeintegerSources in use or waiting to train.
pendingDeletionintegerSources marked Removed, waiting for the next training to take them out.
pendingChangesintegerSources with changes that aren't trained yet. When it's above 0, the agent needs training; train_pending_sources does what Retrain agent does.
processingintegerSources being fetched or trained right now.
totalBillableBytesintegerThe size of the agent's training content, in bytes.
byTypearrayOne row per source type: type, sources, documents and bytes. Types are url, text, qa, file, csv, excel, notion and tickets.
trainingQuota.usedBytesintegerTraining data counted against the allowance, in bytes.
trainingQuota.desiredBytesintegerWhat the agent will hold once pending changes train.
trainingQuota.limitBytesintegerThe plan's per-agent allowance in bytes; -1 means no limit.
trainingQuota.exceededbooleantrue when the agent holds more than its plan allows.

Errors

HTTP statuscodewhen
400INVALID_ARGUMENTSThe body has a field other than chatbotId.
400CHATBOT_ID_REQUIREDchatbotId is missing or isn't a valid agent id.
403INSUFFICIENT_PERMISSIONThe key doesn't hold Read agent settings.
404CHATBOT_NOT_FOUNDNo agent with that chatbotId in your workspace.
429INTEGRATION_RATE_LIMIT_EXCEEDEDMore than 2,000 requests in 15 minutes for this key.
500TOOL_FAILEDThe tool failed on our side. Try again.

Authentication and plan errors are listed in Error Handling.

Explore the documentation