Knowledge Connectors
Create certified connectors and run bounded knowledge sync over HTTP.
Endpoints under /api/v1/knowledge-connectors. Every response uses the api-contracts.v1
envelope: success is { ok: true, data, meta: { contractVersion: "api-contracts.v1" } }; failure
is { ok: false, error: { code, message } }.
There is no durable Knowledge Sync dispatcher. POST .../runs queues the run and executes it in
the same request. A defer body field is rejected. See
Knowledge Connectors for credentials, filters, leases, and
degradation.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/knowledge-connectors | List connectors and advertised providers |
| POST | /api/v1/knowledge-connectors | Create a connector |
| GET | /api/v1/knowledge-connectors/{id} | Get one connector |
| PATCH | /api/v1/knowledge-connectors/{id} | Update name, config, or nextSyncAt |
| DELETE | /api/v1/knowledge-connectors/{id} | Delete a connector and its runs |
| GET | /api/v1/knowledge-connectors/{id}/runs | List sync runs |
| POST | /api/v1/knowledge-connectors/{id}/runs | Queue and execute a sync |
| GET | /api/v1/knowledge-connectors/{id}/runs/{runId} | Get one run |
| POST | /api/v1/knowledge-connectors/{id}/runs/{runId}/cancel | Cancel a queued or running run |
POST, PATCH, and DELETE require header Idempotency-Key. Missing or invalid key: 400
idempotency_key_invalid.
List connectors
GET /api/v1/knowledge-connectors
| Query | Notes |
|---|---|
knowledgeBaseId | Optional. Restricts the page to one knowledge base in this workspace. |
cursor | Optional. Previous page's last connector id. Invalid cursor: 400. |
limit | Optional. Default 50, integer 1–100. |
data:
| Field | Notes |
|---|---|
connectors | Serialized connectors. Dates are ISO-8601. |
nextCursor | Last item id when another page exists; otherwise null. |
providers | From the process registry: { id, label, scopes, certified, capabilities }. |
The process default registry certifies drive, confluence, slack, and github. Those four
advertise capabilities: ["knowledge.sync"] and certified: true. An uncertified provider can
still appear on a stored connector, but capabilities is empty and a run cannot be queued.
Allowlisted providerId values only: drive, confluence, slack, github.
Create a connector
POST /api/v1/knowledge-connectors — 201 { connector }.
| Field | Type | Notes |
|---|---|---|
knowledgeBaseId | string | Required. Must exist in this workspace and not be trashed. |
providerId | string | Required. One of the four allowlisted ids. notion (or any other) is 400. |
name | string | Required, non-empty after trim. Unique per knowledge base. |
config | object | Optional object. Must include credentialId (non-empty string). |
Provider-specific filters (fileIds, spaceIds, channelIds, repositories) are validated at
fetch time, not at create. Duplicate name: 409 conflict. Missing knowledge base: 404.
Get, update, delete
GET /api/v1/knowledge-connectors/{id} — { connector }.
PATCH /api/v1/knowledge-connectors/{id} — { connector }.
| Field | Type | Notes |
|---|---|---|
name | string | Optional. Cannot be empty after trim. |
config | object | Optional. If present, must include credentialId. |
nextSyncAt | string or null | Optional ISO date, or null to clear. Stored only; no scheduler reads it. |
DELETE /api/v1/knowledge-connectors/{id} — { deleted: true, connectorId }. Removes the
connector. Sync runs cascade-delete. On the Prisma store, documents keep their rows and
connectorId is set to null (onDelete: SetNull). The in-memory store also deletes those
documents.
Connector object
| Field | Values / type |
|---|---|
id | string |
workspaceId | string (from the API key) |
knowledgeBaseId | string |
providerId | drive | confluence | slack | github |
name | string |
status | idle | syncing | succeeded | failed |
config | object (includes credentialId plus provider filters) |
cursor | opaque JSON or null |
lastSyncedAt | ISO string or null |
nextSyncAt | ISO string or null |
lastError | string or null |
createdAt | ISO string |
updatedAt | ISO string |
Lease fields (syncLeaseRunId, syncLeaseToken, syncLeaseExpiresAt) are not serialized.
List and get runs
GET /api/v1/knowledge-connectors/{id}/runs — { runs, nextCursor }. Same cursor / limit
rules as connector list. Unknown connector: 404.
GET /api/v1/knowledge-connectors/{id}/runs/{runId} — { run }.
Queue and execute a run
POST /api/v1/knowledge-connectors/{id}/runs — 201 { run } when execute completes.
Body must be an object whose only allowed key is options. records, cursor, defer, or any
other key: 400 validation_failed (Only bounded sync options are accepted.).
{ "options": { "maxPages": 4, "maxItems": 200 } }
options | Default | Bounds |
|---|---|---|
maxPages | 20 | 1–50 |
maxItems | 1000 | 1–5000 |
maxBytes | 25165824 | 1024–52428800 |
timeoutMs | 60000 | 1000–120000 |
Unsupported option keys, non-numbers, or out-of-range values: 400.
The same request calls queueRun then executeRun. A successful HTTP response means the batch
was applied. If execute fails, the handler returns an error envelope (not 201 with a failed
run). The persisted run is still failed (or remains queued if start never claimed the lease).
Inspect it with GET .../runs/{runId}.
Uncertified provider: 409 conflict (Provider {id} has not passed certification.). Missing
or incompatible credential: 409 setup_required (retryable: false, details.availability
from the capability error). Concurrent execute on the same connector: 409 conflict
(Knowledge sync run is not queued.). The second run stays queued for a later retry.
Replay the same Idempotency-Key with the same options to retry a failed or cancelled run
(retryTerminal) or to return a succeeded run without a second apply. Same key, different
options: 409. Stable run id: ksr_ plus the first 40 hex characters of
sha256(workspaceId + NUL + connectorId + NUL + key).
Agents use the preview capability knowledge.sync with the same queue-then-execute path.
Required input: connectorId. Optional: maxPages, maxItems, maxBytes, timeoutMs.
Confirmation and idempotency are required.
Cancel a run
POST /api/v1/knowledge-connectors/{id}/runs/{runId}/cancel — { run } with
status: "cancelled".
Cancels queued or running. A second cancel, or cancel of succeeded / failed /
cancelled: 409 (Cannot cancel a {status} knowledge sync run.). A cancelled run cannot be
started (409 Knowledge sync run is not queued.).
Run object
| Field | Values / type |
|---|---|
id | string |
workspaceId | string |
connectorId | string |
status | queued | running | succeeded | failed | cancelled |
cursorBefore | opaque JSON or null |
cursorAfter | opaque JSON or null |
fullSnapshot | boolean (built-in providers emit false) |
upsertedCount | integer (applied upserts) |
tombstonedCount | integer (explicit tombstones in the batch) |
error | string or null |
startedAt | ISO string or null |
finishedAt | ISO string or null |
createdAt | ISO string |
updatedAt | ISO string |
requestFingerprint, leaseToken, and leaseExpiresAt are not serialized.
Error map
| HTTP | error.code | Typical cause |
|---|---|---|
| 400 | idempotency_key_invalid | Missing or invalid Idempotency-Key on a mutation |
| 400 | validation_failed | Bad body, unknown providerId, option bounds, invalid list cursor, TypeError |
| 401 | authentication_required | Missing or invalid bearer |
| 403 | authorization_failed | Non-workspace API key |
| 404 | resource_not_found | Connector, run, or knowledge base not in this workspace |
| 409 | conflict | Duplicate name, uncertified provider, lease/idempotency clash, cancel denied |
| 409 | setup_required | Credential missing, wrong scope/workspace, incompatible type, missing scopes |
| 500 | internal_error | Unclassified provider or persist failure (run is marked failed when leased) |
