Skip to content
TriedDocs
Knowledge bases

Add synced source

Connect a Google Drive folder, OneDrive folder or Notion page to a knowledge base and keep it in sync.

POSThttps://api.tried.com.au/add-knowledge-base-synced-source/{knowledge_base_id}

Connects an external source to a knowledge base and runs the first sync before it responds. Syncing real documents needs an access token for Google Drive, Microsoft OneDrive or Notion, either sent here as access_token or set up through the dashboard's OAuth connect flow on the Knowledge Base page.

Without a token, the connection is a test connection: each sync adds two fixed sample documents, FAQ and Price list, so you can try the flow. The response shows mock: true.

Request#

Path parameter Type Required Description
knowledge_base_id string Yes The knowledge base ID, starting with knowledge_base_.
Field Type Required Description
provider string Yes google_drive, onedrive or notion.
config object Depends Where to read from. See the table below.
access_token string No Provider access token. Stored encrypted. Leave it out for a test connection.
Provider config keys What is synced
google_drive folder_id (required) Up to 100 files in the folder. Google Docs are exported as plain text; text/* and JSON files are downloaded. Other files are skipped.
onedrive folder_id (optional, default the drive root), drive_id (optional, default your own drive) Up to 200 items in the folder that are text, JSON or Markdown, or end in .txt, .md, .csv or .json.
notion page_id (required) The page and its child pages, up to two levels down, as plain text from their blocks (first 100 blocks per page).

How syncing works#

  • Each document becomes a document source titled <name> (<provider>), with the provider's link as its url.
  • Synced sources do not count toward the 25 file, 500 URL and 50 text limits.
  • On each sync, new documents are added, changed documents are re-ingested, and documents that disappeared are removed from the knowledge base.
  • Connections sync again once a day. Call Sync knowledge base source to sync now.

Example request#

curl -X POST https://api.tried.com.au/add-knowledge-base-synced-source/knowledge_base_9f060d81a4d8df9b04ca6d12 \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider": "google_drive", "config": {"folder_id": "1AbCdEfGhIjKlMnOpQrStUv"}, "access_token": "'"$GOOGLE_ACCESS_TOKEN"'"}'
const res = await fetch(
  "https://api.tried.com.au/add-knowledge-base-synced-source/knowledge_base_9f060d81a4d8df9b04ca6d12",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      provider: "google_drive",
      config: { folder_id: "1AbCdEfGhIjKlMnOpQrStUv" },
      access_token: process.env.GOOGLE_ACCESS_TOKEN,
    }),
  },
);
const sync = await res.json();
import os, requests

res = requests.post(
    "https://api.tried.com.au/add-knowledge-base-synced-source/knowledge_base_9f060d81a4d8df9b04ca6d12",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
    json={
        "provider": "google_drive",
        "config": {"folder_id": "1AbCdEfGhIjKlMnOpQrStUv"},
        "access_token": os.environ["GOOGLE_ACCESS_TOKEN"],
    },
)
sync = res.json()

Response#

201 Created

{
  "oauth": false,
  "oauth_expires_timestamp": null,
  "sync_id": "kbsync_47800c505ee631a117973dcf",
  "knowledge_base_id": "knowledge_base_9f060d81a4d8df9b04ca6d12",
  "provider": "google_drive",
  "config": { "folder_id": "1AbCdEfGhIjKlMnOpQrStUv" },
  "status": "synced",
  "error": null,
  "last_synced_timestamp": 1760832000000,
  "document_count": 12,
  "mock": false
}
Field Type Description
sync_id string Starts with kbsync_.
status string pending before the first sync, synced after a successful sync, error after a failed one.
error string or null Provider error message when status is error (up to 500 characters).
last_synced_timestamp integer or null Unix ms of the last successful sync.
document_count integer Documents currently tracked by this connection.
mock boolean true for a test connection that has no token and syncs the sample documents.
oauth boolean true when the connection was made through the dashboard OAuth flow.
oauth_expires_timestamp integer or null Unix ms when the OAuth access token expires. Tried refreshes it before syncing.

A failed first sync still returns 201. Check status and error.

Errors#

Status When
400 provider must be one of google_drive, onedrive, notion, config.folder_id is required (Google Drive) or config.page_id is required (Notion).
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 <knowledge_base_id> not found.
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.