Skip to main content
patch/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}
Request example
Response
patch/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}

Authorization

Authorizationstringheaderrequired#

Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).

Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).

Path parameters

knowledge_base_idstringrequired#
Knowledge base ID: the last segment of the Service API endpoint shown in the knowledge base's API Access dialog (…/knowledge-fs/spaces/<knowledge base ID>), and the segment after /datasets/new/ in the address bar.
source_idstringrequired#
Source ID. From List Sources.

Body

application/json

Responses

application/json
The updated source.
connection_idstring#
Connection the source uses for credentials. Pass it as connectionId when binding another source to the same connection. null when unbound.
created_atstring#
Creation time, ISO 8601.
credential_configuredboolean#
true when the source holds a credential reference of its own. null when it holds none, as with sources bound to a connection.
idstring#
Source ID.
knowledge_space_idstring#
Internal ID of the knowledge base. Not the knowledge base ID in the path.
last_synced_atstring#
Completion time of the latest completed sync (completed or zero_results) or completed import. Set by List Sources only. null elsewhere and when the source has never synced.
metadataobject#
Provider settings and server-managed sync or page-selection data. May include provider identifiers and parameters; connection-managed settings need not appear here. Credential-like keys are removed. Do not copy the entire object when creating another source.
namestring#
Display name.
permission_scopestring[]#
Content scopes required to read this source. An empty list adds no content restriction within the knowledge base. Knowledge base authorization still applies.
statusstring#

active, syncing, error, or disabled. Most operations return the stored value. List Sources derives it from the latest sync run:

  • failed or canceled run: error
  • completed or zero_results run: active
  • Any live run: syncing

disabled is never overridden.

sync_policyobject#
The source's sync schedule. Set by List Sources only. null elsewhere and when no schedule exists. Read it on its own with Get Sync Policy and change it with Update Sync Policy.
sync_workflowobject#

The source's active sync or import run (crawl-import, online-document-import, or online-drive-import), or else its latest sync run. List Sources sets it when a run is active or newer than the source. Update Source sets it when the call started a sync. null otherwise. Crawl previews and imports from them never appear here.

To follow one run, call Get Source Run with its id.

typestring#

web (website crawl), connector (online document or online drive), upload, or object-storage.

For a connector source, metadata.providerKind is online-document or online-drive. For a web source it is website.

Dify fills upload and object-storage sources.

updated_atstring#
Last change, ISO 8601.
uristring#
Crawl root URL for web sources. connector://<connection_id> for Dify-created connector sources.
versioninteger#
Source version, increased on every write. Send it as expectedVersion on Update Source, as expectedRevision on Delete Source, and as expectedSourceVersion on Update Sync Policy.