Skip to content
QwryAI
Documentation
Pages

Endpoints

Toggle auto-retrain

Turn weekly automatic retraining of a website source on or off

Website sources can retrain themselves every week, so the agent keeps up with changes to your site. In QwryAI the switch belongs to each website source, not to the whole agent: toggle_auto_retrain turns it on or off for one source. Like every change made through the API, it returns a review first; the switch flips when you apply it.

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

Authentication

Send your API key as Authorization: Bearer <api-key>, or in an x-api-key header. The key needs Change sources and training. See Authentication.

Body parameters

NameTypeRequiredDescription
chatbotIdstringYesThe agent's id, from List agents.
sourceIdstringYesThe website source's id, from list_sources.
expectedVersionintegerYesThe source's version as you just read it. If the source changed since, the review is refused.
enabledbooleanYestrue retrains the source every week; false stops it.

Request example

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/toggle_auto_retrain' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "chatbotId": "YOUR_AGENT_ID",
    "sourceId": "YOUR_SOURCE_ID",
    "expectedVersion": 4,
    "enabled": true
  }'

Response

JSON
{
  "success": true,
  "data": {
    "status": "review_required",
    "reviewId": "2c9e7a41-5b3d-4f08-9e6a-1d4b8c7f0a25",
    "tool": "toggle_auto_retrain",
    "changes": [
      {
        "title": "Set weekly retraining for source: qwryai.com",
        "before": { "weekly retraining": "Off" },
        "after": { "weekly retraining": "On" }
      }
    ],
    "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."
  }
}

Apply it with POST /public/v1/reviews/{reviewId}/apply within 15 minutes. Afterwards, list_sources shows autoRetrain: true on the source.

Errors

HTTP statusCodeWhen
400INVALID_ARGUMENTSA missing or malformed argument, or the source isn't a website.
400CHATBOT_ID_REQUIREDThe body has no valid chatbotId.
401API_KEY_REQUIRED / INVALID_API_KEYNo credential, or an unknown, deleted or expired one.
403INSUFFICIENT_PERMISSIONThe key doesn't hold Change sources and training.
403PLAN_FEATURE_UNAVAILABLETurning it on: the plan doesn't include automatic retraining.
404CHATBOT_NOT_FOUNDNo agent with that chatbotId in your workspace.
404SOURCE_NOT_FOUNDNo source with that sourceId on this agent.
409SOURCE_VERSION_CONFLICTThe source changed after you read it. Read version again.
409SOURCE_OPERATION_IN_PROGRESSThe source is training, being removed or otherwise busy. Try again once it's idle.
429INTEGRATION_RATE_LIMIT_EXCEEDEDMore than 2,000 requests in 15 minutes.

See Error Handling for every code.

Explore the documentation