Skip to content
QwryAI
Documentation
Pages

Endpoints

Create source

Add a Plain Text, Q&A Pairs or Website source to an agent through a review you apply

Each kind of source has its own tool: upload_text_source for Plain Text, add_qna_pairs for Q&A Pairs and add_url_source for a Website. The call returns a review; nothing is saved until you apply it. Once applied, the source appears on the Data sources page as New. It isn't used in answers until you train it, so follow up with train_pending_sources or start_training.

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

The other two tools use the same URL with their own name: POST https://api.qwryai.com/public/v1/tools/add_qna_pairs and POST https://api.qwryai.com/public/v1/tools/add_url_source.

Authentication

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

Body parameters

upload_text_source

NameTypeRequiredDescription
chatbotIdstringYesThe agent's id, from list_agents.
namestringYesThe source's name, 1 to 100 characters.
contentstringYesThe text, 1 to 10,000 characters.

Request example

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/upload_text_source' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "chatbotId": "YOUR_AGENT_ID",
    "name": "Shipping policy",
    "content": "We ship to the US and Canada. Orders leave our warehouse within 2 business days."
  }'

Response

The review

JSON
{
  "success": true,
  "data": {
    "status": "review_required",
    "reviewId": "9b2f4c71-3e8a-4d5b-a1c6-7f0e2d9b8a34",
    "tool": "add_qna_pairs",
    "changes": [
      {
        "title": "Add source: Shipping to Canada",
        "before": null,
        "after": {
          "name": "Shipping to Canada",
          "pairs": [
            { "question": "Do you ship to Canada?", "answer": "Yes, orders to Canada arrive in 5 to 7 business days." }
          ]
        }
      }
    ],
    "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

Send POST https://api.qwryai.com/public/v1/reviews/{reviewId}/apply within 15 minutes, with the same key:

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": "9b2f4c71-3e8a-4d5b-a1c6-7f0e2d9b8a34",
    "tool": "add_qna_pairs",
    "data": {
      "operationId": "<operationId>",
      "sourceId": "<sourceId>",
      "disposition": "saved",
      "training": "not_started",
      "applied": true
    },
    "receipt": {
      "applied": true,
      "operation": { "id": "<operationId>", "type": "create", "status": "succeeded", "sourceId": "<sourceId>", "createdAt": "2026-12-01T10:02:11.402Z", "updatedAt": "2026-12-01T10:02:11.402Z" },
      "matchesApprovedState": true,
      "current": { "id": "<sourceId>", "name": "Shipping to Canada", "type": "qa", "version": 1, "publicationState": "never_published", "pendingChanges": true, "exists": true }
    }
  }
}

The receipt is shortened here; it also carries available, observedAt, coverage and the rest of the source's fields. data.data.sourceId is the new source's id. training is not_started: train the source next, then poll check_training_status until it reads published. A website is saved first and fetched during training.

Errors

HTTP statuscodewhen
400INVALID_ARGUMENTSAn argument failed the schema: a name over 100 characters, text over 10,000 characters, more than 3 Q&A pairs, an unknown mode, or an unknown field. issues names each one.
400SOURCE_URL_INVALIDThe website address doesn't resolve to a public http or https address.
400WEBSITE_SETTINGS_INVALIDA path rule can't be used. message says which.
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.
404REVIEW_NOT_FOUNDOn apply: no review with that id for this key.
409SOURCE_DUPLICATEOn apply: the agent already has a website source for this address.
409REVIEW_ALREADY_USED / REVIEW_EXPIREDOn apply: the review was used already, or more than 15 minutes passed. Call the tool again.
422SOURCE_SIZE_LIMIT_EXCEEDEDOn apply: the agent would go over its plan's 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