ソース
ソースのページ一覧を取得
オンラインドキュメントソースがプロバイダー側で参照できるページを、プロバイダーのワークスペースごとにまとめて一覧表示します。
ソースは、metadata.providerKind が online-document の connector ソースである必要があります。
GET
/
knowledge-fs
/
spaces
/
{knowledge_base_id}
/
sources
/
{source_id}
/
pages
ソースのページ一覧を取得
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/pages \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/pages"
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}/pages', 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}/pages",
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}/pages"
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}/pages")
.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}/pages")
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{
"next_cursor": null,
"workspaces": [
{
"pages": [
{
"has_children": null,
"last_edited_time": "2026-09-01T12:00:00.000Z",
"page_id": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"page_name": "Onboarding",
"parent_id": null,
"type": "page"
},
{
"has_children": null,
"last_edited_time": "2026-08-20T09:30:00.000Z",
"page_id": "5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e",
"page_name": "Runbooks",
"parent_id": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"type": "database"
}
],
"total": 2,
"workspace_id": "ws_01HZYQ8K3M",
"workspace_name": "Acme Wiki"
}
]
}Authorizations
すべてのリクエストは、Authorization: Bearer {API_KEY} ヘッダーに指定した API キーで認証します。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API キーを使用します(Dify API クイックスタート)。
キーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーがない、または無効な場合は HTTP 401(unauthorized)が返ります。
Query Parameters
tree を指定すると、ページツリーの 1 階層だけを返します。対象は最上位、または parentId の下のページです。省略するとフラットな一覧を返します。
公式のデータソースプラグインでツリー表示に対応しているのは GitHub だけで、プラグインのバージョン 0.4.12 以降が必要です。
リポジトリ内のファイルを取得するには、ツリー表示を使ってください。どちらの表示も、対象は最近更新された上位 20 個までのリポジトリです。リポジトリの下で取得できるページは、表示によって異なります。
- ツリー表示:各リポジトリの下に Contents、Issues(リポジトリで Issue が有効な場合)、Pull requests があります。Contents とその中のフォルダーには、フォルダーとインポートできるテキストファイルがあります。
- フラットな一覧:各リポジトリと、その README(ある場合)に加え、Issue とプルリクエストをそれぞれ最大 5 件含みます。
Available options:
tree Was this page helpful?
⌘I
ソースのページ一覧を取得
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/pages \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/pages"
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}/pages', 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}/pages",
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}/pages"
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}/pages")
.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}/pages")
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{
"next_cursor": null,
"workspaces": [
{
"pages": [
{
"has_children": null,
"last_edited_time": "2026-09-01T12:00:00.000Z",
"page_id": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"page_name": "Onboarding",
"parent_id": null,
"type": "page"
},
{
"has_children": null,
"last_edited_time": "2026-08-20T09:30:00.000Z",
"page_id": "5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e",
"page_name": "Runbooks",
"parent_id": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"type": "database"
}
],
"total": 2,
"workspace_id": "ws_01HZYQ8K3M",
"workspace_name": "Acme Wiki"
}
]
}