ソースを取得
保存されている状態のソースを 1 件返します。
ここでは last_synced_at、sync_policy、sync_workflow は常に null です。スケジュールは 同期ポリシーを取得 で読み取ってください。実行は ソースの実行を取得 または ソースの実行一覧を取得 で追跡し、last_synced_at は ソース一覧を取得 から読み取ります。「ソース一覧を取得」の結果を、このレスポンスで上書きしないでください。
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"connection_id": "c3d4e5f6-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
"created_at": "2026-09-01T08:00:00Z",
"credential_configured": null,
"id": "6f1c2b0e-3d0b-4a5e-9f4c-1c0e6a7b8d90",
"knowledge_space_id": "0a9d3c2e-5b6f-4e1a-8c7d-2f3e4a5b6c7d",
"last_synced_at": null,
"metadata": {
"client_request_id": "source-20260907-0001",
"providerKind": "website",
"tenantId": "2f1e0d9c-8b7a-4695-8473-2a1b0c9d8e7f"
},
"name": "Docs site",
"permission_scope": [],
"status": "active",
"sync_policy": null,
"sync_workflow": null,
"type": "web",
"updated_at": "2026-09-05T10:12:00Z",
"uri": "https://docs.example.com",
"version": 7
}Authorizations
すべてのリクエストは、Authorization: Bearer {API_KEY} ヘッダーに指定した API キーで認証します。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API キーを使用します(Dify API クイックスタート)。
キーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーがない、または無効な場合は HTTP 401(unauthorized)が返ります。
Path Parameters
ナレッジベース ID です。ナレッジベースの API アクセス ダイアログに表示されるサービス API エンドポイントの最後のセグメント(…/knowledge-fs/spaces/<knowledge base ID>)です。アドレスバーでは /datasets/new/ の後のセグメントです。
Response
ソースです。
ソースが認証情報の取得に使用する接続です。別のソースを同じ接続に紐付ける場合は、connectionId として渡します。紐付けられていない場合は null です。
作成日時(ISO 8601)です。
ソースが独自の認証情報の参照を保持している場合は true です。接続に紐付けられたソースのように参照を保持していない場合は null です。
ソース ID です。
ナレッジベースの内部 ID です。パスのナレッジベース ID とは異なります。
プロバイダーの設定と、サーバーが管理する同期データまたはページ選択データです。プロバイダーの識別子や parameters が含まれる場合があります。接続側で管理される設定は、ここに含まれるとは限りません。認証情報に類するキーは除去されます。別のソースを作成する際に、このオブジェクト全体をコピーしないでください。
表示名です。
このソースを読み取るために必要なコンテンツのアクセス範囲です。空のリストの場合、ナレッジベース内でのコンテンツの制限は追加されません。ナレッジベースの認可は引き続き適用されます。
web(ウェブサイトのクロール)、connector(オンラインドキュメントまたはオンラインドライブ)、upload、object-storage のいずれかです。
connector ソースでは、metadata.providerKind は online-document または online-drive です。web ソースでは website です。
upload と object-storage のソースには、Dify が内容を追加します。
最終更新日時(ISO 8601)です。
web ソースでは、クロールのルート URL です。Dify で作成されたコネクタソースでは connector://<connection_id> です。
Was this page helpful?
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"connection_id": "c3d4e5f6-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
"created_at": "2026-09-01T08:00:00Z",
"credential_configured": null,
"id": "6f1c2b0e-3d0b-4a5e-9f4c-1c0e6a7b8d90",
"knowledge_space_id": "0a9d3c2e-5b6f-4e1a-8c7d-2f3e4a5b6c7d",
"last_synced_at": null,
"metadata": {
"client_request_id": "source-20260907-0001",
"providerKind": "website",
"tenantId": "2f1e0d9c-8b7a-4695-8473-2a1b0c9d8e7f"
},
"name": "Docs site",
"permission_scope": [],
"status": "active",
"sync_policy": null,
"sync_workflow": null,
"type": "web",
"updated_at": "2026-09-05T10:12:00Z",
"uri": "https://docs.example.com",
"version": 7
}