Create Source
Adds a source that reads through an existing connection, found with List Source Connections. Nothing is crawled or imported.
Repeating a successful creation creates another source. Add a unique metadata.client_request_id and keep it until you receive the source ID.
To fill the source, call Preview Website Crawl or Import Website Pages for a web source, or Import Source Items for a connector source. For the steps, see Add a Source.
Authorization
Path parameters
…/knowledge-fs/spaces/<knowledge base ID>), and the segment after /datasets/new/ in the address bar.Body
application/jsonactive. From id of List Source Connections.Provider settings and your own non-sensitive metadata. Add a unique client_request_id to recognize this source if the creation response is lost. It is returned with the source, but the API does not enforce uniqueness or deduplicate requests.
Set providerKind to the connection's configuration.providerKind, and pick the source type that fits it. Settings that come from the connection may be absent from the source response.
If you build metadata from an existing source's response, leave out fields starting with __knowledgeFs, credentials, and the parameters object. credentialId, when present, refers to a credential Dify holds.
web for a website crawl, or connector for an online document or online drive provider (set metadata.providerKind). upload and object-storage are for sources Dify fills.connectorobject-storageuploadwebweb. connector://<connectionId> for connector, matching what Dify writes.Length: 1–4096
Responses
connectionId when binding another source to the same connection. null when unbound.true when the source holds a credential reference of its own. null when it holds none, as with sources bound to a connection.completed or zero_results) or completed import. Set by List Sources only. null elsewhere and when the source has never synced.parameters; connection-managed settings need not appear here. Credential-like keys are removed. Do not copy the entire object when creating another source.active, syncing, error, or disabled. Most operations return the stored value. List Sources derives it from the latest sync run:
failedorcanceledrun:errorcompletedorzero_resultsrun:active- Any live run:
syncing
disabled is never overridden.
null elsewhere and when no schedule exists. Read it on its own with Get Sync Policy and change it with Update Sync Policy.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.
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.
web sources. connector://<connection_id> for Dify-created connector sources.expectedVersion on Update Source, as expectedRevision on Delete Source, and as expectedSourceVersion on Update Sync Policy.