Back to Dify

Non-JSON OpenAPI Responses

packages/contracts/non-json-openapi-responses.md

1.16.014.3 KB
Original Source

Non-JSON OpenAPI Responses

Scope: endpoints emitted by api/dev/generate_swagger_specs.py into the generated console, openapi, service, and web specs.

The current Flask-RESTX generator still emits these response entries under application/json. The schema model names below record the actual runtime response intent so contract generation does not treat them as missing annotations.

Binary And Audio

SpecMethodPathRuntime responseSchema
consolePOST/apps/{app_id}/text-to-audioAudio stream, usually audio/mpegAudioBinaryResponse
consolePOST/installed-apps/{installed_app_id}/text-to-audioAudio stream, usually audio/mpegAudioBinaryResponse
consolePOST/trial-apps/{app_id}/text-to-audioAudio stream, usually audio/mpegAudioBinaryResponse
webPOST/text-to-audioAudio stream, usually audio/mpegAudioBinaryResponse
servicePOST/text-to-audioAudio stream, usually audio/mpegAudioBinaryResponse
consolePOST/datasets/{dataset_id}/documents/download-zipapplication/zip attachmentBinaryFileResponse
servicePOST/datasets/{dataset_id}/documents/download-zipapplication/zip attachmentBinaryFileResponse
serviceGET/files/{file_id}/previewOriginal file MIME type, optionally attachmentBinaryFileResponse
consoleGET/workspaces/current/plugin/iconPlugin asset MIME typeBinaryFileResponse
consoleGET/workspaces/current/plugin/assetapplication/octet-streamBinaryFileResponse
consoleGET/workspaces/current/tool-provider/builtin/{provider}/iconTool icon MIME typeBinaryFileResponse
consoleGET/workspaces/current/trigger-provider/{provider}/iconTrigger icon responseBinaryFileResponse
consoleGET/workspaces/{tenant_id}/model-providers/{provider}/{icon_type}/{lang}Model provider icon MIME typeBinaryFileResponse

Text File Exports

SpecMethodPathRuntime responseSchema
consoleGET/apps/{app_id}/feedbacks/exporttext/csv attachment by default; format=json returns JSON attachmentTextFileResponse
consoleGET/workspaces/current/customized-snippets/{snippet_id}/exportapplication/x-yaml attachmentTextFileResponse

Fixed SSE Streams

SpecMethodPathRuntime responseSchema
consoleGET/workflow/{workflow_run_id}/eventstext/event-streamEventStreamResponse
consoleGET/apps/{app_id}/workflows/draft/runs/{run_id}/node-outputs/eventstext/event-streamEventStreamResponse
consoleGET/apps/{app_id}/workflows/published/runs/{run_id}/node-outputs/eventstext/event-streamEventStreamResponse
openapiPOST/apps/{app_id}/runtext/event-streamEventStreamResponse
openapiGET/apps/{app_id}/tasks/{task_id}/eventstext/event-streamEventStreamResponse
serviceGET/workflow/{task_id}/eventstext/event-streamEventStreamResponse
webGET/workflow/{task_id}/eventstext/event-streamEventStreamResponse

Generated Responses With Streaming Variants

These endpoints call helper.compact_generate_response(...). They return JSON in blocking mode and text/event-stream in streaming mode. Some console/debug paths always pass streaming=True.

SpecMethodPathStreaming behaviorSchema
consolePOST/apps/{app_id}/completion-messagesresponse_mode=streamingGeneratedAppResponse
consolePOST/apps/{app_id}/advanced-chat/workflows/draft/runAlways streamingGeneratedAppResponse
consolePOST/apps/{app_id}/advanced-chat/workflows/draft/iteration/nodes/{node_id}/runAlways streamingGeneratedAppResponse
consolePOST/apps/{app_id}/advanced-chat/workflows/draft/loop/nodes/{node_id}/runAlways streamingGeneratedAppResponse
consolePOST/apps/{app_id}/workflows/draft/runAlways streamingGeneratedAppResponse
consolePOST/apps/{app_id}/workflows/draft/iteration/nodes/{node_id}/runAlways streamingGeneratedAppResponse
consolePOST/apps/{app_id}/workflows/draft/loop/nodes/{node_id}/runAlways streamingGeneratedAppResponse
consolePOST/apps/{app_id}/workflows/draft/trigger/runReturns waiting JSON until an event arrives; then streams workflow eventsGeneratedAppResponse
consolePOST/apps/{app_id}/workflows/draft/trigger/run-allReturns waiting JSON until an event arrives; then streams workflow eventsGeneratedAppResponse
consoleGET/installed-apps/{installed_app_id}/messages/{message_id}/more-like-thisresponse_mode=streamingGeneratedAppResponse
consolePOST/installed-apps/{installed_app_id}/completion-messagesresponse_mode=streamingGeneratedAppResponse
consolePOST/installed-apps/{installed_app_id}/chat-messagesAlways streamingGeneratedAppResponse
consolePOST/installed-apps/{installed_app_id}/workflows/runAlways streamingGeneratedAppResponse
consolePOST/trial-apps/{app_id}/chat-messagesAlways streamingGeneratedAppResponse
consolePOST/trial-apps/{app_id}/completion-messagesresponse_mode=streamingGeneratedAppResponse
consolePOST/trial-apps/{app_id}/workflows/runAlways streamingGeneratedAppResponse
consolePOST/snippets/{snippet_id}/workflows/draft/runAlways streamingGeneratedAppResponse
consolePOST/snippets/{snippet_id}/workflows/draft/iteration/nodes/{node_id}/runAlways streamingGeneratedAppResponse
consolePOST/snippets/{snippet_id}/workflows/draft/loop/nodes/{node_id}/runAlways streamingGeneratedAppResponse
consolePOST/rag/pipelines/{pipeline_id}/workflows/draft/runAlways streamingRagPipelineOpaqueResponse
consolePOST/rag/pipelines/{pipeline_id}/workflows/published/runresponse_mode=streamingRagPipelineOpaqueResponse
consolePOST/rag/pipelines/{pipeline_id}/workflows/draft/iteration/nodes/{node_id}/runAlways streamingRagPipelineOpaqueResponse
consolePOST/rag/pipelines/{pipeline_id}/workflows/draft/loop/nodes/{node_id}/runAlways streamingRagPipelineOpaqueResponse
consolePOST/rag/pipelines/{pipeline_id}/workflows/draft/datasource/nodes/{node_id}/runAlways streamingRagPipelineOpaqueResponse
consolePOST/rag/pipelines/{pipeline_id}/workflows/published/datasource/nodes/{node_id}/runAlways streamingRagPipelineOpaqueResponse
servicePOST/completion-messagesresponse_mode=streamingGeneratedAppResponse
servicePOST/chat-messagesresponse_mode=streaming; agent apps are streaming-onlyGeneratedAppResponse
servicePOST/workflows/runresponse_mode=streamingGeneratedAppResponse
servicePOST/workflows/{workflow_id}/runresponse_mode=streamingGeneratedAppResponse
servicePOST/datasets/{dataset_id}/pipeline/runresponse_mode=streamingGeneratedAppResponse
servicePOST/datasets/{dataset_id}/pipeline/datasource/nodes/{node_id}/runAlways streamingGeneratedAppResponse
webPOST/completion-messagesresponse_mode=streamingGeneratedAppResponse
webPOST/chat-messagesresponse_mode=streaming; agent apps are streaming-onlyGeneratedAppResponse
webGET/messages/{message_id}/more-like-thisresponse_mode=streamingGeneratedAppResponse
webPOST/workflows/runAlways streamingGeneratedAppResponse

Redirects Not Included In Generated Contracts

These console endpoints are browser redirect flows with no 2xx success response. They are documented in the backend OpenAPI as 302 responses with RedirectResponse, but openapi-ts.api.config.ts excludes 3xx-only operations from the oRPC contract input because they are not JSON contract operations.

SpecMethodPathRuntime responseSchema
consoleGET/mcp/oauth/callbackRedirect to console OAuth result pageRedirectResponse
consoleGET/oauth/authorize/{provider}Redirect to OAuth authorization URLRedirectResponse
consoleGET/oauth/data-source/callback/{provider}Redirect to console with data source OAuth resultRedirectResponse
consoleGET/oauth/login/{provider}Redirect to OAuth authorization URLRedirectResponse
consoleGET/oauth/plugin/{provider_id}/datasource/callbackRedirect to console OAuth callback pageRedirectResponse
consoleGET/oauth/plugin/{provider}/tool/callbackRedirect to console tool OAuth result pageRedirectResponse
consoleGET/oauth/plugin/{provider}/trigger/callbackRedirect to console trigger OAuth result pageRedirectResponse