Skip to content

Source connectors

A connector pulls content from an external system on a cron schedule and feeds it into a collection through the same ingestion pipeline as uploads. The KB Connector Sync service claims connectors that are due, decrypts their credential, calls the source API, and upserts one kb_documents row per source item (source: "connector", plain text, with the source URL and the source’s permissions as an ACL). The KB Uploader then chunks and embeds it.

Connector documents carry source permissions: at retrieval time a signed-in user only gets connector chunks their mapped source identities could open. See Source permissions.

Base http://localhost:5050/v1/admin/kb-connectors, admin JWT.

Method Path Purpose
GET /catalog Every connector type with its config and credential schema
GET /catalog/{connector_type} One catalog entry (404 for an unknown type)
GET (base path) List connectors (?connector_type=slack&enabled_only=true)
POST (base path) Create a connector (201)
GET /{connector_id} Get one connector
PATCH /{connector_id} Partial update; a credential replaces the stored one
DELETE /{connector_id} Delete, cascading to credential, checkpoints and run logs (204)
PUT /{connector_id}/groups Replace the connector’s resource-group bindings
POST /{connector_id}/test-connection Check that a credential is configured
POST /{connector_id}/sync Queue an immediate run
GET /{connector_id}/runs Run history (?limit=50, 1–500)
connector_type credential_kind Config keys (example) ACL principals stamped Default schedule
confluence oauth base_url (required, https://acme.atlassian.net/wiki), space_keys, include_archived confluence:user:<accountId>, confluence:group:<id>, confluence:space:<KEY> 0 */6 * * *
notion api_key root_page_ids, include_databases always public 0 */6 * * *
google_drive oauth folder_ids, include_shared_drives, mime_types gdrive:user:<email>, gdrive:group:<email>, gdrive:domain:<domain>, public 0 */6 * * *
slack oauth channels (#engineering), include_threads, lookback_days (30) slack:user:<U…> per channel member, slack:channel:<C…> 0 */6 * * *
github oauth repos (acme/platform), include_issues, include_pull_requests, include_markdown_files, enterprise_base_url github:user:<login>, github:team:<slug>, public 0 */6 * * *
jira oauth base_url (required, https://acme.atlassian.net), project_keys, jql_filter (updated >= "-30d"), include_comments jira:project:<KEY>:role:<name>, jira:project:<KEY>:group:<id>, jira:security:<KEY>:<level> 0 */6 * * *
sharepoint oauth tenant_id (required, Entra directory ID), site_urls, include_subsites, file_types sp:user:<oid>, sp:group:<oid>, sp:tenant:<tenantId>, public 0 */6 * * *
web_crawler api_key (none needed) seed_urls (required, https://docs.example.com), allowed_hosts, max_depth (3), max_pages (500), respect_robots_txt, request_delay_ms (250) always public 0 3 * * *

text_multi config fields take a JSON array of strings. The catalog entry for each type (GET /catalog/{type}) carries the field schema, defaults, capabilities and the setup instructions (scopes to grant, where to create the app) that the Admin UI shows.

The credential object is {"credential_kind": …, "fields": {…}}. Its kind must equal the catalog entry’s credential_kind, otherwise 400. The sync runtime reads these field names:

Type fields the runtime reads Example
confluence, jira, google_drive access_token (or token) {"access_token": "eyJ…"} (OAuth token or Data Center personal access token)
slack bot_token (or access_token, token) {"bot_token": "xoxb-…"}
github installation_token (or access_token, token) {"token": "github_pat_…"}
notion token (or access_token) {"token": "ntn_…"}
sharepoint client_id, client_secret (with config tenant_id) {"client_id": "…", "client_secret": "…"}
web_crawler none {}

Credentials are encrypted at rest with ENCRYPTION_KEY and never returned: responses carry only credential_kind and credential_configured.

  1. Create the target collection and bind it to the groups that should retrieve the content (Collections & access). The connector writes into exactly one collection.

  2. Create the connector with collection_id set:

    Terminal window
    curl -s -X POST http://localhost:5050/v1/admin/kb-connectors \
    -H "Authorization: Bearer $ADMIN_JWT" -H "Content-Type: application/json" \
    -d '{
    "name": "eng-slack",
    "description": "Engineering channels",
    "connector_type": "slack",
    "collection_id": "01K8ZQ3V7M2T4N6P8R0S2U4W6Y",
    "config": {"channels": ["#engineering", "#incidents"], "include_threads": true, "lookback_days": 30},
    "schedule_cron": "0 */6 * * *",
    "enabled": true,
    "credential": {"credential_kind": "oauth", "fields": {"bot_token": "xoxb-1234-5678-abcd"}},
    "group_ids": ["group-01M61N36QYK1HVPN41KAE35PHP"]
    }'

    Response 201:

    {
    "id": "kbconn-01K8ZS6E2G4J6L8N0Q2S4U6W8Y",
    "tenant_id": "default",
    "name": "eng-slack",
    "description": "Engineering channels",
    "connector_type": "slack",
    "config": {"channels": ["#engineering", "#incidents"], "include_threads": true, "lookback_days": 30},
    "collection_id": "01K8ZQ3V7M2T4N6P8R0S2U4W6Y",
    "schedule_cron": "0 */6 * * *",
    "enabled": true,
    "auto_derive_from_oidc": false,
    "next_run_at": "2026-10-28T09:31:07.551203+00:00",
    "last_run_started_at": null,
    "last_run_finished_at": null,
    "last_run_status": null,
    "last_run_error": null,
    "latest_run": null,
    "credential_kind": "oauth",
    "credential_configured": true,
    "group_ids": ["group-01M61N36QYK1HVPN41KAE35PHP"],
    "groups": [{"id": "group-01M61N36QYK1HVPN41KAE35PHP", "name": "borealis-consumer-finance", "display_name": null, "parent_group_id": null, "is_active": true}],
    "created_at": "2026-10-28T09:31:07.551203+00:00",
    "updated_at": "2026-10-28T09:31:07.551203+00:00",
    "created_by": "admin",
    "updated_by": "admin"
    }

    An enabled connector with a schedule gets next_run_at = now, so the first run starts on the sync service’s next poll (every 15 seconds by default). Errors: 400 for a credential_kind that does not match the catalog, 400 for group IDs outside the tenant, 409 for a duplicate name, 422 for an unknown connector_type value.

  3. Trigger a run now (optional):

    Terminal window
    curl -s -X POST http://localhost:5050/v1/admin/kb-connectors/kbconn-01K8ZS6E2G4J6L8N0Q2S4U6W8Y/sync \
    -H "Authorization: Bearer $ADMIN_JWT"
    {"accepted": true, "run_log_id": "kbrun-01K8ZS8H4K6M8P0R2T4V6X8Z0B", "detail": null}

    400 when the connector is disabled (Connector is disabled; enable it before triggering a sync.) or has no stored credential (Credential not configured; cannot start sync.).

  4. Watch the run:

    Terminal window
    curl -s "http://localhost:5050/v1/admin/kb-connectors/kbconn-01K8ZS6E2G4J6L8N0Q2S4U6W8Y/runs?limit=5" \
    -H "Authorization: Bearer $ADMIN_JWT"
    {
    "runs": [
    {
    "id": "kbrun-01K8ZS8H4K6M8P0R2T4V6X8Z0B",
    "connector_id": "kbconn-01K8ZS6E2G4J6L8N0Q2S4U6W8Y",
    "started_at": "2026-10-28T09:32:00.104911+00:00",
    "finished_at": "2026-10-28T09:33:12.880412+00:00",
    "status": "success",
    "trigger": "manual",
    "docs_seen": 418,
    "docs_indexed": 418,
    "docs_failed": 0,
    "error_message": null
    }
    ],
    "total": 1
    }

    Run status is running, success, failure or cancelled; trigger is schedule, manual or initial. The emitted documents then appear in the collection’s document list and move to ready like uploads.

  • Upsert by source item. Each document is keyed {connector_id}::{source_doc_id}. A changed source item updates the same row and sets it back to pending, so it is re-chunked and re-embedded.
  • Incremental cursors are kept per connector: Confluence lastModified, Notion last_edited_time, Google Drive Changes API page token, Slack message ts, GitHub and Jira updated, SharePoint Graph delta links. The web crawler has no cursor; each run is a full crawl from the seeds, capped by max_pages.
  • Schedules are 5-field cron expressions evaluated in UTC. An expression that does not parse leaves next_run_at empty, so the connector only runs on manual sync.
  • Disable (PATCH {"enabled": false}) clears next_run_at; enabling a scheduled connector again primes it to run on the next poll.
  • Outbound policy. Config URLs are checked before any request. Link-local addresses (cloud metadata) are always refused; set BRUTOR_OUTBOUND_DENY_PRIVATE=true to refuse private ranges too, and list exceptions in BRUTOR_OUTBOUND_ALLOW_HOSTS.
  • Run time is capped by KB_CONNECTOR_SYNC_MAX_RUN_SECS (one hour by default).

POST …/test-connection only checks that a credential is stored ({"ok": true, "detail": "Credential present. Real probing is performed on the next sync run."}); the first sync run is the real test of the credential and scopes.

group_ids on a connector (and PUT …/groups) record which groups the connector is associated with; they appear in the group’s Knowledge Base tab and in policy-as-code exports. Retrieval access is decided by the target collection’s group bindings plus the source ACL, not by the connector’s own bindings. Bind the collection to the groups that should retrieve the content.

AI Estate → Resources → Knowledge Base → Connectors lists the configured connectors with status badges (Healthy, Failed, Syncing, Cancelled, Never run), Sync Now, Enable/Disable and Delete. Browse Catalog opens the Connector Catalog with the eight types and their setup instructions; importing one opens the edit form with tabs General (name, description, Schedule (cron), Enabled), Source Config, Credentials (with Test Connection), Access Control and Run History (Started, Status, Trigger, Seen, Indexed, Failed, Error). For Google Drive the form also offers the OIDC auto-derive option described in Source permissions.

The brutor-docs-crawler web crawler connector, Run History tab: two manual runs that succeeded (29 pages seen, 25 indexed, 0 failed) and an earlier run that failed with invalid ENCRYPTION_KEY.

Knowledge Base → Connectors → Connector Catalog: Confluence, Notion, Google Drive, Slack, GitHub, Web Crawler, Jira and SharePoint, each with its auth type and setup steps.

Variable Default Example Purpose
DATABASE_URL required postgresql://brutor:…@postgres:5432/ai_gateway Shared database
ENCRYPTION_KEY required same value as the Control Plane Decrypts connector credentials
DB_POOL_SIZE 8 16 Connection pool size
KB_CONNECTOR_SYNC_POLL_INTERVAL_SECS 15 30 How often due connectors are claimed
KB_CONNECTOR_SYNC_MAX_CONCURRENT 4 8 Connectors synced in parallel
KB_CONNECTOR_SYNC_MAX_RUN_SECS 3600 7200 Hard cap on one run
KB_CONNECTOR_SYNC_SHUTDOWN_GRACE_SECS 30 60 Time to finish runs on shutdown
KB_CONNECTOR_SYNC_LISTEN_ADDR 0.0.0.0:8200 0.0.0.0:8201 (compose) /health and /metrics
BRUTOR_OUTBOUND_DENY_PRIVATE false true Refuse loopback, RFC 1918, CGNAT and ULA destinations
BRUTOR_OUTBOUND_ALLOW_HOSTS unset confluence.internal,*.corp.example Hosts exempt from the address checks

GET /health answers {"status": "ok", "service": "brutor-kb-connector-sync"} (or "db_unreachable").