Endpoints
List sources
List an agent's sources with their type, version and training state, 20 per page
list_sources returns the sources on the agent's Data sources page, newest first, without their content. Each row carries the version you send back when you edit, delete or train the source. Filter by name with search or by source type with type; to filter by status, use find_sources_by_status (below).
https://api.qwryai.com/public/v1/tools/list_sourcesAuthentication
Send your API key as Authorization: Bearer YOUR_API_KEY; it needs the Read agent settings permission. See Authentication.
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
chatbotId | string | Yes | The agent's id, from list_agents. |
page | integer | Yes | The page to return, from 1 to 10000. Each page holds 20 sources. |
search | string | No | Return only sources whose name contains this text. Up to 200 characters. |
type | string | No | One source type: url (Website), text (Plain Text), qa (Q&A Pairs), file, csv, excel or notion. Leave it out to list every type. |
Request example
curl -X POST 'https://api.qwryai.com/public/v1/tools/list_sources' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"chatbotId": "YOUR_AGENT_ID", "page": 1, "type": "qa"}'const response = await fetch(
"https://api.qwryai.com/public/v1/tools/list_sources",
{
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ chatbotId: "YOUR_AGENT_ID", page: 1, type: "qa" }),
}
);
const { data } = await response.json();
for (const source of data.items) console.log(source.name, source.publicationState);import requests
response = requests.post(
"https://api.qwryai.com/public/v1/tools/list_sources",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"chatbotId": "YOUR_AGENT_ID", "page": 1, "type": "qa"},
)
data = response.json()["data"]
more = data["pagination"]["page"] < data["pagination"]["pages"]Response
{
"success": true,
"data": {
"items": [
{
"id": "<sourceId>",
"name": "Shipping to Canada",
"type": "qa",
"version": 1,
"desiredLifecycle": "active",
"processingState": "idle",
"publicationState": "never_published",
"publishedCount": 0,
"health": "healthy",
"warning": null,
"operation": { "status": "succeeded", "phase": "completed", "progress": 100 },
"pendingChanges": true,
"updatedAt": "2026-11-29T10:37:16.040Z",
"autoRetrain": false
},
{
"id": "<sourceId>",
"name": "Returns FAQ",
"type": "qa",
"version": 2,
"desiredLifecycle": "pending_deletion",
"processingState": "idle",
"publicationState": "removal_pending",
"publishedCount": 1,
"health": "healthy",
"warning": null,
"operation": { "status": "succeeded", "phase": "deletion_pending_publication", "progress": 100 },
"pendingChanges": true,
"updatedAt": "2026-11-26T11:24:29.795Z",
"autoRetrain": false
}
],
"pagination": { "page": 1, "limit": 20, "total": 2, "pages": 1 }
}
}| Field | Type | Description |
|---|---|---|
id | string | The source's id. Pass it as sourceId to the other source tools. |
name | string | The name on the Data sources page. |
type | string | url, text, qa, file, csv, excel or notion. |
version | integer | Goes up with every change. Send it as expectedVersion when you edit, delete, restore or train the source. |
desiredLifecycle | string | active, or pending_deletion once deleted and waiting for training. |
processingState | string | idle, queued, running or cancelling. |
publicationState | string | never_published (not trained), changed (edited since training), published (trained) or removal_pending. |
publishedCount | integer | How many of its documents the agent answers from now. |
health | string | healthy, warning or error. |
warning | object | The last warning's code and message, or null. |
operation | object | The latest fetch or training run: status, phase and progress (0 to 100), or null. |
pendingChanges | boolean | true when the source has changes the agent isn't using yet. |
updatedAt | string | When the source last changed, in ISO 8601. |
autoRetrain | boolean | Whether a website retrains every week. |
pagination | object | page, limit (always 20), total and pages. Read on while page is less than pages. See Pagination. |
Filter by status
find_sources_by_status takes statuses (one or more of new, changed, training, trained, failed, removed and partly_trained) and page, and returns the same rows with the status the Data sources page shows, failing ones first. Its page details are page, total and hasMore. See Source status.
curl -X POST 'https://api.qwryai.com/public/v1/tools/find_sources_by_status' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"chatbotId": "YOUR_AGENT_ID", "statuses": ["failed"], "page": 1}'Errors
| HTTP status | code | when |
|---|---|---|
| 400 | INVALID_ARGUMENTS | page is missing or out of range, type isn't a listed value, or search is over 200 characters. issues names each one. |
| 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. |
| 413 | RESULT_TOO_LARGE | The page is over 40,000 bytes. Narrow it with search or type. |
| 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.