Skip to content
QwryAI
Documentation
Pages

Endpoints

Update source

Rename a source, change a website's crawl options, or replace the text of a Plain Text or Q&A document

update_source changes a source's name, its description, or a website's advanced options. update_source_content replaces the text of one document in a Plain Text or Q&A Pairs source. Both return a review; nothing changes until you apply it. Every edit names the version you read, as expectedVersion, so it never overwrites a change someone made after you read the source.

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

Content edits use POST https://api.qwryai.com/public/v1/tools/update_source_content.

Authentication

Send your API key as Authorization: Bearer YOUR_API_KEY; it needs the Change sources and training permission. See Authentication.

Body parameters

update_source works on every source type. Send only what you want to change.

NameTypeRequiredDescription
chatbotIdstringYesThe agent's id, from list_agents.
sourceIdstringYesThe source's id, from list_sources.
expectedVersionintegerYesThe source's current version.
namestringNoA new name, 1 to 100 characters.
descriptionstringNoA new description, up to 2,000 characters.
websiteobjectNoA website's advanced options: include_paths, exclude_paths, include_query_parameters, slow_scraping, load_in_browser and scraping_location, as in Create source. Options you leave out keep their value; they apply at the next fetch.

A website's address can't be changed. To point at another address, add a new website source and delete the old one.

Request example

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/update_source' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "chatbotId": "YOUR_AGENT_ID",
    "sourceId": "SOURCE_ID",
    "expectedVersion": 3,
    "name": "Help center (EN)",
    "website": { "exclude_paths": [{ "operator": "contains", "value": "/fr/" }] }
  }'

Response

The review

JSON
{
  "success": true,
  "data": {
    "status": "review_required",
    "reviewId": "c4a81e2d-5f37-4b90-8e6a-1d2b3c4d5e6f",
    "tool": "update_source",
    "changes": [
      {
        "title": "Update source: Help center",
        "before": {
          "name": "Help center",
          "description": null,
          "website": {
            "include_paths": ["starts_with /help"],
            "exclude_paths": [],
            "include_query_parameters": false,
            "slow_scraping": false,
            "load_in_browser": false,
            "scraping_location": "us"
          }
        },
        "after": {
          "name": "Help center (EN)",
          "description": null,
          "website": {
            "include_paths": ["starts_with /help"],
            "exclude_paths": ["contains /fr/"],
            "include_query_parameters": false,
            "slow_scraping": false,
            "load_in_browser": false,
            "scraping_location": "us"
          }
        }
      }
    ],
    "unchanged": [],
    "expiresAt": "2026-12-01T10:15:00.000Z",
    "next": "Show these changes to the user. Call apply_change with this reviewId only after they approve; the review expires in 15 minutes."
  }
}

A content review shows the document's title and content (and questions for Q&A) before and after.

Apply it

Bash
curl -X POST 'https://api.qwryai.com/public/v1/reviews/REVIEW_ID/apply' \
  -H 'Authorization: Bearer YOUR_API_KEY'
JSON
{
  "success": true,
  "data": {
    "status": "succeeded",
    "reviewId": "c4a81e2d-5f37-4b90-8e6a-1d2b3c4d5e6f",
    "tool": "update_source",
    "data": {
      "operationId": "<operationId>",
      "sourceId": "<sourceId>",
      "disposition": "saved",
      "training": "not_started",
      "applied": true
    },
    "receipt": {
      "applied": true,
      "matchesApprovedState": true,
      "current": { "id": "<sourceId>", "name": "Help center (EN)", "version": 4, "publicationState": "changed", "pendingChanges": true, "exists": true }
    }
  }
}

The receipt is shortened here. A content edit leaves the source Changed: the agent keeps answering from the trained version until you train it again with start_training or train_pending_sources.

Errors

HTTP statuscodewhen
400INVALID_ARGUMENTSAn argument failed the schema, or contentType doesn't match the document. issues or message says which.
400WEBSITE_SETTINGS_INVALIDA path rule can't be used.
400CHATBOT_ID_REQUIREDchatbotId is missing or isn't a valid agent id.
403INSUFFICIENT_PERMISSIONThe key doesn't hold Change sources and training.
404CHATBOT_NOT_FOUNDNo agent with that chatbotId in your workspace.
404SOURCE_NOT_FOUNDThe agent has no source with that id.
409SOURCE_VERSION_CONFLICTexpectedVersion isn't the source's current version. Read it again.
409SOURCE_PENDING_DELETIONOn apply: the source is marked Removed. Restore it first.
409SOURCE_OPERATION_IN_PROGRESSOn apply: the source is being fetched or trained. Try again when it's idle.
409STALE_REVIEWOn apply: the source changed after the review. Call the tool again.
422SOURCE_SIZE_LIMIT_EXCEEDEDOn apply: the new content would take the agent over its training data allowance.
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