Skip to content
TriedDocs
Knowledge bases

Add knowledge base sources

Add files, text snippets or web pages to an existing knowledge base.

POSThttps://api.tried.com.au/add-knowledge-base-sources/{id}

Adds sources to a knowledge base and ingests them in the background. Existing sources are kept. The knowledge base status goes back to in_progress until the new sources are processed.

Request#

Path parameter Type Required Description
id string Yes The knowledge base ID, starting with knowledge_base_.

Send multipart/form-data to upload files, or application/json for texts and URLs only. Send at least one source.

Field Type Required Description
knowledge_base_texts array of objects No Text snippets, each { "title": string, "text": string }.
knowledge_base_urls array of strings No Web pages to fetch. Each must be a valid URL.
knowledge_base_files files No Documents to upload. Multipart only.

Multipart encoding, file types, limits, ingestion steps and the URL egress guard are the same as for Create knowledge base. Limits count the sources already in the knowledge base: at most 25 files, 500 URLs and 50 text snippets in total.

Example request#

curl -X POST https://api.tried.com.au/add-knowledge-base-sources/knowledge_base_9f060d81a4d8df9b04ca6d12 \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -F 'knowledge_base_urls[]=https://example.com.au/services' \
  -F knowledge_base_files=@after-hours.docx
import { readFile } from "node:fs/promises";

const form = new FormData();
form.append("knowledge_base_urls[]", "https://example.com.au/services");
form.append("knowledge_base_files", new Blob([await readFile("after-hours.docx")]), "after-hours.docx");

const res = await fetch(
  "https://api.tried.com.au/add-knowledge-base-sources/knowledge_base_9f060d81a4d8df9b04ca6d12",
  {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.TRIED_API_KEY}` },
    body: form,
  },
);
const kb = await res.json();
import os, requests

with open("after-hours.docx", "rb") as f:
    res = requests.post(
        "https://api.tried.com.au/add-knowledge-base-sources/knowledge_base_9f060d81a4d8df9b04ca6d12",
        headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
        data={"knowledge_base_urls[]": "https://example.com.au/services"},
        files=[("knowledge_base_files", ("after-hours.docx", f))],
    )
kb = res.json()

Response#

200 OK

{
  "knowledge_base_id": "knowledge_base_9f060d81a4d8df9b04ca6d12",
  "knowledge_base_name": "Clinic FAQ",
  "status": "in_progress",
  "knowledge_base_sources": [
    {
      "source_id": "source_92055d142a2829e5c8e77a9f",
      "type": "text",
      "title": "Opening hours",
      "url": null,
      "content_url": "https://api.tried.com.au/get-knowledge-base-source-content/knowledge_base_9f060d81a4d8df9b04ca6d12/source_92055d142a2829e5c8e77a9f"
    },
    {
      "source_id": "source_21ce463cc228d0ea2a439493",
      "type": "url",
      "title": "https://example.com.au/services",
      "url": "https://example.com.au/services",
      "content_url": "https://api.tried.com.au/get-knowledge-base-source-content/knowledge_base_9f060d81a4d8df9b04ca6d12/source_21ce463cc228d0ea2a439493"
    },
    {
      "source_id": "source_5da4e4744cb7ea63832e856c",
      "type": "document",
      "title": "after-hours.docx",
      "url": null,
      "content_url": "https://api.tried.com.au/get-knowledge-base-source-content/knowledge_base_9f060d81a4d8df9b04ca6d12/source_5da4e4744cb7ea63832e856c"
    }
  ],
  "enable_auto_refresh": false,
  "last_refreshed_timestamp": 1760832000000,
  "chunk_size": 800,
  "chunk_overlap": 100,
  "auto_add_pages": false,
  "crawl_roots": []
}

The whole knowledge base is returned, including the new sources. Fields are described in Get knowledge base.

Errors#

Status When
400 No sources provided, a field fails validation, a per knowledge base limit is reached (A knowledge base holds at most 25 files, ... 500 URLs, ... 50 text snippets), or a file cannot be parsed (Could not read <filename>: ...).
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request (this route needs the kb scope), or the caller is a read-only dashboard member.
404 Knowledge base <id> not found.
413 A file is over 50 MB, the request has more than 25 files, or a JSON body is over 25 MB.
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.

Retell compatibility#

Same path, method and field names as Retell. Tried returns 200 (Retell documents 201) and 404 for a missing knowledge base.