# 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. ```http POST https://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](/docs/api-reference/v2/authentication). ## Body parameters | Name | Type | Required | Description | | - | - | - | - | | `chatbotId` | `string` | Yes | The agent's id, from `list_agents`. | The tool takes no other arguments. An unknown field returns `400 INVALID_ARGUMENTS`. ## Request example > [tab] cURL > > ```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"}' > ``` > [tab] JavaScript > > ```javascript > const response = await fetch( > "https://api.qwryai.com/public/v1/tools/get_sources_summary", > { > method: "POST", > headers: { > Authorization: "Bearer YOUR_API_KEY", > "Content-Type": "application/json", > }, > body: JSON.stringify({ chatbotId: "YOUR_AGENT_ID" }), > } > ); > const { data } = await response.json(); > console.log(data.pendingChanges, data.trainingQuota); > ``` > [tab] Python > > ```python > import requests > > response = requests.post( > "https://api.qwryai.com/public/v1/tools/get_sources_summary", > headers={"Authorization": "Bearer YOUR_API_KEY"}, > json={"chatbotId": "YOUR_AGENT_ID"}, > ) > summary = response.json()["data"] > ``` ## 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 } } } ``` | Field | Type | Description | | - | - | - | | `total` | `integer` | Every source the agent has, including ones being removed. | | `active` | `integer` | Sources in use or waiting to train. | | `pendingDeletion` | `integer` | Sources marked **Removed**, waiting for the next training to take them out. | | `pendingChanges` | `integer` | Sources with changes that aren't trained yet. When it's above `0`, the agent needs training; `train_pending_sources` does what **Retrain agent** does. | | `processing` | `integer` | Sources being fetched or trained right now. | | `totalBillableBytes` | `integer` | The size of the agent's training content, in bytes. | | `byType` | `array` | One row per source type: `type`, `sources`, `documents` and `bytes`. Types are `url`, `text`, `qa`, `file`, `csv`, `excel`, `notion` and `tickets`. | | `trainingQuota.usedBytes` | `integer` | Training data counted against the allowance, in bytes. | | `trainingQuota.desiredBytes` | `integer` | What the agent will hold once pending changes train. | | `trainingQuota.limitBytes` | `integer` | The plan's per-agent allowance in bytes; `-1` means no limit. | | `trainingQuota.exceeded` | `boolean` | `true` when the agent holds more than its plan allows. | > [!TIP] > > To see which sources are waiting, call `find_sources_by_status` with `["new", "changed", "failed"]`. See [Sources](/docs/api-reference/v2/sources#source-status). ## Errors | HTTP status | code | when | | - | - | - | | 400 | `INVALID_ARGUMENTS` | The body has a field other than `chatbotId`. | | 400 | `CHATBOT_ID_REQUIRED` | `chatbotId` is missing or isn't a valid agent id. | | 403 | `INSUFFICIENT_PERMISSION` | The key doesn't hold **Read agent settings**. | | 404 | `CHATBOT_NOT_FOUND` | No agent with that `chatbotId` in your workspace. | | 429 | `INTEGRATION_RATE_LIMIT_EXCEEDED` | More than 2,000 requests in 15 minutes for this key. | | 500 | `TOOL_FAILED` | The tool failed on our side. Try again. | Authentication and plan errors are listed in [Error Handling](/docs/api-reference/v2/error-handling).