{ "openapi": "3.0.1", "info": { "title": "Dify サービス API", "description": "Dify アプリケーションとナレッジベースのための REST API です。アプリケーション系エンドポイントはアプリの API キーで、ナレッジ系エンドポイントはナレッジベースの API キーで認証します。", "version": "1.0.0" }, "servers": [ { "url": "https://{api_base_url}", "description": "Dify サービス API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。", "variables": { "api_base_url": { "default": "api.dify.ai/v1", "description": "API ベース URL のホストとパス(`https://` を除く)。" } } } ], "security": [ { "ApiKeyAuth": [] } ], "tags": [ { "name": "チャットメッセージ", "description": "チャットメッセージとインタラクションに関連する操作です。" }, { "name": "ファイル操作", "description": "ファイルのアップロードとプレビューの操作です。" }, { "name": "エンドユーザー", "description": "エンドユーザー情報に関連する操作です。" }, { "name": "メッセージフィードバック", "description": "ユーザーフィードバックの操作です。" }, { "name": "会話管理", "description": "会話管理に関連する操作です。" }, { "name": "音声・テキスト変換", "description": "テキスト読み上げと音声認識の操作です。" }, { "name": "アプリケーション設定", "description": "アプリケーション設定と情報を取得する操作です。" }, { "name": "アノテーション管理", "description": "ダイレクト返信用のアノテーション管理に関連する操作です。" }, { "name": "人間の入力", "description": "人間の入力を要する一時停止中のワークフローの再開操作です。" }, { "name": "ワークフロー実行", "description": "ワークフローの実行と管理のための操作です。" }, { "name": "完了メッセージ", "description": "テキスト生成に関連する操作です。" }, { "name": "ナレッジベース", "description": "ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。" }, { "name": "ドキュメント", "description": "ナレッジベース内のドキュメントの作成、更新、管理のための操作です。" }, { "name": "チャンク", "description": "ドキュメントチャンクと子チャンクの管理のための操作です。" }, { "name": "メタデータ", "description": "ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。" }, { "name": "タグ管理", "description": "ナレッジベースタグとタグバインディングの管理のための操作です。" }, { "name": "モデル", "description": "利用可能なモデルを取得するための操作です。" }, { "name": "ナレッジパイプライン", "description": "データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。" } ], "paths": { "/chat-messages": { "post": { "summary": "チャットメッセージを送信", "description": "**対象アプリ**:Chatflow、新しい Agent、チャットボット、Agent。\n\nチャットアプリにメッセージを送信し、アシスタントの応答を返します。ストリーミングレスポンスのイベントはアプリタイプによって異なります。", "operationId": "sendBasicChatMessageJa", "tags": [ "チャットメッセージ" ], "requestBody": { "description": "チャットメッセージを送信するためのリクエストボディ。", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatRequest" }, "examples": { "streaming_example": { "summary": "リクエスト例 - ストリーミングモード", "value": { "inputs": { "city": "San Francisco" }, "query": "What are the specs of the iPhone 13 Pro Max?", "response_mode": "streaming", "conversation_id": "", "user": "abc-123", "files": [ { "type": "image", "transfer_method": "remote_url", "url": "https://cloud.dify.ai/logo/logo-site.png" } ] } }, "blocking_example": { "summary": "リクエスト例 - ブロッキングモード", "value": { "inputs": {}, "query": "What are the specs of the iPhone 13 Pro Max?", "response_mode": "blocking", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "user": "abc-123" } } } } } }, "responses": { "200": { "description": "リクエスト成功。コンテンツタイプと構造はリクエストの `response_mode` パラメータに依存します。\n\n- `response_mode` が `blocking` の場合、 `application/json` で `ChatCompletionResponse` オブジェクトを返します。\n- `response_mode` が `streaming` の場合、`text/event-stream` でサーバー送信イベントのストリームを返します。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatCompletionResponse" }, "examples": { "blockingResponse": { "summary": "レスポンス例 - ブロッキングモード", "value": { "event": "message", "task_id": "c3800678-a077-43df-a102-53f23ed20b88", "id": "b01a39de-3480-4f3e-9f1e-4841a80f8e5e", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "mode": "chat", "answer": "iPhone 13 Pro Max specs are listed here:...", "metadata": { "usage": { "prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 128, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002560", "total_tokens": 1161, "total_price": "0.0012890", "currency": "USD", "latency": 0.7682376249867957 }, "retriever_resources": [ { "position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\" \"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\"" } ] }, "created_at": 1705407629 } } } }, "text/event-stream": { "schema": { "type": "string", "description": "サーバー送信イベント (SSE) のストリームです。解析は [ストリーミングレスポンスの処理](/ja/api-reference/guides/streaming) に従ってください:`data:` 行を読み取り、`event` フィールドで振り分け、`ping`(10 秒ごとのキープアライブ)は無視します。\n\n**アプリタイプ別のイベント**(応答イベントと、ストリームの終了方法):\n\n- **チャットボット**:`message` チャンク(順番に連結)→ `message_end`。\n- **Agent**:`agent_thought`(推論とツール呼び出しのステップ)と `agent_message` チャンクが並行 → `message_end`。\n- **新しい Agent**:`agent_message` チャンクと `agent_thought` ステップが並行 → 完全な回答を含む終了 `message` が 1 つ(追加するテキストではなく最終回答として扱う)→ `message_end`。その `message_end` の metadata には `usage`(アノテーション一致時は `annotation_reply` も)が含まれ、`retriever_resources` は含まれません。\n- **Chatflow**:`workflow_started` → ノードイベント(`node_started`、`node_finished`、およびイテレーションとループの各バリアント)と `message` チャンクが並行 → その後、結果に応じて:\n - **成功**:`message_end`、続いて `workflow_finished`\n - **失敗**:ステータスが `failed` の `workflow_finished`、続いて `error`。`message_end` はありません\n - **一時停止**:`human_input_required`、続いて `workflow_paused`(ストリームはここで終了し、実行は別途再開されます)\n\n**アドオン**:\n\n- テキスト読み上げの自動再生:`tts_message` の音声チャンクが間に挟まり、`tts_message_end` が終了イベントの後に続きます。\n- `reasoning_format: separated` を使う Chatflow の LLM ノードは、モデルの推論を伝える `reasoning_chunk` デルタも発行します。\n\n**共通フィールド**:`ping` を除き、すべてのイベントには `conversation_id`、`message_id`、`created_at`(Unix エポック秒)が含まれます。`error` を除くイベントには `task_id` も含まれます。ワークフロー、ノード、人間の入力イベント(Chatflow アプリ)は、ペイロードを `data` の下にネストし、`agent_log` を除いてトップレベルの `workflow_run_id` を持ちます。\n\n**応答イベント**\n\n| イベント | アプリ | 発生タイミング | 主なフィールド |\n|:---|:---|:---|:---|\n| `message` | チャットボット、Chatflow、新しい Agent | 回答の各チャンク(順番に連結)。新しい Agent では、完全な回答を含む最後の 1 チャンク | `answer` |\n| `agent_message` | Agent、新しい Agent | 回答の各チャンク(順番に連結) | `answer` |\n| `agent_thought` | Agent、新しい Agent | 推論またはツール呼び出しの各ステップ | `position`、`thought`、`tool`、`tool_input`(JSON)、`observation`、`message_files` |\n| `message_replace` | すべて | 出力モデレーションがそれまでの回答を置き換える | `answer`。Chatflow では `reason` も含む |\n| `reasoning_chunk` | Chatflow | 推論内容の各デルタ(LLM ノードが `reasoning_format: separated` を使用する場合)。順番に連結してください。`is_final: true` の最終イベントは推論の完了を示し、空の `reasoning` を伴う場合があります | `data.message_id`、`data.reasoning`、`data.node_id`、`data.is_final` |\n| `message_file` | チャットボット、Agent | アシスタントがファイルを返す | `type`、`belongs_to`、`url` |\n| `message_end` | すべて | 回答が完了 | `metadata`(`usage`、`retriever_resources`) |\n| `tts_message`、`tts_message_end` | チャットボット、Agent、Chatflow | 音声チャンク/終了(TTS 自動再生が有効な場合) | `audio` |\n\n**ワークフロー・ノードイベント**(Chatflow アプリのみ)\n\n各イベントはペイロードを `data` オブジェクトの下にネストします。\n\n| イベント | 発生タイミング | 主な `data` フィールド |\n|:---|:---|:---|\n| `workflow_started` | 実行開始 | `inputs` |\n| `node_started` | ノード開始 | `node_id`、`node_type`、`title` |\n| `node_finished` | ノード終了 | `status`、`outputs`、`execution_metadata` |\n| `node_retry` | 失敗後にノードを再試行 | `retry_index` |\n| `iteration_started`、`iteration_next`、`iteration_completed` | イテレーションノードの進行(情報提供のみ、処理は任意) | `data` |\n| `loop_started`、`loop_next`、`loop_completed` | ループノードの進行(情報提供のみ、処理は任意) | `data` |\n| `agent_log` | Agent ノードのステップログ(情報提供のみ、処理は任意、`workflow_run_id` なし) | `data` |\n| `workflow_finished` | 実行終了 | `status`(`succeeded`、`failed`、`partial-succeeded`、`stopped`)、`outputs`、`total_tokens` |\n| `workflow_paused` | 実行が一時停止 | `paused_nodes`、`reasons` |\n| `human_input_required` | 実行が人間の入力ノードに到達 | `form_token`、`form_content`、`expiration_time` |\n\n一時停止後、このストリームは `workflow_paused` で終了します。[人間の入力フォームを送信](/ja/api-reference/human-input/submit-human-input-form) でフォームを送信するか、タイムアウトさせてください。再開後の実行(`human_input_form_filled`/`human_input_form_timeout` から `workflow_finished` までを含む)は、[ワークフローイベントをストリーム](/ja/api-reference/workflow-runs/stream-workflow-events) からストリーミングされます。\n\n**トランスポートイベント**\n\n| イベント | 発生タイミング | 主なフィールド |\n|:---|:---|:---|\n| `error` | 失敗によりストリームが終了。HTTP は `200` のまま | `status`(例:`400`)、`code`(例:`invalid_param`)、`message` |\n| `ping` | 10 秒ごとのキープアライブ | なし |" }, "examples": { "streamingResponseBasic": { "summary": "Response Example - Streaming (Basic)", "value": "data: {\"event\": \"message\", \"task_id\": \"mock_task_id\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"conversation_id\": \"45701982-8118-4bc5-8e9b-64562b4555f2\", \"answer\": \" I\", \"created_at\": 1679586595} data: {\"event\": \"message_end\", \"task_id\": \"mock_task_id\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"conversation_id\": \"45701982-8118-4bc5-8e9b-64562b4555f2\", \"created_at\": 1679586595, \"metadata\": {\"usage\": {\"total_tokens\": 10, \"latency\": 1.0}}}" }, "streamingResponseAgent": { "summary": "Response Example - Streaming (Agent)", "value": "data: {\"event\": \"agent_thought\", \"id\": \"agent_thought_id_1\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"position\": 1, \"thought\": \"Thinking about calling a tool...\", \"tool\": \"dalle3\", \"tool_input\": \"{\\\"dalle3\\\": {\\\"prompt\\\": \\\"a cute cat\\\"}}\", \"created_at\": 1705395332} data: {\"event\": \"message_file\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"id\": \"file_id_1\", \"type\": \"image\", \"belongs_to\": \"assistant\", \"url\": \"https://example.com/cat.png\", \"created_at\": 1705395332} data: {\"event\": \"agent_message\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"answer\": \"Here is the image: \", \"created_at\": 1705395333} data: {\"event\": \"message_end\", \"task_id\":\"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"metadata\": {\"usage\": {\"total_tokens\": 50, \"latency\": 2.5}}}" }, "streamingResponseWorkflow": { "summary": "Response Example - Streaming (Workflow)", "value": "data: {\"event\": \"workflow_started\", \"task_id\": \"task123\", \"workflow_run_id\": \"wfr_abc123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"created_at\": 1705395332, \"data\": {\"id\": \"wfr_abc123\", \"workflow_id\": \"wf_def456\", \"inputs\": {\"city\": \"San Francisco\"}, \"created_at\": 1705395332}} data: {\"event\": \"node_started\", \"task_id\": \"task123\", \"workflow_run_id\": \"wfr_abc123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"created_at\": 1705395332, \"data\": {\"id\": \"ne_001\", \"node_id\": \"node_llm_1\", \"node_type\": \"llm\", \"title\": \"LLM\", \"index\": 1, \"created_at\": 1705395332}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"created_at\": 1705395333, \"data\": {\"message_id\": \"msg123\", \"reasoning\": \"The user greeted me, so\", \"node_id\": \"node_llm_1\", \"is_final\": false}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"created_at\": 1705395333, \"data\": {\"message_id\": \"msg123\", \"reasoning\": \"\", \"node_id\": \"node_llm_1\", \"is_final\": true}} data: {\"event\": \"message\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"answer\": \" I\", \"created_at\": 1705395333} data: {\"event\": \"node_finished\", \"task_id\": \"task123\", \"workflow_run_id\": \"wfr_abc123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"created_at\": 1705395334, \"data\": {\"id\": \"ne_001\", \"node_id\": \"node_llm_1\", \"node_type\": \"llm\", \"title\": \"LLM\", \"index\": 1, \"status\": \"succeeded\", \"elapsed_time\": 1.5, \"created_at\": 1705395332, \"finished_at\": 1705395334}} data: {\"event\": \"message_end\", \"task_id\": \"task123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"created_at\": 1705395334, \"metadata\": {\"usage\": {\"total_tokens\": 50, \"latency\": 2.5}}} data: {\"event\": \"workflow_finished\", \"task_id\": \"task123\", \"workflow_run_id\": \"wfr_abc123\", \"message_id\": \"msg123\", \"conversation_id\": \"conv123\", \"created_at\": 1705395335, \"data\": {\"id\": \"wfr_abc123\", \"workflow_id\": \"wf_def456\", \"status\": \"succeeded\", \"elapsed_time\": 2.5, \"total_tokens\": 50, \"total_steps\": 2, \"created_at\": 1705395332, \"finished_at\": 1705395335}}" }, "humanInputPause": { "summary": "レスポンス例 - 人間の入力での一時停止", "value": "data: {\"event\": \"workflow_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407629, \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"inputs\": {\"draft\": \"Hello\"}, \"created_at\": 1705407629, \"reason\": \"initial\"}} data: {\"event\": \"human_input_required\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407629, \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"form_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\", \"form_token\": \"tok_abc123\", \"node_id\": \"approval_node\", \"node_title\": \"Approval\", \"form_content\": \"ドラフトを確認してください。\", \"inputs\": [{\"type\": \"paragraph\", \"output_variable_name\": \"comment\", \"default\": null}], \"actions\": [{\"id\": \"approve\", \"title\": \"承認\", \"button_style\": \"primary\"}], \"display_in_ui\": false, \"resolved_default_values\": {\"comment\": \"\"}, \"expiration_time\": 1705494029}} data: {\"event\": \"workflow_paused\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407629, \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"paused_nodes\": [\"approval_node\"], \"outputs\": {}, \"reasons\": [{\"TYPE\": \"human_input_required\", \"form_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\", \"form_content\": \"ドラフトを確認してください。\", \"inputs\": [{\"type\": \"paragraph\", \"output_variable_name\": \"comment\", \"default\": null}], \"actions\": [{\"id\": \"approve\", \"title\": \"承認\", \"button_style\": \"primary\"}], \"node_id\": \"approval_node\", \"node_title\": \"Approval\", \"resolved_default_values\": {\"comment\": \"\"}, \"form_token\": \"tok_abc123\", \"expiration_time\": 1705494029}], \"status\": \"paused\", \"created_at\": 1705407629, \"elapsed_time\": 0.5, \"total_tokens\": 0, \"total_steps\": 1}}" } } } } }, "400": { "description": "- `app_unavailable` : アプリケーションが利用できないか、設定が正しくありません。\n- `not_chat_app` : App mode does not match the API route.\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。\n- `provider_quota_exceeded` : モデルプロバイダーのクォータが使い切られました。\n- `model_currently_not_support` : 現在のモデルは利用できません。\n- `completion_request_error` : テキスト生成に失敗しました。\n- `bad_request` : Cannot use draft workflow version.\n- `bad_request` : Invalid `workflow_id` format.\n- `bad_request` : 新しい Agent アプリで `blocking` レスポンスモードが指定されました。\n- `invalid_param` : 新しい Agent アプリに Agent がバインドされていません。\n- `agent_not_published` : バインドされた Agent が公開されていません。(新しい Agent アプリ)\n- `conversation_completed` : 会話は終了しています。`conversation_id` を省略して新しい会話を開始してください。", "content": { "application/json": { "examples": { "app_unavailable": { "summary": "app_unavailable", "value": { "status": 400, "code": "app_unavailable", "message": "App unavailable, please check your app configurations." } }, "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "provider_quota_exceeded": { "summary": "provider_quota_exceeded", "value": { "status": 400, "code": "provider_quota_exceeded", "message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials." } }, "model_currently_not_support": { "summary": "model_currently_not_support", "value": { "status": 400, "code": "model_currently_not_support", "message": "Dify Hosted OpenAI trial currently not support the GPT-4 model." } }, "completion_request_error": { "summary": "completion_request_error", "value": { "status": 400, "code": "completion_request_error", "message": "Completion request failed." } }, "is_draft_workflow": { "summary": "bad_request", "value": { "status": 400, "code": "bad_request", "message": "Cannot use draft workflow version. Workflow ID: a1b2c3d4-5678-90ab-cdef-1234567890ab. " } }, "workflow_id_format_error": { "summary": "bad_request", "value": { "status": 400, "code": "bad_request", "message": "Invalid workflow_id format: 'not-a-valid-id'. " } }, "new_agent_streaming_only": { "summary": "bad_request", "value": { "code": "bad_request", "message": "Agent App only supports streaming response mode.", "status": 400 } }, "new_agent_not_bound": { "summary": "invalid_param", "value": { "code": "invalid_param", "message": "Agent App has no bound Agent", "status": 400 } }, "new_agent_not_published": { "summary": "agent_not_published", "value": { "code": "agent_not_published", "message": "Agent has not been published. Please publish the Agent before using the API.", "status": 400 } }, "conversation_completed": { "summary": "conversation_completed", "value": { "status": 400, "code": "conversation_completed", "message": "The conversation has ended. Please start a new conversation." } } } } } }, "403": { "description": "`workflow_version_execution_not_allowed` : Dify Cloud の Sandbox プランで、Chatflow リクエストが `workflow_id` によりワークフローバージョンを指定しました。", "content": { "application/json": { "examples": { "workflow_version_execution_not_allowed": { "summary": "workflow_version_execution_not_allowed", "value": { "status": 403, "code": "workflow_version_execution_not_allowed", "message": "Workflow version execution is not available on your current plan. Please upgrade to a paid plan." } } } } } }, "404": { "description": "- `not_found` : 会話が存在しません。\n- `not_found` : 指定された `workflow_id` のワークフローが見つかりません。", "content": { "application/json": { "examples": { "conversation_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Conversation Not Exists." } }, "workflow_not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Workflow not found with id: a1b2c3d4-5678-90ab-cdef-1234567890ab" } } } } } }, "429": { "description": "- `too_many_requests` : このアプリケーションへの同時リクエストが多すぎます。\n- `rate_limit_error` : ワークスペースの Dify Cloud のワークフロー実行クォータを使い切りました。", "content": { "application/json": { "examples": { "too_many_requests": { "summary": "too_many_requests", "value": { "status": 429, "code": "too_many_requests", "message": "Too many requests. Please try again later." } }, "rate_limit_error": { "summary": "rate_limit_error", "value": { "status": 429, "code": "rate_limit_error", "message": "Rate Limit Error" } } } } } }, "500": { "description": "`internal_server_error` : 内部サーバーエラー。", "content": { "application/json": { "examples": { "internal_server_error": { "summary": "internal_server_error", "value": { "status": 500, "code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chat-messages/send-chat-message", "metadata": { "title": "チャットメッセージを送信", "sidebarTitle": "チャットメッセージを送信" } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request POST \\\n --url 'https://{api_base_url}/chat-messages' \\\n --header 'Authorization: Bearer {api_key}' \\\n --header 'Content-Type: application/json' \\\n --no-buffer \\\n --data '{\"query\": \"What are the specs of the iPhone 13 Pro Max?\", \"inputs\": {}, \"response_mode\": \"streaming\", \"user\": \"{user}\"}'" } ] } }, "/chat-messages/{task_id}/stop": { "post": { "summary": "生成を停止", "description": "**対象アプリ**:Chatflow、新しい Agent、チャットボット、Agent。\n\nチャットメッセージ生成タスクを停止します。`streaming` モードでのみサポートされます。", "operationId": "stopBasicChatMessageGenerationJa", "tags": [ "チャットメッセージ" ], "parameters": [ { "name": "task_id", "in": "path", "required": true, "description": "タスク ID です。[チャットメッセージを送信](/ja/api-reference/chat-messages/send-chat-message) のストリーミングイベントから取得します。", "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "user" ], "properties": { "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。元のメッセージ送信時に渡した `user` と一致する必要があります。一致しない場合、停止は行われず、成功が返されます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } }, "examples": { "example": { "summary": "リクエスト例", "value": { "user": "abc-123" } } } } } }, "responses": { "200": { "$ref": "#/components/responses/SuccessResult" }, "400": { "description": "- `not_chat_app` : アプリモードが API ルートと一致しません。\n- `invalid_param` : 必須の `user` フィールドがありません。", "content": { "application/json": { "examples": { "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Arg user must be provided." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chat-messages/stop-chat-message-generation", "metadata": { "title": "生成を停止", "sidebarTitle": "生成を停止" } } } }, "/messages/{message_id}/suggested": { "get": { "summary": "次の推奨質問を取得", "description": "**対象アプリ**:Chatflow、新しい Agent、チャットボット、Agent。\n\nメッセージに対して提案されたフォローアップ質問を返します。", "operationId": "getBasicChatSuggestedQuestionsJa", "tags": [ "チャットメッセージ" ], "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "推奨質問を取得するメッセージの ID です。チャットのレスポンス、または [会話履歴メッセージ一覧を取得](/ja/api-reference/conversations/list-conversation-messages) から取得します。", "schema": { "type": "string", "format": "uuid" } }, { "name": "user", "in": "query", "required": true, "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。", "schema": { "type": "string" } } ], "responses": { "200": { "description": "提案された質問の取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuggestedQuestionsResponse" }, "examples": { "suggestedQuestions": { "summary": "レスポンス例", "value": { "result": "success", "data": [ "What colors does the iPhone 13 Pro Max come in?", "How does the battery compare to iPhone 12?", "What is the price range?" ] } } } } } }, "400": { "description": "- `not_chat_app` : アプリモードが API ルートと一致しません。\n- `bad_request` : 推奨質問機能が無効です。", "content": { "application/json": { "examples": { "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } }, "bad_request": { "summary": "bad_request", "value": { "status": 400, "code": "bad_request", "message": "Suggested Questions Is Disabled." } } } } } }, "404": { "description": "`not_found` : メッセージが存在しません。", "content": { "application/json": { "examples": { "message_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Message Not Exists." } } } } } }, "500": { "description": "`internal_server_error` : 内部サーバーエラー。", "content": { "application/json": { "examples": { "internal_server_error": { "summary": "internal_server_error", "value": { "status": 500, "code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application." } } } } } } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request GET \\\n --url 'https://{api_base_url}/messages/{message_id}/suggested?user={user}' \\\n --header 'Authorization: Bearer {api_key}'" } ], "x-mint": { "href": "/ja/api-reference/chat-messages/get-next-suggested-questions", "metadata": { "title": "次の推奨質問を取得", "sidebarTitle": "次の推奨質問を取得" } } } }, "/files/upload": { "post": { "summary": "ファイルをアップロード", "description": "**対象アプリ**:Chatflow、Workflow、新しい Agent、チャットボット、Agent、テキストジェネレーター。\n\nファイルをアップロードし、後続のリクエストから参照するための `id` を返します。ファイルはアップロードしたエンドユーザーに属し、同じ `user` を持つリクエストだけがそのファイルを参照できます。\n\nアプリが実際に扱えるファイル種別は、アプリのファイルアップロード設定によって決まります。[アプリケーションのパラメータ情報を取得](/ja/api-reference/applications/get-app-parameters) で確認できます。", "operationId": "uploadBasicChatFileJa", "tags": [ "ファイル操作" ], "requestBody": { "description": "ファイルアップロードリクエスト。multipart/form-data 形式が必要です。", "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "required": [ "file" ], "properties": { "file": { "type": "string", "format": "binary", "description": "アップロードするファイル。`multipart/form-data` の 1 パートとして送信します。ファイル名に `/` や `\\` は使えません。\n\nデプロイの安全ブラックリスト(`UPLOAD_FILE_EXTENSION_BLACKLIST`、デフォルトは空)にある拡張子を除き、任意の拡張子を受け付けます。\n\nサイズ上限はカテゴリごとに適用されます:画像 10 MB、音声 50 MB、動画 100 MB、その他のファイル 15 MB(デフォルト値。Dify Cloud はデフォルト値を使用)。セルフホスト環境では `UPLOAD_*_FILE_SIZE_LIMIT` [環境変数](/ja/self-host/deploy/configuration/environments) で調整できます。" }, "user": { "type": "string", "description": "このアップロードが属するエンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。省略すると、共有の `DEFAULT-USER` に帰属します。同じ `user` を持つ後続のリクエストだけがこのファイルを参照できます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } } } } }, "responses": { "201": { "description": "ファイルが正常にアップロードされました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FileUploadResponse" }, "examples": { "uploadSuccess": { "summary": "Response Example", "value": { "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "reference": null, "name": "product-photo.png", "size": 204800, "extension": "png", "mime_type": "image/png", "created_by": "f1e2d3c4-b5a6-7890-abcd-ef1234567890", "created_at": 1705407629, "preview_url": null, "source_url": "https://upload.dify.ai/files/a1b2c3d4-5678-90ab-cdef-1234567890ab/file-preview?timestamp=1705407629&nonce=8b3e26a5&sign=rN5DXW3xkVGwGE5MSvptu_BhQVXpMbXWmVJ0ib0LMzI=", "original_url": null, "user_id": null, "tenant_id": "11223344-5566-7788-99aa-bbccddeeff00", "conversation_id": null, "file_key": null } } } } } }, "400": { "description": "- `no_file_uploaded` : リクエストにファイルが提供されていません。\n- `too_many_files` : 1 回のリクエストにつき 1 ファイルのみ許可されています。\n- `filename_not_exists_error` : アップロードされたファイルにファイル名がありません。\n- `invalid_param` : ファイル名に `/` または `\\` が含まれているか、ファイルの拡張子がデプロイのブラックリストにあります。", "content": { "application/json": { "examples": { "no_file_uploaded": { "summary": "no_file_uploaded", "value": { "status": 400, "code": "no_file_uploaded", "message": "Please upload your file." } }, "too_many_files": { "summary": "too_many_files", "value": { "status": 400, "code": "too_many_files", "message": "Only one file is allowed." } }, "filename_not_exists_error": { "summary": "filename_not_exists_error", "value": { "status": 400, "code": "filename_not_exists_error", "message": "The specified filename does not exist." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "File extension '.exe' is not allowed for security reasons" } } } } } }, "413": { "description": "`file_too_large` : ファイルがカテゴリごとのサイズ上限(`file` フィールドを参照)を超えています。現在、実行時の `message` は空文字列で返ります(既知のバックエンドの問題)。`code` とステータスコードで判定してください。", "content": { "application/json": { "examples": { "file_too_large": { "summary": "file_too_large", "value": { "status": 413, "code": "file_too_large", "message": "" } } } } } }, "415": { "description": "`unsupported_file_type` : アップロードされた `file` パートに MIME タイプが宣言されていません。", "content": { "application/json": { "examples": { "unsupported_file_type": { "summary": "unsupported_file_type", "value": { "status": 415, "code": "unsupported_file_type", "message": "File type not allowed." } } } } } } }, "x-mint": { "href": "/ja/api-reference/files/upload-file", "metadata": { "title": "ファイルをアップロード", "sidebarTitle": "ファイルをアップロード" } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request POST \\\n --url 'https://{api_base_url}/files/upload' \\\n --header 'Authorization: Bearer {api_key}' \\\n --form 'file=@product-photo.png' \\\n --form 'user={user}'" } ] } }, "/files/{file_id}/preview": { "get": { "summary": "ファイルをダウンロード", "description": "**対象アプリ**:Chatflow、チャットボット、Agent、テキストジェネレーター。\n\n以前 [ファイルをアップロード](/ja/api-reference/files/upload-file) が返したファイルの生のバイト列を返します。ファイルには、そのメッセージが参照しているアプリからのみアクセスできます。", "operationId": "previewBasicChatFileJa", "tags": [ "ファイル操作" ], "parameters": [ { "name": "file_id", "in": "path", "required": true, "description": "ダウンロードするファイルの ID です。ファイルアップロードのレスポンスから取得します。", "schema": { "type": "string", "format": "uuid" } }, { "name": "as_attachment", "in": "query", "required": false, "description": "`true` の場合、ファイルはブラウザでインライン表示される代わりに、添付ファイルとしてダウンロードされます。", "schema": { "type": "boolean", "default": false } }, { "name": "user", "in": "query", "required": false, "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。ここではファイルアクセスに影響しません。アクセスは `user` ではなくアプリとメッセージによってスコープされます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。", "schema": { "type": "string" } } ], "responses": { "200": { "description": "生のファイルコンテンツを返します。`Content-Type` ヘッダーはファイルの MIME タイプに設定されます。`as_attachment` が `true` の場合、ファイルは `Content-Disposition: attachment` としてダウンロード形式で返されます。", "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } } } }, "403": { "description": "`file_access_denied` : ファイルは存在しますが、別のアプリまたはワークスペースに属しています。", "content": { "application/json": { "examples": { "file_access_denied": { "summary": "file_access_denied", "value": { "status": 403, "code": "file_access_denied", "message": "Access to the requested file is denied." } } } } } }, "404": { "description": "`file_not_found` : この ID のファイルは、このアプリのメッセージからは参照できません。", "content": { "application/json": { "examples": { "file_not_found": { "summary": "file_not_found", "value": { "status": 404, "code": "file_not_found", "message": "The requested file was not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/files/download-file", "metadata": { "title": "ファイルをダウンロード", "sidebarTitle": "ファイルをダウンロード" } } } }, "/end-users/{end_user_id}": { "get": { "summary": "エンドユーザー取得", "description": "**対象アプリ**:Chatflow、Workflow、新しい Agent、チャットボット、Agent、テキストジェネレーター。\n\nID を指定してエンドユーザーの詳細を返します。別のエンドポイントが返したエンドユーザー ID(例:[ファイルをアップロード](/ja/api-reference/files/upload-file) レスポンスの `created_by`)を解決するのに便利です。", "operationId": "getEndUserChatJa", "tags": [ "エンドユーザー" ], "parameters": [ { "name": "end_user_id", "in": "path", "required": true, "description": "照会するエンドユーザーの ID です。", "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "エンドユーザーを正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EndUserDetail" }, "examples": { "endUserDetail": { "summary": "Response Example", "value": { "id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890", "tenant_id": "11223344-5566-7788-99aa-bbccddeeff00", "app_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "type": "service-api", "external_user_id": "abc-123", "name": null, "is_anonymous": false, "session_id": "abc-123", "created_at": "2024-01-16T12:00:29Z", "updated_at": "2024-01-16T12:00:29Z" } } } } } }, "404": { "description": "`end_user_not_found` : エンドユーザーが見つかりません。", "content": { "application/json": { "examples": { "end_user_not_found": { "summary": "end_user_not_found", "value": { "status": 404, "code": "end_user_not_found", "message": "End user not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/end-users/get-end-user-info", "metadata": { "title": "エンドユーザー取得", "sidebarTitle": "エンドユーザー取得" } } } }, "/messages/{message_id}/feedbacks": { "post": { "summary": "メッセージフィードバックを送信", "description": "**対象アプリ**:Chatflow、チャットボット、Agent、テキストジェネレーター。\n\nメッセージに `like` または `dislike` の評価と、任意のコメントを記録します。`rating` に `null` を送信すると、そのメッセージの既存のフィードバックを取り消します。", "operationId": "postBasicChatMessageFeedbackJa", "tags": [ "メッセージフィードバック" ], "parameters": [ { "name": "message_id", "in": "path", "required": true, "description": "フィードバックを送信するメッセージの ID です。メッセージ ID は [会話履歴メッセージ一覧を取得](/ja/api-reference/conversations/list-conversation-messages) から取得します。", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageFeedbackRequest" }, "examples": { "likeFeedback": { "summary": "リクエスト例", "value": { "rating": "like", "user": "abc-123", "content": "This answer was very helpful!" } } } } } }, "responses": { "200": { "$ref": "#/components/responses/SuccessResult" }, "400": { "description": "`invalid_param` : 必須の `user` フィールドが省略されているか、`rating` が `null` であるにもかかわらず取り消す既存のフィードバックがありません。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Arg user must be provided." } } } } } }, "404": { "description": "`not_found` : メッセージが存在しません。", "content": { "application/json": { "examples": { "message_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Message Not Exists." } } } } } } }, "x-mint": { "href": "/ja/api-reference/feedback/submit-message-feedback", "metadata": { "title": "メッセージフィードバックを送信", "sidebarTitle": "メッセージフィードバックを送信" } } } }, "/app/feedbacks": { "get": { "summary": "アプリのフィードバック一覧を取得", "description": "**対象アプリ**:Chatflow、チャットボット、Agent、テキストジェネレーター。\n\nアプリのメッセージに対するすべてのフィードバックのページネーション付きリストを返します。エンドユーザーと管理者の両方の送信が含まれます。", "operationId": "getBasicChatAppFeedbacksJa", "tags": [ "メッセージフィードバック" ], "parameters": [ { "name": "page", "in": "query", "description": "ページ番号。", "required": false, "schema": { "type": "integer", "default": 1, "minimum": 1 } }, { "name": "limit", "in": "query", "description": "1 ページあたりのフィードバック件数。", "required": false, "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 101 } } ], "responses": { "200": { "description": "アプリケーションフィードバックのリスト。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppFeedbacksResponse" }, "examples": { "feedbacksList": { "summary": "レスポンス例", "value": { "data": [ { "id": "b7e2f8a1-3c4d-5e6f-7890-abcdef123456", "app_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "rating": "like", "content": "The response accurately answered my question about product specifications.", "from_source": "user", "from_end_user_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890", "from_account_id": null, "created_at": "2025-01-16T14:30:29Z", "updated_at": "2025-01-16T14:30:29Z" }, { "id": "c8f3a9b2-4d5e-6f70-8901-bcdef2345678", "app_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "conversation_id": "56812a93-9229-5cd6-9f0c-75673b666603", "message_id": "ae24b5c0-f814-584d-a493-5439e5d6b7b1", "rating": "dislike", "content": "The answer was too vague and did not address the specific pricing question.", "from_source": "user", "from_end_user_id": "d2c1b0a9-8765-4321-fedc-ba9876543210", "from_account_id": null, "created_at": "2025-01-15T09:12:45Z", "updated_at": "2025-01-15T09:12:45Z" } ] } } } } } } }, "x-mint": { "href": "/ja/api-reference/feedback/list-app-feedbacks", "metadata": { "title": "アプリのフィードバック一覧を取得", "sidebarTitle": "アプリのフィードバック一覧を取得" } } } }, "/conversations": { "get": { "summary": "会話一覧を取得", "description": "**対象アプリ**:Chatflow、新しい Agent、チャットボット、Agent。\n\nエンドユーザーの会話を、最近アクティブな順に一覧表示します。", "operationId": "getBasicChatConversationsListJa", "tags": [ "会話管理" ], "parameters": [ { "name": "user", "in": "query", "required": false, "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。", "schema": { "type": "string" } }, { "name": "last_id", "in": "query", "required": false, "description": "ページネーションカーソルです。現在のページの最後の会話の `id` を指定します。省略すると最初のページを取得します。", "schema": { "type": "string" } }, { "name": "limit", "in": "query", "required": false, "description": "返すレコード数です。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } }, { "name": "sort_by", "in": "query", "required": false, "description": "並べ替えるフィールドです。降順にするには `-` を先頭に付けます。", "schema": { "type": "string", "enum": [ "created_at", "-created_at", "updated_at", "-updated_at" ], "default": "-updated_at" } } ], "responses": { "200": { "description": "会話リストの取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationsListResponse" }, "examples": { "conversationsList": { "summary": "レスポンス例", "value": { "limit": 20, "has_more": false, "data": [ { "id": "45701982-8118-4bc5-8e9b-64562b4555f2", "name": "iPhone Specs Chat", "inputs": { "city": "San Francisco" }, "status": "normal", "introduction": "Welcome! How can I help you today?", "created_at": 1705407629, "updated_at": 1705411229 } ] } } } } } }, "400": { "description": "`not_chat_app` : アプリモードが API ルートと一致しません。", "content": { "application/json": { "examples": { "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } } } } } }, "404": { "description": "`not_found` : 前の会話が存在しません(無効な `last_id`)。", "content": { "application/json": { "examples": { "last_conversation_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Last Conversation Not Exists." } } } } } } }, "x-mint": { "href": "/ja/api-reference/conversations/list-conversations", "metadata": { "title": "会話一覧を取得", "sidebarTitle": "会話一覧を取得" } } } }, "/messages": { "get": { "summary": "会話履歴メッセージ一覧を取得", "description": "**対象アプリ**:Chatflow、新しい Agent、チャットボット、Agent。\n\n会話のメッセージ履歴を新しい順に返します。`first_id` を渡すと、より古いメッセージへページをさかのぼれます。", "operationId": "getBasicChatConversationHistoryJa", "tags": [ "会話管理" ], "parameters": [ { "name": "conversation_id", "in": "query", "required": true, "description": "読み取る会話の ID です。会話 ID は [会話一覧を取得](/ja/api-reference/conversations/list-conversations) から取得します。", "schema": { "type": "string" } }, { "name": "user", "in": "query", "required": false, "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。", "schema": { "type": "string" } }, { "name": "first_id", "in": "query", "required": false, "description": "ページネーションカーソルです。現在のページの最初のメッセージの `id` を指定します。渡すと前(より古い)ページを取得し、省略すると最新のメッセージを取得します。", "schema": { "type": "string" } }, { "name": "limit", "in": "query", "required": false, "description": "リクエストごとに返すチャット履歴メッセージの数です。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } } ], "responses": { "200": { "description": "会話履歴の取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationHistoryResponse" }, "examples": { "conversationHistory": { "summary": "Response Example", "value": { "limit": 20, "has_more": false, "data": [ { "id": "9da23599-e713-473b-982c-4328d4f5c78a", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "parent_message_id": null, "inputs": { "city": "San Francisco" }, "query": "What are the specs of the iPhone 13 Pro Max?", "answer": "iPhone 13 Pro Max specs are listed here:...", "status": "normal", "error": null, "message_files": [], "feedback": { "rating": "like" }, "retriever_resources": [], "agent_thoughts": [], "created_at": 1705407629, "extra_contents": [], "message_tokens": 100, "answer_tokens": 58, "total_tokens": 158, "provider_response_latency": 1.234, "total_price": "0.0012825", "currency": "USD" } ] } } } } } }, "400": { "description": "`not_chat_app` : アプリモードが API ルートと一致しません。", "content": { "application/json": { "examples": { "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } } } } } }, "404": { "description": "- `not_found` : 会話が存在しません。\n- `not_found` : 最初のメッセージが存在しません(無効な `first_id`)。", "content": { "application/json": { "examples": { "conversation_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Conversation Not Exists." } }, "first_message_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "First Message Not Exists." } } } } } } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request GET \\\n --url 'https://{api_base_url}/messages?conversation_id={conversation_id}&user={user}' \\\n --header 'Authorization: Bearer {api_key}'" } ], "x-mint": { "href": "/ja/api-reference/conversations/list-conversation-messages", "metadata": { "title": "会話履歴メッセージ一覧を取得", "sidebarTitle": "会話履歴メッセージ一覧を取得" } } } }, "/conversations/{conversation_id}/variables": { "get": { "summary": "会話変数の取得", "description": "**対象アプリ**:Chatflow、チャットボット、Agent。\n\n会話に保存された変数を一覧表示します。", "operationId": "getBasicChatConversationVariablesJa", "tags": [ "会話管理" ], "parameters": [ { "name": "conversation_id", "in": "path", "required": true, "description": "変数を一覧表示する会話の ID です。会話 ID は [会話一覧を取得](/ja/api-reference/conversations/list-conversations) から取得します。", "schema": { "type": "string" } }, { "name": "user", "in": "query", "required": false, "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。", "schema": { "type": "string" } }, { "name": "last_id", "in": "query", "required": false, "description": "ページネーションカーソルです。現在のページの最後の変数の `id` を指定します。省略すると最初のページを取得します。", "schema": { "type": "string" } }, { "name": "limit", "in": "query", "required": false, "description": "返すレコード数です。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } }, { "name": "variable_name", "in": "query", "required": false, "description": "指定した名前で変数をフィルタリングします。", "schema": { "type": "string", "minLength": 1, "maxLength": 255 } } ], "responses": { "200": { "description": "会話変数の取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariablesResponse" }, "examples": { "conversationVariables": { "summary": "レスポンス例", "value": { "limit": 20, "has_more": false, "data": [ { "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "name": "user_preference", "value_type": "string", "value": "dark_mode", "description": "ユーザー設定", "created_at": 1705407629, "updated_at": 1705411229 } ] } } } } } }, "400": { "description": "- `not_chat_app` : アプリモードが API ルートと一致しません。\n- `invalid_param` : `last_id` がこの会話のどの変数にも一致しません。", "content": { "application/json": { "examples": { "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } }, "invalid_last_id": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "" } } } } } }, "404": { "description": "`not_found` : 会話が存在しません。", "content": { "application/json": { "examples": { "conversation_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Conversation Not Exists." } } } } } } }, "x-mint": { "href": "/ja/api-reference/conversations/list-conversation-variables", "metadata": { "title": "会話変数の取得", "sidebarTitle": "会話変数の取得" } } } }, "/conversations/{conversation_id}/name": { "post": { "summary": "会話の名前を変更", "description": "**対象アプリ**:Chatflow、新しい Agent、チャットボット、Agent。\n\n会話の名前を変更します。`auto_generate` が `true` の場合は、メッセージから名前を自動生成します。この名前は、複数会話のリストでクライアントが表示するものです。", "operationId": "renameBasicChatConversationJa", "tags": [ "会話管理" ], "parameters": [ { "name": "conversation_id", "in": "path", "required": true, "description": "名前を変更する会話の ID です。会話 ID は [会話一覧を取得](/ja/api-reference/conversations/list-conversations) から取得します。", "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationRenameRequest" }, "examples": { "renameExample": { "summary": "リクエスト例", "value": { "name": "iPhone Specs Chat", "user": "abc-123" } } } } } }, "responses": { "200": { "description": "会話が正常に名前変更されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationListItem" }, "examples": { "renamedConversation": { "summary": "レスポンス例", "value": { "id": "45701982-8118-4bc5-8e9b-64562b4555f2", "name": "iPhone Specs Chat", "inputs": { "city": "San Francisco" }, "status": "normal", "introduction": "Welcome! How can I help you today?", "created_at": 1705407629, "updated_at": 1705411229 } } } } } }, "400": { "description": "- `not_chat_app` : アプリモードが API ルートと一致しません。\n- `invalid_param` : `auto_generate` が `true` ですが、名前を生成するためのメッセージが会話にありません。", "content": { "application/json": { "examples": { "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } }, "no_messages": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "" } } } } } }, "404": { "description": "`not_found` : 会話が存在しません。", "content": { "application/json": { "examples": { "conversation_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Conversation Not Exists." } } } } } } }, "x-mint": { "href": "/ja/api-reference/conversations/rename-conversation", "metadata": { "title": "会話の名前を変更", "sidebarTitle": "会話の名前を変更" } } } }, "/conversations/{conversation_id}/variables/{variable_id}": { "put": { "summary": "会話変数を更新", "description": "**対象アプリ**:Chatflow、チャットボット、Agent。\n\n会話変数の値を更新します。新しい値は変数の既存の型と一致する必要があります。", "operationId": "updateChatConversationVariableJa", "tags": [ "会話管理" ], "parameters": [ { "name": "conversation_id", "in": "path", "required": true, "description": "変数が属する会話の ID です。会話 ID は [会話一覧を取得](/ja/api-reference/conversations/list-conversations) から取得します。", "schema": { "type": "string", "format": "uuid" } }, { "name": "variable_id", "in": "path", "required": true, "description": "更新する変数の ID です。変数 ID は [会話変数の取得](/ja/api-reference/conversations/list-conversation-variables) から取得します。", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariableUpdateRequest" }, "examples": { "updateStringVariable": { "summary": "リクエスト例", "value": { "value": "new value", "user": "abc-123" } } } } } }, "responses": { "200": { "description": "変数が正常に更新されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConversationVariableItem" }, "examples": { "updatedVariable": { "summary": "レスポンス例", "value": { "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "name": "user_preference", "value_type": "string", "value": "new value", "description": "ユーザー設定", "created_at": 1705407629, "updated_at": 1705411229 } } } } } }, "400": { "description": "- `not_chat_app` : アプリモードが API ルートと一致しません。\n- `bad_request` : 変数値の型が一致しません。", "content": { "application/json": { "examples": { "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } }, "type_mismatch": { "summary": "bad_request", "value": { "status": 400, "code": "bad_request", "message": "Type mismatch: variable 'user_preference' expects string, but got number type" } } } } } }, "404": { "description": "- `not_found` : 会話が存在しません。\n- `not_found` : 会話変数が存在しません。", "content": { "application/json": { "examples": { "conversation_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Conversation Not Exists." } }, "variable_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Conversation Variable Not Exists." } } } } } } }, "x-mint": { "href": "/ja/api-reference/conversations/update-conversation-variable", "metadata": { "title": "会話変数を更新", "sidebarTitle": "会話変数を更新" } } } }, "/conversations/{conversation_id}": { "delete": { "summary": "会話を削除", "description": "**対象アプリ**:Chatflow、新しい Agent、チャットボット、Agent。\n\n会話を削除します。", "operationId": "deleteBasicChatConversationJa", "tags": [ "会話管理" ], "parameters": [ { "name": "conversation_id", "in": "path", "required": true, "description": "削除する会話の ID です。会話 ID は [会話一覧を取得](/ja/api-reference/conversations/list-conversations) から取得します。", "schema": { "type": "string" } } ], "requestBody": { "description": "JSON ボディは常に必須です。`user` を省略する場合は `{}` を送信してください。", "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } }, "examples": { "deleteExample": { "value": { "user": "abc-123" }, "summary": "リクエスト例" } } } } }, "responses": { "204": { "description": "会話の削除に成功しました。コンテンツは返されません。" }, "400": { "description": "`not_chat_app` : アプリモードが API ルートと一致しません。", "content": { "application/json": { "examples": { "not_chat_app": { "summary": "not_chat_app", "value": { "status": 400, "code": "not_chat_app", "message": "Please check if your app mode matches the right API route." } } } } } }, "404": { "description": "`not_found` : 会話が存在しません。", "content": { "application/json": { "examples": { "conversation_not_exists": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Conversation Not Exists." } } } } } } }, "x-mint": { "href": "/ja/api-reference/conversations/delete-conversation", "metadata": { "title": "会話を削除", "sidebarTitle": "会話を削除" } } } }, "/audio-to-text": { "post": { "summary": "音声をテキストに変換", "description": "**対象アプリ**:Chatflow、Workflow、新しい Agent、チャットボット、Agent、テキストジェネレーター。\n\nアプリに設定された音声認識モデルを使用して、アップロードされた音声ファイルをテキストに文字起こしします。", "operationId": "basicChatAudioToTextJa", "tags": [ "音声・テキスト変換" ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/AudioToTextRequest" } } } }, "responses": { "200": { "description": "音声からテキストへの変換に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioToTextResponse" }, "examples": { "audioToTextSuccess": { "summary": "レスポンス例", "value": { "text": "Hello, I would like to know more about the iPhone 13 Pro Max." } } } } } }, "400": { "description": "- `app_unavailable` : アプリケーションが利用できないか、設定が正しくありません。\n- `speech_to_text_disabled` : このアプリでは音声からテキストへの変換が無効になっています。\n- `provider_not_support_speech_to_text` : モデルプロバイダーが音声認識をサポートしていません。\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。\n- `provider_quota_exceeded` : モデルプロバイダーのクォータが使い切られました。\n- `model_currently_not_support` : 現在のモデルはこの操作をサポートしていません。\n- `completion_request_error` : 音声認識リクエストに失敗しました。", "content": { "application/json": { "examples": { "app_unavailable": { "summary": "app_unavailable", "value": { "status": 400, "code": "app_unavailable", "message": "App unavailable, please check your app configurations." } }, "speech_to_text_disabled": { "summary": "speech_to_text_disabled", "value": { "status": 400, "code": "speech_to_text_disabled", "message": "Speech to text is disabled." } }, "provider_not_support_speech_to_text": { "summary": "provider_not_support_speech_to_text", "value": { "status": 400, "code": "provider_not_support_speech_to_text", "message": "Provider not support speech to text." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "provider_quota_exceeded": { "summary": "provider_quota_exceeded", "value": { "status": 400, "code": "provider_quota_exceeded", "message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials." } }, "model_currently_not_support": { "summary": "model_currently_not_support", "value": { "status": 400, "code": "model_currently_not_support", "message": "Dify Hosted OpenAI trial currently not support the GPT-4 model." } }, "completion_request_error": { "summary": "completion_request_error", "value": { "status": 400, "code": "completion_request_error", "message": "Completion request failed." } } } } } }, "413": { "description": "`audio_too_large` : 音声ファイルが `30 MB` のサイズ上限を超えています。", "content": { "application/json": { "examples": { "audio_too_large": { "summary": "audio_too_large", "value": { "status": 413, "code": "audio_too_large", "message": "Audio size larger than 30 mb" } } } } } }, "415": { "description": "`unsupported_audio_type` : ファイルの MIME タイプが、受け付ける音声タイプのいずれでもありません(`file` フィールドを参照)。", "content": { "application/json": { "examples": { "unsupported_audio_type": { "summary": "unsupported_audio_type", "value": { "status": 415, "code": "unsupported_audio_type", "message": "Audio type not allowed." } } } } } }, "500": { "description": "`internal_server_error` : 内部サーバーエラー。", "content": { "application/json": { "examples": { "internal_server_error": { "summary": "internal_server_error", "value": { "status": 500, "code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application." } } } } } } }, "x-mint": { "href": "/ja/api-reference/audio/convert-audio-to-text", "metadata": { "title": "音声をテキストに変換", "sidebarTitle": "音声をテキストに変換" } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request POST \\\n --url 'https://{api_base_url}/audio-to-text' \\\n --header 'Authorization: Bearer {api_key}' \\\n --form 'file=@meeting-question.mp3' \\\n --form 'user={user}'" } ] } }, "/text-to-audio": { "post": { "summary": "テキストを音声に変換", "description": "**対象アプリ**:Chatflow、Workflow、新しい Agent、チャットボット、Agent、テキストジェネレーター。\n\nテキストを音声に変換します。任意のテキストを合成するには `text` を、既存のメッセージの回答を音声化するには `message_id` を渡します。", "operationId": "basicChatTextToAudioJa", "tags": [ "音声・テキスト変換" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TextToAudioRequest" }, "examples": { "textToAudioExample": { "summary": "リクエスト例", "value": { "text": "Hello, welcome to our service.", "user": "abc-123", "voice": "alloy", "streaming": false } } } } } }, "responses": { "200": { "description": "生成された音声ファイルを返します。`Content-Type` ヘッダーは音声の MIME タイプ(例:`audio/wav`、`audio/mp3`)に設定されます。設定された TTS プロバイダーがストリームを返す場合、音声は `audio/mpeg` としてチャンク転送エンコーディングで配信されます。リクエストの `streaming` フィールドはこれを制御しません。", "content": { "audio/mpeg": { "schema": { "type": "string", "format": "binary" } } } }, "400": { "description": "- `app_unavailable` : アプリケーションが利用できないか、設定が正しくありません。\n- `invalid_param` : テキスト読み上げが有効になっていない、`text` が指定されていない、または利用可能な音声がありません。\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。\n- `provider_quota_exceeded` : モデルプロバイダーのクォータが使い切られました。\n- `model_currently_not_support` : 現在のモデルはこの操作をサポートしていません。\n- `completion_request_error` : テキスト読み上げリクエストに失敗しました。", "content": { "application/json": { "examples": { "app_unavailable": { "summary": "app_unavailable", "value": { "status": 400, "code": "app_unavailable", "message": "App unavailable, please check your app configurations." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "TTS is not enabled" } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "provider_quota_exceeded": { "summary": "provider_quota_exceeded", "value": { "status": 400, "code": "provider_quota_exceeded", "message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials." } }, "model_currently_not_support": { "summary": "model_currently_not_support", "value": { "status": 400, "code": "model_currently_not_support", "message": "Dify Hosted OpenAI trial currently not support the GPT-4 model." } }, "completion_request_error": { "summary": "completion_request_error", "value": { "status": 400, "code": "completion_request_error", "message": "Completion request failed." } } } } } }, "500": { "description": "`internal_server_error` : 内部サーバーエラー。", "content": { "application/json": { "examples": { "internal_server_error": { "summary": "internal_server_error", "value": { "status": 500, "code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application." } } } } } } }, "x-mint": { "href": "/ja/api-reference/audio/convert-text-to-audio", "metadata": { "title": "テキストを音声に変換", "sidebarTitle": "テキストを音声に変換" } } } }, "/info": { "get": { "summary": "アプリケーションの基本情報を取得", "description": "**対象アプリ**:Chatflow、Workflow、新しい Agent、チャットボット、Agent、テキストジェネレーター。\n\nアプリの基本情報(名前、説明、タグ、モード、作成者)を返します。", "operationId": "getBasicChatAppInfoJa", "tags": [ "アプリケーション設定" ], "responses": { "200": { "description": "アプリケーションの基本情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppInfoResponse" }, "examples": { "appInfo": { "summary": "レスポンス例", "value": { "name": "My Chat App", "description": "便利なカスタマーサービスチャットボット。", "tags": [ "customer-service", "chatbot" ], "mode": "chat", "author_name": "Dify Team" } } } } } } }, "x-mint": { "href": "/ja/api-reference/applications/get-app-info", "metadata": { "title": "アプリケーションの基本情報を取得", "sidebarTitle": "アプリケーションの基本情報を取得" } } } }, "/parameters": { "get": { "summary": "アプリケーションのパラメータ情報を取得", "description": "**対象アプリ**:Chatflow、Workflow、新しい Agent、チャットボット、Agent、テキストジェネレーター。\n\nアプリのフロントエンド設定(開始文と推奨質問、機能トグル、ユーザー入力フォーム、ファイルアップロード上限)を返します。アプリの入力をレンダリングし、正しいアップロード上限を適用するために使用します。", "operationId": "getBasicChatAppParametersJa", "tags": [ "アプリケーション設定" ], "responses": { "200": { "description": "アプリケーションパラメータ情報。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppParametersResponse" }, "examples": { "appParameters": { "summary": "レスポンス例", "value": { "opening_statement": "Hello! How can I help you today?", "suggested_questions": [ "What can you do?", "Tell me about your features." ], "suggested_questions_after_answer": { "enabled": true }, "speech_to_text": { "enabled": false }, "text_to_speech": { "enabled": false, "voice": "alloy", "language": "en-US", "autoPlay": "disabled" }, "retriever_resource": { "enabled": true }, "annotation_reply": { "enabled": false }, "more_like_this": { "enabled": false }, "sensitive_word_avoidance": { "enabled": false }, "user_input_form": [ { "text-input": { "label": "City", "variable": "city", "required": true, "default": "" } } ], "file_upload": { "image": { "enabled": true, "number_limits": 3, "detail": "high", "transfer_methods": [ "remote_url", "local_file" ] } }, "system_parameters": { "file_size_limit": 15, "image_file_size_limit": 10, "audio_file_size_limit": 50, "video_file_size_limit": 100, "workflow_file_upload_limit": 10 } } } } } } }, "400": { "description": "- `app_unavailable` : アプリケーションが利用できないか、設定が正しくありません。\n- `agent_not_published` : バインドされた Agent が公開されていません。(新しい Agent アプリ)", "content": { "application/json": { "examples": { "app_unavailable": { "summary": "app_unavailable", "value": { "status": 400, "code": "app_unavailable", "message": "App unavailable, please check your app configurations." } }, "agent_not_published": { "summary": "agent_not_published", "value": { "code": "agent_not_published", "message": "Agent has not been published. Please publish the Agent before using the API.", "status": 400 } } } } } } }, "x-mint": { "href": "/ja/api-reference/applications/get-app-parameters", "metadata": { "title": "アプリケーションのパラメータ情報を取得", "sidebarTitle": "アプリケーションのパラメータ情報を取得" } } } }, "/meta": { "get": { "summary": "アプリケーションのメタ情報を取得", "description": "**対象アプリ**:Chatflow、Workflow、新しい Agent、チャットボット、Agent、テキストジェネレーター。\n\nこのアプリが使用するツールの表示アイコンを、ツール名をキーとして返します。", "operationId": "getBasicChatAppMetaJa", "tags": [ "アプリケーション設定" ], "responses": { "200": { "description": "アプリケーションのメタ情報を正常に取得しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AppMetaResponse" }, "examples": { "appMeta": { "summary": "レスポンス例", "value": { "tool_icons": { "dalle3": "https://example.com/icons/dalle3.png", "calculator": { "background": "#4A90D9", "content": "🧮" } } } } } } } } }, "x-mint": { "href": "/ja/api-reference/applications/get-app-meta", "metadata": { "title": "アプリケーションのメタ情報を取得", "sidebarTitle": "アプリケーションのメタ情報を取得" } } } }, "/site": { "get": { "summary": "アプリの WebApp 設定を取得", "description": "**対象アプリ**:Chatflow、Workflow、新しい Agent、チャットボット、Agent、テキストジェネレーター。\n\nアプリのホスト型 WebApp のブランディングと表示設定(タイトル、アイコン、テーマカラー、デフォルト言語など)を返します。", "operationId": "getBasicChatWebAppSettingsJa", "tags": [ "アプリケーション設定" ], "responses": { "200": { "description": "アプリケーションの WebApp 設定。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebAppSettingsResponse" }, "examples": { "webAppSettings": { "summary": "レスポンス例", "value": { "title": "My Chat App", "chat_color_theme": "#4A90D9", "chat_color_theme_inverted": false, "icon_type": "emoji", "icon": "🤖", "icon_background": "#FFFFFF", "icon_url": null, "description": "便利なカスタマーサービスチャットボット。", "copyright": "2025 Dify", "privacy_policy": "https://example.com/privacy", "input_placeholder": "製品について何でもお尋ねください…", "custom_disclaimer": "", "default_language": "en-US", "show_workflow_steps": false, "use_icon_as_answer_icon": true } } } } } }, "403": { "description": "`forbidden` : このアプリケーションのサイトが見つからないか、ワークスペースがアーカイブされています。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden", "value": { "status": 403, "code": "forbidden", "message": "You don't have the permission to access the requested resource. It is either read-protected or not readable by the server." } } } } } } }, "x-mint": { "href": "/ja/api-reference/applications/get-app-webapp-settings", "metadata": { "title": "アプリの WebApp 設定を取得", "sidebarTitle": "アプリの WebApp 設定を取得" } } } }, "/apps/annotations": { "post": { "summary": "アノテーションを作成", "description": "**対象アプリ**:Chatflow、チャットボット、Agent。\n\nアノテーションを作成します。アノテーションは、一致したときにアプリが新しい応答を生成する代わりに直接返す、事前定義された質問と回答のペアです。", "operationId": "createChatAnnotationJa", "tags": [ "アノテーション管理" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAnnotationRequest" }, "examples": { "createAnnotation": { "summary": "リクエスト例", "value": { "question": "What is Dify?", "answer": "Dify is an open-source LLM application development platform." } } } } } }, "responses": { "201": { "description": "アノテーションが正常に作成されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItem" }, "examples": { "createdAnnotation": { "summary": "レスポンス例", "value": { "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "question": "What is Dify?", "answer": "Dify is an open-source LLM application development platform.", "hit_count": 0, "created_at": 1705407629 } } } } } } }, "x-mint": { "href": "/ja/api-reference/annotations/create-annotation", "metadata": { "title": "アノテーションを作成", "sidebarTitle": "アノテーションを作成" } } }, "get": { "summary": "アノテーションリストを取得", "description": "**対象アプリ**:Chatflow、チャットボット、Agent。\n\nアプリのアノテーションを、任意でキーワードでフィルタリングして一覧表示します。", "operationId": "listChatAnnotationsJa", "tags": [ "アノテーション管理" ], "parameters": [ { "name": "page", "in": "query", "description": "ページ番号。", "required": false, "schema": { "type": "integer", "default": 1, "minimum": 1 } }, { "name": "limit", "in": "query", "description": "1 ページあたりのアイテム数。100 を超えるリクエストは 100 に制限されます。", "required": false, "schema": { "type": "integer", "default": 20, "minimum": 1 } }, { "name": "keyword", "in": "query", "description": "質問または回答の内容でアノテーションをフィルタリングするためのキーワードです。", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "アノテーションリストの取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationListResponse" }, "examples": { "annotationList": { "summary": "レスポンス例", "value": { "data": [ { "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "question": "What is Dify?", "answer": "Dify is an open-source LLM application development platform.", "hit_count": 5, "created_at": 1705407629 } ], "has_more": false, "limit": 20, "total": 1, "page": 1 } } } } } } }, "x-mint": { "href": "/ja/api-reference/annotations/list-annotations", "metadata": { "title": "アノテーションリストを取得", "sidebarTitle": "アノテーションリストを取得" } } } }, "/apps/annotations/{annotation_id}": { "put": { "summary": "アノテーションを更新", "description": "**対象アプリ**:Chatflow、チャットボット、Agent。\n\nアノテーションの質問と回答を更新します。", "operationId": "updateChatAnnotationJa", "tags": [ "アノテーション管理" ], "parameters": [ { "name": "annotation_id", "in": "path", "required": true, "description": "更新するアノテーションの ID です。アノテーション ID は [アノテーションリストを取得](/ja/api-reference/annotations/list-annotations) から取得します。", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAnnotationRequest" }, "examples": { "updateAnnotation": { "summary": "リクエスト例", "value": { "question": "What is Dify?", "answer": "Dify is an open-source LLM application development platform for building AI-powered apps." } } } } } }, "responses": { "200": { "description": "アノテーションが正常に更新されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AnnotationItem" }, "examples": { "updatedAnnotation": { "summary": "レスポンス例", "value": { "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "question": "What is Dify?", "answer": "Dify is an open-source LLM application development platform for building AI-powered apps.", "hit_count": 5, "created_at": 1705407629 } } } } } }, "404": { "description": "`not_found` : アノテーションが存在しません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Annotation not found" } } } } } } }, "x-mint": { "href": "/ja/api-reference/annotations/update-annotation", "metadata": { "title": "アノテーションを更新", "sidebarTitle": "アノテーションを更新" } } }, "delete": { "summary": "アノテーションを削除", "description": "**対象アプリ**:Chatflow、チャットボット、Agent。\n\nアノテーションとその関連するヒット履歴を削除します。", "operationId": "deleteChatAnnotationJa", "tags": [ "アノテーション管理" ], "parameters": [ { "name": "annotation_id", "in": "path", "required": true, "description": "削除するアノテーションの ID です。アノテーション ID は [アノテーションリストを取得](/ja/api-reference/annotations/list-annotations) から取得します。", "schema": { "type": "string", "format": "uuid" } } ], "responses": { "204": { "description": "アノテーションが正常に削除されました。" }, "404": { "description": "`not_found` : アノテーションが存在しません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Annotation not found" } } } } } } }, "x-mint": { "href": "/ja/api-reference/annotations/delete-annotation", "metadata": { "title": "アノテーションを削除", "sidebarTitle": "アノテーションを削除" } } } }, "/apps/annotation-reply/{action}": { "post": { "summary": "アノテーション返信を設定", "description": "**対象アプリ**:Chatflow、チャットボット、Agent。\n\nアプリのアノテーション返信を有効または無効にします。非同期で実行されます。進捗は [アノテーション返信の初期設定タスクステータスを取得](/ja/api-reference/annotations/get-annotation-reply-job-status) で追跡してください。\n\nリクエストボディはアクションの実行前に検証されるため、`disable` の場合でも `score_threshold`、`embedding_provider_name`、`embedding_model_name` が必須です。", "operationId": "setChatAnnotationReplyJa", "tags": [ "アノテーション管理" ], "parameters": [ { "name": "action", "in": "path", "required": true, "description": "アノテーション返信を有効にするか無効にするかを指定します。", "schema": { "type": "string", "enum": [ "enable", "disable" ] } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsRequest" }, "examples": { "enableAnnotationReply": { "summary": "リクエスト例", "value": { "score_threshold": 0.9, "embedding_provider_name": "openai", "embedding_model_name": "text-embedding-3-small" } } } } } }, "responses": { "200": { "description": "アノテーション返信設定タスクが開始されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsResponse" }, "examples": { "annotationReplyResponse": { "summary": "レスポンス例", "value": { "job_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "job_status": "waiting" } } } } } } }, "x-mint": { "href": "/ja/api-reference/annotations/configure-annotation-reply", "metadata": { "title": "アノテーション返信を設定", "sidebarTitle": "アノテーション返信を設定" } } } }, "/apps/annotation-reply/{action}/status/{job_id}": { "get": { "summary": "アノテーション返信の初期設定タスクステータスを取得", "description": "**対象アプリ**:Chatflow、チャットボット、Agent。\n\n[アノテーション返信を設定](/ja/api-reference/annotations/configure-annotation-reply) で開始されたアノテーション返信設定ジョブのステータスを返します。", "operationId": "getChatAnnotationReplyStatusJa", "tags": [ "アノテーション管理" ], "parameters": [ { "name": "action", "in": "path", "required": true, "description": "アクションタイプです。[アノテーション返信を設定](/ja/api-reference/annotations/configure-annotation-reply) の呼び出しと一致する必要があります。", "schema": { "type": "string", "enum": [ "enable", "disable" ] } }, { "name": "job_id", "in": "path", "required": true, "description": "[アノテーション返信を設定](/ja/api-reference/annotations/configure-annotation-reply) から返されたジョブ ID です。", "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "タスクステータスの取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InitialAnnotationReplySettingsStatusResponse" }, "examples": { "jobStatus": { "summary": "レスポンス例", "value": { "job_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "job_status": "completed", "error_msg": "" } } } } } }, "400": { "description": "`invalid_param` : 指定されたジョブが存在しません。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "The job does not exist." } } } } } } }, "x-mint": { "href": "/ja/api-reference/annotations/get-annotation-reply-job-status", "metadata": { "title": "アノテーション返信の初期設定タスクステータスを取得", "sidebarTitle": "アノテーション返信の初期設定タスクステータスを取得" } } } }, "/workflows/run/{workflow_run_id}": { "get": { "summary": "ワークフロー実行詳細を取得", "description": "**対象アプリ**:Chatflow、Workflow。\n\n1 つのワークフロー実行のステータス、入力、出力、実行メトリクスを取得します。", "operationId": "getWorkflowRunDetailJp", "tags": [ "ワークフロー実行" ], "parameters": [ { "name": "workflow_run_id", "in": "path", "required": true, "description": "ワークフロー実行 ID です。[ワークフローを実行](/ja/api-reference/workflow-runs/run-workflow) のレスポンスまたはストリーミングイベント、あるいは Chatflow アプリのメッセージメタデータから取得します。", "schema": { "type": "string" } } ], "responses": { "200": { "description": "ワークフロー実行の詳細の取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowRunDetailResponse" }, "examples": { "workflowRunDetail": { "summary": "レスポンス例", "value": { "id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "workflow_id": "7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345", "status": "succeeded", "inputs": "{\"query\": \"Translate this to French\"}", "outputs": { "result": "Traduisez ceci en francais" }, "error": null, "total_steps": 3, "total_tokens": 150, "created_at": 1705407629, "finished_at": 1705407630, "elapsed_time": 1.23 } } } } } }, "400": { "description": "`not_workflow_app` : アプリモードが API ルートと一致しません。", "content": { "application/json": { "examples": { "not_workflow_app": { "summary": "not_workflow_app", "value": { "status": 400, "code": "not_workflow_app", "message": "Please check if your app mode matches the right API route." } } } } } }, "404": { "description": "`not_found` : ワークフロー実行記録が見つかりません。", "content": { "application/json": { "examples": { "workflow_run_not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Workflow run not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/workflow-runs/get-workflow-run-detail", "metadata": { "title": "ワークフロー実行詳細を取得", "sidebarTitle": "ワークフロー実行詳細を取得" } } } }, "/workflows/logs": { "get": { "summary": "ワークフローログ一覧を取得", "description": "**対象アプリ**:Chatflow、Workflow。\n\n過去のワークフロー実行を、任意のフィルターで一覧表示します。各エントリは実行単位のサマリー(ステータス、トークン使用量、ステップ数、所要時間)であり、ノードごとの実行ログではありません。\n\n実行のノードレベルのイベントを追跡するには、代わりにストリーミングを使用します。\n\n- **自分で開始する実行**:[ワークフローを実行](/ja/api-reference/workflow-runs/run-workflow) をストリーミングモードで使用すると、実行の進行に応じて `node_started` と `node_finished` が送信されます。\n- **すでに進行中の実行**:[ワークフローイベントをストリーム](/ja/api-reference/workflow-runs/stream-workflow-events) を `include_state_snapshot=true` 付きで呼び出し、実行済み各ノードのステータスを再送してから、残りをストリーミングします。\n\n完了した実行のノードレベルのログは、サービス API 経由では取得できません。", "operationId": "getWorkflowLogsJp", "tags": [ "ワークフロー実行" ], "parameters": [ { "name": "keyword", "in": "query", "description": "ログ内を検索するキーワードです。", "schema": { "type": "string" } }, { "name": "status", "in": "query", "description": "実行ステータスでフィルタリングします。", "schema": { "type": "string", "enum": [ "succeeded", "failed", "stopped" ] } }, { "name": "page", "in": "query", "description": "ページ番号。", "schema": { "type": "integer", "default": 1, "minimum": 1, "maximum": 99999 } }, { "name": "limit", "in": "query", "description": "1 ページあたりの件数です。", "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 } }, { "name": "created_at__before", "in": "query", "description": "この ISO 8601 タイムスタンプ以前に作成されたログをフィルタリングします。", "schema": { "type": "string", "format": "date-time" } }, { "name": "created_at__after", "in": "query", "description": "この ISO 8601 タイムスタンプ以降に作成されたログをフィルタリングします。", "schema": { "type": "string", "format": "date-time" } }, { "name": "created_by_end_user_session_id", "in": "query", "description": "エンドユーザーセッション ID でフィルタリングします。", "schema": { "type": "string" } }, { "name": "created_by_account", "in": "query", "description": "作成者のアカウントのメールアドレス(例:`name@example.com`)でフィルタリングします。", "schema": { "type": "string" } } ], "responses": { "200": { "description": "ワークフローログの取得に成功しました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowLogsResponse" }, "examples": { "workflowLogs": { "summary": "Response Example", "value": { "page": 1, "limit": 20, "total": 1, "has_more": false, "data": [ { "id": "b7e2f8a1-3c4d-5e6f-7890-abcdef123456", "workflow_run": { "id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "version": "2025-01-16 12:00:00.000000", "status": "succeeded", "error": null, "elapsed_time": 1.23, "total_tokens": 150, "total_steps": 3, "created_at": 1705407629, "finished_at": 1705407630, "exceptions_count": 0, "triggered_from": "app-run" }, "created_from": "service-api", "created_by_role": "end_user", "created_by_account": null, "created_by_end_user": { "id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890", "type": "service-api", "is_anonymous": false, "session_id": "user_workflow_123" }, "created_at": 1705407629 } ] } } } } } }, "400": { "description": "`invalid_param` : クエリパラメータが無効です。例:どのアカウントにも一致しない `created_by_account`、不正な形式の `created_at__before` や `created_at__after` のタイムスタンプ、範囲外の `page`、`limit`、`status` の値など。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Account not found: name@example.com" } } } } } } }, "x-mint": { "href": "/ja/api-reference/workflow-runs/list-workflow-logs", "metadata": { "title": "ワークフローログ一覧を取得", "sidebarTitle": "ワークフローログ一覧を取得" } } } }, "/form/human_input/{form_token}": { "get": { "tags": [ "人間の入力" ], "summary": "人間の入力フォームを取得", "description": "**対象アプリ**:Chatflow、Workflow。\n\n一時停止中の人間の入力フォームの内容を返します。WebApp 配信が必要です。\n\n人間の入力を呼び出す一連の流れについては、[API 連携フロー](/ja/api-reference/guides/human-input-flow) を参照してください。", "operationId": "getChatflowHumanInputForm", "parameters": [ { "name": "form_token", "in": "path", "required": true, "schema": { "type": "string" }, "description": "一時停止中のフォームへのアクセストークン。ストリーミングモードのワークフローを実行エンドポイントまたはチャットメッセージを送信エンドポイントが返す `human_input_required` イベントから取得します。" } ], "responses": { "200": { "description": "フォーム内容の取得に成功しました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "form_content": { "type": "string", "description": "ワークフロー変数を埋め込んだ、事前レンダリング済みのフォーム本文。" }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "フォーム入力コントロールの種類。利用可能な値: `paragraph` (複数行テキスト入力)、 `select` (リストからの単一選択)、 `file` (単一ファイルアップロード)、 `file-list` (複数ファイルアップロード)。" }, "output_variable_name": { "type": "string", "description": "ワークフロー内でこの入力の送信値を参照する際の変数名。送信リクエストの `inputs` オブジェクトのキーに対応します。" }, "default": { "type": "object", "nullable": true, "description": "`paragraph` 入力の生のデフォルト値設定。クライアントはこのフィールドを直接解決すべきではありません。デフォルトの表示には `resolved_default_values` を使用してください。その他の入力タイプ、またはデフォルト値が未設定の場合、このキーは含まれません。", "properties": { "type": { "type": "string", "description": "デフォルト値のソース。 `constant` は `value` をリテラル文字列として使用することを示します。 `variable` は `selector` がワークフロー変数を指すことを示します。" }, "selector": { "type": "array", "items": { "type": "string" }, "description": "`type` が `variable` の場合の変数参照パス(例: `[\"node_id\", \"var_name\"]`)。少なくとも 2 つの要素を含む必要があります。" }, "value": { "type": "string", "description": "`type` が `constant` の場合のリテラルなデフォルト値。常に文字列です。" } } }, "option_source": { "type": "object", "description": "`select` 入力の選択肢のソース。 `type` が `select` の場合のみ含まれます。", "properties": { "type": { "type": "string", "enum": [ "variable", "constant" ], "description": "選択肢のソース。 `constant` は `value` に選択肢を直接列挙することを示します。 `variable` は `selector` が選択肢を提供する `array[string]` 型のワークフロー変数を指すことを示します。" }, "selector": { "type": "array", "items": { "type": "string" }, "description": "`type` が `variable` の場合の変数参照パス。" }, "value": { "type": "array", "items": { "type": "string" }, "description": "`type` が `constant` の場合のリテラルな選択肢リスト。" } } }, "allowed_file_types": { "type": "array", "items": { "type": "string", "enum": [ "image", "document", "audio", "video", "custom" ] }, "description": "受信者がアップロード可能なファイルカテゴリ。 `file` および `file-list` 入力に含まれます。値: `image`、 `document`、 `audio`、 `video`、 `custom`。" }, "allowed_file_extensions": { "type": "array", "items": { "type": "string" }, "description": "`allowed_file_types` に `custom` が含まれる場合に許可されるファイル拡張子。各拡張子には先頭の `.` を含めてください。たとえば `.md` です。`file` および `file-list` 入力に含まれます。" }, "allowed_file_upload_methods": { "type": "array", "items": { "type": "string", "enum": [ "local_file", "remote_url" ] }, "description": "受信者が使用できるアップロード方法。値: `local_file`、 `remote_url`。 `file` および `file-list` 入力に含まれます。" }, "number_limits": { "type": "integer", "description": "受信者がアップロードできるファイルの最大数。 `file-list` 入力のみに含まれます。" } } }, "description": "フォーム入力フィールドの定義。" }, "resolved_default_values": { "type": "object", "additionalProperties": { "type": "string" }, "description": "フォームに表示するための事前計算済みデフォルト値。入力の `output_variable_name` をキーとします。デフォルト値がワークフロー変数から解決可能な `paragraph` 入力にのみ設定されます。解決可能なデフォルトがない入力では空になります。クライアントはこれらの値をそのまま表示してください。 `default` をクライアント側で再解決する必要はありません。すべての値は文字列化されています。" }, "user_actions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "maxLength": 20, "pattern": "^[A-Za-z_][A-Za-z0-9_]*$", "description": "アクションボタンの識別子。受信者がこのボタンを選択したときに、[人間の入力フォームを送信](/ja/api-reference/human-input/submit-human-input-form) エンドポイントの `action` として渡します。" }, "title": { "type": "string", "maxLength": 100, "description": "受信者に表示されるボタンのラベル。" }, "button_style": { "type": "string", "description": "ボタンの視覚スタイル。利用可能な値: `primary`、 `default`、 `accent`、 `ghost`。" } } }, "description": "利用可能な送信アクション。" }, "expiration_time": { "type": "integer", "format": "int64", "description": "Unix タイムスタンプ(秒)。この時刻以降、フォームは送信できなくなります。", "nullable": true } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "form_content": "ドラフトを確認し、優先度を設定して、承認または修正を依頼してください。", "inputs": [ { "type": "paragraph", "output_variable_name": "feedback", "default": { "type": "constant", "selector": [], "value": "" } }, { "type": "select", "output_variable_name": "priority", "option_source": { "type": "constant", "selector": [], "value": [ "low", "medium", "high" ] } }, { "type": "file", "output_variable_name": "attachment", "allowed_file_types": [ "image", "document" ], "allowed_file_extensions": [], "allowed_file_upload_methods": [ "local_file", "remote_url" ] }, { "type": "file-list", "output_variable_name": "attachments", "allowed_file_types": [ "image", "document" ], "allowed_file_extensions": [], "allowed_file_upload_methods": [ "local_file", "remote_url" ], "number_limits": 5 } ], "resolved_default_values": { "feedback": "" }, "user_actions": [ { "id": "approve", "title": "承認", "button_style": "primary" }, { "id": "reject", "title": "修正を依頼", "button_style": "default" } ], "expiration_time": 1745510400 } } } } } }, "404": { "description": "`not_found` :フォームが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "フォームが見つかりません" } } } } } }, "412": { "description": "- `human_input_form_submitted` :フォームは送信済みです。フォームはワンショットで、最初の応答が有効になります(送信したユーザーは問いません)。\n- `human_input_form_expired` :送信が到達する前にフォームの有効期限が切れています。", "content": { "application/json": { "examples": { "human_input_form_submitted": { "summary": "human_input_form_submitted", "value": { "status": 412, "code": "human_input_form_submitted", "message": "このフォームは他のユーザーによって送信済みです。form_id=a1b2c3d4-e5f6-7890-abcd-ef1234567890" } }, "human_input_form_expired": { "summary": "human_input_form_expired", "value": { "status": 412, "code": "human_input_form_expired", "message": "このフォームは有効期限切れです。form_id=a1b2c3d4-e5f6-7890-abcd-ef1234567890" } } } } } } }, "x-mint": { "href": "/ja/api-reference/human-input/get-human-input-form", "metadata": { "title": "人間の入力フォームを取得", "sidebarTitle": "人間の入力フォームを取得" } } }, "post": { "tags": [ "人間の入力" ], "summary": "人間の入力フォームを送信", "description": "**対象アプリ**:Chatflow、Workflow。\n\n一時停止中の人間の入力フォームに、受信者の応答を送信します。受理されるとワークフローが再開されます。再開後の実行は [ワークフローイベントをストリーム](/ja/api-reference/workflow-runs/stream-workflow-events) で追跡してください。WebApp 配信が必要です。", "operationId": "submitChatflowHumanInputForm", "parameters": [ { "name": "form_token", "in": "path", "required": true, "schema": { "type": "string" }, "description": "一時停止中のフォームへのアクセストークン。ストリーミングモードのワークフローを実行エンドポイントまたはチャットメッセージを送信エンドポイントが返す `human_input_required` イベントから取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "inputs", "action", "user" ], "properties": { "inputs": { "type": "object", "additionalProperties": true, "description": "各入力の `output_variable_name` をキーとして送信する値。段落と選択の入力は文字列、`file` 入力は単一のファイルマッピング、`file-list` 入力はファイルマッピングの配列です。\n\nファイルマッピングは `{transfer_method: local_file, upload_file_id, type}` または `{transfer_method: remote_url, url, type}` で、`type` はそのフィールドの `allowed_file_types` のいずれかです。`local_file` の場合、`upload_file_id` は [ファイルをアップロード](/ja/api-reference/files/upload-file) が返す `id` です。\n\n実行、アップロード、送信の各呼び出しで一貫した `user` を使用してください。" }, "action": { "type": "string", "description": "受信者が選択したアクションボタンの ID。フォームの `user_actions` リスト([人間の入力フォームを取得](/ja/api-reference/human-input/get-human-input-form) エンドポイントから返される)にある `id` のいずれかと一致する必要があります。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。サービス API と WebApp のユーザー ID は、たとえ同じでも別物として扱われます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } }, "examples": { "approve": { "summary": "リクエスト例", "value": { "inputs": { "feedback": "公開して問題ありません", "priority": "high", "attachment": { "transfer_method": "local_file", "upload_file_id": "3c8fa1b2-7d4e-4f9a-b0c1-d2e3f4a5b6c7", "type": "image" }, "attachments": [ { "transfer_method": "local_file", "upload_file_id": "1a77f0df-c0e6-461c-987c-e72526f341ee", "type": "document" }, { "transfer_method": "remote_url", "url": "https://example.com/report.pdf", "type": "document" } ] }, "action": "approve", "user": "abc-123" } } } } } }, "responses": { "200": { "description": "フォームの送信に成功しました。レスポンスボディは空のオブジェクトです。", "content": { "application/json": { "schema": { "type": "object" }, "examples": { "success": { "summary": "レスポンス例", "value": {} } } } } }, "400": { "description": "- `bad_request` :フォーム受信者のタイプが無効です。\n- `invalid_form_data` :送信内容がフォーム定義の検証に失敗しました。", "content": { "application/json": { "examples": { "bad_request": { "summary": "bad_request", "value": { "status": 400, "code": "bad_request", "message": "フォーム受信者のタイプが無効です" } }, "invalid_form_data": { "summary": "invalid_form_data", "value": { "status": 400, "code": "invalid_form_data", "message": "必須入力が不足しています:feedback" } } } } } }, "404": { "description": "`not_found` :フォームが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "フォームが見つかりません" } } } } } }, "412": { "description": "- `human_input_form_submitted` :フォームは送信済みです。フォームはワンショットで、最初の応答が有効になります(送信したユーザーは問いません)。\n- `human_input_form_expired` :送信が到達する前にフォームの有効期限が切れています。", "content": { "application/json": { "examples": { "human_input_form_submitted": { "summary": "human_input_form_submitted", "value": { "status": 412, "code": "human_input_form_submitted", "message": "このフォームは他のユーザーによって送信済みです。form_id=a1b2c3d4-e5f6-7890-abcd-ef1234567890" } }, "human_input_form_expired": { "summary": "human_input_form_expired", "value": { "status": 412, "code": "human_input_form_expired", "message": "このフォームは有効期限切れです。form_id=a1b2c3d4-e5f6-7890-abcd-ef1234567890" } } } } } } }, "x-mint": { "href": "/ja/api-reference/human-input/submit-human-input-form", "metadata": { "title": "人間の入力フォームを送信", "sidebarTitle": "人間の入力フォームを送信" } } } }, "/workflow/{workflow_run_id}/events": { "get": { "tags": [ "ワークフロー実行" ], "summary": "ワークフローイベントをストリーム", "description": "**対象アプリ**:Chatflow、Workflow。\n\n一時停止後または元の SSE 接続が切断された後にワークフロー実行の Server-Sent Events ストリームを再開します。すでに完了している実行に対しては、`workflow_finished` イベントを 1 つ送信してストリームを閉じます。\n\n進行中の実行のノードレベルのステータスと進捗を確認するには、`include_state_snapshot=true` を指定して呼び出します。ストリームは新しいイベントの送信前に、実行済み各ノードのステータスを再送します。", "operationId": "streamWorkflowEvents", "parameters": [ { "name": "workflow_run_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "イベントストリームを再開するワークフロー実行 ID です。[ワークフローを実行](/ja/api-reference/workflow-runs/run-workflow) のレスポンスまたはストリーミングイベントから取得します。" }, { "name": "user", "in": "query", "required": true, "schema": { "type": "string" }, "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。実行を開始した `user` と一致する必要があります。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" }, { "name": "include_state_snapshot", "in": "query", "required": false, "schema": { "type": "boolean", "default": false }, "description": "`true` の場合、永続化された状態スナップショットからリプレイし、新しいイベントのストリーミング開始前に実行済みノードのステータスサマリーを含めます。" }, { "name": "continue_on_pause", "in": "query", "required": false, "schema": { "type": "boolean", "default": false }, "description": "`true` に設定すると、複数の `workflow_paused` イベントを跨いでストリームを開いたままにします(ワークフローに複数の人間の入力ノードが連続する場合に有用)。デフォルトでは最初の一時停止で閉じます。" } ], "responses": { "200": { "description": "Server-Sent Events ストリーム。各イベントは `data: {JSON}\\n\\n` として配信されます。イベントペイロードは元のストリーミングレスポンスと同じスキーマに従います。", "content": { "text/event-stream": { "schema": { "type": "string", "description": "再開されたワークフロー実行のイベントの SSE ストリームです。形式は [ワークフローを実行](/ja/api-reference/workflow-runs/run-workflow)(Workflow アプリ)または [チャットメッセージを送信](/ja/api-reference/chat-messages/send-chat-message)(Chatflow アプリ)と同じです。再開された部分で `reasoning_format: separated` を指定した LLM ノードが実行される場合、このストリームには `reasoning_chunk` イベントも含まれます。" }, "examples": { "resumedRun": { "summary": "レスポンス例 - 再開実行(Workflow)", "value": "data: {\"event\": \"human_input_form_filled\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"node_id\": \"approval_node\", \"node_title\": \"Approval\", \"rendered_content\": \"ドラフトを確認してください。\", \"action_id\": \"approve\", \"action_text\": \"承認\", \"submitted_data\": {\"comment\": \"問題ありません。\"}}} data: {\"event\": \"node_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"node_exec_2\", \"node_id\": \"node_1\", \"node_type\": \"llm\", \"title\": \"LLM Node\", \"index\": 2, \"created_at\": 1705407705}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"reasoning\": \"Approved, now translating.\", \"node_id\": \"node_1\", \"is_final\": false}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"reasoning\": \"\", \"node_id\": \"node_1\", \"is_final\": true}} data: {\"event\": \"text_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"text\": \"Bonjour\", \"from_variable_selector\": [\"node_1\", \"text\"]}} data: {\"event\": \"workflow_finished\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"status\": \"succeeded\", \"outputs\": {\"result\": \"Bonjour\"}, \"elapsed_time\": 2.1, \"total_tokens\": 42, \"total_steps\": 2, \"created_at\": 1705407629, \"finished_at\": 1705407706}}" }, "resumedRunChatflow": { "summary": "レスポンス例 - 再開実行(Chatflow)", "value": "data: {\"event\": \"human_input_form_filled\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407705, \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"node_id\": \"approval_node\", \"node_title\": \"Approval\", \"rendered_content\": \"ドラフトを確認してください。\", \"action_id\": \"approve\", \"action_text\": \"承認\", \"submitted_data\": {\"comment\": \"問題ありません。\"}}} data: {\"event\": \"node_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407705, \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"ne_002\", \"node_id\": \"node_llm_1\", \"node_type\": \"llm\", \"title\": \"LLM\", \"index\": 2, \"created_at\": 1705407705}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407705, \"data\": {\"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"reasoning\": \"The reviewer approved the draft.\", \"node_id\": \"node_llm_1\", \"is_final\": false}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407705, \"data\": {\"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"reasoning\": \"\", \"node_id\": \"node_llm_1\", \"is_final\": true}} data: {\"event\": \"message\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"answer\": \"Approved\", \"created_at\": 1705407706} data: {\"event\": \"node_finished\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407706, \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"ne_002\", \"node_id\": \"node_llm_1\", \"node_type\": \"llm\", \"title\": \"LLM\", \"index\": 2, \"status\": \"succeeded\", \"elapsed_time\": 1.2, \"created_at\": 1705407705, \"finished_at\": 1705407706}} data: {\"event\": \"message_end\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407706, \"metadata\": {\"usage\": {\"total_tokens\": 42, \"latency\": 1.3}}} data: {\"event\": \"workflow_finished\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"message_id\": \"2e4f6a8b-1c3d-5e7f-9a0b-2c4d6e8f0a1b\", \"conversation_id\": \"9d3a2f1b-6c7d-4e8f-a0b1-c2d3e4f5a6b7\", \"created_at\": 1705407706, \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"status\": \"succeeded\", \"elapsed_time\": 2.1, \"total_tokens\": 42, \"total_steps\": 2, \"created_at\": 1705407629, \"finished_at\": 1705407706}}" } } } } }, "400": { "description": "`not_workflow_app` : Please check if your app mode matches the right API route.", "content": { "application/json": { "examples": { "not_workflow_app": { "summary": "not_workflow_app", "value": { "status": 400, "code": "not_workflow_app", "message": "Please check if your app mode matches the right API route." } } } } } }, "404": { "description": "`not_found` : Workflow run not found.", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Workflow run not found" } } } } } } }, "x-codeSamples": [ { "lang": "bash", "label": "Resume stream", "source": "curl -N --request GET \\\n --url 'https://{api_base_url}/workflow/{workflow_run_id}/events?user={user}' \\\n --header 'Authorization: Bearer {api_key}'" }, { "lang": "bash", "label": "With state snapshot", "source": "curl -N --request GET \\\n --url 'https://{api_base_url}/workflow/{workflow_run_id}/events?user={user}&include_state_snapshot=true' \\\n --header 'Authorization: Bearer {api_key}'" } ], "x-mint": { "href": "/ja/api-reference/workflow-runs/stream-workflow-events", "metadata": { "title": "ワークフローイベントをストリーム", "sidebarTitle": "ワークフローイベントをストリーム" } } } }, "/workflows/run": { "post": { "summary": "ワークフローを実行", "description": "**対象アプリ**:Workflow。\n\nアプリの公開済みワークフローを実行し、その出力を返します。単一の `blocking` レスポンス、または `streaming` の Server-Sent Events フィードのいずれかで返します。公開済みのワークフローが必要です。", "operationId": "executeWorkflowJp", "tags": [ "ワークフロー実行" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowExecutionRequest" }, "examples": { "streaming_example": { "summary": "リクエスト例 - ストリーミングモード", "value": { "inputs": { "query": "Summarize this text: The quick brown fox jumps over the lazy dog." }, "response_mode": "streaming", "user": "user_workflow_123" } }, "blocking_example": { "summary": "リクエスト例 - ブロッキングモード", "value": { "inputs": { "query": "Translate this to French: Hello world" }, "response_mode": "blocking", "user": "user_workflow_456" } }, "with_file_array_variable": { "summary": "Request Example - File array input", "value": { "inputs": { "my_documents": [ { "type": "document", "transfer_method": "local_file", "upload_file_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab" }, { "type": "image", "transfer_method": "remote_url", "url": "https://example.com/image.jpg" } ] }, "response_mode": "blocking", "user": "user_workflow_789" } } } } } }, "responses": { "200": { "description": "リクエスト成功。コンテンツタイプと構造はリクエストの `response_mode` パラメータに依存します。\n\n- `response_mode` が `blocking` の場合、 `application/json` で `WorkflowBlockingResponse` オブジェクトを返します。\n- `response_mode` が `streaming` の場合、 `text/event-stream` で `ChunkWorkflowEvent` オブジェクトのストリームを返します。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowBlockingResponse" }, "examples": { "blockingResponse": { "summary": "レスポンス例 - ブロッキングモード", "value": { "task_id": "c3800678-a077-43df-a102-53f23ed20b88", "workflow_run_id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "data": { "id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "workflow_id": "7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345", "status": "succeeded", "outputs": { "result": "Bonjour le monde" }, "error": null, "elapsed_time": 1.23, "total_tokens": 150, "total_steps": 3, "created_at": 1705407629, "finished_at": 1705407630 } } } } }, "text/event-stream": { "schema": { "type": "string", "description": "Server-Sent Events (SSE) のストリームです。解析は [ストリーミングレスポンスの処理](/ja/api-reference/guides/streaming) に従ってください:`data:` 行を読み取り、`event` フィールドで振り分け、`ping`(10 秒ごとのキープアライブ)は無視します。\n\n**ストリームライフサイクル**:`workflow_finished`、`workflow_paused`、または `error` イベントを受信するとストリームが閉じます。エラーはストリーム内の `error` イベントとして HTTP ステータス `200` で配信されます。ステータスコードではなくイベントペイロードを確認して詳細を取得してください。\n\n**推論イベント**:\n- `reasoning_chunk`:`reasoning_format` が `separated` の LLM ノードが発行する思考過程のデルタです。連続する `reasoning_chunk` イベントを連結すると、完全な推論を復元できます。`is_final: true` のイベントはノードの思考完了を示し、空の `reasoning` を伴う場合があります。ペイロードは `data` の下にあり、チャットアプリとは異なり `message_id` は `null` となり、`conversation_id` は含まれません。並行する `text_chunk` ストリームには `` タグが含まれません。\n\n**人間の入力イベント**:\n- `human_input_required`:ワークフローが人間の入力ノードに到達した際に `workflow_paused` と同時に発行されます。ペイロードの `form_token` を使用して、[人間の入力 API](/ja/api-reference/human-input/get-human-input-form) でフォーム処理を進めます。\n- `human_input_form_filled`:受信者がフォームを送信し、ワークフロー実行が再開されます。\n- `human_input_form_timeout`:応答がないままフォームが期限切れ。タイムアウトのフォールバックエッジが定義されている場合、ワークフローはそのエッジを通って実行されます。" }, "examples": { "streamingResponse": { "summary": "レスポンス例 - ストリーミングモード", "value": "data: {\"event\": \"workflow_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"inputs\": {\"query\": \"Translate this\"}, \"created_at\": 1705407629, \"reason\": \"initial\"}} data: {\"event\": \"node_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"node_exec_1\", \"node_id\": \"node_1\", \"node_type\": \"llm\", \"title\": \"LLM Node\", \"index\": 1, \"created_at\": 1705407629}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"reasoning\": \"Let me translate that.\", \"node_id\": \"node_1\", \"is_final\": false}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"reasoning\": \"\", \"node_id\": \"node_1\", \"is_final\": true}} data: {\"event\": \"text_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"text\": \"Bonjour\", \"from_variable_selector\": [\"node_1\", \"text\"]}} data: {\"event\": \"workflow_finished\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"status\": \"succeeded\", \"outputs\": {\"result\": \"Bonjour le monde\"}, \"elapsed_time\": 1.23, \"total_tokens\": 150, \"total_steps\": 3, \"created_at\": 1705407629, \"finished_at\": 1705407630}}" }, "humanInputPause": { "summary": "レスポンス例 - 人間の入力での一時停止", "value": "data: {\"event\": \"workflow_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"inputs\": {\"draft\": \"Hello\"}, \"created_at\": 1705407629, \"reason\": \"initial\"}} data: {\"event\": \"human_input_required\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"form_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\", \"form_token\": \"tok_abc123\", \"node_id\": \"approval_node\", \"node_title\": \"Approval\", \"form_content\": \"ドラフトを確認してください。\", \"inputs\": [{\"type\": \"paragraph\", \"output_variable_name\": \"comment\", \"default\": null}], \"actions\": [{\"id\": \"approve\", \"title\": \"承認\", \"button_style\": \"primary\"}], \"display_in_ui\": false, \"resolved_default_values\": {\"comment\": \"\"}, \"expiration_time\": 1705494029}} data: {\"event\": \"workflow_paused\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"status\": \"paused\", \"created_at\": 1705407629, \"elapsed_time\": 0.5}}" } } } } }, "400": { "description": "- `not_workflow_app` : App mode does not match the API route.\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。\n- `provider_quota_exceeded` : モデルプロバイダーのクォータが使い切られました。\n- `model_currently_not_support` : 現在のモデルは利用できません。\n- `completion_request_error` : Workflow execution request failed.\n- `invalid_param` : リクエストパラメータが不足または無効です(`user` の欠落や未公開のワークフローなど)。", "content": { "application/json": { "examples": { "not_workflow_app": { "summary": "not_workflow_app", "value": { "status": 400, "code": "not_workflow_app", "message": "Please check if your app mode matches the right API route." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "provider_quota_exceeded": { "summary": "provider_quota_exceeded", "value": { "status": 400, "code": "provider_quota_exceeded", "message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials." } }, "model_currently_not_support": { "summary": "model_currently_not_support", "value": { "status": 400, "code": "model_currently_not_support", "message": "Dify Hosted OpenAI trial currently not support the GPT-4 model." } }, "completion_request_error": { "summary": "completion_request_error", "value": { "status": 400, "code": "completion_request_error", "message": "Completion request failed." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Arg user must be provided." } } } } } }, "429": { "description": "- `too_many_requests` : このアプリケーションへの同時リクエストが多すぎます。\n- `rate_limit_error` : このワークスペースの Dify Cloud のワークフロー実行クォータに達しました。", "content": { "application/json": { "examples": { "too_many_requests": { "summary": "too_many_requests", "value": { "status": 429, "code": "too_many_requests", "message": "Too many requests. Please try again later." } }, "rate_limit_error": { "summary": "rate_limit_error", "value": { "status": 429, "code": "rate_limit_error", "message": "Rate Limit Error" } } } } } }, "500": { "description": "`internal_server_error` : 内部サーバーエラー。", "content": { "application/json": { "examples": { "internal_server_error": { "summary": "internal_server_error", "value": { "status": 500, "code": "internal_server_error", "message": "Internal Server Error." } } } } } } }, "x-mint": { "href": "/ja/api-reference/workflow-runs/run-workflow", "metadata": { "title": "ワークフローを実行", "sidebarTitle": "ワークフローを実行" } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl -N --request POST \\\n --url 'https://{api_base_url}/workflows/run' \\\n --header 'Authorization: Bearer {api_key}' \\\n --header 'Content-Type: application/json' \\\n --data '{\"inputs\": {\"query\": \"Summarize this text: The quick brown fox jumps over the lazy dog.\"}, \"response_mode\": \"streaming\", \"user\": \"{user}\"}'" } ] } }, "/workflows/{workflow_id}/run": { "post": { "summary": "ID でワークフローを実行", "description": "**対象アプリ**:Workflow。\n\n特定の公開済みワークフローバージョンを、パスの `workflow_id` で指定して実行します。リクエストボディ、レスポンス、ストリーミングの挙動は [ワークフローを実行](/ja/api-reference/workflow-runs/run-workflow) と同じで、実行されるバージョンだけが異なります。", "operationId": "runWorkflowByIdJa", "tags": [ "ワークフロー実行" ], "parameters": [ { "name": "workflow_id", "in": "path", "required": true, "description": "実行する公開済みワークフローバージョンです。[ワークフローを実行](/ja/api-reference/workflow-runs/run-workflow) のレスポンスおよび [ワークフロー実行詳細を取得](/ja/api-reference/workflow-runs/get-workflow-run-detail) の `workflow_id` フィールドで返されます。公開済みバージョンを指定する必要があります。ドラフトバージョンの ID は `bad_request` で拒否されます。", "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowExecutionRequest" }, "examples": { "example": { "summary": "リクエスト例", "value": { "inputs": { "query": "Summarize this article" }, "response_mode": "blocking", "user": "user_workflow_123" } } } } } }, "responses": { "200": { "description": "リクエスト成功。コンテンツタイプと構造はリクエストの `response_mode` パラメータに依存します。\n\n- `response_mode` が `blocking` の場合、 `application/json` で `WorkflowBlockingResponse` オブジェクトを返します。\n- `response_mode` が `streaming` の場合、 `text/event-stream` で `ChunkWorkflowEvent` オブジェクトのストリームを返します。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WorkflowBlockingResponse" }, "examples": { "blockingResponse": { "summary": "レスポンス例 - ブロッキングモード", "value": { "task_id": "c3800678-a077-43df-a102-53f23ed20b88", "workflow_run_id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "data": { "id": "fb47b2e6-5e43-4f90-be01-d5c5a088d156", "workflow_id": "7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345", "status": "succeeded", "outputs": { "result": "Article summary here" }, "error": null, "elapsed_time": 2.45, "total_tokens": 280, "total_steps": 4, "created_at": 1705407629, "finished_at": 1705407631 } } } } }, "text/event-stream": { "schema": { "type": "string", "description": "Server-Sent Events (SSE) のストリームです。解析は [ストリーミングレスポンスの処理](/ja/api-reference/guides/streaming) に従ってください:`data:` 行を読み取り、`event` フィールドで振り分け、`ping`(10 秒ごとのキープアライブ)は無視します。\n\n**ストリームライフサイクル**:`workflow_finished`、`workflow_paused`、または `error` イベントを受信するとストリームが閉じます。エラーはストリーム内の `error` イベントとして HTTP ステータス `200` で配信されます。ステータスコードではなくイベントペイロードを確認して詳細を取得してください。\n\n**推論イベント**:\n- `reasoning_chunk`:`reasoning_format` が `separated` の LLM ノードが発行する思考過程のデルタです。連続する `reasoning_chunk` イベントを連結すると、完全な推論を復元できます。`is_final: true` のイベントはノードの思考完了を示し、空の `reasoning` を伴う場合があります。ペイロードは `data` の下にあり、チャットアプリとは異なり `message_id` は `null` となり、`conversation_id` は含まれません。並行する `text_chunk` ストリームには `` タグが含まれません。\n\n**人間の入力イベント**:\n- `human_input_required`:ワークフローが人間の入力ノードに到達した際に `workflow_paused` と同時に発行されます。ペイロードの `form_token` を使用して、[人間の入力 API](/ja/api-reference/human-input/get-human-input-form) でフォーム処理を進めます。\n- `human_input_form_filled`:受信者がフォームを送信し、ワークフロー実行が再開されます。\n- `human_input_form_timeout`:応答がないままフォームが期限切れ。タイムアウトのフォールバックエッジが定義されている場合、ワークフローはそのエッジを通って実行されます。" }, "examples": { "streamingResponse": { "summary": "レスポンス例 - ストリーミングモード", "value": "data: {\"event\": \"workflow_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"inputs\": {\"query\": \"Translate this\"}, \"created_at\": 1705407629, \"reason\": \"initial\"}} data: {\"event\": \"node_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"node_exec_1\", \"node_id\": \"node_1\", \"node_type\": \"llm\", \"title\": \"LLM Node\", \"index\": 1, \"created_at\": 1705407629}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"reasoning\": \"Let me translate that.\", \"node_id\": \"node_1\", \"is_final\": false}} data: {\"event\": \"reasoning_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"reasoning\": \"\", \"node_id\": \"node_1\", \"is_final\": true}} data: {\"event\": \"text_chunk\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"text\": \"Bonjour\", \"from_variable_selector\": [\"node_1\", \"text\"]}} data: {\"event\": \"workflow_finished\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"status\": \"succeeded\", \"outputs\": {\"result\": \"Bonjour le monde\"}, \"elapsed_time\": 1.23, \"total_tokens\": 150, \"total_steps\": 3, \"created_at\": 1705407629, \"finished_at\": 1705407630}}" }, "humanInputPause": { "summary": "レスポンス例 - 人間の入力での一時停止", "value": "data: {\"event\": \"workflow_started\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"workflow_id\": \"7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345\", \"inputs\": {\"draft\": \"Hello\"}, \"created_at\": 1705407629, \"reason\": \"initial\"}} data: {\"event\": \"human_input_required\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"form_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\", \"form_token\": \"tok_abc123\", \"node_id\": \"approval_node\", \"node_title\": \"Approval\", \"form_content\": \"ドラフトを確認してください。\", \"inputs\": [{\"type\": \"paragraph\", \"output_variable_name\": \"comment\", \"default\": null}], \"actions\": [{\"id\": \"approve\", \"title\": \"承認\", \"button_style\": \"primary\"}], \"display_in_ui\": false, \"resolved_default_values\": {\"comment\": \"\"}, \"expiration_time\": 1705494029}} data: {\"event\": \"workflow_paused\", \"task_id\": \"c3800678-a077-43df-a102-53f23ed20b88\", \"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"data\": {\"workflow_run_id\": \"fb47b2e6-5e43-4f90-be01-d5c5a088d156\", \"status\": \"paused\", \"created_at\": 1705407629, \"elapsed_time\": 0.5}}" } } } } }, "400": { "description": "- `not_workflow_app` : App mode does not match the API route.\n- `bad_request` : Workflow is a draft or has an invalid ID format.\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。\n- `provider_quota_exceeded` : モデルプロバイダーのクォータが使い切られました。\n- `model_currently_not_support` : 現在のモデルは利用できません。\n- `completion_request_error` : Workflow execution request failed.\n- `invalid_param` : リクエストパラメータが不足または無効です(`user` の欠落など)。", "content": { "application/json": { "examples": { "not_workflow_app": { "summary": "not_workflow_app", "value": { "status": 400, "code": "not_workflow_app", "message": "Please check if your app mode matches the right API route." } }, "bad_request": { "summary": "bad_request", "value": { "status": 400, "code": "bad_request", "message": "Cannot use draft workflow version. Workflow ID: 7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345. Please use a published workflow version or leave workflow_id empty." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "provider_quota_exceeded": { "summary": "provider_quota_exceeded", "value": { "status": 400, "code": "provider_quota_exceeded", "message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials." } }, "model_currently_not_support": { "summary": "model_currently_not_support", "value": { "status": 400, "code": "model_currently_not_support", "message": "Dify Hosted OpenAI trial currently not support the GPT-4 model." } }, "completion_request_error": { "summary": "completion_request_error", "value": { "status": 400, "code": "completion_request_error", "message": "Completion request failed." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Arg user must be provided." } } } } } }, "403": { "description": "`workflow_version_execution_not_allowed` : Dify Cloud の Sandbox プランでは、特定のワークフローバージョンを実行できません。", "content": { "application/json": { "examples": { "workflow_version_execution_not_allowed": { "summary": "workflow_version_execution_not_allowed", "value": { "status": 403, "code": "workflow_version_execution_not_allowed", "message": "Workflow version execution is not available on your current plan. Please upgrade to a paid plan." } } } } } }, "404": { "description": "`not_found` : ワークフローが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Workflow not found with id: 7c3e33d4-2a8b-4e5f-9b1a-d3c6e8f12345" } } } } } }, "429": { "description": "- `too_many_requests` : このアプリケーションへの同時リクエストが多すぎます。\n- `rate_limit_error` : このワークスペースの Dify Cloud のワークフロー実行クォータに達しました。", "content": { "application/json": { "examples": { "too_many_requests": { "summary": "too_many_requests", "value": { "status": 429, "code": "too_many_requests", "message": "Too many requests. Please try again later." } }, "rate_limit_error": { "summary": "rate_limit_error", "value": { "status": 429, "code": "rate_limit_error", "message": "Rate Limit Error" } } } } } }, "500": { "description": "`internal_server_error` : 内部サーバーエラー。", "content": { "application/json": { "examples": { "internal_server_error": { "summary": "internal_server_error", "value": { "status": 500, "code": "internal_server_error", "message": "Internal Server Error." } } } } } } }, "x-mint": { "href": "/ja/api-reference/workflow-runs/run-workflow-by-id", "metadata": { "title": "ID でワークフローを実行", "sidebarTitle": "ID でワークフローを実行" } } } }, "/workflows/tasks/{task_id}/stop": { "post": { "summary": "ワークフロータスクを停止", "description": "**対象アプリ**:Workflow。\n\n実行中のワークフロータスクを停止します。`streaming` モードでのみサポートされます。", "operationId": "stopWorkflowTaskGenerationJp", "tags": [ "ワークフロー実行" ], "parameters": [ { "name": "task_id", "in": "path", "required": true, "description": "タスク ID です。[ワークフローを実行](/ja/api-reference/workflow-runs/run-workflow) のストリーミングイベントから取得します。", "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "user" ], "properties": { "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。実行を開始した `user` と一致する必要はありません。停止は `user` にかかわらずタスクに適用されます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } }, "examples": { "example": { "summary": "リクエスト例", "value": { "user": "user_workflow_123" } } } } } }, "responses": { "200": { "$ref": "#/components/responses/SuccessResult" }, "400": { "description": "- `not_workflow_app` : アプリモードが API ルートと一致しません。\n- `invalid_param` : リクエストパラメータが不足または無効です(`user` の欠落など)。", "content": { "application/json": { "examples": { "not_workflow_app": { "summary": "not_workflow_app", "value": { "status": 400, "code": "not_workflow_app", "message": "Please check if your app mode matches the right API route." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Arg user must be provided." } } } } } } }, "x-mint": { "href": "/ja/api-reference/workflow-runs/stop-workflow-task", "metadata": { "title": "ワークフロータスクを停止", "sidebarTitle": "ワークフロータスクを停止" } } } }, "/completion-messages": { "post": { "summary": "完了メッセージを送信", "description": "**対象アプリ**:テキストジェネレーター。\n\nテキスト生成アプリにリクエストを送信し、生成されたテキストを返します。", "operationId": "createCompletionMessageJp", "tags": [ "完了メッセージ" ], "requestBody": { "description": "テキスト生成メッセージを作成するためのリクエストボディ。", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompletionRequest" }, "examples": { "streaming_example": { "summary": "リクエスト例 - ストリーミングモード", "value": { "inputs": { "city": "San Francisco" }, "query": "Translate 'hello' to Spanish.", "response_mode": "streaming", "user": "abc-123", "files": [ { "type": "image", "transfer_method": "remote_url", "url": "https://cloud.dify.ai/logo/logo-site.png" } ] } }, "blocking_example": { "summary": "リクエスト例 - ブロッキングモード", "value": { "inputs": { "city": "New York" }, "query": "Summarize the following text: ...", "response_mode": "blocking", "user": "def-456" } } } } } }, "responses": { "200": { "description": "リクエスト成功。コンテンツタイプと構造はリクエストの `response_mode` パラメータに依存します。\n\n- `response_mode` が `blocking` の場合、 `application/json` で `CompletionResponse` オブジェクトを返します。\n- `response_mode` が `streaming` の場合、 `text/event-stream` で `ChunkCompletionEvent` オブジェクトのストリームを返します。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompletionResponse" }, "examples": { "blockingResponse": { "summary": "レスポンス例 - ブロッキングモード", "value": { "event": "message", "task_id": "c3800678-a077-43df-a102-53f23ed20b88", "id": "b01a39de-3480-4f3e-9f1e-4841a80f8e5e", "message_id": "9da23599-e713-473b-982c-4328d4f5c78a", "mode": "completion", "answer": "Hello World!...", "metadata": { "usage": { "prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 128, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002560", "total_tokens": 1161, "total_price": "0.0012890", "currency": "USD", "latency": 0.7682376249867957 } }, "created_at": 1705407629 } } } }, "text/event-stream": { "schema": { "type": "string", "description": "サーバー送信イベント (SSE) のストリームです。解析は [ストリーミングレスポンスの処理](/ja/api-reference/guides/streaming) に従ってください:`data:` 行を読み取り、`event` フィールドで振り分け、`ping`(10 秒ごとのキープアライブ)は無視します。イベント構造については `ChunkCompletionEvent` を参照してください。\n\n**ストリームライフサイクル**:応答は `message` チャンクとしてストリーミングされ、`message_end` で終了します。`error` イベントはストリームを早期に終了させます。HTTP ステータスは `200` のままなので、詳細はイベントペイロードを確認してください。" }, "examples": { "streamingResponse": { "summary": "レスポンス例 - ストリーミングモード", "value": "data: {\"event\": \"message\", \"task_id\": \"900bbd43-dc0b-4383-a372-aa6e6c414227\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"answer\": \" I\", \"created_at\": 1679586595}\n\ndata: {\"event\": \"message\", \"task_id\": \"900bbd43-dc0b-4383-a372-aa6e6c414227\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"answer\": \"'m\", \"created_at\": 1679586595}\n\ndata: {\"event\": \"message_end\", \"task_id\": \"900bbd43-dc0b-4383-a372-aa6e6c414227\", \"id\": \"5e52ce04-874b-4d27-9045-b3bc80def685\", \"message_id\": \"5ad4cb98-f0c7-4085-b384-88c403be6290\", \"metadata\": {\"usage\": {\"prompt_tokens\": 1033, \"prompt_unit_price\": \"0.001\", \"prompt_price_unit\": \"0.001\", \"prompt_price\": \"0.0010330\", \"completion_tokens\": 135, \"completion_unit_price\": \"0.002\", \"completion_price_unit\": \"0.001\", \"completion_price\": \"0.0002700\", \"total_tokens\": 1168, \"total_price\": \"0.0013030\", \"currency\": \"USD\", \"latency\": 1.381760165997548}}}\n\n" } } } } }, "400": { "description": "- `app_unavailable` : アプリケーションが利用できないか、設定が正しくありません。\n- `provider_not_initialize` : 有効なモデルプロバイダーの認証情報が見つかりません。\n- `provider_quota_exceeded` : モデルプロバイダーのクォータが使い切られました。\n- `model_currently_not_support` : 現在のモデルは利用できません。\n- `completion_request_error` : テキスト生成に失敗しました。\n- `invalid_param` : 必須の `user` フィールドがありません。", "content": { "application/json": { "examples": { "app_unavailable": { "summary": "app_unavailable", "value": { "status": 400, "code": "app_unavailable", "message": "App unavailable, please check your app configurations." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "provider_quota_exceeded": { "summary": "provider_quota_exceeded", "value": { "status": 400, "code": "provider_quota_exceeded", "message": "Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials." } }, "model_currently_not_support": { "summary": "model_currently_not_support", "value": { "status": 400, "code": "model_currently_not_support", "message": "Dify Hosted OpenAI trial currently not support the GPT-4 model." } }, "completion_request_error": { "summary": "completion_request_error", "value": { "status": 400, "code": "completion_request_error", "message": "Completion request failed." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Arg user must be provided." } } } } } }, "429": { "description": "`too_many_requests` : このアプリケーションへの同時リクエストが多すぎます。", "content": { "application/json": { "examples": { "too_many_requests": { "summary": "too_many_requests", "value": { "status": 429, "code": "too_many_requests", "message": "Too many requests. Please try again later. The current maximum concurrent requests allowed for 5b3d4f2a-1c9e-4a7b-8f6d-2e0c9a1b3d4f is 10." } } } } } }, "500": { "description": "`internal_server_error` : 内部サーバーエラー。", "content": { "application/json": { "examples": { "internal_server_error": { "summary": "internal_server_error", "value": { "status": 500, "code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application." } } } } } } }, "x-mint": { "href": "/ja/api-reference/completion-messages/send-completion-message", "metadata": { "title": "完了メッセージを送信", "sidebarTitle": "完了メッセージを送信" } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request POST \\\n --url 'https://{api_base_url}/completion-messages' \\\n --header 'Authorization: Bearer {api_key}' \\\n --header 'Content-Type: application/json' \\\n --no-buffer \\\n --data '{\"inputs\": {\"city\": \"San Francisco\"}, \"response_mode\": \"streaming\", \"user\": \"{user}\"}'" } ] } }, "/completion-messages/{task_id}/stop": { "post": { "summary": "生成を停止", "description": "**対象アプリ**:テキストジェネレーター。\n\nテキスト生成メッセージ生成タスクを停止します。`streaming` モードでのみサポートされています。", "operationId": "stopCompletionGenerationJp", "tags": [ "完了メッセージ" ], "parameters": [ { "name": "task_id", "in": "path", "required": true, "description": "タスク ID です。[完了メッセージを送信](/ja/api-reference/completion-messages/send-completion-message) のストリーミングイベントから取得します。", "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "user" ], "properties": { "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。元のメッセージ送信時に渡した `user` と一致する必要があります。一致しない場合、停止は行われず、成功が返されます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } }, "examples": { "example": { "summary": "リクエスト例", "value": { "user": "abc-123" } } } } } }, "responses": { "200": { "$ref": "#/components/responses/SuccessResult" }, "400": { "description": "- `app_unavailable` : アプリケーションが利用できないか、設定が正しくありません。\n- `invalid_param` : 必須の `user` フィールドがありません。", "content": { "application/json": { "examples": { "app_unavailable": { "summary": "app_unavailable", "value": { "status": 400, "code": "app_unavailable", "message": "App unavailable, please check your app configurations." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Arg user must be provided." } } } } } } }, "x-mint": { "href": "/ja/api-reference/completion-messages/stop-completion-message-generation", "metadata": { "title": "生成を停止", "sidebarTitle": "生成を停止" } } } }, "/datasets": { "post": { "tags": [ "ナレッジベース" ], "summary": "空のナレッジベースを作成", "description": "空のナレッジベースを作成します。ドキュメントを追加するには [テキストからドキュメントを作成](/ja/api-reference/documents/create-document-by-text) または [ファイルからドキュメントを作成](/ja/api-reference/documents/create-document-by-file) を使用します。", "operationId": "createDataset", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 40, "description": "ナレッジベース名。" }, "description": { "type": "string", "maxLength": 400, "default": "", "description": "ナレッジベースの説明です。" }, "indexing_technique": { "type": "string", "enum": [ "high_quality", "economy" ], "nullable": true, "description": "`high_quality` は埋め込みモデルを使用した精密検索、`economy` はキーワードベースのインデキシングです。" }, "permission": { "type": "string", "enum": [ "only_me", "all_team_members", "partial_members" ], "default": "only_me", "description": "このナレッジベースにアクセスできるユーザーを制御します。`only_me` は作成者のみに制限、`all_team_members` はワークスペース全体にアクセスを許可、`partial_members` は指定されたメンバーにアクセスを許可します。" }, "provider": { "type": "string", "enum": [ "vendor", "external" ], "default": "vendor", "description": "`vendor` は内部ナレッジベース、`external` は外部ナレッジベースです。" }, "embedding_model": { "type": "string", "description": "埋め込みモデル名です。[利用可能なモデルを取得](/ja/api-reference/models/get-available-models) で `model_type=text-embedding` を指定した際の `model` フィールドの値を使用します。" }, "embedding_model_provider": { "type": "string", "description": "埋め込みモデルプロバイダーの識別子です。`organization/plugin_name/provider_name` の形式です(例:`langgenius/openai/openai`)。`openai` のような短縮名は `langgenius//` に展開され、langgenius が公開したプラグインでのみ機能します。\n\n有効な値は [利用可能なモデルを取得](/ja/api-reference/models/get-available-models) で `model_type=text-embedding` を指定した際の `provider` フィールドから取得します。" }, "retrieval_model": { "$ref": "#/components/schemas/RetrievalModel", "description": "検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。" }, "external_knowledge_api_id": { "type": "string", "description": "外部ナレッジ API 接続の ID です。" }, "external_knowledge_id": { "type": "string", "description": "外部ナレッジベースの ID です。" }, "summary_index_setting": { "type": "object", "nullable": true, "description": "サマリーインデックスの設定です。", "properties": { "enable": { "type": "boolean", "description": "サマリーインデックスを有効にするかどうかです。" }, "model_name": { "type": "string", "description": "要約生成に使用されるモデルの名前です。" }, "model_provider_name": { "type": "string", "description": "要約生成モデルのプロバイダーです。" }, "summary_prompt": { "type": "string", "description": "要約生成用のカスタムプロンプトテンプレートです。" } } } } } } } }, "responses": { "200": { "description": "ナレッジベースが正常に作成されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Dataset" }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "c42e2a6e-40b3-4330-96f8-f1e4d768e8c9", "name": "Product Documentation", "description": "プロダクト API 技術ドキュメント", "provider": "vendor", "permission": "only_me", "data_source_type": null, "indexing_technique": "high_quality", "app_count": 0, "document_count": 0, "word_count": 0, "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "author_name": "admin", "created_at": 1741267200, "updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "updated_at": 1741267200, "embedding_model": "text-embedding-3-small", "embedding_model_provider": "langgenius/openai/openai", "embedding_available": true, "retrieval_model_dict": { "search_method": "semantic_search", "reranking_enable": false, "reranking_mode": null, "reranking_model": { "reranking_provider_name": "", "reranking_model_name": "" }, "weights": null, "top_k": 3, "score_threshold_enabled": false, "score_threshold": null }, "tags": [], "doc_form": "text_model", "external_knowledge_info": null, "external_retrieval_model": null, "doc_metadata": [], "built_in_field_enabled": true, "pipeline_id": null, "runtime_mode": null, "chunk_structure": null, "icon_info": null, "summary_index_setting": null, "is_published": false, "total_documents": 0, "total_available_documents": 0, "enable_api": true, "is_multimodal": false, "maintainer": "admin" } } } } } }, "400": { "description": "`invalid_param` : 指定した埋め込みモデルまたはリランクモデルが設定されていないか、利用できません。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider." } } } } } }, "403": { "description": "`forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "409": { "description": "`dataset_name_duplicate` : 同じ名前のナレッジベースが既に存在します。", "content": { "application/json": { "examples": { "dataset_name_duplicate": { "summary": "dataset_name_duplicate", "value": { "status": 409, "code": "dataset_name_duplicate", "message": "The dataset name already exists. Please modify your dataset name." } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-bases/create-an-empty-knowledge-base", "metadata": { "title": "空のナレッジベースを作成", "sidebarTitle": "空のナレッジベースを作成" } } }, "get": { "tags": [ "ナレッジベース" ], "summary": "ナレッジベースリストを取得", "description": "ナレッジベースのページネーションリストを返します。任意でキーワードまたはタグでフィルタリングできます。", "operationId": "listDatasets", "parameters": [ { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 }, "description": "ページ番号。" }, { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20 }, "description": "1 ページあたりの件数です。" }, { "name": "keyword", "in": "query", "schema": { "type": "string" }, "description": "名前でフィルタリングする検索キーワードです。" }, { "name": "include_all", "in": "query", "schema": { "type": "boolean", "default": false }, "description": "権限に関係なくすべてのナレッジベースを含めるかどうかです。" }, { "name": "tag_ids", "in": "query", "schema": { "type": "array", "items": { "type": "string" } }, "style": "form", "explode": true, "description": "フィルタリングに使用するタグ ID です。タグ ID は [ナレッジベースタグリストを取得](/ja/api-reference/tags/list-knowledge-tags) から取得します。" } ], "responses": { "200": { "description": "ナレッジベースのリストです。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "description": "ナレッジベースオブジェクトの配列です。", "items": { "$ref": "#/components/schemas/Dataset" } }, "has_more": { "type": "boolean", "description": "次のページにさらに項目が存在するかどうかです。" }, "limit": { "type": "integer", "description": "1 ページあたりの件数です。" }, "total": { "type": "integer", "description": "一致する項目の合計数です。" }, "page": { "type": "integer", "description": "現在のページ番号です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": [ { "id": "c42e2a6e-40b3-4330-96f8-f1e4d768e8c9", "name": "Product Documentation", "description": "プロダクト API 技術ドキュメント", "provider": "vendor", "permission": "only_me", "data_source_type": null, "indexing_technique": "high_quality", "app_count": 0, "document_count": 0, "word_count": 0, "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "author_name": "admin", "created_at": 1741267200, "updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "updated_at": 1741267200, "embedding_model": "text-embedding-3-small", "embedding_model_provider": "langgenius/openai/openai", "embedding_available": true, "retrieval_model_dict": { "search_method": "semantic_search", "reranking_enable": false, "reranking_mode": null, "reranking_model": { "reranking_provider_name": "", "reranking_model_name": "" }, "weights": null, "top_k": 3, "score_threshold_enabled": false, "score_threshold": null }, "tags": [], "doc_form": "text_model", "external_knowledge_info": null, "external_retrieval_model": null, "doc_metadata": [], "built_in_field_enabled": true, "pipeline_id": null, "runtime_mode": null, "chunk_structure": null, "icon_info": null, "summary_index_setting": null, "is_published": false, "total_documents": 0, "total_available_documents": 0, "enable_api": true, "is_multimodal": false, "maintainer": "admin" } ], "has_more": false, "limit": 20, "total": 1, "page": 1 } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-bases/list-knowledge-bases", "metadata": { "title": "ナレッジベースリストを取得", "sidebarTitle": "ナレッジベースリストを取得" } } } }, "/datasets/{dataset_id}": { "get": { "tags": [ "ナレッジベース" ], "summary": "ナレッジベース詳細を取得", "description": "ナレッジベースの詳細情報(埋め込みモデル、検索設定、ドキュメント統計を含む)を返します。", "operationId": "getDatasetDetail", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" } ], "responses": { "200": { "description": "ナレッジベースの詳細です。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Dataset" }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "c42e2a6e-40b3-4330-96f8-f1e4d768e8c9", "name": "Product Documentation", "description": "プロダクト API 技術ドキュメント", "provider": "vendor", "permission": "only_me", "data_source_type": null, "indexing_technique": "high_quality", "app_count": 0, "document_count": 0, "word_count": 0, "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "author_name": "admin", "created_at": 1741267200, "updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "updated_at": 1741267200, "embedding_model": "text-embedding-3-small", "embedding_model_provider": "langgenius/openai/openai", "embedding_available": true, "retrieval_model_dict": { "search_method": "semantic_search", "reranking_enable": false, "reranking_mode": null, "reranking_model": { "reranking_provider_name": "", "reranking_model_name": "" }, "weights": null, "top_k": 3, "score_threshold_enabled": false, "score_threshold": null }, "tags": [], "doc_form": "text_model", "external_knowledge_info": null, "external_retrieval_model": null, "doc_metadata": [], "built_in_field_enabled": true, "pipeline_id": null, "runtime_mode": null, "chunk_structure": null, "icon_info": null, "summary_index_setting": null, "is_published": false, "total_documents": 0, "total_available_documents": 0, "enable_api": true, "is_multimodal": false, "maintainer": "admin" } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : `dataset_id` に一致するナレッジベースがありません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-bases/get-knowledge-base", "metadata": { "title": "ナレッジベース詳細を取得", "sidebarTitle": "ナレッジベース詳細を取得" } } }, "patch": { "tags": [ "ナレッジベース" ], "summary": "ナレッジベースを更新", "description": "ナレッジベースを更新します。リクエストボディに含まれるフィールドのみが変更されます。", "operationId": "updateDataset", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 40, "description": "ナレッジベース名。" }, "description": { "type": "string", "maxLength": 400, "description": "ナレッジベースの説明です。" }, "indexing_technique": { "type": "string", "enum": [ "high_quality", "economy" ], "nullable": true, "description": "`high_quality` は埋め込みモデルを使用した精密検索、`economy` はキーワードベースのインデキシングです。" }, "permission": { "type": "string", "enum": [ "only_me", "all_team_members", "partial_members" ], "description": "このナレッジベースにアクセスできるユーザーを制御します。`only_me` は作成者のみに制限、`all_team_members` はワークスペース全体にアクセスを許可、`partial_members` は指定されたメンバーにアクセスを許可します。" }, "embedding_model": { "type": "string", "description": "埋め込みモデル名です。[利用可能なモデルを取得](/ja/api-reference/models/get-available-models) で `model_type=text-embedding` を指定した際の `model` フィールドの値を使用します。" }, "embedding_model_provider": { "type": "string", "description": "埋め込みモデルプロバイダーの識別子です。`organization/plugin_name/provider_name` の形式です(例:`langgenius/openai/openai`)。`openai` のような短縮名は `langgenius//` に展開され、langgenius が公開したプラグインでのみ機能します。\n\n有効な値は [利用可能なモデルを取得](/ja/api-reference/models/get-available-models) で `model_type=text-embedding` を指定した際の `provider` フィールドから取得します。" }, "retrieval_model": { "$ref": "#/components/schemas/RetrievalModel", "description": "検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。" }, "partial_member_list": { "type": "array", "description": "`permission` が `partial_members` の場合にアクセス権を持つチームメンバーのリストです。", "items": { "type": "object", "properties": { "user_id": { "type": "string", "description": "アクセス権を付与するチームメンバーの ID です。" } } } }, "external_retrieval_model": { "type": "object", "description": "外部ナレッジベースの検索設定です。", "properties": { "top_k": { "type": "integer", "description": "返す結果の最大数です。" }, "score_threshold": { "type": "number", "description": "結果フィルタリング用の最小関連性スコア閾値です。" }, "score_threshold_enabled": { "type": "boolean", "description": "スコア閾値フィルタリングが有効かどうかです。" } } }, "external_knowledge_id": { "type": "string", "description": "外部ナレッジベースの ID です。" }, "external_knowledge_api_id": { "type": "string", "description": "外部ナレッジ API 接続の ID です。" } } } } } }, "responses": { "200": { "description": "ナレッジベースが正常に更新されました。", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Dataset" }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "c42e2a6e-40b3-4330-96f8-f1e4d768e8c9", "name": "Product Documentation", "description": "プロダクト API 技術ドキュメント", "provider": "vendor", "permission": "only_me", "data_source_type": null, "indexing_technique": "high_quality", "app_count": 0, "document_count": 0, "word_count": 0, "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "author_name": "admin", "created_at": 1741267200, "updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "updated_at": 1741267200, "embedding_model": "text-embedding-3-small", "embedding_model_provider": "langgenius/openai/openai", "embedding_available": true, "retrieval_model_dict": { "search_method": "semantic_search", "reranking_enable": false, "reranking_mode": null, "reranking_model": { "reranking_provider_name": "", "reranking_model_name": "" }, "weights": null, "top_k": 3, "score_threshold_enabled": false, "score_threshold": null }, "tags": [], "doc_form": "text_model", "external_knowledge_info": null, "external_retrieval_model": null, "doc_metadata": [], "built_in_field_enabled": true, "pipeline_id": null, "runtime_mode": null, "chunk_structure": null, "icon_info": null, "summary_index_setting": null, "is_published": false, "total_documents": 0, "total_available_documents": 0, "enable_api": true, "is_multimodal": false, "maintainer": "admin", "partial_member_list": [] } } } } } }, "400": { "description": "`invalid_param` : 指定した埋め込みモデルまたはリランクモデルが設定されていないか、利用できません。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider." } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : `dataset_id` に一致するナレッジベースがありません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-bases/update-knowledge-base", "metadata": { "title": "ナレッジベースを更新", "sidebarTitle": "ナレッジベースを更新" } } }, "delete": { "tags": [ "ナレッジベース" ], "summary": "ナレッジベースを削除", "description": "ナレッジベースとそのすべてのドキュメントを完全に削除します。", "operationId": "deleteDataset", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" } ], "responses": { "204": { "description": "ナレッジベースが正常に削除されました。" }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : `dataset_id` に一致するナレッジベースがありません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-bases/delete-knowledge-base", "metadata": { "title": "ナレッジベースを削除", "sidebarTitle": "ナレッジベースを削除" } } } }, "/datasets/{dataset_id}/document/create-by-text": { "post": { "tags": [ "ドキュメント" ], "summary": "テキストからドキュメントを作成", "description": "生のテキストからナレッジベースにドキュメントを作成します。インデックスは非同期で実行されます。返された `batch` ID を使って [ドキュメント埋め込みステータス(進捗)を取得](/ja/api-reference/documents/get-document-indexing-status) で追跡します。", "operationId": "createDocumentFromText", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "name", "text" ], "properties": { "name": { "type": "string", "description": "ドキュメント名です。" }, "text": { "type": "string", "description": "ドキュメントのテキスト内容です。" }, "indexing_technique": { "type": "string", "enum": [ "high_quality", "economy" ], "description": "ナレッジベースに最初のドキュメントを追加する際に必須です。以降のドキュメントでは省略するとナレッジベースのインデックス方式を継承します。`high_quality` は埋め込みモデルによる精密検索、`economy` はキーワードベースのインデックスを使用します。" }, "doc_form": { "type": "string", "enum": [ "text_model", "hierarchical_model", "qa_model" ], "default": "text_model", "description": "`text_model` は標準テキストチャンキング、`hierarchical_model` は親子チャンク構造、`qa_model` は質問・回答ペアの抽出です。" }, "doc_language": { "type": "string", "default": "English", "description": "処理最適化のためのドキュメント言語です。" }, "process_rule": { "type": "object", "description": "チャンキングの処理ルールです。", "required": [ "mode" ], "properties": { "mode": { "type": "string", "enum": [ "automatic", "custom", "hierarchical" ], "description": "`automatic` は組み込みルールを使用、`custom` は手動設定が可能、`hierarchical` は親子チャンク構造を有効にします(`doc_form: hierarchical_model` と組み合わせて使用)。" }, "rules": { "type": "object", "properties": { "pre_processing_rules": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "enum": [ "remove_stopwords", "remove_extra_spaces", "remove_urls_emails" ], "description": "ルール識別子です。" }, "enabled": { "type": "boolean", "description": "この前処理ルールが有効かどうかです。" } } } }, "segmentation": { "type": "object", "properties": { "separator": { "type": "string", "default": "\n", "description": "テキスト分割用のカスタムセパレーターです。" }, "max_tokens": { "type": "integer", "description": "チャンクあたりの最大トークン数です。" }, "chunk_overlap": { "type": "integer", "default": 0, "description": "チャンク間のトークンオーバーラップです。" } } } } } } }, "retrieval_model": { "$ref": "#/components/schemas/RetrievalModel", "description": "このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。" }, "embedding_model": { "type": "string", "description": "埋め込みモデル名です。[利用可能なモデルを取得](/ja/api-reference/models/get-available-models) で `model_type=text-embedding` を指定した際の `model` フィールドの値を使用します。" }, "embedding_model_provider": { "type": "string", "description": "埋め込みモデルプロバイダーです。[利用可能なモデルを取得](/ja/api-reference/models/get-available-models) で `model_type=text-embedding` を指定した際の `provider` フィールドの値を使用します。" }, "original_document_id": { "type": "string", "description": "バージョン管理用の元ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } } } } } }, "responses": { "200": { "description": "ドキュメントが正常に作成されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "document": { "$ref": "#/components/schemas/Document" }, "batch": { "type": "string", "description": "インデックス進捗を追跡するためのバッチ ID です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "document": { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "position": 1, "data_source_type": "upload_file", "data_source_info": { "upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }, "data_source_detail_dict": { "upload_file": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "guide.txt", "size": 2048, "extension": "txt", "mime_type": "text/plain", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200 } }, "dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234", "name": "guide.txt", "created_from": "api", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "tokens": 0, "indexing_status": "indexing", "error": null, "enabled": true, "disabled_at": null, "disabled_by": null, "archived": false, "display_status": "indexing", "word_count": 0, "hit_count": 0, "doc_form": "text_model", "doc_metadata": [], "summary_index_status": null, "need_summary": false }, "batch": "20250306150245647595" } } } } } }, "400": { "description": "- `provider_not_initialize` : ワークスペースにモデルプロバイダーの認証情報が設定されていません。\n- `invalid_param` : 最初のドキュメント追加時には `indexing_technique` が必須です。または `doc_form` が無効です。", "content": { "application/json": { "examples": { "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "invalid_param_indexing": { "summary": "invalid_param (indexing_technique)", "value": { "status": 400, "code": "invalid_param", "message": "indexing_technique is required." } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : ドキュメント数がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (documents limit)", "value": { "status": 403, "code": "forbidden", "message": "The number of documents has reached the limit of your subscription." } }, "forbidden_4": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/create-document-by-text", "metadata": { "title": "テキストからドキュメントを作成", "sidebarTitle": "テキストからドキュメントを作成" } } } }, "/datasets/{dataset_id}/document/create-by-file": { "post": { "tags": [ "ドキュメント" ], "summary": "ファイルからドキュメントを作成", "description": "アップロードしたファイルからナレッジベースにドキュメントを作成します。PDF、TXT、DOCX などの一般的な形式をサポートします。インデックスは非同期で実行されます。返された `batch` ID を使って [ドキュメント埋め込みステータス(進捗)を取得](/ja/api-reference/documents/get-document-indexing-status) で追跡します。", "operationId": "createDocumentFromFile", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "required": [ "file" ], "properties": { "file": { "type": "string", "format": "binary", "description": "アップロードするファイルです。" }, "data": { "type": "string", "description": "設定情報を含む JSON 文字列です。[テキストからドキュメントを作成](/ja/api-reference/documents/create-document-by-text) と同じフィールド(`indexing_technique`、`doc_form`、`doc_language`、`process_rule`、`retrieval_model`、`embedding_model`、`embedding_model_provider`)を受け付けますが、`name` と `text` は除きます。", "example": "{\"indexing_technique\":\"high_quality\",\"doc_form\":\"text_model\",\"doc_language\":\"English\",\"process_rule\":{\"mode\":\"automatic\"}}" } } } } } }, "responses": { "200": { "description": "ドキュメントが正常に作成されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "document": { "$ref": "#/components/schemas/Document" }, "batch": { "type": "string", "description": "インデックス進捗を追跡するためのバッチ ID です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "document": { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "position": 1, "data_source_type": "upload_file", "data_source_info": { "upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }, "data_source_detail_dict": { "upload_file": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "guide.txt", "size": 2048, "extension": "txt", "mime_type": "text/plain", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200 } }, "dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234", "name": "guide.txt", "created_from": "api", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "tokens": 0, "indexing_status": "indexing", "error": null, "enabled": true, "disabled_at": null, "disabled_by": null, "archived": false, "display_status": "indexing", "word_count": 0, "hit_count": 0, "doc_form": "text_model", "doc_metadata": [], "summary_index_status": null, "need_summary": false }, "batch": "20250306150245647595" } } } } } }, "400": { "description": "- `no_file_uploaded` : リクエストにファイルが提供されていません。\n- `too_many_files` : 1 回のリクエストにつき 1 ファイルのみ許可されています。\n- `filename_not_exists_error` : アップロードされたファイルにファイル名がありません。\n- `provider_not_initialize` : ワークスペースにモデルプロバイダーの認証情報が設定されていません。\n- `invalid_param` : ナレッジベースが外部です。`indexing_technique` が必須、または `process_rule` がありません。", "content": { "application/json": { "examples": { "no_file_uploaded": { "summary": "no_file_uploaded", "value": { "status": 400, "code": "no_file_uploaded", "message": "Please upload your file." } }, "too_many_files": { "summary": "too_many_files", "value": { "status": 400, "code": "too_many_files", "message": "Only one file is allowed." } }, "filename_not_exists_error": { "summary": "filename_not_exists_error", "value": { "status": 400, "code": "filename_not_exists_error", "message": "The specified filename does not exist." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "invalid_param_external": { "summary": "invalid_param (external)", "value": { "status": 400, "code": "invalid_param", "message": "External datasets are not supported." } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : ドキュメント数がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (documents limit)", "value": { "status": 403, "code": "forbidden", "message": "The number of documents has reached the limit of your subscription." } }, "forbidden_4": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/create-document-by-file", "metadata": { "title": "ファイルからドキュメントを作成", "sidebarTitle": "ファイルからドキュメントを作成" } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request POST \\\n --url 'https://{api_base_url}/datasets/{dataset_id}/document/create-by-file' \\\n --header 'Authorization: Bearer {api_key}' \\\n --form 'file=@quarterly-report.pdf' \\\n --form 'data={\"indexing_technique\":\"high_quality\",\"process_rule\":{\"mode\":\"automatic\"}};type=application/json'" } ] } }, "/datasets/{dataset_id}/documents": { "get": { "tags": [ "ドキュメント" ], "summary": "ナレッジベースのドキュメントリストを取得", "description": "ナレッジベース内のドキュメントのページネーションされた一覧を返します。", "operationId": "listDocuments", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 }, "description": "ページ番号。" }, { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20 }, "description": "1 ページあたりの項目数です。サーバーの上限は `100` です。" }, { "name": "keyword", "in": "query", "schema": { "type": "string" }, "description": "ドキュメント名でフィルタリングするための検索キーワードです。" }, { "name": "status", "in": "query", "schema": { "type": "string", "enum": [ "queuing", "indexing", "paused", "error", "available", "disabled", "archived" ] }, "description": "表示ステータスでフィルタリングします。" } ], "responses": { "200": { "description": "ドキュメントのリストです。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "description": "ドキュメントオブジェクトの配列です。", "items": { "$ref": "#/components/schemas/Document" } }, "has_more": { "type": "boolean", "description": "次のページにさらに項目が存在するかどうかです。" }, "limit": { "type": "integer", "description": "1 ページあたりの件数です。" }, "total": { "type": "integer", "description": "一致する項目の合計数です。" }, "page": { "type": "integer", "description": "現在のページ番号です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": [ { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "position": 1, "data_source_type": "upload_file", "data_source_info": { "upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }, "data_source_detail_dict": { "upload_file": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "guide.txt", "size": 2048, "extension": "txt", "mime_type": "text/plain", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200 } }, "dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234", "name": "guide.txt", "created_from": "api", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "tokens": 512, "indexing_status": "completed", "error": null, "enabled": true, "disabled_at": null, "disabled_by": null, "archived": false, "display_status": "available", "word_count": 350, "hit_count": 0, "doc_form": "text_model", "doc_metadata": [], "summary_index_status": null, "need_summary": false } ], "has_more": false, "limit": 20, "total": 1, "page": 1 } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/list-documents", "metadata": { "title": "ナレッジベースのドキュメントリストを取得", "sidebarTitle": "ナレッジベースのドキュメントリストを取得" } } } }, "/datasets/{dataset_id}/documents/{document_id}": { "get": { "tags": [ "ドキュメント" ], "summary": "ドキュメント詳細を取得", "description": "1 つのドキュメントの詳細情報を返します。", "operationId": "getDocumentDetail", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "metadata", "in": "query", "schema": { "type": "string", "enum": [ "all", "only", "without" ], "default": "all" }, "description": "`all` はメタデータを含むすべてのフィールドを返します。`only` は `id`、`doc_type`、`doc_metadata` のみを返します。`without` は `doc_metadata` を除くすべてのフィールドを返します。" } ], "responses": { "200": { "description": "ドキュメントの詳細です。返されるフィールドは `metadata` クエリパラメータによって異なります。", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "description": "ドキュメント識別子です。" }, "position": { "type": "integer", "description": "ナレッジベース内の位置インデックスです。" }, "data_source_type": { "type": "string", "description": "ドキュメントのアップロード方法です。ファイルアップロードの場合は `upload_file`、Notion インポートの場合は `notion_import` です。" }, "data_source_info": { "type": "object", "description": "データソースの詳細です。ファイルアップロードの場合、この詳細エンドポイントは `upload_file` 配下に完全なファイルオブジェクトを返します(リストエンドポイントは `upload_file_id` のみを返します)。", "properties": { "upload_file": { "type": "object", "description": "アップロードされたファイルの詳細です。`data_source_type` が `upload_file` の場合に返されます。", "properties": { "id": { "type": "string", "description": "ファイル識別子です。" }, "name": { "type": "string", "description": "元のファイル名です。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト単位)です。" }, "extension": { "type": "string", "description": "ファイル拡張子です。" }, "mime_type": { "type": "string", "description": "ファイルの MIME タイプです。" }, "created_by": { "type": "string", "description": "ファイルをアップロードしたユーザーの ID です。" }, "created_at": { "type": "integer", "description": "ファイルアップロードの Unix タイムスタンプです。" } } } } }, "dataset_process_rule_id": { "type": "string", "description": "このドキュメントに適用された処理ルールの ID です。" }, "dataset_process_rule": { "type": "object", "description": "ナレッジベースレベルの処理ルール設定です。" }, "document_process_rule": { "type": "object", "description": "ドキュメントレベルの処理ルール設定です。" }, "name": { "type": "string", "description": "ドキュメント名です。" }, "created_from": { "type": "string", "description": "ドキュメントの作成元です。API で作成した場合は `api`、UI で作成した場合は `web` です。" }, "created_by": { "type": "string", "description": "ドキュメントを作成したユーザーの ID です。" }, "created_at": { "type": "number", "description": "ドキュメント作成の Unix タイムスタンプです。" }, "tokens": { "type": "integer", "description": "ドキュメント内のトークン数です。" }, "indexing_status": { "type": "string", "description": "現在のインデックスステータスです(例:`waiting`、`parsing`、`cleaning`、`splitting`、`indexing`、`completed`、`error`、`paused`)。" }, "error": { "type": "string", "nullable": true, "description": "インデックス作成が失敗した場合のエラーメッセージです。それ以外は `null` です。" }, "enabled": { "type": "boolean", "description": "このドキュメントが検索に対して有効かどうかです。" }, "disabled_at": { "type": "number", "nullable": true, "description": "ドキュメントが無効化された Unix タイムスタンプです。有効な場合は `null` です。" }, "disabled_by": { "type": "string", "nullable": true, "description": "ドキュメントを無効化したユーザーの ID です。有効な場合は `null` です。" }, "archived": { "type": "boolean", "description": "ドキュメントがアーカイブ済みかどうかです。" }, "display_status": { "type": "string", "description": "UI 向けの表示用インデックスステータスです。" }, "hit_count": { "type": "integer", "description": "このドキュメントが検索された回数です。" }, "doc_form": { "type": "string", "description": "ドキュメントのチャンキングモードです。`text_model` は標準テキスト、`hierarchical_model` は親子構造、`qa_model` は QA ペアを示します。" }, "doc_language": { "type": "string", "description": "ドキュメント内容の言語です。" }, "doc_type": { "type": "string", "nullable": true, "description": "ドキュメントタイプの分類です。未設定の場合は `null` です。" }, "doc_metadata": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "メタデータフィールドの識別子です。" }, "name": { "type": "string", "description": "メタデータフィールド名です。" }, "type": { "type": "string", "description": "メタデータフィールドの種類です。" }, "value": { "type": "string", "description": "このドキュメントのメタデータフィールド値。" } } }, "description": "このドキュメントのカスタムメタデータキーバリューペア。" }, "completed_at": { "type": "number", "nullable": true, "description": "処理が完了した Unix タイムスタンプです。まだ完了していない場合は `null` です。" }, "updated_at": { "type": "number", "nullable": true, "description": "最終更新の Unix タイムスタンプです。更新されたことがない場合は `null` です。" }, "indexing_latency": { "type": "number", "nullable": true, "description": "インデックス作成にかかった時間(秒)です。未完了の場合は `null` です。" }, "segment_count": { "type": "integer", "description": "ドキュメント内のチャンク数です。" }, "average_segment_length": { "type": "number", "description": "チャンクの平均文字長です。" }, "summary_index_status": { "type": "string", "nullable": true, "description": "要約インデックスのステータスです。要約インデックスが有効でない場合は `null` です。" }, "need_summary": { "type": "boolean", "description": "このドキュメントが要約生成を必要とするかどうかです。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "position": 1, "data_source_type": "upload_file", "data_source_info": { "upload_file": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "guide.txt", "size": 2048, "extension": "txt", "mime_type": "text/plain", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200 } }, "dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234", "dataset_process_rule": { "id": "e1f2a3b4-c5d6-7890-ef12-345678901234", "mode": "custom" }, "document_process_rule": { "mode": "custom", "rules": { "pre_processing_rules": [], "segmentation": { "separator": "###", "max_tokens": 500, "chunk_overlap": 50 } } }, "name": "guide.txt", "created_from": "api", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "tokens": 512, "indexing_status": "completed", "error": null, "enabled": true, "disabled_at": null, "disabled_by": null, "archived": false, "display_status": "available", "hit_count": 0, "doc_form": "text_model", "doc_language": "English", "doc_type": null, "doc_metadata": [], "completed_at": 1741267260, "updated_at": 1741267260, "indexing_latency": 60.0, "segment_count": 5, "average_segment_length": 70.0, "summary_index_status": null, "need_summary": false } } } } } }, "400": { "description": "`invalid_metadata` : `metadata` クエリパラメータの値が無効です(`all`、`only`、`without` のいずれかである必要があります)。", "content": { "application/json": { "examples": { "invalid_metadata": { "summary": "invalid_metadata", "value": { "status": 400, "code": "invalid_metadata", "message": "Invalid metadata value: only" } } } } } }, "403": { "description": "- `forbidden` : このドキュメントにアクセスする権限がありません。\n- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (no permission)", "value": { "status": 403, "code": "forbidden", "message": "No permission." } }, "forbidden_2": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : ドキュメントが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/get-document", "metadata": { "title": "ドキュメント詳細を取得", "sidebarTitle": "ドキュメント詳細を取得" } } }, "delete": { "tags": [ "ドキュメント" ], "summary": "ドキュメントを削除", "description": "ナレッジベースからドキュメントとそのすべてのチャンクを完全に削除します。", "operationId": "deleteDocument", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } ], "responses": { "204": { "description": "Success." }, "403": { "description": "- `archived_document_immutable` : アーカイブされたドキュメントは編集できません。\n- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "archived_document_immutable": { "summary": "archived_document_immutable", "value": { "status": 403, "code": "archived_document_immutable", "message": "The archived document is not editable." } }, "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ドキュメントが存在しません。 ナレッジベース自体が存在しない場合は \"Dataset not found.\" が返ります。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document Not Exists." } }, "not_found_2": { "summary": "not_found_2", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/delete-document", "metadata": { "title": "ドキュメントを削除", "sidebarTitle": "ドキュメントを削除" } } }, "patch": { "tags": [ "ドキュメント" ], "summary": "ドキュメントを更新", "description": "新しいファイルをアップロードしてドキュメントを更新し、再インデックスします。これはファイルベースのドキュメント更新の正規エンドポイントです。返された `batch` ID を使って [ドキュメント埋め込みステータス(進捗)を取得](/ja/api-reference/documents/get-document-indexing-status) で進捗を追跡します。", "operationId": "updateDocument", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "file": { "type": "string", "format": "binary", "description": "アップロードするファイルです。" }, "data": { "type": "string", "description": "設定情報を含む JSON 文字列です。[テキストからドキュメントを作成](/ja/api-reference/documents/create-document-by-text) と同じフィールド(`doc_form`、`doc_language`、`process_rule`、`retrieval_model`、`embedding_model`、`embedding_model_provider`)を受け付けますが、`name` と `text` は除きます。", "example": "{\"doc_form\":\"text_model\",\"doc_language\":\"English\",\"process_rule\":{\"mode\":\"automatic\"}}" } } } } } }, "responses": { "200": { "description": "ドキュメントが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "document": { "$ref": "#/components/schemas/Document" }, "batch": { "type": "string", "description": "インデックス進捗を追跡するためのバッチ ID です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "document": { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "position": 1, "data_source_type": "upload_file", "data_source_info": { "upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }, "data_source_detail_dict": { "upload_file": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "guide.txt", "size": 2048, "extension": "txt", "mime_type": "text/plain", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200 } }, "dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234", "name": "guide.txt", "created_from": "api", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "tokens": 512, "indexing_status": "completed", "error": null, "enabled": true, "disabled_at": null, "disabled_by": null, "archived": false, "display_status": "available", "word_count": 350, "hit_count": 0, "doc_form": "text_model", "doc_metadata": [], "summary_index_status": null, "need_summary": false }, "batch": "20250306150245647595" } } } } } }, "400": { "description": "- `too_many_files` : 1 回のリクエストにつき 1 ファイルのみ許可されています。\n- `filename_not_exists_error` : アップロードされたファイルにファイル名がありません。\n- `provider_not_initialize` : ワークスペースにモデルプロバイダーの認証情報が設定されていません。\n- `invalid_param` : ドキュメントが更新できる状態ではありません(利用可能なドキュメントのみ更新できます)。", "content": { "application/json": { "examples": { "too_many_files": { "summary": "too_many_files", "value": { "status": 400, "code": "too_many_files", "message": "Only one file is allowed." } }, "filename_not_exists_error": { "summary": "filename_not_exists_error", "value": { "status": 400, "code": "filename_not_exists_error", "message": "The specified filename does not exist." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "invalid_param_not_available": { "summary": "invalid_param (not available)", "value": { "status": 400, "code": "invalid_param", "message": "Document is not available" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } } } } } }, "413": { "description": "`file_too_large` : ファイルサイズが上限を超えています。", "content": { "application/json": { "examples": { "file_too_large": { "summary": "file_too_large", "value": { "status": 413, "code": "file_too_large", "message": "File size exceeded." } } } } } }, "415": { "description": "`unsupported_file_type` : 許可されていないファイルタイプです。", "content": { "application/json": { "examples": { "unsupported_file_type": { "summary": "unsupported_file_type", "value": { "status": 415, "code": "unsupported_file_type", "message": "File type not allowed." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/update-document", "metadata": { "title": "ドキュメントを更新", "sidebarTitle": "ドキュメントを更新" } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request PATCH \\\n --url 'https://{api_base_url}/datasets/{dataset_id}/documents/{document_id}' \\\n --header 'Authorization: Bearer {api_key}' \\\n --form 'file=@quarterly-report.pdf' \\\n --form 'data={\"process_rule\":{\"mode\":\"automatic\"}};type=application/json'" } ] } }, "/datasets/{dataset_id}/documents/{document_id}/download": { "get": { "tags": [ "ドキュメント" ], "summary": "ドキュメントをダウンロード", "description": "ドキュメントの元のアップロードファイルをダウンロードするための署名付き URL を返します。", "operationId": "downloadDocumentJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } ], "responses": { "200": { "description": "ダウンロード URL が正常に生成されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "url": { "type": "string", "description": "元のアップロードファイルをダウンロードするための署名付き URL です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "url": "https://storage.example.com/datasets/documents/abc123/original-file.pdf?token=xyz789&expires=1741353600" } } } } } }, "403": { "description": "- `forbidden` : このドキュメントにアクセスする権限がありません。\n- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (no permission)", "value": { "status": 403, "code": "forbidden", "message": "No permission." } }, "forbidden_2": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_3": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ドキュメントが見つかりません。 保存ファイルが見つからない場合は \"Uploaded file not found.\"、ファイル以外のドキュメントでは \"Document does not have an uploaded file to download.\" が返ります。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_2": { "summary": "not_found_2", "value": { "status": 404, "code": "not_found", "message": "Uploaded file not found." } }, "not_found_3": { "summary": "not_found_3", "value": { "status": 404, "code": "not_found", "message": "Document does not have an uploaded file to download." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/download-document", "metadata": { "title": "ドキュメントをダウンロード", "sidebarTitle": "ドキュメントをダウンロード" } } } }, "/datasets/{dataset_id}/documents/{batch}/indexing-status": { "get": { "tags": [ "ドキュメント" ], "summary": "ドキュメント埋め込みステータス(進捗)を取得", "description": "バッチ内のすべてのドキュメントのインデックス進捗(現在の段階とチャンク完了数)を返します。各 `indexing_status` が `completed` または `error` に達するまでポーリングします。ステータスは `waiting` → `parsing` → `cleaning` → `splitting` → `indexing` → `completed` の順に進みます。", "operationId": "getDocumentIndexingStatus", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "batch", "in": "path", "required": true, "schema": { "type": "string" }, "description": "ドキュメントの作成時または更新時に返されるバッチ ID です。" } ], "responses": { "200": { "description": "バッチ内のドキュメントのインデックス状態です。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "ドキュメント識別子です。" }, "indexing_status": { "type": "string", "description": "現在のインデックスステータスです:`waiting`、`parsing`、`cleaning`、`splitting`、`indexing`、`completed`、または `error`。" }, "processing_started_at": { "type": "number", "nullable": true, "description": "処理開始時の Unix タイムスタンプです。" }, "parsing_completed_at": { "type": "number", "nullable": true, "description": "解析完了時の Unix タイムスタンプです。" }, "cleaning_completed_at": { "type": "number", "nullable": true, "description": "クリーニング完了時の Unix タイムスタンプです。" }, "splitting_completed_at": { "type": "number", "nullable": true, "description": "分割完了時の Unix タイムスタンプです。" }, "completed_at": { "type": "number", "nullable": true, "description": "インデックス完了時の Unix タイムスタンプです。" }, "paused_at": { "type": "number", "nullable": true, "description": "インデキシングが一時停止されたタイムスタンプ。一時停止されていない場合は `null`。" }, "error": { "type": "string", "nullable": true, "description": "インデキシングが失敗した場合のエラーメッセージ。エラーがない場合は `null`。" }, "stopped_at": { "type": "number", "nullable": true, "description": "インデキシングが停止されたタイムスタンプ。停止されていない場合は `null`。" }, "completed_segments": { "type": "integer", "description": "インデックス済みのチャンク数です。" }, "total_segments": { "type": "integer", "description": "インデックス対象のチャンクの合計数です。" } } }, "description": "インデキシングステータスエントリのリスト。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": [ { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "indexing_status": "completed", "processing_started_at": 1741267200, "parsing_completed_at": 1741267200, "cleaning_completed_at": 1741267200, "splitting_completed_at": 1741267200, "completed_at": 1741267200, "paused_at": null, "error": null, "stopped_at": null, "completed_segments": 5, "total_segments": 5 } ] } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。", "content": { "application/json": { "examples": { "dataset_not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "documents_not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Documents not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/get-document-indexing-status", "metadata": { "title": "ドキュメント埋め込みステータス(進捗)を取得", "sidebarTitle": "ドキュメント埋め込みステータス(進捗)を取得" } } } }, "/datasets/{dataset_id}/documents/{document_id}/update-by-text": { "post": { "tags": [ "ドキュメント" ], "summary": "テキストでドキュメントを更新", "description": "ドキュメントのテキスト内容、名前、または処理設定を更新します。テキストが変更されると、ドキュメントを再インデックスします。", "operationId": "updateDocumentByText", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "ドキュメント名です。`text` を指定する場合は必須です。" }, "text": { "type": "string", "description": "ドキュメントのテキスト内容です。" }, "process_rule": { "type": "object", "description": "チャンキングの処理ルールです。", "required": [ "mode" ], "properties": { "mode": { "type": "string", "enum": [ "automatic", "custom", "hierarchical" ], "description": "`automatic` は組み込みルールを使用、`custom` は手動設定が可能、`hierarchical` は親子チャンク構造を有効にします(`doc_form: hierarchical_model` と組み合わせて使用)。" }, "rules": { "type": "object", "properties": { "pre_processing_rules": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "enum": [ "remove_stopwords", "remove_extra_spaces", "remove_urls_emails" ], "description": "ルール識別子です。" }, "enabled": { "type": "boolean", "description": "この前処理ルールが有効かどうかです。" } } } }, "segmentation": { "type": "object", "properties": { "separator": { "type": "string", "default": "\n", "description": "テキスト分割用のカスタムセパレーターです。" }, "max_tokens": { "type": "integer", "description": "チャンクあたりの最大トークン数です。" }, "chunk_overlap": { "type": "integer", "default": 0, "description": "チャンク間のトークンオーバーラップです。" } } } } } } }, "doc_form": { "type": "string", "enum": [ "text_model", "hierarchical_model", "qa_model" ], "default": "text_model", "description": "`text_model` は標準テキストチャンキング、`hierarchical_model` は親子チャンク構造、`qa_model` は質問・回答ペアの抽出です。" }, "doc_language": { "type": "string", "default": "English", "description": "処理最適化のためのドキュメント言語です。" }, "retrieval_model": { "$ref": "#/components/schemas/RetrievalModel", "description": "このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。" } } } } } }, "responses": { "200": { "description": "ドキュメントが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "document": { "$ref": "#/components/schemas/Document" }, "batch": { "type": "string", "description": "インデックス進捗を追跡するためのバッチ ID です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "document": { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "position": 1, "data_source_type": "upload_file", "data_source_info": { "upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }, "data_source_detail_dict": { "upload_file": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "guide.txt", "size": 2048, "extension": "txt", "mime_type": "text/plain", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200 } }, "dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234", "name": "guide.txt", "created_from": "api", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "tokens": 512, "indexing_status": "completed", "error": null, "enabled": true, "disabled_at": null, "disabled_by": null, "archived": false, "display_status": "available", "word_count": 350, "hit_count": 0, "doc_form": "text_model", "doc_metadata": [], "summary_index_status": null, "need_summary": false }, "batch": "20250306150245647595" } } } } } }, "400": { "description": "- `provider_not_initialize` : ワークスペースにモデルプロバイダーの認証情報が設定されていません。\n- `invalid_param` : `text` を指定する場合は `name` が必須です。または `doc_form` が無効です。\n- `invalid_param` : ドキュメントが更新できる状態ではありません(利用可能なドキュメントのみ更新できます)。", "content": { "application/json": { "examples": { "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "invalid_param_name": { "summary": "invalid_param (name required)", "value": { "status": 400, "code": "invalid_param", "message": "name is required when text is provided." } }, "invalid_param_not_available": { "summary": "invalid_param (not available)", "value": { "status": 400, "code": "invalid_param", "message": "Document is not available" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/update-document-by-text", "metadata": { "title": "テキストでドキュメントを更新", "sidebarTitle": "テキストでドキュメントを更新" } } } }, "/datasets/{dataset_id}/documents/{document_id}/update-by-file": { "post": { "tags": [ "ドキュメント" ], "summary": "ファイルでドキュメントを更新", "description": "非推奨です。代わりに [ドキュメントを更新](/ja/api-reference/documents/update-document) を使用してください。新しいファイルをアップロードしてドキュメントを更新し、再インデックスします。", "operationId": "updateDocumentByFile", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "file": { "type": "string", "format": "binary", "description": "アップロードするファイルです。" }, "data": { "type": "string", "description": "設定情報を含む JSON 文字列です。[テキストからドキュメントを作成](/ja/api-reference/documents/create-document-by-text) と同じフィールド(`doc_form`、`doc_language`、`process_rule`、`retrieval_model`、`embedding_model`、`embedding_model_provider`)を受け付けますが、`name` と `text` は除きます。", "example": "{\"doc_form\":\"text_model\",\"doc_language\":\"English\",\"process_rule\":{\"mode\":\"automatic\"}}" } } } } } }, "responses": { "200": { "description": "ドキュメントが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "document": { "$ref": "#/components/schemas/Document" }, "batch": { "type": "string", "description": "インデックス進捗を追跡するためのバッチ ID です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "document": { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "position": 1, "data_source_type": "upload_file", "data_source_info": { "upload_file_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }, "data_source_detail_dict": { "upload_file": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "guide.txt", "size": 2048, "extension": "txt", "mime_type": "text/plain", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200 } }, "dataset_process_rule_id": "e1f2a3b4-c5d6-7890-ef12-345678901234", "name": "guide.txt", "created_from": "api", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "tokens": 512, "indexing_status": "completed", "error": null, "enabled": true, "disabled_at": null, "disabled_by": null, "archived": false, "display_status": "available", "word_count": 350, "hit_count": 0, "doc_form": "text_model", "doc_metadata": [], "summary_index_status": null, "need_summary": false }, "batch": "20250306150245647595" } } } } } }, "400": { "description": "- `too_many_files` : 1 回のリクエストにつき 1 ファイルのみ許可されています。\n- `filename_not_exists_error` : アップロードされたファイルにファイル名がありません。\n- `provider_not_initialize` : ワークスペースにモデルプロバイダーの認証情報が設定されていません。\n- `invalid_param` : ドキュメントが更新できる状態ではありません(利用可能なドキュメントのみ更新できます)。", "content": { "application/json": { "examples": { "too_many_files": { "summary": "too_many_files", "value": { "status": 400, "code": "too_many_files", "message": "Only one file is allowed." } }, "filename_not_exists_error": { "summary": "filename_not_exists_error", "value": { "status": 400, "code": "filename_not_exists_error", "message": "The specified filename does not exist." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "invalid_param_not_available": { "summary": "invalid_param (not available)", "value": { "status": 400, "code": "invalid_param", "message": "Document is not available" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } } } } } }, "413": { "description": "`file_too_large` : ファイルサイズが上限を超えています。", "content": { "application/json": { "examples": { "file_too_large": { "summary": "file_too_large", "value": { "status": 413, "code": "file_too_large", "message": "File size exceeded." } } } } } }, "415": { "description": "`unsupported_file_type` : 許可されていないファイルタイプです。", "content": { "application/json": { "examples": { "unsupported_file_type": { "summary": "unsupported_file_type", "value": { "status": 415, "code": "unsupported_file_type", "message": "File type not allowed." } } } } } } }, "deprecated": true, "x-mint": { "href": "/ja/api-reference/documents/update-document-by-file", "metadata": { "title": "ファイルでドキュメントを更新", "sidebarTitle": "ファイルでドキュメントを更新" } } } }, "/datasets/{dataset_id}/documents/download-zip": { "post": { "tags": [ "ドキュメント" ], "summary": "ドキュメントを一括ダウンロード(ZIP)", "description": "1 つ以上のドキュメントを単一の ZIP アーカイブとしてダウンロードします。ファイルとしてアップロードされたドキュメントのみ含められます。", "operationId": "downloadDocumentsZipJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "document_ids" ], "properties": { "document_ids": { "type": "array", "minItems": 1, "maxItems": 100, "items": { "type": "string", "format": "uuid" }, "description": "アーカイブに含めるドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } } } } } }, "responses": { "200": { "description": "リクエストされたドキュメントを含む ZIP アーカイブです。", "content": { "application/zip": { "schema": { "type": "string", "format": "binary", "description": "ZIP アーカイブのバイナリストリームです。" } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。\n- `forbidden` : このナレッジベースにアクセスする権限がありません。\n- `forbidden` : リクエストされたドキュメントのいずれかにアクセスする権限がありません。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (dataset permission)", "value": { "status": 403, "code": "forbidden", "message": "You do not have permission to access this dataset." } }, "forbidden_4": { "summary": "forbidden (document permission)", "value": { "status": 403, "code": "forbidden", "message": "No permission." } } } } } }, "404": { "description": "- `not_found` : ドキュメントが見つかりません。\n- `not_found` : ナレッジベースが見つかりません。 リクエストしたドキュメントにアップロード済みファイルがない場合は \"Only uploaded-file documents can be downloaded as ZIP.\" が返ります。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_3": { "summary": "not_found_3", "value": { "status": 404, "code": "not_found", "message": "Only uploaded-file documents can be downloaded as ZIP." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/download-documents-as-zip", "metadata": { "title": "ドキュメントを一括ダウンロード(ZIP)", "sidebarTitle": "ドキュメントを一括ダウンロード(ZIP)" } } } }, "/datasets/{dataset_id}/documents/status/{action}": { "patch": { "tags": [ "ドキュメント" ], "summary": "ドキュメントステータスを一括更新", "description": "複数のドキュメントを 1 回のリクエストで有効化、無効化、アーカイブ、またはアーカイブ解除します。", "operationId": "batchUpdateDocumentStatus", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "action", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "enable", "disable", "archive", "un_archive" ] }, "description": "`enable` はドキュメントを検索対象として有効化し、`disable` は無効化し、`archive` はアーカイブに移動し、`un_archive` はアーカイブから復元します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "document_ids" ], "properties": { "document_ids": { "type": "array", "items": { "type": "string" }, "description": "更新するドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } } } } } }, "responses": { "200": { "description": "ドキュメントが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "description": "操作結果です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "result": "success" } } } } } }, "400": { "description": "`invalid_action` : アクションが無効です。またはドキュメントがアクションを許可しない状態です(インデックス中、または未完了など)。", "content": { "application/json": { "examples": { "invalid_action": { "summary": "invalid_action", "value": { "status": 400, "code": "invalid_action", "message": "Invalid action." } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/documents/update-document-status-in-batch", "metadata": { "title": "ドキュメントステータスを一括更新", "sidebarTitle": "ドキュメントステータスを一括更新" } } } }, "/datasets/{dataset_id}/documents/{document_id}/segments": { "post": { "tags": [ "チャンク" ], "summary": "ドキュメントにチャンクを追加", "description": "ドキュメント内に 1 つ以上のチャンクを作成します。", "operationId": "createSegments", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "segments" ], "properties": { "segments": { "type": "array", "items": { "type": "object", "properties": { "content": { "type": "string", "description": "チャンクのテキスト内容です。", "minLength": 1 }, "answer": { "type": "string", "description": "回答テキストです。Q&A モード(`qa_model`)のドキュメントでは必須です。" }, "keywords": { "type": "array", "items": { "type": "string" }, "description": "チャンクのキーワードです。" }, "attachment_ids": { "type": "array", "items": { "type": "string" }, "description": "添付ファイル ID です。" } }, "required": [ "content" ] }, "description": "作成するチャンクオブジェクトの配列です。", "minItems": 1 } } } } } }, "responses": { "200": { "description": "チャンクが正常に作成されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Segment" }, "description": "作成されたチャンクのリスト。" }, "doc_form": { "type": "string", "description": "このドキュメントが使用するドキュメントチャンキングモードです。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": [ { "id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1", "position": 1, "document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "content": "Dify is an open-source LLM app development platform.", "sign_content": "", "answer": "", "word_count": 9, "tokens": 12, "keywords": [ "dify", "platform", "llm" ], "index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001", "index_node_hash": "abc123def456", "hit_count": 0, "enabled": true, "disabled_at": null, "disabled_by": null, "status": "completed", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "updated_at": 1741267200, "updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "indexing_at": 1741267200, "completed_at": 1741267200, "error": null, "stopped_at": null, "child_chunks": [], "attachments": [], "summary": null } ], "doc_form": "text_model" } } } } } }, "400": { "description": "- `provider_not_initialize` : ナレッジベースは高品質インデックスを使用していますが、埋め込みモデルが未設定または誤って設定されています。\n- `invalid_param` : チャンクのフィールドが無効です(例:Q&A モードのドキュメントでは `answer` が必須)。またはチャンク数がリクエストごとの上限を超えています。\n- リクエストボディのスキーマ検証(`content` が空など)では、`code` や `status` を持たない非標準のボディ `{\"error\": \"<検証の詳細>\"}` が返されます。", "content": { "application/json": { "examples": { "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider." } }, "invalid_param_limit": { "summary": "invalid_param (segments limit)", "value": { "status": 400, "code": "invalid_param", "message": "Exceeded maximum segments limit of 1000." } }, "validation_error": { "summary": "schema validation (non-standard body)", "value": { "error": "1 validation error for SegmentCreatePayload\nsegments.0.content\n String should have at least 1 character [type=string_too_short, input_value='', input_type=str]" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。\n- `forbidden` : To unlock this feature and elevate your Dify experience, please upgrade to a paid plan.", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } }, "forbidden_4": { "summary": "forbidden (upgrade plan)", "value": { "status": 403, "code": "forbidden", "message": "To unlock this feature and elevate your Dify experience, please upgrade to a paid plan." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。\n- `not_found` : ドキュメントの処理が完了していません。\n- `not_found` : ドキュメントが無効化されています。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_3": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document is not completed." } }, "not_found_4": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document is disabled." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/create-chunks", "metadata": { "title": "ドキュメントにチャンクを追加", "sidebarTitle": "ドキュメントにチャンクを追加" } } }, "get": { "tags": [ "チャンク" ], "summary": "チャンク一覧を取得", "description": "ドキュメント内のチャンクのページネーションリストを返します。任意でキーワードまたはインデックスステータスでフィルタリングできます。", "operationId": "listSegments", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1, "minimum": 1 }, "description": "ページ番号。" }, { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20, "minimum": 1 }, "description": "1 ページあたりの項目数です。サーバーの上限は `100` です。" }, { "name": "status", "in": "query", "schema": { "type": "array", "items": { "type": "string" } }, "style": "form", "explode": true, "description": "インデックスステータスでチャンクをフィルタリングします(例:`completed`、`indexing`、`error`)。" }, { "name": "keyword", "in": "query", "schema": { "type": "string" }, "description": "検索キーワードです。" } ], "responses": { "200": { "description": "チャンクのリストです。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Segment" }, "description": "チャンクのリスト。" }, "doc_form": { "type": "string", "description": "このドキュメントが使用するドキュメントチャンキングモードです。" }, "total": { "type": "integer", "description": "一致するチャンクの合計数です。" }, "has_more": { "type": "boolean", "description": "次のページにさらに項目が存在するかどうかです。" }, "limit": { "type": "integer", "description": "1 ページあたりの件数です。" }, "page": { "type": "integer", "description": "現在のページ番号です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": [ { "id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1", "position": 1, "document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "content": "Dify is an open-source LLM app development platform.", "sign_content": "", "answer": "", "word_count": 9, "tokens": 12, "keywords": [ "dify", "platform", "llm" ], "index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001", "index_node_hash": "abc123def456", "hit_count": 0, "enabled": true, "disabled_at": null, "disabled_by": null, "status": "completed", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "updated_at": 1741267200, "updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "indexing_at": 1741267200, "completed_at": 1741267200, "error": null, "stopped_at": null, "child_chunks": [], "attachments": [], "summary": null } ], "doc_form": "text_model", "total": 1, "has_more": false, "limit": 20, "page": 1 } } } } } }, "400": { "description": "`provider_not_initialize` : ナレッジベースは高品質インデックスを使用していますが、埋め込みモデルが未設定または誤って設定されています。", "content": { "application/json": { "examples": { "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider." } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/list-chunks", "metadata": { "title": "チャンク一覧を取得", "sidebarTitle": "チャンク一覧を取得" } } } }, "/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}": { "get": { "tags": [ "チャンク" ], "summary": "ドキュメント内のチャンク詳細を取得", "description": "1 つのチャンクの詳細をすべて取得します。", "operationId": "getSegmentDetail", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "segment_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "チャンク ID です。[チャンク一覧を取得](/ja/api-reference/chunks/list-chunks) から取得します。" } ], "responses": { "200": { "description": "チャンクの詳細です。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/Segment" }, "doc_form": { "type": "string", "description": "このドキュメントが使用するドキュメントチャンキングモードです。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": { "id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1", "position": 1, "document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "content": "Dify is an open-source LLM app development platform.", "sign_content": "", "answer": "", "word_count": 9, "tokens": 12, "keywords": [ "dify", "platform", "llm" ], "index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001", "index_node_hash": "abc123def456", "hit_count": 0, "enabled": true, "disabled_at": null, "disabled_by": null, "status": "completed", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "updated_at": 1741267200, "updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "indexing_at": 1741267200, "completed_at": 1741267200, "error": null, "stopped_at": null, "child_chunks": [], "attachments": [], "summary": null }, "doc_form": "text_model" } } } } } }, "400": { "description": "`invalid_param` : ナレッジベースは高品質インデックスを使用していますが、埋め込みモデルが未設定または誤って設定されています。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider." } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。\n- `not_found` : チャンクが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_3": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Segment not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/get-chunk", "metadata": { "title": "ドキュメント内のチャンク詳細を取得", "sidebarTitle": "ドキュメント内のチャンク詳細を取得" } } }, "post": { "tags": [ "チャンク" ], "summary": "ドキュメント内のチャンクを更新", "description": "チャンクのフィールドを更新します。この更新により、そのチャンクのインデックス作成が再トリガーされます。", "operationId": "updateSegment", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "segment_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "チャンク ID です。[チャンク一覧を取得](/ja/api-reference/chunks/list-chunks) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "segment" ], "properties": { "segment": { "type": "object", "properties": { "content": { "type": "string", "description": "チャンクのテキスト内容です。" }, "answer": { "type": "string", "description": "Q&A モード(`qa_model`)のドキュメントの回答テキストです。" }, "keywords": { "type": "array", "items": { "type": "string" }, "description": "チャンクのキーワードです。" }, "enabled": { "type": "boolean", "description": "チャンクが有効かどうかです。" }, "regenerate_child_chunks": { "type": "boolean", "default": false, "description": "子チャンクを再生成するかどうかです。" }, "attachment_ids": { "type": "array", "items": { "type": "string" }, "description": "添付ファイル ID です。" }, "summary": { "type": "string", "nullable": true, "description": "サマリーインデックスのサマリー内容です。" } }, "description": "更新するチャンクデータです。" } } } } } }, "responses": { "200": { "description": "チャンクが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/Segment" }, "doc_form": { "type": "string", "description": "このドキュメントが使用するドキュメントチャンキングモードです。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": { "id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1", "position": 1, "document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "content": "Dify is an open-source LLM app development platform.", "sign_content": "", "answer": "", "word_count": 9, "tokens": 12, "keywords": [ "dify", "platform", "llm" ], "index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001", "index_node_hash": "abc123def456", "hit_count": 0, "enabled": true, "disabled_at": null, "disabled_by": null, "status": "completed", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "updated_at": 1741267200, "updated_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "indexing_at": 1741267200, "completed_at": 1741267200, "error": null, "stopped_at": null, "child_chunks": [], "attachments": [], "summary": null }, "doc_form": "text_model" } } } } } }, "400": { "description": "- `provider_not_initialize` : ナレッジベースは高品質インデックスを使用していますが、埋め込みモデルが未設定または誤って設定されています。\n- `invalid_param` : チャンクがインデックス中または無効化されているため更新できません。またはインデックス設定が無効です。", "content": { "application/json": { "examples": { "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider." } }, "invalid_param_state": { "summary": "invalid_param (state)", "value": { "status": 400, "code": "invalid_param", "message": "Segment is indexing, please try again later" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。\n- `not_found` : チャンクが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_3": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Segment not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/update-chunk", "metadata": { "title": "ドキュメント内のチャンクを更新", "sidebarTitle": "ドキュメント内のチャンクを更新" } } }, "delete": { "tags": [ "チャンク" ], "summary": "ドキュメント内のチャンクを削除", "description": "ドキュメントからチャンクを完全に削除します。", "operationId": "deleteSegment", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "segment_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "チャンク ID です。[チャンク一覧を取得](/ja/api-reference/chunks/list-chunks) から取得します。" } ], "responses": { "204": { "description": "Success." }, "400": { "description": "- `invalid_param` : ナレッジベースは高品質インデックスを使用していますが、埋め込みモデルが未設定または誤って設定されています。\n- `invalid_param` : チャンクは別の同時リクエストによってすでに削除中です。", "content": { "application/json": { "examples": { "invalid_param_model_setting": { "summary": "invalid_param (model setting)", "value": { "status": 400, "code": "invalid_param", "message": "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider." } }, "invalid_param_deleting": { "summary": "invalid_param (deleting)", "value": { "status": 400, "code": "invalid_param", "message": "Segment is deleting." } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。\n- `not_found` : チャンクが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_3": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Segment not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/delete-chunk", "metadata": { "title": "ドキュメント内のチャンクを削除", "sidebarTitle": "ドキュメント内のチャンクを削除" } } } }, "/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks": { "post": { "tags": [ "チャンク" ], "summary": "子チャンクを作成", "description": "親チャンクの下に子チャンクを作成します。親子(`hierarchical_model`)チャンキングモードを使用するドキュメント向けです。", "operationId": "createChildChunk", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "segment_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "親チャンク ID です。[チャンク一覧を取得](/ja/api-reference/chunks/list-chunks) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "content" ], "properties": { "content": { "type": "string", "description": "子チャンクのテキスト内容です。" } } } } } }, "responses": { "200": { "description": "子チャンクが正常に作成されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/ChildChunk" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": { "id": "d7e8f9a0-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "segment_id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1", "content": "Dify is an open-source platform.", "position": 1, "word_count": 6, "type": "customized", "created_at": 1741267200, "updated_at": 1741267200 } } } } } } }, "400": { "description": "- `provider_not_initialize` : ナレッジベースは高品質インデックスを使用していますが、埋め込みモデルが未設定または誤って設定されています。\n- `invalid_param` : ベクトルストアでの子チャンクのインデックス作成に失敗しました。メッセージにはベクトルストアの元のエラーが含まれます。", "content": { "application/json": { "examples": { "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Vector store operation failed: [Errno 111] Connection refused" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。\n- `forbidden` : To unlock this feature and elevate your Dify experience, please upgrade to a paid plan.", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } }, "forbidden_4": { "summary": "forbidden (upgrade plan)", "value": { "status": 403, "code": "forbidden", "message": "To unlock this feature and elevate your Dify experience, please upgrade to a paid plan." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。\n- `not_found` : チャンクが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_3": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Segment not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/create-child-chunk", "metadata": { "title": "子チャンクを作成", "sidebarTitle": "子チャンクを作成" } } }, "get": { "tags": [ "チャンク" ], "summary": "子チャンク一覧を取得", "description": "特定の親チャンク配下の子チャンクのページネーションリストを返します。", "operationId": "getChildChunks", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "segment_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "親チャンク ID です。[チャンク一覧を取得](/ja/api-reference/chunks/list-chunks) から取得します。" }, { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1, "minimum": 1 }, "description": "ページ番号。" }, { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20, "minimum": 1 }, "description": "1 ページあたりの項目数です。サーバーの上限は `100` です。" }, { "name": "keyword", "in": "query", "schema": { "type": "string" }, "description": "検索キーワードです。" } ], "responses": { "200": { "description": "子チャンクのリストです。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/ChildChunk" }, "description": "子チャンクのリスト。" }, "total": { "type": "integer", "description": "子チャンクの合計数です。" }, "total_pages": { "type": "integer", "description": "合計ページ数です。" }, "page": { "type": "integer", "description": "現在のページ番号です。" }, "limit": { "type": "integer", "description": "1 ページあたりの件数です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": [ { "id": "d7e8f9a0-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "segment_id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1", "content": "Dify is an open-source platform.", "position": 1, "word_count": 6, "type": "customized", "created_at": 1741267200, "updated_at": 1741267200 } ], "total": 1, "total_pages": 1, "page": 1, "limit": 20 } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。\n- `not_found` : チャンクが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_3": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Segment not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/list-child-chunks", "metadata": { "title": "子チャンク一覧を取得", "sidebarTitle": "子チャンク一覧を取得" } } } }, "/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}": { "patch": { "tags": [ "チャンク" ], "summary": "子チャンクを更新", "description": "既存の子チャンクのコンテンツを更新します。", "operationId": "updateChildChunk", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "segment_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "親チャンク ID です。[チャンク一覧を取得](/ja/api-reference/chunks/list-chunks) から取得します。" }, { "name": "child_chunk_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "子チャンク ID です。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "content" ], "properties": { "content": { "type": "string", "description": "子チャンクのテキスト内容です。" } } } } } }, "responses": { "200": { "description": "子チャンクが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/ChildChunk" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": { "id": "d7e8f9a0-1b2c-3d4e-5f6a-7b8c9d0e1f2a", "segment_id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1", "content": "Dify is an open-source platform.", "position": 1, "word_count": 6, "type": "customized", "created_at": 1741267200, "updated_at": 1741267200 } } } } } } }, "400": { "description": "`invalid_param` : ベクトルストアでの子チャンクの再インデックスに失敗しました。メッセージにはベクトルストアの元のエラーが含まれます。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Vector store operation failed: [Errno 111] Connection refused" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : ベクトル空間の容量がサブスクリプションの上限に達しました。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。\n- `forbidden` : To unlock this feature and elevate your Dify experience, please upgrade to a paid plan.", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (vector space)", "value": { "status": 403, "code": "forbidden", "message": "The capacity of the vector space has reached the limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } }, "forbidden_4": { "summary": "forbidden (upgrade plan)", "value": { "status": 403, "code": "forbidden", "message": "To unlock this feature and elevate your Dify experience, please upgrade to a paid plan." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。\n- `not_found` : チャンクが見つかりません。\n- `not_found` : 子チャンクが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_3": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Segment not found." } }, "not_found_4": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Child chunk not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/update-child-chunk", "metadata": { "title": "子チャンクを更新", "sidebarTitle": "子チャンクを更新" } } }, "delete": { "tags": [ "チャンク" ], "summary": "子チャンクを削除", "description": "親チャンクから子チャンクを完全に削除します。", "operationId": "deleteChildChunk", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ドキュメント ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) から取得します。" }, { "name": "segment_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "親チャンク ID です。[チャンク一覧を取得](/ja/api-reference/chunks/list-chunks) から取得します。" }, { "name": "child_chunk_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "子チャンク ID です。" } ], "responses": { "204": { "description": "Success." }, "400": { "description": "`invalid_param` : ベクトルストアからの子チャンクインデックスの削除に失敗しました。メッセージにはベクトルストアの元のエラーが含まれます。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Vector store operation failed: [Errno 111] Connection refused" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。\n- `forbidden` : To unlock this feature and elevate your Dify experience, please upgrade to a paid plan.", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } }, "forbidden_3": { "summary": "forbidden (upgrade plan)", "value": { "status": 403, "code": "forbidden", "message": "To unlock this feature and elevate your Dify experience, please upgrade to a paid plan." } } } } } }, "404": { "description": "- `not_found` : ナレッジベースが見つかりません。\n- `not_found` : ドキュメントが見つかりません。\n- `not_found` : チャンクが見つかりません。\n- `not_found` : 子チャンクが見つかりません。", "content": { "application/json": { "examples": { "not_found_1": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } }, "not_found_2": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Document not found." } }, "not_found_3": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Segment not found." } }, "not_found_4": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Child chunk not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/chunks/delete-child-chunk", "metadata": { "title": "子チャンクを削除", "sidebarTitle": "子チャンクを削除" } } } }, "/datasets/{dataset_id}/retrieve": { "post": { "tags": [ "ナレッジベース" ], "summary": "ナレッジベースからチャンクを取得 / テスト検索", "description": "ナレッジベースを検索し、クエリに最も関連性の高いチャンクを返します。本番環境の検索とテスト検索の両方に使用できます。", "operationId": "retrieveSegments", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "query" ], "properties": { "query": { "type": "string", "maxLength": 250, "description": "検索クエリテキストです。" }, "retrieval_model": { "$ref": "#/components/schemas/RetrievalModel", "description": "検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。" }, "attachment_ids": { "type": "array", "items": { "type": "string" }, "nullable": true, "description": "検索コンテキストに含める添付ファイル ID のリストです。" }, "external_retrieval_model": { "type": "object", "description": "外部ナレッジベースの検索設定です。", "properties": { "top_k": { "type": "integer", "description": "返す結果の最大数です。" }, "score_threshold": { "type": "number", "description": "結果をフィルタリングするための最小類似度スコアのしきい値です。" }, "score_threshold_enabled": { "type": "boolean", "description": "スコアしきい値によるフィルタリングを有効にするかどうか。" } } } } } } } }, "responses": { "200": { "description": "検索結果です。", "content": { "application/json": { "schema": { "type": "object", "properties": { "query": { "type": "object", "description": "元のクエリオブジェクトです。", "properties": { "content": { "type": "string", "description": "クエリテキストです。" } } }, "records": { "type": "array", "items": { "type": "object", "properties": { "segment": { "type": "object", "description": "ナレッジベースから一致したチャンクです。", "properties": { "id": { "type": "string", "description": "チャンクの一意識別子です。" }, "position": { "type": "integer", "description": "ドキュメント内のチャンクの位置。" }, "document_id": { "type": "string", "description": "このチャンクが属するドキュメントの ID です。" }, "content": { "type": "string", "description": "チャンクのテキスト内容です。" }, "sign_content": { "type": "string", "description": "整合性検証用の署名付きコンテンツハッシュです。" }, "answer": { "type": "string", "description": "回答コンテンツです。Q&A モードのドキュメントで使用されます。" }, "word_count": { "type": "integer", "description": "チャンク内容の単語数です。" }, "tokens": { "type": "integer", "description": "チャンク内容のトークン数です。" }, "keywords": { "type": "array", "description": "キーワードベースの検索のためにこのチャンクに関連付けられたキーワードです。", "items": { "type": "string" } }, "index_node_id": { "type": "string", "description": "ベクトルストア内のインデックスノードの ID です。" }, "index_node_hash": { "type": "string", "description": "インデックスされたコンテンツのハッシュです。変更の検出に使用されます。" }, "hit_count": { "type": "integer", "description": "このチャンクが検索クエリでマッチした回数です。" }, "enabled": { "type": "boolean", "description": "このチャンクが検索に対して有効かどうかです。" }, "disabled_at": { "type": "number", "nullable": true, "description": "チャンクが無効化されたタイムスタンプです。有効な場合は `null` です。" }, "disabled_by": { "type": "string", "nullable": true, "description": "チャンクを無効化したユーザーの ID です。有効な場合は `null` です。" }, "status": { "type": "string", "description": "チャンクのインデックスステータスです。" }, "created_by": { "type": "string", "description": "チャンクを作成したユーザーの ID です。" }, "created_at": { "type": "number", "description": "作成タイムスタンプ(Unix エポック、秒単位)です。" }, "indexing_at": { "type": "number", "nullable": true, "description": "インデックス作成が開始されたタイムスタンプです。まだ開始されていない場合は `null` です。" }, "completed_at": { "type": "number", "nullable": true, "description": "インデックス作成が完了したタイムスタンプです。まだ完了していない場合は `null` です。" }, "error": { "type": "string", "nullable": true, "description": "インデックス作成が失敗した場合のエラーメッセージです。エラーなしの場合は `null` です。" }, "stopped_at": { "type": "number", "nullable": true, "description": "インデックス作成が停止されたタイムスタンプです。停止されていない場合は `null` です。" }, "document": { "type": "object", "description": "マッチしたチャンクの親ドキュメント情報です。", "properties": { "id": { "type": "string", "description": "ドキュメントの一意識別子です。" }, "data_source_type": { "type": "string", "description": "ドキュメントの作成方法です。" }, "name": { "type": "string", "description": "ドキュメント名です。" }, "doc_type": { "type": "string", "nullable": true, "description": "ドキュメントタイプの分類です。未設定の場合は `null` です。" }, "doc_metadata": { "type": "object", "nullable": true, "description": "ドキュメントのメタデータ値です。メタデータが設定されていない場合は `null` です。" } } } } }, "child_chunks": { "type": "array", "description": "階層インデックスを使用している場合、チャンク内でマッチした子チャンクです。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "子チャンクの一意識別子です。" }, "content": { "type": "string", "description": "子チャンクのテキスト内容です。" }, "position": { "type": "integer", "description": "親チャンク内の子チャンクの位置です。" }, "score": { "type": "number", "description": "子チャンクの関連性スコアです。" } } } }, "score": { "type": "number", "description": "関連性スコアです。" }, "tsne_position": { "type": "object", "nullable": true, "description": "t-SNE 可視化の位置です。" }, "files": { "type": "array", "description": "このチャンクに添付されたファイルです。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "添付ファイルの識別子です。" }, "name": { "type": "string", "description": "元のファイル名です。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト)。" }, "extension": { "type": "string", "description": "ファイル拡張子。" }, "mime_type": { "type": "string", "description": "ファイルの MIME タイプ。" }, "source_url": { "type": "string", "description": "添付ファイルにアクセスする URL です。" } } } }, "summary": { "type": "string", "nullable": true, "description": "要約インデックス経由で取得された場合の要約コンテンツです。" } } }, "description": "一致した検索レコードのリスト。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "query": { "content": "What is Dify?" }, "records": [ { "segment": { "id": "f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1", "position": 1, "document_id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "content": "Dify is an open-source LLM app development platform.", "sign_content": "", "answer": "", "word_count": 9, "tokens": 12, "keywords": [ "dify", "platform", "llm" ], "index_node_id": "a1b2c3d4-e5f6-7890-abcd-000000000001", "index_node_hash": "abc123def456", "hit_count": 1, "enabled": true, "disabled_at": null, "disabled_by": null, "status": "completed", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": 1741267200, "indexing_at": 1741267200, "completed_at": 1741267200, "error": null, "stopped_at": null, "document": { "id": "a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac", "data_source_type": "upload_file", "name": "guide.txt", "doc_type": null, "doc_metadata": null } }, "child_chunks": [], "score": 0.92, "tsne_position": null, "files": [], "summary": null } ] } } } } } }, "400": { "description": "- `dataset_not_initialized` : ナレッジベースはまだ初期化中またはインデキシング中です。\n- `provider_not_initialize` : モデルプロバイダーに有効な認証情報が設定されていません。\n- `provider_quota_exceeded` : Dify がホストするモデルプロバイダーのクォータが使い切られました。\n- `model_currently_not_support` : 選択したモデルは現在サポートされていません。\n- `completion_request_error` : モデルへのリクエストに失敗しました。\n- `invalid_param` : リクエストパラメータが無効です。", "content": { "application/json": { "examples": { "dataset_not_initialized": { "summary": "dataset_not_initialized", "value": { "status": 400, "code": "dataset_not_initialized", "message": "The dataset is still being initialized or indexing. Please wait a moment." } }, "provider_not_initialize": { "summary": "provider_not_initialize", "value": { "status": 400, "code": "provider_not_initialize", "message": "No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials." } }, "provider_quota_exceeded": { "summary": "provider_quota_exceeded", "value": { "status": 400, "code": "provider_quota_exceeded", "message": "Your quota for Dify Hosted Model Provider has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials." } }, "model_currently_not_support": { "summary": "model_currently_not_support", "value": { "status": 400, "code": "model_currently_not_support", "message": "Dify Hosted OpenAI trial currently not support the GPT-4 model." } }, "completion_request_error": { "summary": "completion_request_error", "value": { "status": 400, "code": "completion_request_error", "message": "Completion request failed." } }, "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Invalid parameter value." } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : `dataset_id` に一致するナレッジベースがありません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } }, "500": { "description": "`internal_server_error` : 検索中に内部エラーが発生しました。", "content": { "application/json": { "examples": { "internal_server_error": { "summary": "internal_server_error", "value": { "status": 500, "code": "internal_server_error", "message": "An internal error occurred." } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-bases/retrieve-chunks-from-a-knowledge-base-test-retrieval", "metadata": { "title": "ナレッジベースからチャンクを取得 / テスト検索", "sidebarTitle": "ナレッジベースからチャンクを取得 / テスト検索" } } } }, "/datasets/tags": { "post": { "tags": [ "タグ管理" ], "summary": "ナレッジベースタグを作成", "description": "ナレッジベースを整理するためのタグを作成します。", "operationId": "createKnowledgeTag", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 50, "description": "タグ名です。ワークスペース内で一意である必要があります。" } } } } } }, "responses": { "200": { "description": "タグが正常に作成されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "description": "タグ識別子です。" }, "name": { "type": "string", "description": "タグの表示名です。" }, "type": { "type": "string", "description": "タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。" }, "binding_count": { "type": "string", "nullable": true, "description": "このタグにバインドされたナレッジベースの数です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d", "name": "Product Docs", "type": "knowledge", "binding_count": "0" } } } } } }, "400": { "description": "`invalid_param` : 同じ名前のナレッジタグが既に存在します。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Tag name already exists" } } } } } } }, "x-mint": { "href": "/ja/api-reference/tags/create-knowledge-tag", "metadata": { "title": "ナレッジベースタグを作成", "sidebarTitle": "ナレッジベースタグを作成" } } }, "get": { "tags": [ "タグ管理" ], "summary": "ナレッジベースタグリストを取得", "description": "ワークスペース内のすべてのナレッジベースタグを返します。", "operationId": "getKnowledgeTags", "responses": { "200": { "description": "タグのリストです。", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "タグ識別子です。" }, "name": { "type": "string", "description": "タグの表示名です。" }, "type": { "type": "string", "description": "タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。" }, "binding_count": { "type": "string", "nullable": true, "description": "このタグにバインドされたナレッジベースの数です。" } } } }, "examples": { "success": { "summary": "レスポンス例", "value": [ { "id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d", "name": "Product Docs", "type": "knowledge", "binding_count": "0" } ] } } } } } }, "x-mint": { "href": "/ja/api-reference/tags/list-knowledge-tags", "metadata": { "title": "ナレッジベースタグリストを取得", "sidebarTitle": "ナレッジベースタグリストを取得" } } }, "patch": { "tags": [ "タグ管理" ], "summary": "ナレッジベースタグを変更", "description": "ナレッジベースタグの名前を変更します。", "operationId": "updateKnowledgeTag", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "tag_id", "name" ], "properties": { "tag_id": { "type": "string", "description": "名前を変更するタグの ID です。[ナレッジベースタグリストを取得](/ja/api-reference/tags/list-knowledge-tags) を参照してください。" }, "name": { "type": "string", "minLength": 1, "maxLength": 50, "description": "タグの新しい名前です。ワークスペース内で一意である必要があります。" } } } } } }, "responses": { "200": { "description": "タグが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "description": "タグ識別子です。" }, "name": { "type": "string", "description": "タグの表示名です。" }, "type": { "type": "string", "description": "タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。" }, "binding_count": { "type": "string", "nullable": true, "description": "このタグにバインドされたナレッジベースの数です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d", "name": "Product Docs", "type": "knowledge", "binding_count": "0" } } } } } }, "400": { "description": "`invalid_param` : 同じ名前のナレッジタグが既に存在します。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Tag name already exists" } } } } } }, "404": { "description": "`not_found` : 指定されたタグが存在しません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Tag not found" } } } } } } }, "x-mint": { "href": "/ja/api-reference/tags/update-knowledge-tag", "metadata": { "title": "ナレッジベースタグを変更", "sidebarTitle": "ナレッジベースタグを変更" } } }, "delete": { "tags": [ "タグ管理" ], "summary": "ナレッジベースタグを削除", "description": "ナレッジベースタグを完全に削除します。タグ付けされたナレッジベース自体は削除されません。", "operationId": "deleteKnowledgeTag", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "tag_id" ], "properties": { "tag_id": { "type": "string", "description": "削除するタグの ID です。[ナレッジベースタグリストを取得](/ja/api-reference/tags/list-knowledge-tags) を参照してください。" } } } } } }, "responses": { "204": { "description": "Success." }, "404": { "description": "`not_found` : 指定されたタグが存在しません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Tag not found" } } } } } } }, "x-mint": { "href": "/ja/api-reference/tags/delete-knowledge-tag", "metadata": { "title": "ナレッジベースタグを削除", "sidebarTitle": "ナレッジベースタグを削除" } } } }, "/datasets/tags/binding": { "post": { "tags": [ "タグ管理" ], "summary": "タグをナレッジベースにバインド", "description": "ナレッジベースに 1 つ以上のタグをバインドします。ナレッジベースには複数のタグを設定できます。", "operationId": "bindTagsToDataset", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "tag_ids", "target_id" ], "properties": { "tag_ids": { "type": "array", "items": { "type": "string" }, "minItems": 1, "description": "バインドするタグの ID です。[ナレッジベースタグリストを取得](/ja/api-reference/tags/list-knowledge-tags) を参照してください。 不明なタグ ID はエラーにならず無視されます。" }, "target_id": { "type": "string", "description": "タグをバインドするナレッジベースです。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" } } } } } }, "responses": { "204": { "description": "Success." }, "404": { "description": "`not_found` : 対象のナレッジベースが存在しません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found" } } } } } } }, "x-mint": { "href": "/ja/api-reference/tags/create-tag-binding", "metadata": { "title": "タグをナレッジベースにバインド", "sidebarTitle": "タグをナレッジベースにバインド" } } } }, "/datasets/tags/unbinding": { "post": { "tags": [ "タグ管理" ], "summary": "タグとナレッジベースのバインドを解除", "description": "ナレッジベースから 1 つまたは複数のタグを削除します。", "operationId": "unbindTagFromDataset", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "target_id" ], "properties": { "tag_ids": { "type": "array", "items": { "type": "string" }, "minItems": 1, "description": "バインド解除するタグ ID のリストです。旧版の `tag_id` を指定しない限り必須です。[ナレッジベースタグリストを取得](/ja/api-reference/tags/list-knowledge-tags) を参照してください。" }, "tag_id": { "type": "string", "deprecated": true, "description": "旧版の単一タグ用フィールドです。サーバーサイドで `tag_ids` に正規化されます。新規連携では `tag_ids` を使用してください。" }, "target_id": { "type": "string", "description": "タグのバインドを解除するナレッジベースです。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" } } } } } }, "responses": { "204": { "description": "Success." }, "404": { "description": "`not_found` : 対象のナレッジベースが存在しません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found" } } } } } } }, "x-mint": { "href": "/ja/api-reference/tags/delete-tag-binding", "metadata": { "title": "タグとナレッジベースのバインドを解除", "sidebarTitle": "タグとナレッジベースのバインドを解除" } } } }, "/datasets/{dataset_id}/tags": { "get": { "tags": [ "タグ管理" ], "summary": "ナレッジベースにバインドされたタグを取得", "description": "ナレッジベースにバインドされたタグを返します。", "operationId": "queryDatasetTags", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" } ], "responses": { "200": { "description": "ナレッジベースにバインドされたタグです。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "タグ識別子です。" }, "name": { "type": "string", "description": "タグの表示名です。" } } }, "description": "このナレッジベースにバインドされたタグのリスト。" }, "total": { "type": "integer", "description": "このナレッジベースにバインドされたタグの合計数です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": [ { "id": "f4b5c6d7-e8f9-0a1b-2c3d-4e5f6a7b8c9d", "name": "Product Docs" } ], "total": 1 } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/tags/get-knowledge-base-tags", "metadata": { "title": "ナレッジベースにバインドされたタグを取得", "sidebarTitle": "ナレッジベースにバインドされたタグを取得" } } } }, "/datasets/{dataset_id}/metadata": { "post": { "tags": [ "メタデータ" ], "summary": "メタデータフィールドを作成", "description": "ナレッジベース内のドキュメントを構造化情報でアノテーションするための、カスタムメタデータフィールドを作成します。", "operationId": "createMetadataFieldJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "type", "name" ], "properties": { "type": { "type": "string", "enum": [ "string", "number", "time" ], "description": "`string` はテキスト値、`number` は数値、`time` は日付/時刻値です。" }, "name": { "type": "string", "description": "メタデータフィールドの名前です。ナレッジベースのフィールド内で一意であり、255 文字以内である必要があります。" } } } } } }, "responses": { "201": { "description": "メタデータフィールドが正常に作成されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "description": "メタデータフィールドの識別子です。" }, "name": { "type": "string", "description": "メタデータフィールド名です。" }, "type": { "type": "string", "description": "メタデータフィールドの種類です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "b5c6d7e8-f9a0-1b2c-3d4e-5f6a7b8c9d0e", "name": "author", "type": "string" } } } } } }, "400": { "description": "`invalid_param` : メタデータ名が既に存在する、255 文字を超えている、または組み込みフィールドと競合しています。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Metadata name already exists." } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/metadata/create-metadata-field", "metadata": { "title": "メタデータフィールドを作成", "sidebarTitle": "メタデータフィールドを作成" } } }, "get": { "tags": [ "メタデータ" ], "summary": "メタデータフィールドリストを取得", "description": "ナレッジベースのすべてのメタデータフィールド(カスタムと組み込みの両方)を、各フィールドを使用しているドキュメント数とともに返します。", "operationId": "listMetadataFieldsJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" } ], "responses": { "200": { "description": "ナレッジベースのメタデータフィールドです。", "content": { "application/json": { "schema": { "type": "object", "properties": { "doc_metadata": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "メタデータフィールドの識別子です。" }, "name": { "type": "string", "description": "メタデータフィールド名です。" }, "type": { "type": "string", "description": "メタデータフィールドの種類です。" }, "count": { "type": "integer", "description": "このメタデータフィールドを使用しているドキュメント数です。" } } }, "description": "メタデータフィールド定義のリスト。" }, "built_in_field_enabled": { "type": "boolean", "description": "このナレッジベースで組み込みメタデータフィールドが有効かどうかです。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "doc_metadata": [ { "id": "b5c6d7e8-f9a0-1b2c-3d4e-5f6a7b8c9d0e", "name": "author", "type": "string", "count": 3 } ], "built_in_field_enabled": true } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/metadata/list-metadata-fields", "metadata": { "title": "メタデータフィールドリストを取得", "sidebarTitle": "メタデータフィールドリストを取得" } } } }, "/datasets/{dataset_id}/metadata/{metadata_id}": { "patch": { "tags": [ "メタデータ" ], "summary": "メタデータフィールドを更新", "description": "カスタムメタデータフィールドの名前を変更します。", "operationId": "updateMetadataFieldJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" }, { "name": "metadata_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "名前を変更するメタデータフィールドの ID です。[メタデータフィールドリストを取得](/ja/api-reference/metadata/list-metadata-fields) を参照してください。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string", "description": "フィールドの新しい名前です。ナレッジベースのフィールド内で一意であり、255 文字以内である必要があります。" } } } } } }, "responses": { "200": { "description": "メタデータフィールドが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "description": "メタデータフィールドの識別子です。" }, "name": { "type": "string", "description": "メタデータフィールド名です。" }, "type": { "type": "string", "description": "メタデータフィールドの種類です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "b5c6d7e8-f9a0-1b2c-3d4e-5f6a7b8c9d0e", "name": "author", "type": "string" } } } } } }, "400": { "description": "`invalid_param` : メタデータ名が既に存在する、255 文字を超えている、または組み込みフィールドと競合しています。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Metadata name already exists." } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/metadata/update-metadata-field", "metadata": { "title": "メタデータフィールドを更新", "sidebarTitle": "メタデータフィールドを更新" } } }, "delete": { "tags": [ "メタデータ" ], "summary": "メタデータフィールドを削除", "description": "カスタムメタデータフィールドを完全に削除します。このフィールドを使用していたドキュメントは、それに対応する値を失います。", "operationId": "deleteMetadataFieldJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" }, { "name": "metadata_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "削除するメタデータフィールドの ID です。[メタデータフィールドリストを取得](/ja/api-reference/metadata/list-metadata-fields) を参照してください。" } ], "responses": { "204": { "description": "Success." }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/metadata/delete-metadata-field", "metadata": { "title": "メタデータフィールドを削除", "sidebarTitle": "メタデータフィールドを削除" } } } }, "/datasets/{dataset_id}/metadata/built-in": { "get": { "tags": [ "メタデータ" ], "summary": "組み込みメタデータフィールドを取得", "description": "システムが提供する組み込みメタデータフィールドを返します。", "operationId": "getBuiltInMetadataFieldsJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" } ], "responses": { "200": { "description": "組み込みメタデータフィールドです。", "content": { "application/json": { "schema": { "type": "object", "properties": { "fields": { "type": "array", "description": "システム提供のメタデータフィールドのリストです。", "items": { "type": "object", "properties": { "name": { "type": "string", "description": "組み込みフィールド識別子です。`document_name` はドキュメントタイトル、`uploader` は作成者、`upload_date` は作成日時、`last_update_date` は最終更新日時、`source` はドキュメントの出典を示します。" }, "type": { "type": "string", "description": "フィールドのデータ型です。テキスト値の場合は `string`、日時値の場合は `time` です。" } } } } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "fields": [ { "name": "document_name", "type": "string" }, { "name": "uploader", "type": "string" }, { "name": "upload_date", "type": "time" }, { "name": "last_update_date", "type": "time" }, { "name": "source", "type": "string" } ] } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/metadata/get-built-in-metadata-fields", "metadata": { "title": "組み込みメタデータフィールドを取得", "sidebarTitle": "組み込みメタデータフィールドを取得" } } } }, "/datasets/{dataset_id}/metadata/built-in/{action}": { "post": { "tags": [ "メタデータ" ], "summary": "組み込みメタデータフィールドを更新", "description": "ナレッジベースの組み込みメタデータフィールドを有効または無効にします。", "operationId": "toggleBuiltInMetadataFieldJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" }, { "name": "action", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "enable", "disable" ] }, "description": "`enable` で内蔵メタデータフィールドを有効化、`disable` で無効化します。" } ], "responses": { "200": { "description": "組み込みメタデータフィールドの切り替えに成功しました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "description": "操作結果です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "result": "success" } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/metadata/update-built-in-metadata-field", "metadata": { "title": "組み込みメタデータフィールドを更新", "sidebarTitle": "組み込みメタデータフィールドを更新" } } } }, "/datasets/{dataset_id}/documents/metadata": { "post": { "tags": [ "メタデータ" ], "summary": "ドキュメントメタデータを一括更新", "description": "複数のドキュメントのメタデータ値を 1 回のリクエストで更新します。", "operationId": "batchUpdateDocumentMetadataJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) を参照してください。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "operation_data" ], "properties": { "operation_data": { "type": "array", "items": { "type": "object", "required": [ "document_id", "metadata_list" ], "properties": { "document_id": { "type": "string", "description": "更新するドキュメントの ID です。[ナレッジベースのドキュメントリストを取得](/ja/api-reference/documents/list-documents) を参照してください。" }, "metadata_list": { "type": "array", "items": { "type": "object", "required": [ "id", "name" ], "properties": { "id": { "type": "string", "description": "メタデータフィールド ID です。[メタデータフィールドリストを取得](/ja/api-reference/metadata/list-metadata-fields) を参照してください。" }, "name": { "type": "string", "description": "メタデータフィールド名です。" }, "value": { "description": "メタデータ値。文字列、数値、または `null` を指定できます。" } } }, "description": "ドキュメントに設定するメタデータフィールドです。" }, "partial_update": { "type": "boolean", "default": false, "description": "メタデータを部分的に更新し、未指定フィールドの既存の値を保持するかどうかです。" } } }, "description": "ドキュメントメタデータの更新操作です。ドキュメントごとに 1 エントリです。" } } } } } }, "responses": { "200": { "description": "ドキュメントメタデータが正常に更新されました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "description": "操作結果です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "result": "success" } } } } } }, "400": { "description": "`invalid_param` : 参照されたドキュメントが見つからない、またはこのリクエスト内のドキュメントで別のメタデータ操作が実行中です。", "content": { "application/json": { "examples": { "invalid_param_doc": { "summary": "invalid_param (document)", "value": { "status": 400, "code": "invalid_param", "message": "Document not found." } } } } } }, "403": { "description": "- `forbidden` : このナレッジベースでは API アクセスが有効になっていません。\n- `forbidden` : サブスクリプションのナレッジベースリクエストのレート制限に達しました。", "content": { "application/json": { "examples": { "forbidden_1": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } }, "forbidden_2": { "summary": "forbidden (rate limit)", "value": { "status": 403, "code": "forbidden", "message": "Sorry, you have reached the knowledge base request rate limit of your subscription." } } } } } }, "404": { "description": "`not_found` : ナレッジベースが見つかりません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/metadata/update-document-metadata-in-batch", "metadata": { "title": "ドキュメントメタデータを一括更新", "sidebarTitle": "ドキュメントメタデータを一括更新" } } } }, "/workspaces/current/models/model-types/{model_type}": { "get": { "tags": [ "モデル" ], "summary": "利用可能なモデルを取得", "description": "指定したタイプの利用可能なモデルを返します。ナレッジベースに設定する `text-embedding` モデルと `rerank` モデルを見つけるために使用します。", "operationId": "getAvailableModelsJa", "parameters": [ { "name": "model_type", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "text-embedding", "rerank", "llm", "tts", "speech2text", "moderation" ] }, "description": "取得するモデルのタイプです。ナレッジベースの設定には、埋め込みモデルの場合は `text-embedding`、リランキングモデルの場合は `rerank` を使用します。" } ], "responses": { "200": { "description": "指定された種類で利用可能なモデルです。", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "description": "利用可能なモデルを持つモデルプロバイダーのリストです。", "items": { "type": "object", "properties": { "provider": { "type": "string", "description": "モデルプロバイダーの識別子です。`organization/plugin_name/provider_name` の形式です(例:`langgenius/openai/openai`)。以前のプロバイダーでは短縮形(例:`openai`)が返される場合があります。" }, "label": { "type": "object", "description": "プロバイダーのローカライズ表示名です。", "properties": { "en_US": { "type": "string", "description": "英語表示名。" }, "zh_Hans": { "type": "string", "description": "中国語表示名。" } } }, "icon_small": { "type": "object", "description": "プロバイダーの小アイコンの URL です。", "properties": { "en_US": { "type": "string", "description": "小アイコン URL。" }, "zh_Hans": { "type": "string", "description": "中国語アイコンの URL。" } } }, "status": { "type": "string", "description": "プロバイダーのステータスです。認証情報が設定済みで有効な場合は `active` です。" }, "models": { "type": "array", "description": "このプロバイダーから利用可能なモデルのリストです。", "items": { "type": "object", "properties": { "model": { "type": "string", "description": "モデル識別子です。ナレッジベースの作成または更新時に `embedding_model` の値として使用します。" }, "label": { "type": "object", "description": "モデルのローカライズ表示名です。", "properties": { "en_US": { "type": "string", "description": "英語モデル名。" }, "zh_Hans": { "type": "string", "description": "中国語モデル名。" } } }, "model_type": { "type": "string", "description": "モデルのタイプです。`model_type` パスパラメータと一致します。" }, "features": { "type": "array", "nullable": true, "description": "モデルがサポートする機能です。なしの場合は `null` です。", "items": { "type": "string" } }, "fetch_from": { "type": "string", "description": "モデル定義の取得元です。`predefined-model` は組み込みモデル、`customizable-model` はユーザー設定モデルを示します。" }, "model_properties": { "type": "object", "description": "`context_size` などのモデル固有のプロパティです。" }, "status": { "type": "string", "description": "モデルの利用可能ステータスです。使用可能な場合は `active` です。" }, "deprecated": { "type": "boolean", "description": "モデルが非推奨かどうか。" }, "load_balancing_enabled": { "type": "boolean", "description": "モデルのロードバランシングが有効かどうか。" }, "has_invalid_load_balancing_configs": { "type": "boolean", "description": "モデルに無効なロードバランシング設定があるかどうか。" } } } }, "tenant_id": { "type": "string", "description": "このプロバイダー設定が属するワークスペース ID。" }, "icon_small_dark": { "type": "object", "description": "ダークモード用アイコンの URL。プロバイダーにない場合は `null`。", "properties": { "en_US": { "type": "string" }, "zh_Hans": { "type": "string" } } } } } } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "data": [ { "provider": "langgenius/openai/openai", "label": { "en_US": "OpenAI", "zh_Hans": "OpenAI" }, "icon_small": { "en_US": "https://example.com/openai-small.svg", "zh_Hans": "https://example.com/openai-small.svg" }, "status": "active", "models": [ { "model": "text-embedding-3-small", "label": { "en_US": "text-embedding-3-small", "zh_Hans": "text-embedding-3-small" }, "model_type": "text-embedding", "features": null, "fetch_from": "predefined-model", "model_properties": { "context_size": 8191 }, "status": "active", "deprecated": false, "load_balancing_enabled": false, "has_invalid_load_balancing_configs": false } ], "tenant_id": "11223344-5566-7788-99aa-bbccddeeff00", "icon_small_dark": null } ] } } } } } } }, "x-mint": { "href": "/ja/api-reference/models/get-available-models", "metadata": { "title": "利用可能なモデルを取得", "sidebarTitle": "利用可能なモデルを取得" } } } }, "/datasets/pipeline/file-upload": { "post": { "tags": [ "ナレッジパイプライン" ], "summary": "パイプラインファイルをアップロード", "description": "ナレッジパイプラインで使用するファイルをアップロードします。返された `id` を [パイプラインを実行](/ja/api-reference/knowledge-pipeline/run-pipeline) の `local_file` アイテムの `reference` として使用します。", "operationId": "uploadPipelineFileJa", "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "required": [ "file" ], "properties": { "file": { "type": "string", "format": "binary", "description": "アップロードするファイル。`multipart/form-data` の 1 パートとして送信します。" } } } } } }, "responses": { "201": { "description": "ファイルが正常にアップロードされました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "description": "アップロードされたファイルの一意識別子です。" }, "name": { "type": "string", "description": "元のファイル名です。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト)。" }, "extension": { "type": "string", "description": "ファイル拡張子。" }, "mime_type": { "type": "string", "nullable": true, "description": "ファイルの MIME タイプです。アップロードに MIME タイプが含まれない場合、`null` となることがあります。" }, "created_by": { "type": "string", "description": "ファイルをアップロードしたユーザーの ID。" }, "created_at": { "type": "string", "nullable": true, "description": "アップロードのタイムスタンプ(ISO 8601 形式)です。レコード作成中は `null` となることがあります。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "report.pdf", "size": 524288, "extension": "pdf", "mime_type": "application/pdf", "created_by": "ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4", "created_at": "2025-03-06T12:00:00" } } } } } }, "400": { "description": "- `no_file_uploaded` : リクエストにファイルが提供されていません。\n- `filename_not_exists_error` : アップロードされたファイルにファイル名がありません。\n- `too_many_files` : 1 回のリクエストにつき 1 ファイルのみ許可されています。", "content": { "application/json": { "examples": { "no_file_uploaded": { "summary": "no_file_uploaded", "value": { "status": 400, "code": "no_file_uploaded", "message": "Please upload your file." } }, "filename_not_exists_error": { "summary": "filename_not_exists_error", "value": { "status": 400, "code": "filename_not_exists_error", "message": "The specified filename does not exist." } }, "too_many_files": { "summary": "too_many_files", "value": { "status": 400, "code": "too_many_files", "message": "Only one file is allowed." } } } } } }, "413": { "description": "`file_too_large` : ファイルサイズの上限を超えています。", "content": { "application/json": { "examples": { "file_too_large": { "summary": "file_too_large", "value": { "status": 413, "code": "file_too_large", "message": "File size exceeded." } } } } } }, "415": { "description": "`unsupported_file_type` : 許可されていないファイルタイプです。", "content": { "application/json": { "examples": { "unsupported_file_type": { "summary": "unsupported_file_type", "value": { "status": 415, "code": "unsupported_file_type", "message": "File type not allowed." } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-pipeline/upload-pipeline-file", "metadata": { "title": "パイプラインファイルをアップロード", "sidebarTitle": "パイプラインファイルをアップロード" } }, "x-codeSamples": [ { "lang": "bash", "label": "cURL", "source": "curl --request POST \\\n --url 'https://{api_base_url}/datasets/pipeline/file-upload' \\\n --header 'Authorization: Bearer {api_key}' \\\n --form 'file=@quarterly-report.pdf'" } ] } }, "/datasets/{dataset_id}/pipeline/datasource-plugins": { "get": { "tags": [ "ナレッジパイプライン" ], "summary": "データソースプラグインリストを取得", "description": "ナレッジパイプラインに設定されたデータソースノードを、それぞれが使用するプラグインとノードの実行に必要なメタデータとともに返します。", "operationId": "listDatasourcePluginsJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "is_published", "in": "query", "schema": { "type": "boolean", "default": true }, "description": "ドラフトではなく公開済みパイプラインバージョンからノードを読み取るかどうかを指定します。" } ], "responses": { "200": { "description": "パイプラインに設定されているデータソースノードのリストです。", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "node_id": { "type": "string", "description": "パイプラインワークフロー内のデータソースノードの ID です。 [データソースノードを実行](/ja/api-reference/knowledge-pipeline/run-datasource-node) では `node_id` として、 [パイプラインを実行](/ja/api-reference/knowledge-pipeline/run-pipeline) では `start_node_id` として渡します。" }, "plugin_id": { "type": "string", "description": "このノードを提供するデータソースプラグインの ID です。" }, "provider_name": { "type": "string", "description": "データソースプラグインが登録するプロバイダー名です。" }, "datasource_type": { "type": "string", "description": "データソースのタイプです。`local_file`、`online_document`、`online_drive`、`website_crawl` のいずれかです。" }, "title": { "type": "string", "description": "ノードに設定されている表示タイトルです。" }, "user_input_variables": { "type": "array", "description": "このデータソースに対して呼び出し元が指定するパイプライン入力変数です。ノードのデータソースパラメータ内の `{{#...#}}` 参照から導出されます。各要素はワークフローが使用するパイプライン変数のスキーマに従います。", "items": { "type": "object", "additionalProperties": true } }, "credentials": { "type": "array", "description": "このデータソースの認証に利用できる資格情報のリストです。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "資格情報の ID です。 [データソースノードを実行](/ja/api-reference/knowledge-pipeline/run-datasource-node) では `credential_id` として、 [パイプラインを実行](/ja/api-reference/knowledge-pipeline/run-pipeline) の各データソース項目の `credential_id` フィールドとして渡します。" }, "name": { "type": "string", "description": "資格情報の表示名です。" }, "type": { "type": "string", "description": "データソースプラグインが定義する資格情報のタイプです。" }, "is_default": { "type": "boolean", "description": "この資格情報がプロバイダーのデフォルトかどうかを示します。" } } } } } } }, "examples": { "success": { "summary": "レスポンス例", "value": [ { "node_id": "1719288585006", "plugin_id": "langgenius/notion_datasource", "provider_name": "notion", "datasource_type": "online_document", "title": "Notion Documents", "user_input_variables": [], "credentials": [ { "id": "c1d2e3f4-a5b6-7890-abcd-ef1234567890", "name": "Production Notion", "type": "api-key", "is_default": true } ] } ] } } } } }, "400": { "description": "`invalid_param` : このナレッジベースには処理パイプラインが設定されていません。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Pipeline not found" } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : `dataset_id` に一致するナレッジベースがありません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-pipeline/list-datasource-plugins", "metadata": { "title": "データソースプラグインリストを取得", "sidebarTitle": "データソースプラグインリストを取得" } } } }, "/datasets/{dataset_id}/pipeline/datasource/nodes/{node_id}/run": { "post": { "tags": [ "ナレッジパイプライン" ], "summary": "データソースノードを実行", "description": "ナレッジパイプライン内の単一のデータソースノードを実行し、その実行イベントをストリーミングします。", "operationId": "runDatasourceNodeJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" }, { "name": "node_id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "実行するデータソースノードの ID です。[データソースプラグインリストを取得](/ja/api-reference/knowledge-pipeline/list-datasource-plugins) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "inputs", "datasource_type", "is_published" ], "properties": { "inputs": { "type": "object", "additionalProperties": true, "description": "データソースノードの入力変数です。" }, "datasource_type": { "type": "string", "enum": [ "online_document", "local_file", "website_crawl", "online_drive" ], "description": "データソースの種類です。" }, "credential_id": { "type": "string", "nullable": true, "description": "データソースとの認証に使用する認証情報の ID です。[データソースプラグインリストを取得](/ja/api-reference/knowledge-pipeline/list-datasource-plugins) の `credentials` 配列から取得します。" }, "is_published": { "type": "boolean", "description": "ドラフトではなくノードの公開バージョンを実行するかどうかを指定します。" } } } } } }, "responses": { "200": { "description": "ノード実行イベントを含むストリーミングレスポンスです。", "content": { "text/event-stream": { "schema": { "type": "string", "description": "ノード実行の進捗と結果を含む Server-Sent Events ストリームです。解析については [ストリーミングレスポンスの処理](/ja/api-reference/guides/streaming) を参照してください。" } } } }, "400": { "description": "`invalid_param` : このナレッジベースには処理パイプラインが設定されていない、またはリクエストボディの検証に失敗しました。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Pipeline not found" } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : `dataset_id` に一致するナレッジベースがありません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-pipeline/run-datasource-node", "metadata": { "title": "データソースノードを実行", "sidebarTitle": "データソースノードを実行" } } } }, "/datasets/{dataset_id}/pipeline/run": { "post": { "tags": [ "ナレッジパイプライン" ], "summary": "パイプラインを実行", "description": "1 つ以上のデータソースに対して完全なナレッジパイプラインを実行します。`response_mode` でストリーミングまたはブロッキングのレスポンスを選択します。", "operationId": "runPipelineJa", "parameters": [ { "name": "dataset_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ナレッジベース ID です。[ナレッジベースリストを取得](/ja/api-reference/knowledge-bases/list-knowledge-bases) から取得します。" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "inputs", "datasource_type", "datasource_info_list", "start_node_id", "is_published", "response_mode" ], "properties": { "inputs": { "type": "object", "additionalProperties": true, "description": "パイプライン入力変数のキーと値のペア。ワークフローで定義されたパイプライン変数に対応します。入力変数がない場合は `{}` を渡してください。" }, "datasource_type": { "type": "string", "enum": [ "local_file", "online_document", "website_crawl", "online_drive" ], "description": "データソースのタイプ。`datasource_info_list` の各項目に必要なフィールドを決定します。" }, "datasource_info_list": { "type": "array", "description": "処理対象のデータソースオブジェクトのリストです。項目の構造は `datasource_type` によって異なります。", "items": { "oneOf": [ { "title": "Local File", "type": "object", "required": [ "reference" ], "properties": { "reference": { "type": "string", "description": "[パイプラインファイルアップロード](/ja/api-reference/knowledge-pipeline/upload-pipeline-file) エンドポイントから返される `id` を使用してください。`related_id` もエイリアスとして使用可能です。" }, "name": { "type": "string", "description": "ドキュメントのタイトルです。デフォルトは `\"untitled\"` です。" } } }, { "title": "Online Document", "type": "object", "required": [ "workspace_id", "page" ], "properties": { "workspace_id": { "type": "string", "description": "外部プラットフォームのワークスペースまたはデータベース ID(例:Notion のワークスペース ID)。" }, "page": { "type": "object", "description": "ページの詳細です。", "required": [ "page_id", "type" ], "properties": { "page_id": { "type": "string", "description": "ページ識別子です。" }, "type": { "type": "string", "description": "データソースプラグインで定義されたページタイプ(例:`\"page\"`、`\"database\"`)。" }, "page_name": { "type": "string", "description": "表示名です。デフォルトは `\"untitled\"` です。" } } }, "credential_id": { "type": "string", "description": "外部プラットフォームとの認証用クレデンシャルです。Dify コンソールで管理します。省略した場合、プロバイダーのデフォルトクレデンシャルが使用されます。" } } }, { "title": "Website Crawl", "type": "object", "required": [ "url" ], "properties": { "url": { "type": "string", "description": "クロール対象の URL です。" }, "title": { "type": "string", "description": "ドキュメント名として使用されます。デフォルトは `\"untitled\"` です。" } } }, { "title": "Online Drive", "type": "object", "required": [ "id", "type" ], "properties": { "id": { "type": "string", "description": "ファイルまたはフォルダの ID です。" }, "type": { "type": "string", "enum": [ "file", "folder" ], "description": "この項目が単一ファイルか、展開対象のフォルダかを指定します。" }, "bucket": { "type": "string", "description": "ストレージバケット名です。一部のドライブプロバイダー(S3 互換ストレージなど)で必要です。プロバイダーがバケットを使用しない場合は省略できます。" }, "name": { "type": "string", "description": "ファイル名です。デフォルトは `\"untitled\"` です。" } } } ] } }, "start_node_id": { "type": "string", "description": "実行を開始するノードの ID です。[データソースプラグインリストを取得](/ja/api-reference/knowledge-pipeline/list-datasource-plugins) から取得します。" }, "is_published": { "type": "boolean", "description": "現在のドラフトではなくパイプラインの公開バージョンを実行するかどうかを指定します。未公開の変更をテストするにはドラフトを実行します。" }, "response_mode": { "type": "string", "enum": [ "streaming", "blocking" ], "description": "パイプライン実行のレスポンスモードです。`streaming` は Server-Sent Events ストリームを返し、`blocking` は完了まで待機して完全な結果を返します。" } } }, "examples": { "local_file": { "summary": "リクエスト例 - ローカルファイル", "value": { "inputs": {}, "datasource_type": "local_file", "datasource_info_list": [ { "reference": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "quarterly-report.pdf" } ], "start_node_id": "1719288585006", "is_published": true, "response_mode": "blocking" } }, "online_document": { "summary": "リクエスト例 - オンラインドキュメント", "value": { "inputs": {}, "datasource_type": "online_document", "datasource_info_list": [ { "workspace_id": "ws-abc123", "page": { "page_id": "pg-def456", "type": "page", "page_name": "Product Roadmap" }, "credential_id": "cred-789xyz" } ], "start_node_id": "1719288585006", "is_published": true, "response_mode": "streaming" } }, "website_crawl": { "summary": "リクエスト例 - ウェブサイトクロール", "value": { "inputs": {}, "datasource_type": "website_crawl", "datasource_info_list": [ { "url": "https://example.com/docs/getting-started", "title": "Getting Started Guide" } ], "start_node_id": "1719288585006", "is_published": true, "response_mode": "blocking" } }, "online_drive": { "summary": "リクエスト例 - オンラインドライブ", "value": { "inputs": {}, "datasource_type": "online_drive", "datasource_info_list": [ { "id": "file-abc123", "type": "file", "bucket": "my-bucket", "name": "meeting-notes.docx" } ], "start_node_id": "1719288585006", "is_published": true, "response_mode": "blocking" } } } } } }, "responses": { "200": { "description": "パイプライン実行結果。フォーマットは `response_mode` に依存します:ストリーミングは `text/event-stream` を返し、ブロッキングは完全な JSON 結果を返します。", "content": { "text/event-stream": { "schema": { "type": "string", "description": "Server-Sent Events ストリームです。`response_mode` が `streaming` の場合に返されます。ワイヤーフォーマットについては [ストリーミングレスポンスの処理](/ja/api-reference/guides/streaming) を参照してください。\n\n主なイベント:\n\n- `workflow_started`:実行開始\n- `node_started` / `node_finished`:ノードごとの進捗(`node_id`、`node_type`、`status`、`inputs`、`outputs` を含む)\n- `workflow_finished`:最終結果(`status`、`outputs`、`total_tokens`、`elapsed_time` を含む)\n- `ping`:キープアライブ" } }, "application/json": { "schema": { "type": "object", "description": "パイプライン実行の完全な結果です。`response_mode` が `blocking` の場合に返されます。", "additionalProperties": true }, "examples": { "success": { "summary": "Blocking Response Example", "value": { "task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "workflow_run_id": "f1e2d3c4-b5a6-7890-abcd-ef0987654321", "data": { "id": "f1e2d3c4-b5a6-7890-abcd-ef0987654321", "status": "succeeded", "outputs": {}, "created_at": 1741267200, "finished_at": 1741267210 } } } } } } }, "400": { "description": "`invalid_param` : このナレッジベースには処理パイプラインが設定されていない、またはリクエストボディの検証に失敗しました。", "content": { "application/json": { "examples": { "invalid_param": { "summary": "invalid_param", "value": { "status": 400, "code": "invalid_param", "message": "Pipeline not found" } } } } } }, "403": { "description": "`forbidden` : このナレッジベースでは API アクセスが有効になっていません。", "content": { "application/json": { "examples": { "forbidden": { "summary": "forbidden (api access)", "value": { "status": 403, "code": "forbidden", "message": "Dataset api access is not enabled." } } } } } }, "404": { "description": "`not_found` : `dataset_id` に一致するナレッジベースがありません。", "content": { "application/json": { "examples": { "not_found": { "summary": "not_found", "value": { "status": 404, "code": "not_found", "message": "Dataset not found." } } } } } }, "500": { "description": "`pipeline_run_error` : パイプライン実行に失敗しました。", "content": { "application/json": { "examples": { "pipeline_run_error": { "summary": "pipeline_run_error", "value": { "status": 500, "code": "pipeline_run_error", "message": "Pipeline execution failed: connection timeout" } } } } } } }, "x-mint": { "href": "/ja/api-reference/knowledge-pipeline/run-pipeline", "metadata": { "title": "パイプラインを実行", "sidebarTitle": "パイプラインを実行" } } } } }, "components": { "securitySchemes": { "ApiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API_KEY", "description": "すべてのリクエストは API キーで認証します:`Authorization: Bearer {API_KEY}`。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API キーを使用します([Dify API クイックスタート](/ja/api-reference/guides/get-started))。\n\nキーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーが欠落または無効なリクエストは HTTP `401`(`unauthorized`)で失敗します。" } }, "responses": { "SuccessResult": { "description": "操作が成功しました。", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "description": "操作結果。常に `success` です。" } } }, "examples": { "success": { "summary": "レスポンス例", "value": { "result": "success" } } } } } } }, "schemas": { "ChatRequest": { "type": "object", "required": [ "inputs", "query", "user" ], "properties": { "query": { "type": "string", "description": "ユーザーのメッセージです。" }, "inputs": { "type": "object", "description": "アプリの入力変数の値を、変数名をキーとして指定します。期待される名前と型は、[アプリケーションのパラメータ情報を取得](/ja/api-reference/applications/get-app-parameters) の `user_input_form` フィールドで確認できます。", "additionalProperties": true }, "response_mode": { "type": "string", "enum": [ "streaming", "blocking" ], "description": "レスポンスの返却モードです。省略した場合はブロッキングになります。\n\n- `streaming`(推奨):応答は Server-Sent Events として届きます。\n- `blocking`:生成の完了後に返します。長時間の生成は中断されるおそれがあります。Dify Cloud では、応答がタイムアウト内に届かないと、エッジプロキシが接続を終了する場合があります。\n- Agent と新しい Agent アプリは `streaming` のみに対応します。`blocking` のリクエストは 400 で失敗します。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。会話、メッセージ、ファイルは、同じ `user` を持つリクエストにのみ表示されます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" }, "conversation_id": { "type": "string", "description": "継続する会話の ID です。省略するか空文字列を渡すと新しい会話を開始します。レスポンスで `conversation_id` が返されるので、次のメッセージで渡します。以前の会話を再開するには、その ID を [会話一覧を取得](/ja/api-reference/conversations/list-conversations) から取得します。" }, "files": { "type": "array", "description": "メッセージに添付するファイルです。ローカルファイルの場合は、まず [ファイルをアップロード](/ja/api-reference/files/upload-file) でアップロードし、返された `id` を `upload_file_id` として `transfer_method: local_file` で参照します。新しい Agent アプリはファイル参照を受け付けますが、その内容は処理しません。", "items": { "type": "object", "required": [ "type", "transfer_method" ], "properties": { "type": { "type": "string", "enum": [ "image", "document", "audio", "video", "custom" ], "description": "ファイルタイプ。" }, "transfer_method": { "type": "string", "enum": [ "remote_url", "local_file" ], "description": "転送方法です。ファイル URL の場合は `remote_url`、アップロードファイルの場合は `local_file` です。" }, "url": { "type": "string", "format": "url", "description": "ファイル URL(`transfer_method` が `remote_url` の場合は必須)です。" }, "upload_file_id": { "type": "string", "description": "[ファイルをアップロード](/ja/api-reference/files/upload-file) API から取得したアップロード済みファイル ID です(`transfer_method` が `local_file` の場合は必須)。" } } } }, "auto_generate_name": { "type": "boolean", "description": "会話タイトルを自動生成します。`false` の場合、[会話の名前を変更](/ja/api-reference/conversations/rename-conversation) API で `auto_generate: true` を設定して非同期でタイトルを生成します。", "default": true }, "workflow_id": { "type": "string", "description": "Chatflow アプリでのみ使用できます。 実行する公開済みワークフローバージョンの ID を指定します。指定しない場合、最新の公開バージョンが使用されます。Dify Cloud では、バージョンの指定には有料プランが必要です。" } } }, "ChatCompletionResponse": { "type": "object", "properties": { "event": { "type": "string", "description": "イベントタイプ。`message` に固定されています。" }, "task_id": { "type": "string", "format": "uuid", "description": "リクエスト追跡およびレスポンス停止 API 用のタスク ID です。" }, "id": { "type": "string", "format": "uuid", "description": "このレスポンスイベントの一意 ID です。" }, "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージ ID です。フィードバックや推奨質問のエンドポイントを呼び出す際に `message_id` パラメータとして使用します。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会話 ID。" }, "mode": { "type": "string", "description": "アプリモード。`chat` はチャットボットアプリ、`agent-chat` は Agent アプリ、`advanced-chat` は Chatflow アプリです。" }, "answer": { "type": "string", "description": "完全なレスポンスコンテンツ。" }, "metadata": { "type": "object", "description": "使用量と検索リソースを含むメタデータ。", "properties": { "usage": { "$ref": "#/components/schemas/Usage" }, "retriever_resources": { "type": "array", "description": "使用された検索リソースのリスト。", "items": { "$ref": "#/components/schemas/RetrieverResource" } } } }, "created_at": { "type": "integer", "format": "int64", "description": "メッセージ作成タイムスタンプ(Unix エポック秒)。" } } }, "ChunkChatEvent": { "type": "object", "description": "ストリーミングモードにおける Server-Sent Event チャンクのベーススキーマです。", "properties": { "event": { "type": "string", "description": "イベントの種類です。", "enum": [ "message", "agent_message", "agent_thought", "tts_message", "tts_message_end", "message_file", "message_end", "message_replace", "reasoning_chunk", "workflow_started", "workflow_finished", "node_started", "node_finished", "node_retry", "iteration_started", "iteration_next", "iteration_completed", "loop_started", "loop_next", "loop_completed", "workflow_paused", "human_input_required", "human_input_form_filled", "human_input_form_timeout", "agent_log", "text_chunk", "error", "ping" ] } }, "discriminator": { "propertyName": "event", "mapping": { "message": "#/components/schemas/StreamEventChatMessage", "agent_message": "#/components/schemas/StreamEventChatAgentMessage", "tts_message": "#/components/schemas/StreamEventChatTtsMessage", "tts_message_end": "#/components/schemas/StreamEventChatTtsMessageEnd", "agent_thought": "#/components/schemas/StreamEventChatAgentThought", "message_file": "#/components/schemas/StreamEventChatMessageFile", "message_end": "#/components/schemas/StreamEventChatMessageEnd", "message_replace": "#/components/schemas/StreamEventChatMessageReplace", "error": "#/components/schemas/StreamEventChatError", "ping": "#/components/schemas/StreamEventChatPing", "reasoning_chunk": "#/components/schemas/StreamEventChatReasoningChunk", "workflow_started": "#/components/schemas/StreamEventWorkflowStarted", "workflow_finished": "#/components/schemas/StreamEventWorkflowFinished", "node_started": "#/components/schemas/StreamEventNodeStarted", "node_finished": "#/components/schemas/StreamEventNodeFinished", "node_retry": "#/components/schemas/StreamEventNodeRetry", "iteration_started": "#/components/schemas/StreamEventIterationStarted", "iteration_next": "#/components/schemas/StreamEventIterationNext", "iteration_completed": "#/components/schemas/StreamEventIterationCompleted", "loop_started": "#/components/schemas/StreamEventLoopStarted", "loop_next": "#/components/schemas/StreamEventLoopNext", "loop_completed": "#/components/schemas/StreamEventLoopCompleted", "workflow_paused": "#/components/schemas/StreamEventWorkflowPaused", "human_input_required": "#/components/schemas/StreamEventHumanInputRequired", "human_input_form_filled": "#/components/schemas/StreamEventHumanInputFormFilled", "human_input_form_timeout": "#/components/schemas/StreamEventHumanInputFormTimeout", "agent_log": "#/components/schemas/StreamEventAgentLog", "text_chunk": "#/components/schemas/StreamEventChatTextChunk" } } }, "StreamEventBase": { "type": "object", "description": "ストリームイベントの基本プロパティです。", "properties": { "task_id": { "type": "string", "format": "uuid", "description": "タスク ID。" }, "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージ ID。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会話 ID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } }, "StreamEventChatMessage": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "properties": { "answer": { "type": "string", "description": "LLM が返したテキストチャンクです。" } } } ] }, "StreamEventChatAgentMessage": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "properties": { "answer": { "type": "string", "description": "LLM が返したテキストチャンク(エージェントモード)です。" } } } ] }, "StreamEventChatTtsMessage": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "TTS 音声ストリームイベント(base64 エンコードの Mp3)です。自動再生が有効な場合に利用できます。", "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64 エンコードされた MP3 音声チャンク。すべてのチャンクを順番にデコードして連結すると、完全な音声ファイルが生成されます。" } } } ] }, "StreamEventChatTtsMessageEnd": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "TTS 音声ストリーム終了イベント。", "properties": { "audio": { "type": "string", "description": "空の文字列。音声ストリームの終了を示します。" } } } ] }, "StreamEventChatAgentThought": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "エージェントの思考、LLM の推論、ツール呼び出しの詳細(エージェントモード)です。", "properties": { "id": { "type": "string", "format": "uuid", "description": "エージェント思考 ID です。" }, "position": { "type": "integer", "description": "メッセージ内のシーケンスにおけるこの思考の位置です。" }, "thought": { "type": "string", "description": "LLM が思考している内容です。" }, "observation": { "type": "string", "description": "ツール呼び出しからのレスポンスです。" }, "tool": { "type": "string", "description": "呼び出されたツールのリスト(`;` で区切り)です。" }, "tool_input": { "type": "string", "description": "ツールの入力(JSON 形式)です。" }, "message_files": { "type": "array", "items": { "type": "string", "format": "uuid" }, "description": "この思考に関連するファイルのファイル ID です。" } } } ] }, "StreamEventChatMessageFile": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "メッセージファイルイベント。ツールによって作成された新しいファイルです。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ファイルの一意の ID。" }, "type": { "type": "string", "description": "ファイルタイプ(例:`image`)。" }, "belongs_to": { "type": "string", "description": "このファイルの所有者です。ツールが生成したファイルの場合は常に `assistant` です。" }, "url": { "type": "string", "format": "url", "description": "ファイルのリモート URL。" } } } ] }, "StreamEventChatMessageEnd": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "メッセージ終了イベント、ストリーミングが終了しました。", "properties": { "id": { "type": "string", "format": "uuid", "description": "メッセージの一意な ID。" }, "metadata": { "type": "object", "description": "使用量と検索リソースを含むメタデータ。", "properties": { "usage": { "$ref": "#/components/schemas/Usage" }, "retriever_resources": { "type": "array", "description": "使用された検索リソースのリスト。", "items": { "$ref": "#/components/schemas/RetrieverResource" } } } } } } ] }, "StreamEventChatMessageReplace": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "メッセージコンテンツ置換イベント(例:コンテンツモデレーションによるもの)。", "properties": { "answer": { "type": "string", "description": "置換コンテンツ。" }, "reason": { "type": "string", "description": "コンテンツ置換の理由。" } } } ] }, "StreamEventChatError": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ストリーミング中のエラーイベント。", "properties": { "status": { "type": "integer", "description": "HTTP ステータスコード。" }, "code": { "type": "string", "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } } ] }, "StreamEventChatPing": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "type": "object", "description": "接続を維持するための Ping イベント。`event: ping` 行として送信され、`data:` ペイロードはありません。" } ] }, "Usage": { "type": "object", "description": "モデルの使用情報です。", "properties": { "prompt_tokens": { "type": "integer", "description": "プロンプト内のトークン数。" }, "prompt_unit_price": { "type": "string", "format": "decimal", "description": "プロンプトトークンあたりの単価。" }, "prompt_price_unit": { "type": "string", "format": "decimal", "description": "プロンプトトークンの価格単位。" }, "prompt_price": { "type": "string", "format": "decimal", "description": "プロンプトトークンの合計価格。" }, "completion_tokens": { "type": "integer", "description": "補完のトークン数。" }, "completion_unit_price": { "type": "string", "format": "decimal", "description": "補完トークンあたりの単価。" }, "completion_price_unit": { "type": "string", "format": "decimal", "description": "補完トークンの価格単位。" }, "completion_price": { "type": "string", "format": "decimal", "description": "補完トークンの合計価格。" }, "total_tokens": { "type": "integer", "description": "使用されたトークンの合計数。" }, "total_price": { "type": "string", "format": "decimal", "description": "すべてのトークンの合計価格。" }, "currency": { "type": "string", "description": "課金通貨。" }, "latency": { "type": "number", "format": "double", "description": "レイテンシ(秒)。" } } }, "RetrieverResource": { "type": "object", "description": "検索リソースの引用および帰属情報です。", "properties": { "id": { "type": "string", "format": "uuid", "description": "検索リソースの一意の ID。" }, "message_id": { "type": "string", "format": "uuid", "description": "このリソースが属するメッセージの ID。" }, "position": { "type": "integer", "description": "リスト内のリソースの位置。" }, "dataset_id": { "type": "string", "format": "uuid", "description": "ナレッジベース ID。" }, "dataset_name": { "type": "string", "description": "ナレッジベース名。" }, "document_id": { "type": "string", "format": "uuid", "description": "ドキュメント ID。" }, "document_name": { "type": "string", "description": "ドキュメント名。" }, "data_source_type": { "type": "string", "description": "データソースのタイプ。" }, "segment_id": { "type": "string", "format": "uuid", "description": "ドキュメント内の特定のチャンクの ID。" }, "score": { "type": "number", "format": "float", "description": "リソースの関連性スコア。" }, "hit_count": { "type": "integer", "description": "このチャンクがヒットした回数。" }, "word_count": { "type": "integer", "description": "チャンクの単語数。" }, "segment_position": { "type": "integer", "description": "ドキュメント内のチャンクの位置。" }, "index_node_hash": { "type": "string", "description": "インデックスノードのハッシュ。" }, "content": { "type": "string", "description": "リソースからのコンテンツスニペット。" }, "summary": { "type": "string", "nullable": true, "description": "チャンクコンテンツの要約。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ(Unix エポック秒)。" } } }, "FileUploadResponse": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "一意のファイル ID。" }, "reference": { "type": "string", "nullable": true, "description": "Agent やツールのコンテキストでファイルを添付する際に内部的に使用される不透明なファイル参照です。このエンドポイントでアップロードされたファイルでは常に `null` です。" }, "name": { "type": "string", "description": "ファイル名。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト)。" }, "extension": { "type": "string", "nullable": true, "description": "ファイル拡張子。" }, "mime_type": { "type": "string", "nullable": true, "description": "ファイルの MIME タイプ。" }, "created_by": { "type": "string", "format": "uuid", "nullable": true, "description": "アップロードしたエンドユーザーの ID。[エンドユーザー取得](/ja/api-reference/end-users/get-end-user-info) で詳細を確認できます。" }, "created_at": { "type": "integer", "format": "int64", "description": "アップロードタイムスタンプ(Unix エポック秒)。" }, "preview_url": { "type": "string", "nullable": true, "description": "ファイルのプレビュー URL。" }, "source_url": { "type": "string", "description": "ファイルの署名付きダウンロード URL です。" }, "original_url": { "type": "string", "nullable": true, "description": "ファイルの元の URL。" }, "user_id": { "type": "string", "format": "uuid", "nullable": true, "description": "未使用です。常に `null` になります。" }, "tenant_id": { "type": "string", "format": "uuid", "nullable": true, "description": "関連付けられたテナントの ID。" }, "conversation_id": { "type": "string", "format": "uuid", "nullable": true, "description": "関連付けられた会話の ID。" }, "file_key": { "type": "string", "nullable": true, "description": "未使用です。常に `null` になります。" } } }, "EndUserDetail": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "エンドユーザー ID。" }, "tenant_id": { "type": "string", "format": "uuid", "description": "テナント ID。" }, "app_id": { "type": "string", "format": "uuid", "nullable": true, "description": "アプリケーション ID。" }, "type": { "type": "string", "description": "エンドユーザーのタイプ。Service API ユーザーの場合は常に `service-api` です。" }, "external_user_id": { "type": "string", "nullable": true, "description": "API リクエストで提供された `user` 識別子です(例:[チャットメッセージを送信](/ja/api-reference/chat-messages/send-chat-message) の `user` フィールド)。" }, "name": { "type": "string", "nullable": true, "description": "エンドユーザー名。" }, "is_anonymous": { "type": "boolean", "description": "ユーザーが匿名かどうかを示します。元の API リクエストで `user` 識別子が提供されなかった場合、`true` になります。" }, "session_id": { "type": "string", "description": "セッション識別子。デフォルトは `external_user_id` の値です。" }, "created_at": { "type": "string", "format": "date-time", "description": "作成タイムスタンプ。" }, "updated_at": { "type": "string", "format": "date-time", "description": "最終更新タイムスタンプ。" } } }, "MessageFeedbackRequest": { "type": "object", "description": "メッセージフィードバックを送信するためのリクエストボディ。", "required": [ "user" ], "properties": { "rating": { "type": "string", "enum": [ "like", "dislike", null ], "nullable": true, "description": "フィードバック評価。以前送信したフィードバックを取り消すには `null` に設定します。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。フィードバックはそのエンドユーザーにスコープされるため、メッセージを受け取った `user` と一致する必要があります。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" }, "content": { "type": "string", "description": "追加の詳細を提供する任意のテキストフィードバック。" } } }, "AppFeedbacksResponse": { "type": "object", "properties": { "data": { "type": "array", "description": "フィードバック項目のリスト。", "items": { "$ref": "#/components/schemas/FeedbackItem" } } } }, "FeedbackItem": { "type": "object", "description": "単一のフィードバック項目。", "properties": { "id": { "type": "string", "format": "uuid", "description": "フィードバック ID。" }, "app_id": { "type": "string", "format": "uuid", "description": "アプリケーション ID。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会話 ID。" }, "message_id": { "type": "string", "format": "uuid", "description": "メッセージ ID。" }, "rating": { "type": "string", "description": "フィードバック評価。肯定的な場合は `like`、否定的な場合は `dislike`。" }, "content": { "type": "string", "nullable": true, "description": "任意のテキストフィードバック。" }, "from_source": { "type": "string", "description": "フィードバックのソース。API 経由でエンドユーザーが送信したフィードバックの場合は `user`、コンソールから送信されたフィードバックの場合は `admin`。" }, "from_end_user_id": { "type": "string", "format": "uuid", "nullable": true, "description": "フィードバックを送信したエンドユーザー ID。`from_source` が `user` の場合に存在します。" }, "from_account_id": { "type": "string", "format": "uuid", "nullable": true, "description": "フィードバックを送信したアカウント ID。`from_source` が `admin` の場合に存在します。" }, "created_at": { "type": "string", "format": "date-time", "description": "作成タイムスタンプ。" }, "updated_at": { "type": "string", "format": "date-time", "description": "最終更新タイムスタンプ。" } } }, "SuggestedQuestionsResponse": { "type": "object", "properties": { "result": { "type": "string", "description": "結果ステータス。" }, "data": { "type": "array", "items": { "type": "string" }, "description": "提案された質問のリストです。" } } }, "ConversationHistoryResponse": { "type": "object", "properties": { "limit": { "type": "integer", "description": "1 ページあたりの件数です。" }, "has_more": { "type": "boolean", "description": "さらにメッセージがあるかどうかです。" }, "data": { "type": "array", "description": "メッセージのリストです。", "items": { "$ref": "#/components/schemas/ConversationMessageItem" } } } }, "ConversationMessageItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "メッセージ ID。" }, "conversation_id": { "type": "string", "format": "uuid", "description": "会話 ID。" }, "parent_message_id": { "type": "string", "format": "uuid", "nullable": true, "description": "スレッド会話の親メッセージ ID です。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "このメッセージの入力変数です。" }, "query": { "type": "string", "description": "ユーザークエリテキストです。" }, "answer": { "type": "string", "description": "アシスタントの回答テキストです。" }, "status": { "type": "string", "description": "メッセージステータスです。成功したメッセージの場合は `normal`、生成に失敗した場合は `error` です。" }, "error": { "type": "string", "nullable": true, "description": "`status` が `error` の場合のエラーメッセージです。" }, "message_files": { "type": "array", "description": "このメッセージに添付されたファイルです。", "items": { "$ref": "#/components/schemas/MessageFileItem" } }, "feedback": { "type": "object", "nullable": true, "description": "このメッセージのユーザーフィードバックです。", "properties": { "rating": { "type": "string", "description": "フィードバック評価。肯定的な場合は `like`、否定的な場合は `dislike`。" } } }, "retriever_resources": { "type": "array", "description": "このメッセージに使用された検索リソースです。", "items": { "$ref": "#/components/schemas/RetrieverResource" } }, "agent_thoughts": { "type": "array", "description": "このメッセージのエージェント思考です。", "items": { "$ref": "#/components/schemas/AgentThoughtItem" } }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ(Unix エポック秒)。" }, "extra_contents": { "type": "array", "description": "このメッセージに関連する追加の実行コンテンツです。chatflow ワークフローの人間の入力ノードからのフォームデータなどが含まれます。", "items": { "$ref": "#/components/schemas/HumanInputContent" } }, "message_tokens": { "type": "integer", "description": "入力メッセージのトークン数です。" }, "answer_tokens": { "type": "integer", "description": "生成された回答のトークン数です。" }, "total_tokens": { "type": "integer", "description": "使用されたトークンの合計。`message_tokens` と `answer_tokens` の合計です。" }, "provider_response_latency": { "type": "number", "format": "double", "description": "モデルプロバイダーの応答レイテンシ(秒)です。" }, "total_price": { "type": "string", "format": "decimal", "nullable": true, "description": "使用されたトークンの合計金額です。価格情報が利用できない場合は `null` です。" }, "currency": { "type": "string", "nullable": true, "description": "`total_price` の通貨(例:`USD`)です。価格情報が利用できない場合は `null` です。" } } }, "MessageFileItem": { "type": "object", "description": "メッセージに添付されたファイルです。", "properties": { "id": { "type": "string", "format": "uuid", "description": "File ID." }, "filename": { "type": "string", "description": "元のファイル名です。" }, "type": { "type": "string", "description": "ファイルの種類(例: `image`)です。" }, "url": { "type": "string", "format": "url", "nullable": true, "description": "ファイルのプレビュー URL。" }, "mime_type": { "type": "string", "nullable": true, "description": "ファイルの MIME タイプ。" }, "size": { "type": "integer", "nullable": true, "description": "ファイルサイズ(バイト)。" }, "transfer_method": { "type": "string", "description": "使用された転送方法です。`remote_url` は URL ベースのファイル、`local_file` はアップロード済みファイル、`tool_file` はツール生成ファイルを示します。" }, "belongs_to": { "type": "string", "nullable": true, "description": "このファイルの所有者です。ユーザーがアップロードしたファイルの場合は `user`、アシスタントが生成したファイルの場合は `assistant` です。" }, "upload_file_id": { "type": "string", "format": "uuid", "nullable": true, "description": "`local_file` で転送された場合のアップロードファイル ID です。" } } }, "AgentThoughtItem": { "type": "object", "description": "メッセージ内のエージェント思考ステップです。", "properties": { "id": { "type": "string", "format": "uuid", "description": "エージェント思考 ID です。" }, "chain_id": { "type": "string", "nullable": true, "description": "この思考のチェーン ID です。" }, "message_id": { "type": "string", "format": "uuid", "description": "この思考が属する一意のメッセージ ID です。" }, "position": { "type": "integer", "description": "この思考の位置です。" }, "thought": { "type": "string", "description": "LLM が思考している内容です。" }, "tool": { "type": "string", "description": "呼び出されたツール(`;` で区切り)です。" }, "tool_labels": { "type": "object", "nullable": true, "additionalProperties": true, "description": "使用されたツールのラベルです。" }, "tool_input": { "type": "string", "description": "ツールの入力(JSON 形式)です。" }, "observation": { "type": "string", "description": "ツール呼び出しからのレスポンスです。" }, "files": { "type": "array", "items": { "type": "string" }, "description": "この思考に関連するファイル ID です。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } }, "ConversationsListResponse": { "type": "object", "properties": { "limit": { "type": "integer", "description": "1 ページあたりの件数です。" }, "has_more": { "type": "boolean", "description": "さらに会話があるかどうかです。" }, "data": { "type": "array", "description": "会話のリストです。", "items": { "$ref": "#/components/schemas/ConversationListItem" } } } }, "ConversationListItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "会話 ID。" }, "name": { "type": "string", "description": "会話名です。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "会話の入力変数です。" }, "status": { "type": "string", "description": "会話ステータスです。アクティブな会話の場合は `normal` です。" }, "introduction": { "type": "string", "description": "会話の紹介文です。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }, "updated_at": { "type": "integer", "format": "int64", "description": "最終更新タイムスタンプ。" } } }, "ConversationRenameRequest": { "type": "object", "description": "会話の名前変更用リクエストボディです。", "properties": { "name": { "type": "string", "description": "新しい会話名です。`auto_generate` が `true` でない限り必須です。" }, "auto_generate": { "type": "boolean", "default": false, "description": "会話名を自動生成します。`true` の場合、`name` フィールドは無視されます。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } }, "ConversationVariablesResponse": { "type": "object", "properties": { "limit": { "type": "integer", "description": "1 ページあたりの件数です。" }, "has_more": { "type": "boolean", "description": "次のページがあるかどうかです。" }, "data": { "type": "array", "description": "会話変数のリストです。", "items": { "$ref": "#/components/schemas/ConversationVariableItem" } } } }, "ConversationVariableItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Variable ID." }, "name": { "type": "string", "description": "変数名です。" }, "value_type": { "type": "string", "description": "変数の値の型です。指定可能な値:`string`、`number`、`object`、`secret`、`file`、`boolean`、`array[any]`、`array[string]`、`array[number]`、`array[object]`、`array[file]`、`array[boolean]`。" }, "value": { "type": "string", "description": "変数値(複雑な型の場合は JSON 文字列)。" }, "description": { "type": "string", "description": "変数の説明です。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }, "updated_at": { "type": "integer", "format": "int64", "description": "最終更新タイムスタンプ。" } } }, "ConversationVariableUpdateRequest": { "type": "object", "description": "会話変数を更新するためのリクエストボディです。", "required": [ "value" ], "properties": { "value": { "description": "変数の新しい値。変数の期待される型と一致する必要があります。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } }, "AudioToTextRequest": { "type": "object", "description": "音声からテキストへの変換のリクエストボディ。", "required": [ "file" ], "properties": { "file": { "type": "string", "format": "binary", "description": "文字起こしする音声ファイルです。受け付ける MIME タイプは `audio/mp3`、`audio/m4a`、`audio/wav`、`audio/amr`、`audio/mpga` です。それ以外のタイプ(一般的な `audio/mpeg` を含む)は `unsupported_audio_type` で拒否されます。最大サイズは `30 MB` です。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" } } }, "AudioToTextResponse": { "type": "object", "properties": { "text": { "type": "string", "description": "音声認識からの出力テキスト。" } } }, "TextToAudioRequest": { "type": "object", "description": "テキストから音声への変換のリクエストボディ。`message_id` または `text` のいずれかを指定してください。", "properties": { "message_id": { "type": "string", "format": "uuid", "description": "回答を音声化するメッセージの ID です。両方が指定された場合、`text` よりも優先されます。メッセージ ID は [会話履歴メッセージ一覧を取得](/ja/api-reference/conversations/list-conversation-messages) から取得します。" }, "text": { "type": "string", "description": "音声に合成するテキストです。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" }, "voice": { "type": "string", "description": "テキスト読み上げに使用する音声。利用可能な音声は、このアプリに設定された TTS プロバイダーによって異なります。デフォルトには[アプリケーションのパラメータ情報を取得](/ja/api-reference/applications/get-app-parameters) → `text_to_speech.voice` の `voice` 値を使用してください。" }, "streaming": { "type": "boolean", "description": "後方互換性のために受け付けられますが、効果はありません。音声がストリーミングされるかどうかは、設定された TTS プロバイダーの出力によって決まり、このフィールドでは制御されません。" } } }, "AppInfoResponse": { "type": "object", "properties": { "name": { "type": "string", "description": "アプリケーション名。" }, "description": { "type": "string", "description": "アプリケーションの説明。" }, "tags": { "type": "array", "items": { "type": "string" }, "description": "アプリケーションタグ。" }, "mode": { "type": "string", "description": "アプリケーションモード。`completion` はテキスト生成アプリ、`chat` は基本チャットアプリ、`agent-chat` はエージェントベースのアプリ、`advanced-chat` は Chatflow アプリ、`workflow` は Workflow アプリです、`agent` は新しい Agent アプリです。" }, "author_name": { "type": "string", "description": "アプリケーション作成者の名前。" } } }, "UserInputFormItem": { "type": "object", "oneOf": [ { "$ref": "#/components/schemas/TextInputControlWrapper" }, { "$ref": "#/components/schemas/ParagraphControlWrapper" }, { "$ref": "#/components/schemas/SelectControlWrapper" } ] }, "TextInputControlWrapper": { "title": "Text Input", "type": "object", "properties": { "text-input": { "$ref": "#/components/schemas/TextInputControl" } } }, "ParagraphControlWrapper": { "title": "Paragraph", "type": "object", "properties": { "paragraph": { "$ref": "#/components/schemas/ParagraphControl" } } }, "SelectControlWrapper": { "title": "Select", "type": "object", "properties": { "select": { "$ref": "#/components/schemas/SelectControl" } } }, "TextInputControl": { "type": "object", "properties": { "label": { "type": "string", "description": "フォームフィールドの表示ラベル。" }, "variable": { "type": "string", "description": "`inputs` オブジェクトのキーとして使用される変数名。" }, "required": { "type": "boolean", "description": "送信前にこのフィールドを入力する必要があるかどうか。" }, "default": { "type": "string", "description": "フォームフィールドに事前入力されるデフォルト値。" } } }, "ParagraphControl": { "type": "object", "properties": { "label": { "type": "string", "description": "フォームフィールドの表示ラベル。" }, "variable": { "type": "string", "description": "`inputs` オブジェクトのキーとして使用される変数名。" }, "required": { "type": "boolean", "description": "送信前にこのフィールドを入力する必要があるかどうか。" }, "default": { "type": "string", "description": "フォームフィールドに事前入力されるデフォルト値。" } } }, "SelectControl": { "type": "object", "properties": { "label": { "type": "string", "description": "フォームフィールドの表示ラベル。" }, "variable": { "type": "string", "description": "`inputs` オブジェクトのキーとして使用される変数名。" }, "required": { "type": "boolean", "description": "送信前に選択を行う必要があるかどうか。" }, "default": { "type": "string", "description": "デフォルトで選択される値。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "このフォームコントロールの選択可能な値のリスト。" } } }, "AppMetaResponse": { "type": "object", "properties": { "tool_icons": { "type": "object", "additionalProperties": { "oneOf": [ { "title": "Icon URL", "type": "string", "format": "url", "description": "アイコンの URL。" }, { "$ref": "#/components/schemas/ToolIconDetail" } ] }, "description": "ツールアイコン。キーはツール名です。" } } }, "ToolIconDetail": { "title": "Emoji Icon", "type": "object", "description": "絵文字を使用したツールアイコンの詳細。", "properties": { "background": { "type": "string", "description": "16進数形式の背景色。" }, "content": { "type": "string", "description": "Emoji コンテンツ。" } } }, "WebAppSettingsResponse": { "type": "object", "properties": { "title": { "type": "string", "description": "WebApp タイトル。" }, "chat_color_theme": { "type": "string", "description": "チャットカラーテーマ。" }, "chat_color_theme_inverted": { "type": "boolean", "description": "チャットカラーテーマが反転しているかどうか。" }, "icon_type": { "type": "string", "description": "使用されるアイコンのタイプ。`emoji` は絵文字アイコン、`image` はアップロードされた画像アイコンです。" }, "icon": { "type": "string", "description": "アイコンのコンテンツ(絵文字または画像 ID)。" }, "icon_background": { "type": "string", "description": "アイコンの背景色。" }, "icon_url": { "type": "string", "format": "url", "nullable": true, "description": "アイコン画像の URL。" }, "description": { "type": "string", "description": "WebApp の説明。" }, "copyright": { "type": "string", "description": "著作権テキスト。" }, "privacy_policy": { "type": "string", "description": "プライバシーポリシー URL。" }, "input_placeholder": { "type": "string", "nullable": true, "description": "WebApp のメッセージ入力ボックスに表示されるプレースホルダーテキストです。設定されていない場合は `null` です。" }, "custom_disclaimer": { "type": "string", "description": "カスタム免責事項テキスト。" }, "default_language": { "type": "string", "description": "デフォルト言語コード。" }, "show_workflow_steps": { "type": "boolean", "description": "ワークフローステップを表示するかどうか。" }, "use_icon_as_answer_icon": { "type": "boolean", "description": "アプリアイコンを回答アイコンとして使用するかどうか。" } } }, "AnnotationListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/AnnotationItem" }, "description": "現在のページのアノテーション項目のリストです。" }, "has_more": { "type": "boolean", "description": "現在の結果セットの後にさらにページがある場合は `true` です。" }, "limit": { "type": "integer", "description": "1 ページあたりの件数です。" }, "total": { "type": "integer", "description": "クエリに一致するアノテーションの合計数です。" }, "page": { "type": "integer", "description": "現在のページ番号です。" } } }, "AnnotationItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "アノテーションの一意識別子です。" }, "question": { "type": "string", "nullable": true, "description": "このアノテーションをトリガーする質問テキストです。" }, "answer": { "type": "string", "nullable": true, "description": "アノテーションがマッチした際に返される定義済みの回答です。" }, "hit_count": { "type": "integer", "nullable": true, "description": "このアノテーションがマッチして返信として返された回数です。" }, "created_at": { "type": "integer", "format": "int64", "nullable": true, "description": "作成タイムスタンプ(Unix エポック秒)。" } } }, "CreateAnnotationRequest": { "type": "object", "description": "新しいアノテーションを作成するためのリクエストボディです。", "required": [ "question", "answer" ], "properties": { "question": { "type": "string", "description": "アプリが受信したユーザー入力を照合する質問テキストです。" }, "answer": { "type": "string", "description": "このアノテーションが一致したときに返される回答です。" } } }, "UpdateAnnotationRequest": { "type": "object", "description": "アノテーション更新のリクエストボディです。", "required": [ "question", "answer" ], "properties": { "question": { "type": "string", "description": "アノテーションの新しい質問テキストです。" }, "answer": { "type": "string", "description": "アノテーションの新しい回答テキストです。" } } }, "InitialAnnotationReplySettingsRequest": { "type": "object", "description": "アノテーション返信設定を構成するためのリクエストボディです。", "required": [ "score_threshold", "embedding_provider_name", "embedding_model_name" ], "properties": { "embedding_provider_name": { "type": "string", "description": "埋め込みモデルプロバイダーです(例:`openai`)。利用可能なプロバイダーは [利用可能なモデルを取得](/ja/api-reference/models/get-available-models) から取得します。" }, "embedding_model_name": { "type": "string", "description": "マッチングのためにアノテーションをベクトル化する埋め込みモデルです(例:`text-embedding-3-small`)。" }, "score_threshold": { "type": "number", "format": "float", "description": "アノテーションがマッチとみなされるための最低類似度スコアです。値が高いほど、より正確なマッチが必要になります。" } } }, "InitialAnnotationReplySettingsResponse": { "type": "object", "properties": { "job_id": { "type": "string", "format": "uuid", "description": "非同期ジョブ ID です。[アノテーション返信の初期設定タスクステータスを取得](/ja/api-reference/annotations/get-annotation-reply-job-status) と組み合わせて進捗を追跡します。" }, "job_status": { "type": "string", "description": "現在のジョブステータスです。このエンドポイントが返すのは `waiting`(キュー待ち)または `processing`(処理中)のみです。`completed` と `error` は [アノテーション返信の初期設定タスクステータスを取得](/ja/api-reference/annotations/get-annotation-reply-job-status) からのみ返されます。" } } }, "InitialAnnotationReplySettingsStatusResponse": { "type": "object", "properties": { "job_id": { "type": "string", "format": "uuid", "description": "[アノテーション返信を設定](/ja/api-reference/annotations/configure-annotation-reply) 呼び出しから取得したジョブ ID です。" }, "job_status": { "type": "string", "description": "現在のジョブステータスです。`waiting` はキュー待ち、`processing` は処理中、`completed` は完了、`error` は失敗を示します。" }, "error_msg": { "type": "string", "description": "ジョブが失敗した理由を説明するエラーメッセージです。`job_status` が `error` でない場合は空文字列です。" } } }, "AppParametersResponse": { "type": "object", "properties": { "opening_statement": { "type": "string", "nullable": true, "description": "オープニングステートメントのテキストです。" }, "suggested_questions": { "type": "array", "items": { "type": "string" }, "description": "提案された質問のリストです。" }, "suggested_questions_after_answer": { "type": "object", "description": "回答後の提案質問の設定です。", "properties": { "enabled": { "type": "boolean", "description": "この機能が有効かどうか。" } } }, "speech_to_text": { "type": "object", "description": "音声テキスト変換機能の設定です。", "properties": { "enabled": { "type": "boolean", "description": "この機能が有効かどうか。" } } }, "text_to_speech": { "type": "object", "description": "テキスト音声変換機能の設定です。", "properties": { "enabled": { "type": "boolean", "description": "この機能が有効かどうか。" }, "voice": { "type": "string", "description": "TTS 音声識別子。" }, "language": { "type": "string", "description": "TTS 言語。" }, "autoPlay": { "type": "string", "description": "自動再生設定です。音声を自動再生するには `enabled`、手動再生を要求するには `disabled` を指定します。" } } }, "retriever_resource": { "type": "object", "description": "ナレッジ検索の引用リソース設定です。", "properties": { "enabled": { "type": "boolean", "description": "この機能が有効かどうか。" } } }, "annotation_reply": { "type": "object", "description": "アノテーション返信機能の設定です。", "properties": { "enabled": { "type": "boolean", "description": "この機能が有効かどうか。" } } }, "more_like_this": { "type": "object", "description": "類似コンテンツ機能の設定です。", "properties": { "enabled": { "type": "boolean", "description": "この機能が有効かどうか。" } } }, "sensitive_word_avoidance": { "type": "object", "description": "コンテンツモデレーション機能の設定です。", "properties": { "enabled": { "type": "boolean", "description": "この機能が有効かどうか。" } } }, "user_input_form": { "type": "array", "items": { "type": "object", "oneOf": [ { "title": "Text Input", "type": "object", "properties": { "text-input": { "type": "object", "properties": { "label": { "type": "string", "description": "入力フィールドの表示ラベルです。" }, "variable": { "type": "string", "description": "ワークフローで使用される変数名です。" }, "required": { "type": "boolean", "description": "このフィールドが必須かどうかです。" }, "default": { "type": "string", "description": "入力フィールドのデフォルト値です。" } } } } }, { "title": "Paragraph", "type": "object", "properties": { "paragraph": { "type": "object", "properties": { "label": { "type": "string", "description": "段落フィールドの表示ラベルです。" }, "variable": { "type": "string", "description": "ワークフローで使用される変数名です。" }, "required": { "type": "boolean", "description": "このフィールドが必須かどうかです。" }, "default": { "type": "string", "description": "段落フィールドのデフォルト値です。" } } } } }, { "title": "Select", "type": "object", "properties": { "select": { "type": "object", "properties": { "label": { "type": "string", "description": "セレクトフィールドの表示ラベルです。" }, "variable": { "type": "string", "description": "ワークフローで使用される変数名です。" }, "required": { "type": "boolean", "description": "このフィールドが必須かどうかです。" }, "default": { "type": "string", "description": "デフォルトで選択される値。" }, "options": { "type": "array", "items": { "type": "string" }, "description": "このフォームコントロールの選択可能な値のリスト。" } } } } } ] }, "description": "ユーザー入力フォームの設定です。" }, "file_upload": { "type": "object", "description": "ファイルアップロードの設定。", "properties": { "image": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "画像アップロードが有効かどうか。" }, "number_limits": { "type": "integer", "description": "アップロード可能な画像の最大数です。" }, "detail": { "type": "string", "description": "ビジョンモデルの画像詳細レベルです。" }, "transfer_methods": { "type": "array", "items": { "type": "string" }, "description": "画像アップロードで許可される転送方法です。`remote_url` はファイル URL 経由、`local_file` はアップロード済みファイルを示します。" } } } } }, "system_parameters": { "type": "object", "description": "システムレベルのパラメータ制限です。", "properties": { "file_size_limit": { "type": "integer", "description": "一般ファイルの最大サイズ(MB)です。" }, "image_file_size_limit": { "type": "integer", "description": "最大画像ファイルサイズ(MB)。" }, "audio_file_size_limit": { "type": "integer", "description": "最大音声ファイルサイズ(MB)。" }, "video_file_size_limit": { "type": "integer", "description": "最大動画ファイルサイズ(MB)。" }, "workflow_file_upload_limit": { "type": "integer", "description": "ワークフロー実行ごとの最大ファイル数です。" } } } } }, "StreamEventWorkflowStarted": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ワークフローの実行が開始されました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "ワークフロー実行 ID です。" }, "workflow_id": { "type": "string", "description": "関連するワークフロー ID です。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "このワークフロー実行の入力変数です。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "reason": { "type": "string", "description": "ワークフロー開始の理由です。`initial` は初回開始、`resumption` は一時停止後の再開(例:人間の入力後)を示します。" } } } } } ] }, "StreamEventWorkflowFinished": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ワークフローの実行が完了しました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "ワークフロー実行 ID です。" }, "workflow_id": { "type": "string", "description": "関連するワークフロー ID です。" }, "status": { "type": "string", "description": "実行ステータスです。`running` は進行中、`succeeded` は成功、`failed` は失敗、`stopped` は手動停止、`partial-succeeded` は部分完了、`paused` は人間の入力待ちを示します。" }, "outputs": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ワークフローの出力データです。" }, "error": { "type": "string", "nullable": true, "description": "実行が失敗した場合のエラーメッセージです。" }, "elapsed_time": { "type": "number", "description": "合計実行時間(秒)です。" }, "total_tokens": { "type": "integer", "description": "消費された合計トークン数です。" }, "total_steps": { "type": "integer", "description": "実行された合計ステップ数です。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "finished_at": { "type": "integer", "format": "int64", "nullable": true, "description": "終了タイムスタンプ(Unix エポック秒)です。" }, "exceptions_count": { "type": "integer", "nullable": true, "description": "実行中の例外数です。" }, "files": { "type": "array", "nullable": true, "items": { "type": "object", "additionalProperties": true }, "description": "ワークフロー実行中に生成されたファイルです。" } } } } } ] }, "StreamEventNodeStarted": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ノードの実行が開始されました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "ノード実行 ID です。" }, "node_id": { "type": "string", "description": "ワークフローグラフ内のノード ID です。" }, "node_type": { "type": "string", "description": "ノードタイプ(例:`llm`、`knowledge-retrieval`、`code`)です。" }, "title": { "type": "string", "description": "Node title." }, "index": { "type": "integer", "description": "実行インデックスです。" }, "predecessor_node_id": { "type": "string", "nullable": true, "description": "先行ノードの ID です。" }, "inputs": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ノードの入力データです。簡略化された API レスポンスでは `null` の場合があります。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "extras": { "type": "object", "additionalProperties": true, "description": "追加メタデータです。" }, "iteration_id": { "type": "string", "nullable": true, "description": "このノードがイテレーション内で実行される場合のイテレーション ID です。" }, "loop_id": { "type": "string", "nullable": true, "description": "このノードがループ内で実行される場合のループ ID です。" } } } } } ] }, "StreamEventNodeFinished": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ノードの実行が完了しました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "ノード実行 ID です。" }, "node_id": { "type": "string", "description": "ワークフローグラフ内のノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "Node title." }, "index": { "type": "integer", "description": "実行インデックスです。" }, "predecessor_node_id": { "type": "string", "nullable": true, "description": "先行ノードの ID です。" }, "inputs": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ノードの入力データです。簡略化された API レスポンスでは `null` の場合があります。" }, "process_data": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ノードの処理データです。簡略化された API レスポンスでは `null` の場合があります。" }, "outputs": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ノードの出力データです。簡略化された API レスポンスでは `null` の場合があります。" }, "status": { "type": "string", "description": "ノードの実行ステータスです。`running` は進行中、`succeeded` は成功、`failed` は失敗、`exception` は例外発生を示します。" }, "error": { "type": "string", "nullable": true, "description": "ノードが失敗した場合のエラーメッセージです。" }, "elapsed_time": { "type": "number", "description": "ノードの実行時間(秒)です。" }, "execution_metadata": { "type": "object", "nullable": true, "additionalProperties": true, "description": "実行メタデータ(例:トークン使用量、モデル情報)です。簡略化された API レスポンスでは `null` の場合があります。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "finished_at": { "type": "integer", "format": "int64", "description": "終了タイムスタンプ(Unix エポック秒)です。" }, "files": { "type": "array", "nullable": true, "items": { "type": "object", "additionalProperties": true }, "description": "このノードで生成されたファイルです。" }, "iteration_id": { "type": "string", "nullable": true, "description": "このノードがイテレーション内で実行される場合のイテレーション ID です。" }, "loop_id": { "type": "string", "nullable": true, "description": "このノードがループ内で実行される場合のループ ID です。" } } } } } ] }, "StreamEventNodeRetry": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ノードのリトライ回数です。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "ノード実行 ID です。" }, "node_id": { "type": "string", "description": "ワークフローグラフ内のノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "Node title." }, "index": { "type": "integer", "description": "実行インデックスです。" }, "predecessor_node_id": { "type": "string", "nullable": true, "description": "先行ノードの ID です。" }, "inputs": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ノードの入力データです。" }, "process_data": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ノードの処理データです。" }, "outputs": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ノードの出力データです。" }, "status": { "type": "string", "description": "ノードの実行ステータスです。`running` は進行中、`succeeded` は成功、`failed` は失敗、`exception` は例外発生を示します。" }, "error": { "type": "string", "nullable": true, "description": "このリトライのエラーメッセージです。" }, "elapsed_time": { "type": "number", "description": "この試行の実行時間(秒)です。" }, "execution_metadata": { "type": "object", "nullable": true, "additionalProperties": true, "description": "実行メタデータです。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "finished_at": { "type": "integer", "format": "int64", "description": "終了タイムスタンプ(Unix エポック秒)です。" }, "files": { "type": "array", "nullable": true, "items": { "type": "object", "additionalProperties": true }, "description": "このリトライ中に生成されたファイルです。" }, "iteration_id": { "type": "string", "nullable": true, "description": "イテレーション ID(該当する場合)です。" }, "loop_id": { "type": "string", "nullable": true, "description": "ループ ID(該当する場合)です。" }, "retry_index": { "type": "integer", "description": "リトライ回数インデックス、`0` から開始します。" } } } } } ] }, "StreamEventIterationStarted": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "イテレーションループが開始されました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "イテレーション実行 ID です。" }, "node_id": { "type": "string", "description": "イテレーションノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "イテレーションノードのタイトルです。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "extras": { "type": "object", "additionalProperties": true, "description": "追加メタデータです。" }, "metadata": { "type": "object", "additionalProperties": true, "description": "イテレーションのメタデータです。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "イテレーションの入力データです。" } } } } } ] }, "StreamEventIterationNext": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "イテレーションが次の項目に進みました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "イテレーション実行 ID です。" }, "node_id": { "type": "string", "description": "イテレーションノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "イテレーションノードのタイトルです。" }, "index": { "type": "integer", "description": "現在のイテレーションインデックス(0 始まり)です。" }, "created_at": { "type": "integer", "format": "int64", "description": "タイムスタンプ(Unix エポック秒)です。" }, "extras": { "type": "object", "additionalProperties": true, "description": "追加メタデータです。" } } } } } ] }, "StreamEventIterationCompleted": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "イテレーションループが完了しました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "イテレーション実行 ID です。" }, "node_id": { "type": "string", "description": "イテレーションノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "イテレーションノードのタイトルです。" }, "outputs": { "type": "object", "nullable": true, "additionalProperties": true, "description": "イテレーションの出力データです。" }, "status": { "type": "string", "description": "イテレーションの実行ステータスです。`running` は進行中、`succeeded` は成功、`failed` は失敗、`exception` は例外発生を示します。" }, "error": { "type": "string", "nullable": true, "description": "イテレーションが失敗した場合のエラーメッセージです。" }, "elapsed_time": { "type": "number", "description": "イテレーションの合計時間(秒)です。" }, "total_tokens": { "type": "integer", "description": "すべてのイテレーションで消費されたトークンの合計です。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "finished_at": { "type": "integer", "format": "int64", "description": "終了タイムスタンプ(Unix エポック秒)です。" }, "steps": { "type": "integer", "description": "実行されたイテレーションステップの合計数です。" } } } } } ] }, "StreamEventLoopStarted": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ループが開始されました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "ループ実行 ID です。" }, "node_id": { "type": "string", "description": "ループノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "ループノードのタイトルです。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "extras": { "type": "object", "additionalProperties": true, "description": "追加メタデータです。" }, "metadata": { "type": "object", "additionalProperties": true, "description": "ループのメタデータです。" }, "inputs": { "type": "object", "additionalProperties": true, "description": "ループの入力データです。" } } } } } ] }, "StreamEventLoopNext": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ループが次のイテレーションに進みました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "ループ実行 ID です。" }, "node_id": { "type": "string", "description": "ループノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "ループノードのタイトルです。" }, "index": { "type": "integer", "description": "現在のループインデックス(0 始まり)です。" }, "created_at": { "type": "integer", "format": "int64", "description": "タイムスタンプ(Unix エポック秒)です。" }, "pre_loop_output": { "description": "前回のループイテレーションからの出力です。" }, "extras": { "type": "object", "additionalProperties": true, "description": "追加メタデータです。" } } } } } ] }, "StreamEventLoopCompleted": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ループが完了しました。", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "ループ実行 ID です。" }, "node_id": { "type": "string", "description": "ループノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "ループノードのタイトルです。" }, "outputs": { "type": "object", "nullable": true, "additionalProperties": true, "description": "ループの出力データです。" }, "status": { "type": "string", "description": "ループの実行ステータスです。`running` は進行中、`succeeded` は成功、`failed` は失敗、`exception` は例外発生を示します。" }, "error": { "type": "string", "nullable": true, "description": "ループが失敗した場合のエラーメッセージです。" }, "elapsed_time": { "type": "number", "description": "ループの合計実行時間(秒)です。" }, "total_tokens": { "type": "integer", "description": "すべてのループイテレーションで消費されたトークンの合計です。" }, "created_at": { "type": "integer", "format": "int64", "description": "開始タイムスタンプ(Unix エポック秒)です。" }, "finished_at": { "type": "integer", "format": "int64", "description": "終了タイムスタンプ(Unix エポック秒)です。" }, "steps": { "type": "integer", "description": "実行されたループの合計ステップ数です。" } } } } } ] }, "StreamEventHumanInputRequired": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "form_id": { "type": "string", "description": "フォームインスタンスの識別子。エラーメッセージやログに含まれます。Service API の呼び出しには `form_token` を使用してください。" }, "node_id": { "type": "string", "description": "このフォームを生成した Human Input ノードの ID。" }, "node_title": { "type": "string", "description": "Human Input ノードの表示タイトル。" }, "form_content": { "type": "string", "description": "ワークフロー変数が置換された、事前レンダリング済みのフォーム本文。" }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "フォーム入力コントロールの種類。使用可能な値:`paragraph`(複数行テキスト)、`select`(リストからの単一選択)、`file`(単一ファイルのアップロード)、`file-list`(複数ファイルのアップロード)。" }, "output_variable_name": { "type": "string", "description": "この入力の送信値をワークフロー内で参照する変数名。送信時の `inputs` オブジェクトのキーに対応します。" }, "default": { "type": "object", "nullable": true, "description": "ワークフローコンテキストから解決されるデフォルト値。デフォルトが設定されていない場合は `null`。", "properties": { "type": { "type": "string", "description": "デフォルト値のソース。`constant` は `value` をリテラル文字列として使用します。`variable` は `selector` がワークフロー変数を指します。" }, "selector": { "type": "array", "items": { "type": "string" }, "description": "`type` が `variable` の場合の変数参照パス(例:`[\"node_id\", \"var_name\"]`)。少なくとも 2 要素を含みます。" }, "value": { "type": "string", "description": "`type` が `constant` の場合のリテラルデフォルト値。常に文字列です。" } } } } }, "description": "受信者が記入するフォーム入力フィールド。" }, "actions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "maxLength": 20, "pattern": "^[A-Za-z_][A-Za-z0-9_]*$", "description": "アクションボタンの識別子。受信者がこのボタンを選択したら、`action` として [人間の入力フォームを送信](/ja/api-reference/human-input/submit-human-input-form) に渡します。" }, "title": { "type": "string", "maxLength": 100, "description": "受信者に表示されるボタンのラベル。" }, "button_style": { "type": "string", "description": "ボタンの視覚スタイル。使用可能な値:`primary`、`default`、`accent`、`ghost`。" } } }, "description": "送信時に受信者が選択できるアクション(ボタン)。" }, "display_in_ui": { "type": "boolean", "description": "フォームが Dify コンソール UI にも表示されるかどうか。" }, "form_token": { "type": "string", "nullable": true, "description": "[人間の入力フォームを取得](/ja/api-reference/human-input/get-human-input-form) と [人間の入力フォームを送信](/ja/api-reference/human-input/submit-human-input-form) のアクセストークン。人間の入力ノードがメール配信またはコンソール配信を使用する場合は `null` になります(Service API は WebApp 配信のフォームのみ操作できます)。" }, "resolved_default_values": { "type": "object", "additionalProperties": { "type": "string" }, "description": "入力の `output_variable_name` をキーとする事前入力デフォルト値。すべての値は文字列化されます。" }, "expiration_time": { "type": "integer", "format": "int64", "description": "Unix タイムスタンプ(秒)。これを過ぎるとフォームは送信できなくなります。" } } } } } ] }, "StreamEventWorkflowPaused": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "workflow_run_id": { "type": "string", "description": "このワークフロー実行記録の永続的な識別子です。[ワークフロー実行詳細を取得](/ja/api-reference/workflow-runs/get-workflow-run-detail) と組み合わせて、実行後に結果を取得します。" }, "paused_nodes": { "type": "array", "items": { "type": "string" }, "description": "一時停止中のノード ID のリストです。" }, "outputs": { "type": "object", "additionalProperties": true, "description": "一時停止時の部分的な出力です。" }, "reasons": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "description": "一時停止の理由です。" }, "status": { "type": "string", "description": "ワークフローの実行ステータスです。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }, "elapsed_time": { "type": "number", "format": "float", "description": "合計経過時間(秒)です。" }, "total_tokens": { "type": "integer", "description": "消費された合計トークン数です。" }, "total_steps": { "type": "integer", "description": "実行された合計ステップ数です。" } } } } } ] }, "StreamEventHumanInputFormFilled": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "node_id": { "type": "string", "description": "フォームが記入された Human Input ノードの ID。" }, "node_title": { "type": "string", "description": "Human Input ノードの表示タイトル。" }, "rendered_content": { "type": "string", "description": "受信者の入力値で描画されたフォーム本文(`human_input_required` の `form_content` は未入力のテンプレートです)。" }, "action_id": { "type": "string", "description": "受信者が選択したアクションの識別子([人間の入力フォームを送信](/ja/api-reference/human-input/submit-human-input-form) に渡された `action` の値と一致します)。" }, "action_text": { "type": "string", "description": "選択されたアクションの表示テキスト。" }, "submitted_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "受信者が送信したフォームの値。各入力項目の `output_variable_name` をキーとします。" } } } } } ] }, "StreamEventHumanInputFormTimeout": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "properties": { "workflow_run_id": { "type": "string", "description": "ワークフロー実行の実行 ID です。" }, "data": { "type": "object", "properties": { "node_id": { "type": "string", "description": "フォームが期限切れとなった Human Input ノードの ID。" }, "node_title": { "type": "string", "description": "Human Input ノードの表示タイトル。" }, "expiration_time": { "type": "integer", "format": "int64", "description": "Unix タイムスタンプ(秒)。フォームが期限切れとなった時刻。" } } } } } ] }, "StreamEventAgentLog": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "description": "ワークフロー内のエージェントノードからのエージェントログです。", "properties": { "data": { "type": "object", "properties": { "node_execution_id": { "type": "string", "description": "ノード実行 ID です。" }, "id": { "type": "string", "description": "ログエントリ ID です。" }, "label": { "type": "string", "description": "ログエントリのラベルです。" }, "parent_id": { "type": "string", "nullable": true, "description": "ネストされたエントリの親ログエントリ ID です。" }, "error": { "type": "string", "nullable": true, "description": "エラーメッセージ(該当する場合)です。" }, "status": { "type": "string", "description": "ログエントリのステータスです。" }, "data": { "type": "object", "additionalProperties": true, "description": "ログエントリのデータです。" }, "metadata": { "type": "object", "additionalProperties": true, "description": "追加メタデータです。" }, "node_id": { "type": "string", "description": "ワークフローグラフ内のノード ID です。" } } } } } ] }, "StreamEventChatReasoningChunk": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "message_id": { "type": "string", "format": "uuid", "description": "この推論が属するメッセージの ID(トップレベルの `message_id` と同じ値)。" }, "reasoning": { "type": "string", "description": "`reasoning_format` が `separated` の LLM ノードが発行する思考過程のデルタです。連続する `reasoning_chunk` イベントを連結すると、完全な推論を復元できます。このストリームは `message` と並行しており、`message`(回答)ストリームには `` タグが含まれません。" }, "node_id": { "type": "string", "nullable": true, "description": "推論を生成している LLM ノードの ID です。複数の LLM ノードが実行される場合に、推論の出所を特定できます。" }, "is_final": { "type": "boolean", "description": "`true` は LLM ノードの推論フェーズの終了(「思考完了」のシグナル)を示します。空の `reasoning` を伴う場合があります。" } } } } } ] }, "StreamEventChatTextChunk": { "allOf": [ { "$ref": "#/components/schemas/ChunkChatEvent" }, { "$ref": "#/components/schemas/StreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "text": { "type": "string", "description": "テキスト内容のチャンクです。" }, "from_variable_selector": { "type": "array", "items": { "type": "string" }, "nullable": true, "description": "ワークフロー内のテキスト変数のソースパスです。" } } } } } ] }, "WorkflowRunDetailResponse": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行 ID です。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "Workflow ID." }, "status": { "type": "string", "description": "ワークフローの実行ステータスです。`running` は実行中、`succeeded` は正常完了、`failed` は実行エラー、`stopped` は手動停止、`partial-succeeded` は一部のノードが成功し他が失敗、`paused` は人間の入力待ちを示します。" }, "inputs": { "type": "string", "nullable": true, "description": "ワークフロー実行の入力変数です。生の JSON 文字列として返されるため(例:`{\"query\": \"...\"}`)、クライアント側でパースする必要があります。`null` の場合もあります。" }, "outputs": { "type": "object", "additionalProperties": true, "description": "ワークフローからの出力データです。出力がまだない場合は空のオブジェクトです。" }, "error": { "type": "string", "nullable": true, "description": "ワークフローが失敗した場合のエラーメッセージです。" }, "total_steps": { "type": "integer", "description": "実行されたワークフローの合計ステップ数です。" }, "total_tokens": { "type": "integer", "description": "消費された合計トークン数です。" }, "created_at": { "type": "integer", "format": "int64", "description": "ワークフロー実行が作成された Unix タイムスタンプです。" }, "finished_at": { "type": "integer", "format": "int64", "nullable": true, "description": "ワークフロー実行が完了した Unix タイムスタンプです。" }, "elapsed_time": { "type": "number", "format": "float", "nullable": true, "description": "合計経過時間(秒)です。" } } }, "WorkflowLogsResponse": { "type": "object", "properties": { "page": { "type": "integer", "description": "現在のページ番号です。" }, "limit": { "type": "integer", "description": "1 ページあたりの件数です。" }, "total": { "type": "integer", "description": "ログエントリの合計数です。" }, "has_more": { "type": "boolean", "description": "さらにページがあるかどうかです。" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowLogItem" }, "description": "ワークフローログエントリのリストです。" } } }, "WorkflowLogItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ログエントリ ID です。" }, "workflow_run": { "$ref": "#/components/schemas/WorkflowRunSummary" }, "created_from": { "type": "string", "description": "ワークフロー実行のソース(例:`service-api`)です。" }, "created_by_role": { "type": "string", "description": "作成者のロール(例:`end_user`、`account`)です。" }, "created_by_account": { "type": "object", "nullable": true, "description": "管理者ユーザーが作成した場合のアカウント詳細です。", "properties": { "id": { "type": "string", "format": "uuid", "description": "アカウント ID。" }, "name": { "type": "string", "description": "アカウント表示名。" }, "email": { "type": "string", "description": "アカウントメールアドレス。" } } }, "created_by_end_user": { "$ref": "#/components/schemas/EndUserSummary" }, "created_at": { "type": "integer", "format": "int64", "description": "ログエントリが作成された Unix タイムスタンプです。" }, "details": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ログエントリの追加詳細です。" } } }, "WorkflowRunSummary": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行 ID です。" }, "version": { "type": "string", "description": "ワークフローバージョン識別子です。" }, "status": { "type": "string", "description": "ワークフローの実行ステータスです。`running` は実行中、`succeeded` は正常完了、`failed` は実行エラー、`stopped` は手動停止、`partial-succeeded` は一部のノードが成功し他が失敗、`paused` は人間の入力待ちを示します。" }, "error": { "type": "string", "nullable": true, "description": "ワークフローが失敗した場合のエラーメッセージです。" }, "elapsed_time": { "type": "number", "format": "float", "description": "合計経過時間(秒)です。" }, "total_tokens": { "type": "integer", "description": "消費された合計トークン数です。" }, "total_steps": { "type": "integer", "description": "実行されたワークフローの合計ステップ数です。" }, "created_at": { "type": "integer", "format": "int64", "description": "ワークフロー実行が作成された Unix タイムスタンプです。" }, "finished_at": { "type": "integer", "format": "int64", "nullable": true, "description": "ワークフロー実行が完了した Unix タイムスタンプです。" }, "exceptions_count": { "type": "integer", "description": "実行中に発生した例外の数です。" }, "triggered_from": { "type": "string", "description": "ワークフロー実行をトリガーしたソースです。`app-run` はアプリまたは API からの実行、`webhook` は Webhook トリガーによる実行、`schedule` はスケジュールトリガーによる実行を示します、`plugin` はプラグイントリガーによる実行を示します。" } } }, "EndUserSummary": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "エンドユーザー ID。" }, "type": { "type": "string", "description": "エンドユーザーの種類です。" }, "is_anonymous": { "type": "boolean", "description": "エンドユーザーが匿名かどうかです。" }, "session_id": { "type": "string", "description": "セッション識別子です。" } } }, "HumanInputContent": { "type": "object", "description": "人間の入力ノードからの実行コンテンツです。フォーム定義と送信データを含みます。", "properties": { "workflow_run_id": { "type": "string", "description": "このコンテンツが属するワークフロー実行の ID です。" }, "submitted": { "type": "boolean", "description": "人間の入力フォームが送信されたかどうかです。" }, "type": { "type": "string", "description": "`human_input` は人間の入力コンテンツを示します。" }, "form_definition": { "nullable": true, "description": "人間の入力ノードからのフォーム定義です。コンテンツが送信レスポンスを表す場合は `null` です。", "$ref": "#/components/schemas/HumanInputFormDefinition" }, "form_submission_data": { "nullable": true, "description": "送信されたフォームデータです。フォームがまだ送信されていない場合は `null` です。", "$ref": "#/components/schemas/HumanInputFormSubmissionData" } } }, "HumanInputFormDefinition": { "type": "object", "description": "人間の入力ノードによってレンダリングされる人間の入力フォームの定義です。", "properties": { "form_id": { "type": "string", "description": "フォームの一意識別子です。" }, "node_id": { "type": "string", "description": "このフォームを生成した人間の入力ノードの ID です。" }, "node_title": { "type": "string", "description": "人間の入力ノードのタイトルです。" }, "form_content": { "type": "string", "description": "フォームと共に表示される Markdown またはテキストコンテンツです。" }, "inputs": { "type": "array", "description": "フォーム内の入力フィールドです。", "items": { "$ref": "#/components/schemas/FormInput" } }, "actions": { "type": "array", "description": "フォームで利用可能なアクションボタンです。", "items": { "$ref": "#/components/schemas/UserAction" } }, "display_in_ui": { "type": "boolean", "description": "フォームを UI に表示するかどうかです。" }, "form_token": { "type": "string", "nullable": true, "description": "フォーム送信認証用のトークンです。" }, "resolved_default_values": { "type": "object", "additionalProperties": true, "description": "出力変数名をキーとする、フォーム入力の解決済みデフォルト値です。" }, "expiration_time": { "type": "integer", "description": "フォームが期限切れになる Unix タイムスタンプです。" } } }, "HumanInputFormSubmissionData": { "type": "object", "description": "送信された人間の入力フォームからのデータです。", "properties": { "node_id": { "type": "string", "description": "人間の入力ノードの ID です。" }, "node_title": { "type": "string", "description": "人間の入力ノードのタイトルです。" }, "rendered_content": { "type": "string", "description": "フォーム送信のレンダリングされた内容です。" }, "action_id": { "type": "string", "description": "クリックされたアクションボタンの ID です。" }, "action_text": { "type": "string", "description": "クリックされたアクションボタンの表示テキストです。" } } }, "FormInput": { "type": "object", "description": "フォーム入力フィールドの定義です。", "properties": { "type": { "type": "string", "description": "フォーム入力コントロールの種類。使用可能な値:`paragraph`(複数行テキスト)、`select`(リストからの単一選択)、`file`(単一ファイルのアップロード)、`file-list`(複数ファイルのアップロード)。" }, "output_variable_name": { "type": "string", "description": "入力値が格納される変数名です。" }, "default": { "nullable": true, "description": "この入力のデフォルト値設定です。", "$ref": "#/components/schemas/FormInputDefault" } } }, "FormInputDefault": { "type": "object", "description": "フォーム入力のデフォルト値設定です。", "properties": { "type": { "type": "string", "description": "`variable` はワークフロー変数からの動的な値、`constant` は静的な値です。" }, "selector": { "type": "array", "items": { "type": "string" }, "description": "`type` が `variable` の場合の変数セレクターパスです。" }, "value": { "type": "string", "description": "`type` が `constant` の場合の静的値。" } } }, "UserAction": { "type": "object", "description": "人間の入力フォーム上のアクションボタンです。", "properties": { "id": { "type": "string", "description": "アクションの一意識別子です。" }, "title": { "type": "string", "description": "ボタンの表示テキストです。" }, "button_style": { "type": "string", "description": "`primary`, `default`, `accent`, or `ghost`." } } }, "WorkflowExecutionRequest": { "type": "object", "required": [ "inputs", "user" ], "properties": { "inputs": { "type": "object", "description": "ワークフロー入力変数のキーと値のペアです。アプリが期待する変数名と型は、[アプリケーションのパラメータ情報を取得](/ja/api-reference/applications/get-app-parameters) の `user_input_form` フィールドで確認できます。\n\nファイル型の変数には、`type`、`transfer_method`、および `url` または `upload_file_id` を持つファイルオブジェクトの配列を渡します。", "additionalProperties": { "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "object" }, { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObject" } } ] } }, "response_mode": { "type": "string", "enum": [ "streaming", "blocking" ], "description": "レスポンスモードです。同期レスポンスには `blocking`(Cloudflare タイムアウトは `100 s`)、サーバー送信イベントには `streaming` を使用します。省略した場合、デフォルトはブロッキング動作になります。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。データアクセスをスコープします。ワークフロー実行とそのファイルは、同じ `user` を持つ後続のリクエストにのみ表示されます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" }, "files": { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObject" }, "nullable": true, "description": "ファイルリストです。ファイルとテキストを組み合わせて入力する場合に適しており、モデルが Vision 機能をサポートしている場合にのみ使用できます。ローカルファイルを添付するには、まず [ファイルをアップロード](/ja/api-reference/files/upload-file) でアップロードし、返された `id` を `upload_file_id` として `transfer_method: local_file` で使用します。" } } }, "InputFileObject": { "type": "object", "required": [ "type", "transfer_method" ], "properties": { "type": { "type": "string", "enum": [ "image", "document", "audio", "video", "custom" ], "description": "ファイルタイプ。" }, "transfer_method": { "type": "string", "enum": [ "remote_url", "local_file" ], "description": "転送方法です。ファイル URL の場合は `remote_url`、アップロードファイルの場合は `local_file` です。" }, "url": { "type": "string", "format": "url", "description": "ファイル URL(`transfer_method` が `remote_url` の場合)です。" }, "upload_file_id": { "type": "string", "description": "事前に [ファイルをアップロード](/ja/api-reference/files/upload-file) API でアップロードして取得したファイル ID です(`transfer_method` が `local_file` の場合に使用)。" } }, "anyOf": [ { "properties": { "transfer_method": { "enum": [ "remote_url" ] }, "url": { "type": "string", "format": "url" } }, "required": [ "url" ], "not": { "required": [ "upload_file_id" ] } }, { "properties": { "transfer_method": { "enum": [ "local_file" ] }, "upload_file_id": { "type": "string" } }, "required": [ "upload_file_id" ], "not": { "required": [ "url" ] } } ] }, "WorkflowBlockingResponse": { "type": "object", "properties": { "task_id": { "type": "string", "format": "uuid", "description": "進行中の実行のタスク ID です。[ワークフロータスクを停止](/ja/api-reference/workflow-runs/stop-workflow-task) と組み合わせて、実行中のワークフローをキャンセルします。実行中のみ有効です。" }, "workflow_run_id": { "type": "string", "format": "uuid", "description": "このワークフロー実行記録の永続的な識別子です。[ワークフロー実行詳細を取得](/ja/api-reference/workflow-runs/get-workflow-run-detail) と組み合わせて、実行後に結果を取得します。" }, "data": { "$ref": "#/components/schemas/WorkflowFinishedData" } } }, "ChunkWorkflowEvent": { "type": "object", "required": [ "event" ], "properties": { "event": { "type": "string", "enum": [ "workflow_started", "node_started", "node_finished", "node_retry", "iteration_started", "iteration_next", "iteration_completed", "loop_started", "loop_next", "loop_completed", "reasoning_chunk", "text_chunk", "workflow_finished", "tts_message", "tts_message_end", "workflow_paused", "agent_log", "human_input_required", "human_input_form_filled", "human_input_form_timeout", "error", "ping" ], "description": "ストリーミングイベントの種類。" } }, "discriminator": { "propertyName": "event", "mapping": { "workflow_started": "#/components/schemas/WorkflowStreamEventWorkflowStarted", "node_started": "#/components/schemas/WorkflowStreamEventNodeStarted", "node_finished": "#/components/schemas/WorkflowStreamEventNodeFinished", "node_retry": "#/components/schemas/WorkflowStreamEventNodeRetry", "iteration_started": "#/components/schemas/WorkflowStreamEventIterationStarted", "iteration_next": "#/components/schemas/WorkflowStreamEventIterationNext", "iteration_completed": "#/components/schemas/WorkflowStreamEventIterationCompleted", "loop_started": "#/components/schemas/WorkflowStreamEventLoopStarted", "loop_next": "#/components/schemas/WorkflowStreamEventLoopNext", "loop_completed": "#/components/schemas/WorkflowStreamEventLoopCompleted", "reasoning_chunk": "#/components/schemas/StreamEventReasoningChunk", "text_chunk": "#/components/schemas/StreamEventTextChunk", "workflow_finished": "#/components/schemas/WorkflowStreamEventWorkflowFinished", "tts_message": "#/components/schemas/StreamEventTtsMessage", "tts_message_end": "#/components/schemas/StreamEventTtsMessageEnd", "error": "#/components/schemas/StreamEventError", "ping": "#/components/schemas/StreamEventPing", "workflow_paused": "#/components/schemas/WorkflowStreamEventWorkflowPaused", "agent_log": "#/components/schemas/WorkflowStreamEventAgentLog", "human_input_required": "#/components/schemas/WorkflowStreamEventHumanInputRequired", "human_input_form_filled": "#/components/schemas/WorkflowStreamEventHumanInputFormFilled", "human_input_form_timeout": "#/components/schemas/WorkflowStreamEventHumanInputFormTimeout" } } }, "StreamEventReasoningChunk": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "reasoning": { "type": "string", "description": "`reasoning_format` が `separated` の LLM ノードが発行する思考過程のデルタです。連続する `reasoning_chunk` イベントを連結すると、完全な推論を復元できます。このストリームは `text_chunk` と並行しており、`text` ストリームには `` タグが含まれません。" }, "node_id": { "type": "string", "nullable": true, "description": "推論を生成している LLM ノードの ID です。複数の LLM ノードが実行される場合に、推論の出所を特定できます。" }, "is_final": { "type": "boolean", "description": "`true` は LLM ノードの推論フェーズの終了(「思考完了」のシグナル)を示します。空の `reasoning` を伴う場合があります。" } } } } } ] }, "StreamEventTextChunk": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "text": { "type": "string", "description": "テキスト内容のチャンクです。" }, "from_variable_selector": { "type": "array", "items": { "type": "string" }, "nullable": true, "description": "ワークフロー内のテキスト変数のソースパスです。" } } } } } ] }, "StreamEventTtsMessage": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64 エンコードされた MP3 音声チャンク。すべてのチャンクを順番にデコードして連結すると、完全な音声ファイルが生成されます。" }, "created_at": { "type": "integer", "format": "int64", "description": "このオーディオチャンクが生成された Unix タイムスタンプです。" } } } ] }, "StreamEventTtsMessageEnd": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "audio": { "type": "string", "description": "空の文字列。音声ストリームの終了を示します。" }, "created_at": { "type": "integer", "format": "int64", "description": "音声ストリームが終了した Unix タイムスタンプです。" } } } ] }, "StreamEventError": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "status": { "type": "integer", "description": "エラーの HTTP ステータスコードです。" }, "code": { "type": "string", "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } } ] }, "StreamEventPing": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "type": "object", "description": "キープアライブ ping イベントです。追加プロパティはありません。" } ] }, "WorkflowFinishedData": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行 ID です。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "Workflow ID." }, "status": { "type": "string", "description": "ワークフローの実行ステータスです。`running` は実行中、`succeeded` は正常完了、`failed` は実行エラー、`stopped` は手動停止、`partial-succeeded` は一部のノードが成功し他が失敗、`paused` は人間の入力待ちを示します。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ワークフローからの出力データです。" }, "error": { "type": "string", "nullable": true, "description": "ワークフローが失敗した場合のエラーメッセージです。" }, "elapsed_time": { "type": "number", "format": "float", "description": "合計経過時間(秒)です。" }, "total_tokens": { "type": "integer", "description": "全ノードで消費された合計トークン数です。" }, "total_steps": { "type": "integer", "description": "実行されたワークフローの合計ステップ数です。" }, "created_at": { "type": "integer", "format": "int64", "description": "ワークフロー実行が作成された Unix タイムスタンプです。" }, "finished_at": { "type": "integer", "format": "int64", "nullable": true, "description": "ワークフロー実行が完了した Unix タイムスタンプです。" }, "created_by": { "type": "object", "additionalProperties": true, "description": "作成者情報です。ストリーミングの `workflow_finished` イベントにのみ存在します。" }, "exceptions_count": { "type": "integer", "nullable": true, "description": "実行中に発生した例外の数です。ストリーミングの `workflow_finished` イベントにのみ含まれます。" }, "files": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "nullable": true, "description": "ワークフロー実行中に生成されたファイルです。ストリーミングの `workflow_finished` イベントにのみ存在します。" } } }, "WorkflowStreamEventBase": { "type": "object", "properties": { "task_id": { "type": "string", "format": "uuid", "description": "進行中の実行のタスク ID です。[ワークフロータスクを停止](/ja/api-reference/workflow-runs/stop-workflow-task) と組み合わせて、実行中のワークフローをキャンセルします。実行中のみ有効です。" }, "workflow_run_id": { "type": "string", "format": "uuid", "description": "このワークフロー実行記録の永続的な識別子です。[ワークフロー実行詳細を取得](/ja/api-reference/workflow-runs/get-workflow-run-detail) と組み合わせて、実行後に結果を取得します。" } } }, "WorkflowStreamEventWorkflowStarted": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ワークフロー実行 ID です。" }, "workflow_id": { "type": "string", "format": "uuid", "description": "Workflow ID." }, "inputs": { "type": "object", "additionalProperties": true, "description": "このワークフロー実行の入力変数です。" }, "created_at": { "type": "integer", "format": "int64", "description": "ワークフロー実行が開始した Unix タイムスタンプです。" }, "reason": { "type": "string", "description": "ワークフロー開始の理由です。`initial` は新規実行、`resumption` は一時停止状態からの再開を示します。" } } } } } ] }, "WorkflowStreamEventWorkflowFinished": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/WorkflowFinishedData" } } } ] }, "WorkflowStreamEventNodeStarted": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ノード実行 ID です。" }, "node_id": { "type": "string", "description": "ワークフローグラフ内のノード ID です。" }, "node_type": { "type": "string", "description": "ノードタイプ(例:`llm`、`code`、`template-transform`)です。" }, "title": { "type": "string", "description": "ノードの表示名です。" }, "index": { "type": "integer", "description": "実行シーケンスインデックスです。" }, "predecessor_node_id": { "type": "string", "nullable": true, "description": "先行ノードの ID(存在する場合)です。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "このノードの入力変数です。" }, "inputs_truncated": { "type": "boolean", "description": "`inputs` データが切り捨てられたかどうかです。" }, "created_at": { "type": "integer", "format": "int64", "description": "ノード実行が開始した Unix タイムスタンプです。" }, "extras": { "type": "object", "additionalProperties": true, "description": "ノード実行の追加メタデータです。" }, "iteration_id": { "type": "string", "nullable": true, "description": "このノードがイテレーション内で実行される場合の親イテレーション ID です。" }, "loop_id": { "type": "string", "nullable": true, "description": "このノードがループ内で実行される場合の親ループ ID です。" } } } } } ] }, "WorkflowStreamEventNodeFinished": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ノード実行 ID です。" }, "node_id": { "type": "string", "description": "ワークフローグラフ内のノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "ノードの表示名です。" }, "index": { "type": "integer", "description": "実行シーケンスインデックスです。" }, "predecessor_node_id": { "type": "string", "nullable": true, "description": "先行ノードの ID(存在する場合)です。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "このノードの入力変数です。" }, "inputs_truncated": { "type": "boolean", "description": "`inputs` データが切り捨てられたかどうかです。" }, "process_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ノード実行中に生成された処理データです。" }, "process_data_truncated": { "type": "boolean", "description": "`process_data` が切り詰められたかどうかです。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ノードからの出力データです。" }, "outputs_truncated": { "type": "boolean", "description": "`outputs` データが切り詰められたかどうかです。" }, "status": { "type": "string", "description": "ノードの実行ステータスです。`running` は進行中、`succeeded` は完了、`failed` はエラー、`stopped` は手動停止、`exception` は予期しない障害を示します。" }, "error": { "type": "string", "nullable": true, "description": "ノードが失敗した場合のエラーメッセージです。" }, "elapsed_time": { "type": "number", "format": "float", "description": "経過時間(秒)です。" }, "execution_metadata": { "type": "object", "nullable": true, "description": "トークン使用量を含む実行メタデータです。", "properties": { "total_tokens": { "type": "integer", "nullable": true, "description": "このノードで消費された合計トークン数です。" }, "total_price": { "type": "number", "format": "float", "nullable": true, "description": "このノード実行の合計コストです。" }, "currency": { "type": "string", "nullable": true, "description": "コストの通貨(例: `USD`)です。" } } }, "created_at": { "type": "integer", "format": "int64", "description": "ノード実行が開始した Unix タイムスタンプです。" }, "finished_at": { "type": "integer", "format": "int64", "description": "ノード実行が完了した Unix タイムスタンプです。" }, "files": { "type": "array", "nullable": true, "items": { "type": "object", "additionalProperties": true }, "description": "このノードで生成されたファイルです。" }, "iteration_id": { "type": "string", "nullable": true, "description": "このノードがイテレーション内で実行される場合の親イテレーション ID です。" }, "loop_id": { "type": "string", "nullable": true, "description": "このノードがループ内で実行される場合の親ループ ID です。" } } } } } ] }, "WorkflowStreamEventNodeRetry": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ノード実行 ID です。" }, "node_id": { "type": "string", "description": "ワークフローグラフ内のノード ID です。" }, "node_type": { "type": "string", "description": "Node type." }, "title": { "type": "string", "description": "ノードの表示名です。" }, "index": { "type": "integer", "description": "実行シーケンスインデックスです。" }, "predecessor_node_id": { "type": "string", "nullable": true, "description": "先行ノードの ID(存在する場合)です。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true }, "inputs_truncated": { "type": "boolean", "description": "`inputs` データが切り捨てられたかどうかです。" }, "process_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ノード実行中に生成された処理データです。" }, "process_data_truncated": { "type": "boolean", "description": "`process_data` が切り詰められたかどうかです。" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true }, "outputs_truncated": { "type": "boolean", "description": "`outputs` データが切り詰められたかどうかです。" }, "status": { "type": "string", "description": "リトライ時点のノード実行ステータスです。" }, "error": { "type": "string", "nullable": true, "description": "リトライをトリガーしたエラーメッセージです。" }, "elapsed_time": { "type": "number", "format": "float", "description": "経過時間(秒)です。" }, "created_at": { "type": "integer", "format": "int64" }, "finished_at": { "type": "integer", "format": "int64" }, "retry_index": { "type": "integer", "description": "ゼロ始まりのリトライ回数インデックスです。" }, "iteration_id": { "type": "string", "nullable": true }, "loop_id": { "type": "string", "nullable": true }, "execution_metadata": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ノード実行のメタデータです。" }, "files": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "description": "実行中にノードが生成したファイルです。" } } } } } ] }, "WorkflowStreamEventIterationStarted": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "ノード実行 ID です。" }, "node_id": { "type": "string", "description": "イテレーションノード ID です。" }, "node_type": { "type": "string", "description": "ノードの種類(常に `iteration`)です。" }, "title": { "type": "string", "description": "イテレーションノードの表示名です。" }, "created_at": { "type": "integer", "format": "int64" }, "inputs": { "type": "object", "additionalProperties": true, "description": "イテレーションの入力変数です。" }, "inputs_truncated": { "type": "boolean", "description": "`inputs` データが切り捨てられたかどうかです。" }, "metadata": { "type": "object", "additionalProperties": true, "description": "イテレーションのメタデータです。" }, "extras": { "type": "object", "additionalProperties": true } } } } } ] }, "WorkflowStreamEventIterationNext": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "node_id": { "type": "string" }, "node_type": { "type": "string" }, "title": { "type": "string" }, "index": { "type": "integer", "description": "現在のイテレーションインデックス(ゼロ始まり)です。" }, "created_at": { "type": "integer", "format": "int64" }, "extras": { "type": "object", "additionalProperties": true } } } } } ] }, "WorkflowStreamEventIterationCompleted": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "node_id": { "type": "string" }, "node_type": { "type": "string" }, "title": { "type": "string" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true }, "outputs_truncated": { "type": "boolean", "description": "`outputs` データが切り詰められたかどうかです。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "イテレーションの入力変数です。" }, "inputs_truncated": { "type": "boolean", "description": "`inputs` データが切り捨てられたかどうかです。" }, "created_at": { "type": "integer", "format": "int64", "description": "イテレーションが開始した Unix タイムスタンプです。" }, "extras": { "type": "object", "additionalProperties": true, "nullable": true, "description": "イテレーションの追加メタデータです。" }, "status": { "type": "string", "description": "イテレーションの完了ステータスです。" }, "error": { "type": "string", "nullable": true }, "elapsed_time": { "type": "number", "format": "float" }, "total_tokens": { "type": "integer" }, "execution_metadata": { "type": "object", "additionalProperties": true, "description": "トークン使用量を含む実行メタデータです。" }, "finished_at": { "type": "integer", "format": "int64" }, "steps": { "type": "integer", "description": "完了したイテレーションステップ数です。" } } } } } ] }, "WorkflowStreamEventLoopStarted": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "node_id": { "type": "string" }, "node_type": { "type": "string" }, "title": { "type": "string" }, "created_at": { "type": "integer", "format": "int64" }, "inputs": { "type": "object", "additionalProperties": true }, "inputs_truncated": { "type": "boolean", "description": "`inputs` データが切り捨てられたかどうかです。" }, "metadata": { "type": "object", "additionalProperties": true }, "extras": { "type": "object", "additionalProperties": true } } } } } ] }, "WorkflowStreamEventLoopNext": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "node_id": { "type": "string" }, "node_type": { "type": "string" }, "title": { "type": "string" }, "index": { "type": "integer", "description": "現在のループイテレーションインデックス(ゼロベース)です。" }, "created_at": { "type": "integer", "format": "int64" }, "pre_loop_output": { "description": "前回のループイテレーションからの出力です。", "nullable": true }, "extras": { "type": "object", "additionalProperties": true } } } } } ] }, "WorkflowStreamEventLoopCompleted": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "node_id": { "type": "string" }, "node_type": { "type": "string" }, "title": { "type": "string" }, "outputs": { "type": "object", "additionalProperties": true, "nullable": true }, "outputs_truncated": { "type": "boolean", "description": "`outputs` データが切り詰められたかどうかです。" }, "inputs": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ループの入力変数です。" }, "inputs_truncated": { "type": "boolean", "description": "`inputs` データが切り捨てられたかどうかです。" }, "created_at": { "type": "integer", "format": "int64" }, "extras": { "type": "object", "additionalProperties": true, "nullable": true, "description": "ループの追加メタデータです。" }, "status": { "type": "string", "description": "ループの完了ステータスです。" }, "error": { "type": "string", "nullable": true }, "elapsed_time": { "type": "number", "format": "float" }, "total_tokens": { "type": "integer" }, "execution_metadata": { "type": "object", "additionalProperties": true, "description": "トークン使用量を含む実行メタデータです。" }, "finished_at": { "type": "integer", "format": "int64" }, "steps": { "type": "integer", "description": "完了したループイテレーション数です。" } } } } } ] }, "WorkflowStreamEventHumanInputRequired": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "form_id": { "type": "string", "description": "フォームインスタンスの識別子。エラーメッセージやログに含まれます。Service API の呼び出しには `form_token` を使用してください。" }, "node_id": { "type": "string", "description": "このフォームを生成した Human Input ノードの ID。" }, "node_title": { "type": "string", "description": "Human Input ノードの表示タイトル。" }, "form_content": { "type": "string", "description": "ワークフロー変数が置換された、事前レンダリング済みのフォーム本文。" }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "フォーム入力コントロールの種類。使用可能な値:`paragraph`(複数行テキスト)、`select`(リストからの単一選択)、`file`(単一ファイルのアップロード)、`file-list`(複数ファイルのアップロード)。" }, "output_variable_name": { "type": "string", "description": "この入力の送信値をワークフロー内で参照する変数名。送信時の `inputs` オブジェクトのキーに対応します。" }, "default": { "type": "object", "nullable": true, "description": "ワークフローコンテキストから解決されるデフォルト値。デフォルトが設定されていない場合は `null`。", "properties": { "type": { "type": "string", "description": "デフォルト値のソース。`constant` は `value` をリテラル文字列として使用します。`variable` は `selector` がワークフロー変数を指します。" }, "selector": { "type": "array", "items": { "type": "string" }, "description": "`type` が `variable` の場合の変数参照パス(例:`[\"node_id\", \"var_name\"]`)。少なくとも 2 要素を含みます。" }, "value": { "type": "string", "description": "`type` が `constant` の場合のリテラルデフォルト値。常に文字列です。" } } } } }, "description": "受信者が記入するフォーム入力フィールド。" }, "actions": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "maxLength": 20, "pattern": "^[A-Za-z_][A-Za-z0-9_]*$", "description": "アクションボタンの識別子。受信者がこのボタンを選択したら、`action` として [人間の入力フォームを送信](/ja/api-reference/human-input/submit-human-input-form) に渡します。" }, "title": { "type": "string", "maxLength": 100, "description": "受信者に表示されるボタンのラベル。" }, "button_style": { "type": "string", "description": "ボタンの視覚スタイル。使用可能な値:`primary`、`default`、`accent`、`ghost`。" } } }, "description": "送信時に受信者が選択できるアクション(ボタン)。" }, "display_in_ui": { "type": "boolean", "description": "フォームが Dify コンソール UI にも表示されるかどうか。" }, "form_token": { "type": "string", "nullable": true, "description": "[人間の入力フォームを取得](/ja/api-reference/human-input/get-human-input-form) と [人間の入力フォームを送信](/ja/api-reference/human-input/submit-human-input-form) のアクセストークン。人間の入力ノードがメール配信またはコンソール配信を使用する場合は `null` になります(Service API は WebApp 配信のフォームのみ操作できます)。" }, "resolved_default_values": { "type": "object", "additionalProperties": { "type": "string" }, "description": "入力の `output_variable_name` をキーとする事前入力デフォルト値。すべての値は文字列化されます。" }, "expiration_time": { "type": "integer", "format": "int64", "description": "Unix タイムスタンプ(秒)。これを過ぎるとフォームは送信できなくなります。" } } } } } ] }, "WorkflowStreamEventWorkflowPaused": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "workflow_run_id": { "type": "string", "format": "uuid", "description": "このワークフロー実行記録の永続的な識別子です。[ワークフロー実行詳細を取得](/ja/api-reference/workflow-runs/get-workflow-run-detail) と組み合わせて、実行後に結果を取得します。" }, "paused_nodes": { "type": "array", "items": { "type": "string" }, "description": "一時停止中のノード ID のリストです。" }, "outputs": { "type": "object", "additionalProperties": true, "description": "一時停止時の部分的な出力です。" }, "reasons": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "description": "一時停止の理由です。" }, "status": { "type": "string", "description": "ワークフローの実行ステータスです。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" }, "elapsed_time": { "type": "number", "format": "float", "description": "合計経過時間(秒)です。" }, "total_tokens": { "type": "integer", "description": "消費された合計トークン数です。" }, "total_steps": { "type": "integer", "description": "実行された合計ステップ数です。" } } } } } ] }, "WorkflowStreamEventHumanInputFormFilled": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "node_id": { "type": "string", "description": "フォームが記入された Human Input ノードの ID。" }, "node_title": { "type": "string", "description": "Human Input ノードの表示タイトル。" }, "rendered_content": { "type": "string", "description": "受信者の入力値で描画されたフォーム本文(`human_input_required` の `form_content` は未入力のテンプレートです)。" }, "action_id": { "type": "string", "description": "受信者が選択したアクションの識別子([人間の入力フォームを送信](/ja/api-reference/human-input/submit-human-input-form) に渡された `action` の値と一致します)。" }, "action_text": { "type": "string", "description": "選択されたアクションの表示テキスト。" }, "submitted_data": { "type": "object", "additionalProperties": true, "nullable": true, "description": "受信者が送信したフォームの値。各入力項目の `output_variable_name` をキーとします。" } } } } } ] }, "WorkflowStreamEventHumanInputFormTimeout": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "node_id": { "type": "string", "description": "フォームが期限切れとなった Human Input ノードの ID。" }, "node_title": { "type": "string", "description": "Human Input ノードの表示タイトル。" }, "expiration_time": { "type": "integer", "format": "int64", "description": "Unix タイムスタンプ(秒)。フォームが期限切れとなった時刻。" } } } } } ] }, "WorkflowStreamEventAgentLog": { "allOf": [ { "$ref": "#/components/schemas/ChunkWorkflowEvent" }, { "$ref": "#/components/schemas/WorkflowStreamEventBase" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "node_execution_id": { "type": "string", "description": "ノード実行 ID です。" }, "id": { "type": "string", "description": "エージェントログエントリ ID です。" }, "label": { "type": "string", "description": "Log label." }, "parent_id": { "type": "string", "nullable": true, "description": "親ログエントリ ID です。" }, "error": { "type": "string", "nullable": true, "description": "エージェントステップが失敗した場合のエラーメッセージです。" }, "status": { "type": "string", "description": "エージェントステップのステータスです。" }, "data": { "type": "object", "additionalProperties": true, "description": "エージェントステップのデータです。" }, "metadata": { "type": "object", "additionalProperties": true, "description": "エージェントステップのメタデータです。" }, "node_id": { "type": "string", "description": "Node ID." } } } } } ] }, "CompletionRequest": { "type": "object", "required": [ "inputs", "user" ], "properties": { "inputs": { "type": "object", "description": "アプリの入力変数の値を、変数名をキーとして指定します。期待される名前と型は、[アプリケーションのパラメータ情報を取得](/ja/api-reference/applications/get-app-parameters) の `user_input_form` フィールドで確認できます。", "additionalProperties": true }, "query": { "type": "string", "default": "", "description": "処理するテキストです。レガシーフィールドで、新しいアプリではこの値を `inputs` の中で渡します。" }, "response_mode": { "type": "string", "enum": [ "streaming", "blocking" ], "description": "レスポンスの返却モード。`streaming`(推奨)は SSE を使用します。`blocking` は完了後に返却します(長時間の処理では中断される場合があります)。Cloudflare のタイムアウトは `100 s` です。省略した場合、デフォルトでブロッキングモードになります。" }, "user": { "type": "string", "description": "エンドユーザーの識別子。アプリ側で定義し、アプリ内で一意にします。メッセージとファイルは、同じ `user` を持つリクエストにのみ表示されます。[エンドユーザーの識別](/ja/api-reference/guides/end-user-identity) を参照してください。" }, "files": { "type": "array", "items": { "$ref": "#/components/schemas/InputFileObject" }, "description": "リクエストに添付するファイルです。ローカルファイルの場合は、まず [ファイルをアップロード](/ja/api-reference/files/upload-file) でアップロードし、返された `id` を `upload_file_id` として `transfer_method: local_file` で参照します。" } } }, "CompletionResponse": { "type": "object", "properties": { "event": { "type": "string", "description": "イベントタイプ。`message` に固定されています。" }, "task_id": { "type": "string", "format": "uuid", "description": "リクエスト追跡および [生成を停止](/ja/api-reference/completion-messages/stop-completion-message-generation) API 用のタスク ID です。" }, "id": { "type": "string", "format": "uuid", "description": "このレスポンスイベントの一意 ID です。" }, "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージ ID です。フィードバックや推奨質問のエンドポイントを呼び出す際に `message_id` パラメータとして使用します。" }, "mode": { "type": "string", "description": "アプリモード、`completion` 固定です。" }, "answer": { "type": "string", "description": "完全なレスポンスコンテンツ。" }, "metadata": { "type": "object", "description": "使用量と検索リソースを含むメタデータ。", "properties": { "usage": { "$ref": "#/components/schemas/Usage" }, "retriever_resources": { "type": "array", "description": "使用された検索リソースのリスト。", "items": { "$ref": "#/components/schemas/RetrieverResource" } } } }, "created_at": { "type": "integer", "format": "int64", "description": "メッセージ作成タイムスタンプ(Unix エポック秒)。" } } }, "ChunkCompletionEvent": { "type": "object", "properties": { "event": { "type": "string", "enum": [ "message", "message_end", "message_file", "tts_message", "tts_message_end", "message_replace", "error", "ping" ], "description": "ストリーミングイベントのタイプ。" } }, "discriminator": { "propertyName": "event", "mapping": { "message": "#/components/schemas/StreamEventMessage", "message_end": "#/components/schemas/StreamEventMessageEnd", "message_file": "#/components/schemas/StreamEventMessageFile", "tts_message": "#/components/schemas/CompletionStreamEventTtsMessage", "tts_message_end": "#/components/schemas/CompletionStreamEventTtsMessageEnd", "message_replace": "#/components/schemas/StreamEventMessageReplace", "error": "#/components/schemas/CompletionStreamEventError", "ping": "#/components/schemas/CompletionStreamEventPing" } } }, "StreamEventMessage": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEvent" }, { "$ref": "#/components/schemas/CompletionStreamEventBase" }, { "type": "object", "description": "LLM がテキストチャンクイベントを返します。", "properties": { "answer": { "type": "string", "description": "LLM が返したテキストチャンクのコンテンツ。" } } } ] }, "StreamEventMessageEnd": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEvent" }, { "$ref": "#/components/schemas/CompletionStreamEventBase" }, { "type": "object", "description": "メッセージ終了イベント。このイベントを受信すると、ストリーミングが終了したことを意味します。", "properties": { "id": { "type": "string", "format": "uuid", "description": "メッセージの一意な ID。" }, "metadata": { "type": "object", "description": "使用量と検索リソースを含むメタデータ。", "properties": { "usage": { "$ref": "#/components/schemas/Usage" }, "retriever_resources": { "type": "array", "description": "使用された検索リソースのリスト。", "items": { "$ref": "#/components/schemas/RetrieverResource" } } } }, "files": { "type": "array", "nullable": true, "description": "このメッセージで生成されたファイル(モデルが生成した画像など)。ファイルが生成されなかった場合は `null` です。", "items": { "type": "object", "properties": { "related_id": { "type": "string", "description": "メッセージファイルレコードの ID。" }, "type": { "type": "string", "description": "ファイルタイプ(例:`image`)。" }, "filename": { "type": "string", "description": "ファイル名。" }, "extension": { "type": "string", "description": "先頭のドットを含むファイル拡張子(例:`.png`)。" }, "mime_type": { "type": "string", "description": "ファイルの MIME タイプ。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト単位)。" }, "transfer_method": { "type": "string", "description": "ファイルの参照方法:`remote_url`、`local_file`、`tool_file` のいずれか。" }, "url": { "type": "string", "description": "ファイルのアクセス可能な URL。" }, "upload_file_id": { "type": "string", "description": "関連するアップロードファイルの ID。" }, "remote_url": { "type": "string", "nullable": true, "description": "ファイルがリモート URL として提供された場合の元のリモート URL。それ以外の場合は空文字列。" } } } } } } ] }, "StreamEventMessageFile": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEvent" }, { "type": "object", "description": "メッセージファイルイベント。生成中に作成されたファイル(通常はモデルが生成した画像)です。", "properties": { "id": { "type": "string", "format": "uuid", "description": "ファイルの一意の ID。" }, "type": { "type": "string", "description": "ファイルタイプ(例:`image`)。" }, "belongs_to": { "type": "string", "enum": [ "assistant" ], "description": "このファイルの所有者。ここでは常に `assistant` です。" }, "url": { "type": "string", "format": "url", "description": "ファイルのリモート URL。" } } } ] }, "StreamEventMessageReplace": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEvent" }, { "$ref": "#/components/schemas/CompletionStreamEventBase" }, { "type": "object", "description": "メッセージコンテンツ置換イベント(例:コンテンツモデレーションによるもの)。", "properties": { "answer": { "type": "string", "description": "置換コンテンツ。" }, "reason": { "type": "string", "description": "コンテンツ置換の理由。" } } } ] }, "CompletionStreamEventBase": { "type": "object", "properties": { "task_id": { "type": "string", "format": "uuid", "description": "タスク ID。" }, "message_id": { "type": "string", "format": "uuid", "description": "一意のメッセージ ID。" }, "created_at": { "type": "integer", "format": "int64", "description": "作成タイムスタンプ。" } } }, "CompletionStreamEventTtsMessage": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEvent" }, { "$ref": "#/components/schemas/CompletionStreamEventBase" }, { "type": "object", "description": "TTS 音声ストリームイベント(base64 エンコード MP3)。自動再生が有効な場合に利用できます。", "properties": { "audio": { "type": "string", "format": "byte", "description": "Base64 エンコードされた MP3 音声チャンク。すべてのチャンクを順番にデコードして連結すると、完全な音声ファイルが生成されます。" } } } ] }, "CompletionStreamEventTtsMessageEnd": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEvent" }, { "$ref": "#/components/schemas/CompletionStreamEventBase" }, { "type": "object", "description": "TTS 音声ストリーム終了イベント。", "properties": { "audio": { "type": "string", "description": "空の文字列。音声ストリームの終了を示します。" } } } ] }, "CompletionStreamEventError": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEvent" }, { "$ref": "#/components/schemas/CompletionStreamEventBase" }, { "type": "object", "description": "ストリーミング中のエラーイベント。", "properties": { "status": { "type": "integer", "description": "HTTP ステータスコード。" }, "code": { "type": "string", "description": "エラーコード。" }, "message": { "type": "string", "description": "エラーメッセージ。" } } } ] }, "CompletionStreamEventPing": { "allOf": [ { "$ref": "#/components/schemas/ChunkCompletionEvent" }, { "type": "object", "description": "接続を維持するための Ping イベント。" } ] }, "Dataset": { "type": "object", "properties": { "id": { "type": "string", "description": "ナレッジベースの一意識別子です。" }, "name": { "type": "string", "description": "ナレッジベースの表示名です。ワークスペース内で一意です。" }, "description": { "type": "string", "description": "ナレッジベースの目的または内容を説明するオプションのテキストです。" }, "provider": { "type": "string", "description": "プロバイダータイプです。内部管理の場合は `vendor`、外部ナレッジベース接続の場合は `external` です。" }, "permission": { "type": "string", "description": "このナレッジベースにアクセスできるユーザーを制御します。指定可能な値:`only_me`、`all_team_members`、`partial_members`。" }, "data_source_type": { "type": "string", "description": "ドキュメントのデータソースタイプです。まだ設定されていない場合は `null` です。" }, "indexing_technique": { "type": "string", "description": "`high_quality` は埋め込みモデルを使用した精密検索、`economy` はキーワードベースのインデキシングです。" }, "app_count": { "type": "integer", "description": "現在このナレッジベースを使用しているアプリケーションの数です。" }, "document_count": { "type": "integer", "description": "ナレッジベース内のドキュメント総数です。" }, "word_count": { "type": "integer", "description": "全ドキュメントの合計単語数です。" }, "created_by": { "type": "string", "description": "ナレッジベースを作成したユーザーの ID です。" }, "author_name": { "type": "string", "description": "作成者の表示名です。" }, "created_at": { "type": "number", "description": "作成タイムスタンプ(Unix エポック、秒単位)です。" }, "updated_by": { "type": "string", "description": "ナレッジベースを最後に更新したユーザーの ID です。" }, "updated_at": { "type": "number", "description": "最終更新タイムスタンプ(Unix エポック、秒単位)です。" }, "embedding_model": { "type": "string", "description": "インデックス作成に使用される埋め込みモデルの名前です。" }, "embedding_model_provider": { "type": "string", "description": "埋め込みモデルプロバイダーの識別子です。`organization/plugin_name/provider_name` の形式です(例:`langgenius/openai/openai`)。以前のナレッジベースでは短縮形(例:`openai`)が返される場合があります。" }, "embedding_available": { "type": "boolean", "description": "設定された埋め込みモデルが現在利用可能かどうかです。" }, "retrieval_model_dict": { "type": "object", "description": "ナレッジベースの検索設定です。", "properties": { "search_method": { "type": "string", "description": "検索に使用する検索方法です。`keyword_search` はキーワードマッチング、`semantic_search` は埋め込みベースの類似度検索、`full_text_search` は全文インデックス検索、`hybrid_search` はセマンティックとキーワードの組み合わせ検索を示します。" }, "reranking_enable": { "type": "boolean", "description": "リランキングが有効かどうかです。" }, "reranking_mode": { "type": "string", "nullable": true, "description": "リランキングモードです。`reranking_model` はモデルベースのリランキング、`weighted_score` はスコアベースの重み付けを示します。リランキングが無効の場合は `null` です。" }, "reranking_model": { "type": "object", "description": "リランキングモデルの設定です。", "properties": { "reranking_provider_name": { "type": "string", "description": "リランクモデルプロバイダーの識別子です。`organization/plugin_name/provider_name` の形式です(例:`langgenius/cohere/cohere`)。以前のナレッジベースでは短縮形(例:`cohere`)が返される場合があります。" }, "reranking_model_name": { "type": "string", "description": "リランキングモデル名です。" } } }, "weights": { "type": "object", "nullable": true, "description": "ハイブリッド検索の重み設定です。", "properties": { "weight_type": { "type": "string", "description": "セマンティック検索とキーワード検索の重みを調整するための戦略です。" }, "vector_setting": { "type": "object", "description": "セマンティック検索の重み設定です。", "properties": { "vector_weight": { "type": "number", "description": "セマンティック(ベクトル)検索結果に割り当てられた重みです。" }, "embedding_provider_name": { "type": "string", "description": "ベクトル検索に使用される埋め込みモデルのプロバイダーです。" }, "embedding_model_name": { "type": "string", "description": "ベクトル検索に使用される埋め込みモデルの名前です。" } } }, "keyword_setting": { "type": "object", "description": "キーワード検索の重み設定です。", "properties": { "keyword_weight": { "type": "number", "description": "キーワード検索結果に割り当てられた重みです。" } } } } }, "top_k": { "type": "integer", "description": "返す結果の最大数です。" }, "score_threshold_enabled": { "type": "boolean", "description": "スコア閾値フィルタリングが有効かどうかです。" }, "score_threshold": { "type": "number", "description": "結果の最小関連性スコアです。`score_threshold_enabled` が `true` の場合にのみ有効です。" } } }, "summary_index_setting": { "type": "object", "nullable": true, "description": "サマリーインデックスの設定です。", "properties": { "enable": { "type": "boolean", "description": "サマリーインデックスが有効かどうかです。" }, "model_name": { "type": "string", "description": "要約生成に使用されるモデルの名前です。" }, "model_provider_name": { "type": "string", "description": "要約生成モデルのプロバイダーです。" }, "summary_prompt": { "type": "string", "description": "要約生成に使用されるプロンプトテンプレートです。" } } }, "tags": { "type": "array", "description": "このナレッジベースに関連付けられたタグです。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "タグ識別子です。" }, "name": { "type": "string", "description": "Tag name." }, "type": { "type": "string", "description": "タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。" } } } }, "doc_form": { "type": "string", "description": "ドキュメントのチャンキングモードです。`text_model` は標準テキストチャンキング、`hierarchical_model` は親子構造、`qa_model` は QA ペア抽出を示します。" }, "external_knowledge_info": { "type": "object", "nullable": true, "description": "外部ナレッジベースの接続詳細です。`provider` が `external` の場合に存在します。", "properties": { "external_knowledge_id": { "type": "string", "description": "外部ナレッジベースの ID です。" }, "external_knowledge_api_id": { "type": "string", "description": "外部ナレッジ API 接続の ID です。" }, "external_knowledge_api_name": { "type": "string", "description": "外部ナレッジ API の表示名です。" }, "external_knowledge_api_endpoint": { "type": "string", "description": "外部ナレッジ API のエンドポイント URL です。" } } }, "external_retrieval_model": { "type": "object", "nullable": true, "description": "外部ナレッジベースの検索設定です。内部ナレッジベースの場合は `null` です。", "properties": { "top_k": { "type": "integer", "description": "外部ナレッジベースから返す結果の最大数です。" }, "score_threshold": { "type": "number", "description": "最小関連性スコアのしきい値です。" }, "score_threshold_enabled": { "type": "boolean", "description": "スコア閾値フィルタリングが有効かどうかです。" } } }, "doc_metadata": { "type": "array", "description": "ナレッジベースのメタデータフィールド定義です。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "メタデータフィールドの識別子です。" }, "name": { "type": "string", "description": "メタデータフィールド名です。" }, "type": { "type": "string", "description": "メタデータフィールドの値の種類です。" } } } }, "built_in_field_enabled": { "type": "boolean", "description": "組み込みメタデータフィールド(例:`document_name`、`uploader`)が有効かどうかです。" }, "pipeline_id": { "type": "string", "nullable": true, "description": "カスタム処理パイプラインが設定されている場合のパイプライン ID です。" }, "runtime_mode": { "type": "string", "nullable": true, "description": "ランタイム処理モードです。" }, "chunk_structure": { "type": "string", "nullable": true, "description": "チャンク構造の設定です。" }, "icon_info": { "type": "object", "nullable": true, "description": "ナレッジベースのアイコン表示設定です。", "properties": { "icon_type": { "type": "string", "description": "アイコンの種類です。" }, "icon": { "type": "string", "description": "アイコン識別子または絵文字です。" }, "icon_background": { "type": "string", "description": "アイコンの背景色です。" }, "icon_url": { "type": "string", "description": "カスタムアイコン画像の URL です。" } } }, "is_published": { "type": "boolean", "description": "ナレッジベースが公開済みかどうかです。" }, "total_documents": { "type": "integer", "description": "ドキュメントの合計数です。" }, "total_available_documents": { "type": "integer", "description": "有効で利用可能なドキュメントの数です。" }, "enable_api": { "type": "boolean", "description": "このナレッジベースで API アクセスが有効かどうかです。" }, "is_multimodal": { "type": "boolean", "description": "マルチモーダルコンテンツ処理が有効かどうかです。" }, "maintainer": { "type": "string", "nullable": true, "description": "ナレッジベースのメンテナーの表示名です。設定されていない場合は `null` です。" }, "partial_member_list": { "type": "array", "nullable": true, "items": { "type": "string" }, "description": "`permission` が `partial_members` の場合にアクセスを許可されたメンバーのアカウント ID です。更新レスポンスでは常に含まれ、詳細レスポンスでは `permission` が `partial_members` の場合にのみ含まれます。" } } }, "Document": { "type": "object", "properties": { "id": { "type": "string", "description": "ドキュメントの一意識別子です。" }, "position": { "type": "integer", "description": "リスト内のドキュメントの表示位置です。" }, "data_source_type": { "type": "string", "description": "ドキュメントの作成方法です。ファイルアップロードの場合は `upload_file`、Notion インポートの場合は `notion_import` です。" }, "data_source_info": { "type": "object", "description": "生のデータソース情報です。`data_source_type` によって異なります。" }, "data_source_detail_dict": { "type": "object", "description": "ファイル詳細を含む詳細なデータソース情報です。" }, "dataset_process_rule_id": { "type": "string", "description": "このドキュメントに適用された処理ルールの ID です。" }, "name": { "type": "string", "description": "ドキュメント名です。" }, "created_from": { "type": "string", "description": "ドキュメントの作成元です。API で作成した場合は `api`、UI で作成した場合は `web` です。" }, "created_by": { "type": "string", "description": "ドキュメントを作成したユーザーの ID です。" }, "created_at": { "type": "number", "description": "作成タイムスタンプ(Unix エポック、秒単位)です。" }, "tokens": { "type": "integer", "description": "ドキュメント内の合計トークン数です。" }, "indexing_status": { "type": "string", "description": "現在のインデックスステータスです。`waiting` はキュー待ち、`parsing` はコンテンツ抽出中、`cleaning` はノイズ除去中、`splitting` はチャンキング中、`indexing` はベクトル構築中、`completed` は準備完了、`error` は失敗、`paused` は手動一時停止を示します。" }, "error": { "type": "string", "nullable": true, "description": "インデックス作成が失敗した場合のエラーメッセージです。エラーなしの場合は `null` です。" }, "enabled": { "type": "boolean", "description": "このドキュメントが検索に対して有効かどうかです。" }, "disabled_at": { "type": "number", "nullable": true, "description": "ドキュメントが無効化されたタイムスタンプです。有効な場合は `null` です。" }, "disabled_by": { "type": "string", "nullable": true, "description": "ドキュメントを無効化したユーザーの ID です。有効な場合は `null` です。" }, "archived": { "type": "boolean", "description": "ドキュメントがアーカイブ済みかどうかです。" }, "display_status": { "type": "string", "description": "`indexing_status` と `enabled` 状態から導出されたユーザー向け表示ステータスです。" }, "word_count": { "type": "integer", "description": "ドキュメントの合計単語数です。" }, "hit_count": { "type": "integer", "description": "ドキュメントが検索クエリでマッチした回数です。" }, "doc_form": { "type": "string", "description": "ドキュメントのチャンキングモードです。`text_model` は標準テキストチャンキング、`hierarchical_model` は親子構造、`qa_model` は QA ペア抽出を示します。" }, "doc_metadata": { "type": "array", "description": "このドキュメントに割り当てられたメタデータ値です。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "メタデータフィールドの識別子です。" }, "name": { "type": "string", "description": "メタデータフィールド名です。" }, "type": { "type": "string", "description": "メタデータフィールドの値の種類です。" }, "value": { "type": "string", "description": "このドキュメントのメタデータ値。" } } } }, "summary_index_status": { "type": "string", "nullable": true, "description": "このドキュメントの要約インデックスのステータスです。要約インデックスが設定されていない場合は `null` です。" }, "need_summary": { "type": "boolean", "description": "このドキュメントに要約を生成する必要があるかどうかです。" } } }, "Segment": { "type": "object", "properties": { "id": { "type": "string", "description": "チャンクの一意識別子です。" }, "position": { "type": "integer", "description": "ドキュメント内のチャンクの位置。" }, "document_id": { "type": "string", "description": "このチャンクが属するドキュメントの ID です。" }, "content": { "type": "string", "description": "チャンクのテキスト内容です。" }, "sign_content": { "type": "string", "description": "整合性検証用の署名付きコンテンツハッシュです。" }, "answer": { "type": "string", "description": "回答コンテンツです。Q&A モードのドキュメントで使用されます。" }, "word_count": { "type": "integer", "description": "チャンク内容の単語数です。" }, "tokens": { "type": "integer", "description": "チャンク内容のトークン数です。" }, "keywords": { "type": "array", "description": "キーワードベースの検索のためにこのチャンクに関連付けられたキーワードです。", "items": { "type": "string" } }, "index_node_id": { "type": "string", "description": "ベクトルストア内のインデックスノードの ID です。" }, "index_node_hash": { "type": "string", "description": "インデックスされたコンテンツのハッシュです。変更の検出に使用されます。" }, "hit_count": { "type": "integer", "description": "このチャンクが検索クエリでマッチした回数です。" }, "enabled": { "type": "boolean", "description": "このチャンクが検索に対して有効かどうかです。" }, "disabled_at": { "type": "number", "nullable": true, "description": "チャンクが無効化されたタイムスタンプです。有効な場合は `null` です。" }, "disabled_by": { "type": "string", "nullable": true, "description": "チャンクを無効化したユーザーの ID です。有効な場合は `null` です。" }, "status": { "type": "string", "description": "チャンクの現在のインデックスステータスです(例:`completed`、`indexing`、`error`)。" }, "created_by": { "type": "string", "description": "チャンクを作成したユーザーの ID です。" }, "created_at": { "type": "number", "description": "作成タイムスタンプ(Unix エポック、秒単位)です。" }, "updated_at": { "type": "number", "description": "最終更新タイムスタンプ(Unix エポック、秒単位)です。" }, "updated_by": { "type": "string", "description": "このチャンクを最後に更新したユーザーの ID です。" }, "indexing_at": { "type": "number", "nullable": true, "description": "インデックス作成が開始されたタイムスタンプです。まだ開始されていない場合は `null` です。" }, "completed_at": { "type": "number", "nullable": true, "description": "インデックス作成が完了したタイムスタンプです。まだ完了していない場合は `null` です。" }, "error": { "type": "string", "nullable": true, "description": "インデックス作成が失敗した場合のエラーメッセージです。エラーなしの場合は `null` です。" }, "stopped_at": { "type": "number", "nullable": true, "description": "インデックス作成が停止されたタイムスタンプです。停止されていない場合は `null` です。" }, "child_chunks": { "type": "array", "description": "このチャンクに属する子チャンクです。階層モードのドキュメントにのみ存在します。", "items": { "$ref": "#/components/schemas/ChildChunk" } }, "attachments": { "type": "array", "description": "このチャンクに添付されたファイルです。", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "添付ファイルの識別子です。" }, "name": { "type": "string", "description": "元のファイル名です。" }, "size": { "type": "integer", "description": "ファイルサイズ(バイト)。" }, "extension": { "type": "string", "description": "ファイル拡張子。" }, "mime_type": { "type": "string", "description": "ファイルの MIME タイプ。" }, "source_url": { "type": "string", "description": "添付ファイルにアクセスする URL です。" } } } }, "summary": { "type": "string", "nullable": true, "description": "AI が生成したチャンクコンテンツの要約です。要約インデックスが有効でない場合は `null` です。" } } }, "ChildChunk": { "type": "object", "properties": { "id": { "type": "string", "description": "子チャンクの一意識別子です。" }, "segment_id": { "type": "string", "description": "この子チャンクが属する親チャンクの ID です。" }, "content": { "type": "string", "description": "子チャンクのテキスト内容です。" }, "position": { "type": "integer", "description": "親チャンク内の子チャンクの位置です。" }, "word_count": { "type": "integer", "description": "子チャンク内容の単語数です。" }, "type": { "type": "string", "description": "子チャンクの作成方法です。API から作成または更新された子チャンクは常に `customized` です。システム生成の子チャンクは `automatic` です。" }, "created_at": { "type": "number", "description": "作成タイムスタンプ(Unix エポック、秒単位)です。" }, "updated_at": { "type": "number", "description": "最終更新タイムスタンプ(Unix エポック、秒単位)です。" } } }, "RetrievalModel": { "type": "object", "required": [ "search_method", "reranking_enable", "top_k", "score_threshold_enabled" ], "properties": { "search_method": { "type": "string", "description": "検索に使用される検索メソッドです。", "enum": [ "keyword_search", "semantic_search", "full_text_search", "hybrid_search" ] }, "reranking_enable": { "type": "boolean", "description": "リランキングが有効かどうかです。" }, "reranking_model": { "type": "object", "description": "リランキングモデルの設定です。", "properties": { "reranking_provider_name": { "type": "string", "description": "リランクモデルプロバイダーの識別子です。`organization/plugin_name/provider_name` の形式です(例:`langgenius/cohere/cohere`)。`cohere` のような短縮名は `langgenius//` に展開され、langgenius が公開したプラグインでのみ機能します。\n\n有効な値は [利用可能なモデルを取得](/ja/api-reference/models/get-available-models) で `model_type=rerank` を指定した際の `provider` フィールドから取得します。" }, "reranking_model_name": { "type": "string", "description": "リランキングモデル名です。" } } }, "reranking_mode": { "type": "string", "enum": [ "reranking_model", "weighted_score" ], "nullable": true, "description": "リランキングモードです。`reranking_enable` が `true` の場合は必須です。" }, "top_k": { "type": "integer", "description": "返す結果の最大数です。" }, "score_threshold_enabled": { "type": "boolean", "description": "スコア閾値フィルタリングが有効かどうかです。" }, "score_threshold": { "type": "number", "nullable": true, "description": "結果の最小関連性スコアです。`score_threshold_enabled` が `true` の場合にのみ有効です。" }, "weights": { "type": "object", "nullable": true, "description": "ハイブリッド検索の重み設定です。", "properties": { "weight_type": { "type": "string", "description": "セマンティック検索とキーワード検索の重みを調整するための戦略です。", "enum": [ "semantic_first", "keyword_first", "customized" ] }, "vector_setting": { "type": "object", "description": "セマンティック検索の重み設定です。", "properties": { "vector_weight": { "type": "number", "description": "セマンティック(ベクトル)検索結果に割り当てられた重みです。" }, "embedding_provider_name": { "type": "string", "description": "ベクトル検索に使用される埋め込みモデルのプロバイダーです。" }, "embedding_model_name": { "type": "string", "description": "ベクトル検索に使用される埋め込みモデルの名前です。" } } }, "keyword_setting": { "type": "object", "description": "キーワード検索の重み設定です。", "properties": { "keyword_weight": { "type": "number", "description": "キーワード検索結果に割り当てられた重みです。" } } } } }, "metadata_filtering_conditions": { "type": "object", "nullable": true, "description": "ドキュメントのメタデータが指定した条件に一致するチャンクのみを取得対象に絞り込みます。条件はサーバーサイドで評価されます。", "properties": { "logical_operator": { "type": "string", "enum": [ "and", "or" ], "default": "and", "nullable": true, "description": "複数の条件を組み合わせる方法です。" }, "conditions": { "type": "array", "nullable": true, "description": "評価するメタデータ条件のリストです。", "items": { "type": "object", "required": [ "name", "comparison_operator" ], "properties": { "name": { "type": "string", "description": "比較対象とするメタデータフィールド名です。" }, "comparison_operator": { "type": "string", "description": "適用する比較方法です。メタデータのタイプ別:\n\n- 文字列または配列のメタデータ:`contains`、`not contains`、`start with`、`end with`、`is`、`is not`、`empty`、`not empty`、`in`、`not in`\n- 数値メタデータ:`=`、`≠`、`>`、`<`、`≥`、`≤`\n- 時刻メタデータ:`before`、`after`", "enum": [ "contains", "not contains", "start with", "end with", "is", "is not", "empty", "not empty", "in", "not in", "=", "≠", ">", "<", "≥", "≤", "before", "after" ] }, "value": { "nullable": true, "description": "比較対象の値です。型は `comparison_operator` によって異なります。ほとんどの文字列演算子では文字列、`in` および `not in` では文字列配列、数値演算子では数値、`empty` および `not empty` では省略します。", "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } }, { "type": "number" } ] } } } } } } } } } } }