ドキュメントのインデックスタスク一覧を取得
アップロードと同期で作成された、ドキュメントのインデックスタスクを、それぞれの結果とともに古い順に一覧表示します。失敗したタスクとキャンセルされたタスクも含まれます。
最新のタスクは最後のページにあります。現在実行中のタスクを知るには、代わりに ドキュメントを取得 の latest_task を読み取ってください。
不明なドキュメント ID(ドキュメントファイル ID を含む)を指定すると、200 と空の data が返ります。1 ページのタスク数が limit 未満になることがあるため、next_cursor が null になるまでたどってください。
どの場面でどのタスク操作を使うかについては、インデックス処理の追跡 を参照してください。
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/logical-documents/{document_id}/processing-tasks \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/logical-documents/{document_id}/processing-tasks"
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}/logical-documents/{document_id}/processing-tasks', 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}/logical-documents/{document_id}/processing-tasks",
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}/logical-documents/{document_id}/processing-tasks"
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}/logical-documents/{document_id}/processing-tasks")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/logical-documents/{document_id}/processing-tasks")
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{
"data": [
{
"active_operations": [
"parse"
],
"completed_at": "2026-09-03T10:03:40Z",
"created_at": "2026-09-03T10:02:11Z",
"document_id": "2f6b8d1a-7c3e-4a5b-9d0e-1f2a3b4c5d6e",
"document_revision": 1,
"error_code": "DOCUMENT_COMPILATION_FAILED",
"error_message": "The document could not be processed. Try again, or contact an administrator with the error reference.",
"failure": {
"action": "contact_admin",
"category": "internal",
"code": "DOCUMENT_COMPILATION_FAILED",
"message": "Agent Knowledge Base could not complete the operation. Try again, or contact an administrator with the error reference.",
"parameters": null,
"retryPolicy": "manual",
"stage": "parsing",
"traceId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
},
"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"knowledge_space_id": "9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b",
"phase": "parsing",
"progress_percent": 0,
"retry_at": null,
"semantic_enrichment": {
"error_code": null,
"error_message": null,
"failure": null,
"nodes_completed": 0,
"nodes_total": null,
"provider_calls": null,
"provider_calls_maximum": null,
"state": "disabled",
"updated_at": null
},
"stage": "queued",
"state": "failed",
"updated_at": "2026-09-03T10:03:40Z"
},
{
"active_operations": [],
"completed_at": "2026-10-20T08:16:05Z",
"created_at": "2026-10-20T08:15:42Z",
"document_id": "2f6b8d1a-7c3e-4a5b-9d0e-1f2a3b4c5d6e",
"document_revision": 2,
"error_code": null,
"error_message": null,
"failure": null,
"id": "c4e8a2f6-1b3d-4e5f-8a9b-0c1d2e3f4a5b",
"knowledge_space_id": "9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b",
"phase": "complete",
"progress_percent": 100,
"retry_at": null,
"semantic_enrichment": {
"error_code": null,
"error_message": null,
"failure": null,
"nodes_completed": 18,
"nodes_total": 18,
"provider_calls": 12,
"provider_calls_maximum": 200,
"state": "ready",
"updated_at": "2026-10-20T08:17:30Z"
},
"stage": "published",
"state": "succeeded",
"updated_at": "2026-10-20T08:17:30Z"
}
],
"next_cursor": null
}Authorizations
すべてのリクエストは API キーで認証します:Authorization: Bearer {API_KEY}。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API キーを使用します(Dify API クイックスタート)。
キーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーが欠落または無効なリクエストは HTTP 401(unauthorized)で失敗します。
Path Parameters
ナレッジベース ID です。ナレッジベースの API アクセス ダイアログに表示されるサービス API エンドポイントの最後のセグメント(…/knowledge-fs/spaces/<knowledge base ID>)です。アドレスバーでは /datasets/new/ の後のセグメントです。
ドキュメント ID です。ドキュメント一覧を取得 から取得します。
Query Parameters
前のページの next_cursor から取得したカーソルです。
1 - 10001 ページあたりのタスク数です。
1 <= x <= 100Was this page helpful?
curl --request GET \
--url https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/logical-documents/{document_id}/processing-tasks \
--header 'Authorization: Bearer <token>'import requests
url = "https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/logical-documents/{document_id}/processing-tasks"
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}/logical-documents/{document_id}/processing-tasks', 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}/logical-documents/{document_id}/processing-tasks",
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}/logical-documents/{document_id}/processing-tasks"
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}/logical-documents/{document_id}/processing-tasks")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api_base_url}/knowledge-fs/spaces/{knowledge_base_id}/logical-documents/{document_id}/processing-tasks")
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{
"data": [
{
"active_operations": [
"parse"
],
"completed_at": "2026-09-03T10:03:40Z",
"created_at": "2026-09-03T10:02:11Z",
"document_id": "2f6b8d1a-7c3e-4a5b-9d0e-1f2a3b4c5d6e",
"document_revision": 1,
"error_code": "DOCUMENT_COMPILATION_FAILED",
"error_message": "The document could not be processed. Try again, or contact an administrator with the error reference.",
"failure": {
"action": "contact_admin",
"category": "internal",
"code": "DOCUMENT_COMPILATION_FAILED",
"message": "Agent Knowledge Base could not complete the operation. Try again, or contact an administrator with the error reference.",
"parameters": null,
"retryPolicy": "manual",
"stage": "parsing",
"traceId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
},
"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"knowledge_space_id": "9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b",
"phase": "parsing",
"progress_percent": 0,
"retry_at": null,
"semantic_enrichment": {
"error_code": null,
"error_message": null,
"failure": null,
"nodes_completed": 0,
"nodes_total": null,
"provider_calls": null,
"provider_calls_maximum": null,
"state": "disabled",
"updated_at": null
},
"stage": "queued",
"state": "failed",
"updated_at": "2026-09-03T10:03:40Z"
},
{
"active_operations": [],
"completed_at": "2026-10-20T08:16:05Z",
"created_at": "2026-10-20T08:15:42Z",
"document_id": "2f6b8d1a-7c3e-4a5b-9d0e-1f2a3b4c5d6e",
"document_revision": 2,
"error_code": null,
"error_message": null,
"failure": null,
"id": "c4e8a2f6-1b3d-4e5f-8a9b-0c1d2e3f4a5b",
"knowledge_space_id": "9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b",
"phase": "complete",
"progress_percent": 100,
"retry_at": null,
"semantic_enrichment": {
"error_code": null,
"error_message": null,
"failure": null,
"nodes_completed": 18,
"nodes_total": 18,
"provider_calls": 12,
"provider_calls_maximum": 200,
"state": "ready",
"updated_at": "2026-10-20T08:17:30Z"
},
"stage": "published",
"state": "succeeded",
"updated_at": "2026-10-20T08:17:30Z"
}
],
"next_cursor": null
}